100+ results for 'php key'
Not the results you expected?
Feed.php (https://github.com/quarkness/piwik.git) PHP · 320 lines
1 <?php
2 /**
3 * Zend Framework
17 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id: Feed.php 23775 2011-03-01 17:25:24Z ralph $
20 */
23 * @see Zend_Feed_Writer_Extension_RendererAbstract
24 */
25 // require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
27 /**
220 protected function _setKeywords(DOMDocument $dom, DOMElement $root)
221 {
222 $keywords = $this->getDataContainer()->getItunesKeywords();
223 if (!$keywords || empty($keywords)) {
TaggableBehavior.php (https://github.com/mmonguilod/sfPropel15TaggableBehaviorPlugin.git) PHP · 304 lines
10 protected $parameters = array(
11 'tagging_table' => '%TABLE%_tagging',
12 'tagging_table_phpname' => '%PHPNAME%Tagging',
13 'tag_table' => 'taggable_tag',
14 'tag_table_phpname' => 'Tag',
91 $this->taggingTable = $database->addTable(array(
92 'name' => $taggingTableName,
93 'phpName' => $this->replaceTokens($this->parameters['tagging_table_phpname']),
94 'package' => $table->getPackage(),
95 'schema' => $table->getSchema(),
297 return strtr($string, array(
298 '%TABLE%' => $table->getName(),
299 '%PHPNAME%' => $table->getPhpName(),
300 ));
301 }
translated-object.php (https://gitlab.com/hop23typhu/bryepoxy) PHP · 272 lines
1 <?php
3 /**
76 * @since 1.8
77 *
78 * @param array $translations an associative array of translations with language code as key and translation id as value
79 */
80 protected function keep_translation_group( $translations ) {
88 *
89 * @param int $id post id or term id
90 * @param array $translations an associative array of translations with language code as key and translation id as value
91 */
92 public function save_translations( $id, $translations ) {
98 $translations = array_merge( array( $lang->slug => $id ), $translations ); // make sure this object is in translations
99 $translations = array_diff( $translations, array( 0 ) ); // don't keep non translated languages
100 $translations = array_intersect_key( $translations, array_flip( $this->model->get_languages_list( array( 'fields' => 'slug' ) ) ) ); // keep only valid languages slugs as keys
102 // unlink removed translations
DB_result.php (https://gitlab.com/ricoru21/py_incidencia) PHP · 410 lines
1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2 /**
3 * CodeIgniter
4 *
5 * An open source application development framework for PHP 5.1.6 or newer
6 *
7 * @package CodeIgniter
63 public function custom_result_object($class_name)
64 {
65 if (array_key_exists($class_name, $this->custom_result_object))
66 {
67 return $this->custom_result_object[$class_name];
81 $object = new $class_name();
83 foreach ($row as $key => $value)
84 {
85 $object->$key = $value;
hostname_pattern.rst (https://github.com/althaus/symfony-docs.git) ReStructuredText · 285 lines
30 <route id="mobile_homepage" path="/" host="m.example.com">
31 <default key="_controller">AcmeDemoBundle:Main:mobileHomepage</default>
32 </route>
34 <route id="homepage" path="/">
35 <default key="_controller">AcmeDemoBundle:Main:homepage</default>
36 </route>
37 </routes>
39 .. code-block:: php
41 use Symfony\Component\Routing\RouteCollection;
VCardTest.php (https://gitlab.com/deichbrise/vcard-viewhelper) PHP · 355 lines
1 <?php
3 namespace JeroenDesloovere\VCard\tests;
5 // required to load
6 require_once __DIR__ . '/../vendor/autoload.php';
8 /*
9 * This file is part of the VCard PHP Class from Jeroen Desloovere.
10 *
11 * For the full copyright and license information, please view the license
17 /**
18 * This class will test our VCard PHP Class which can generate VCards.
19 *
20 * @author Jeroen Desloovere <info@jeroendesloovere.be>
developer_generates_method.feature (https://gitlab.com/kimting254/wbms) Gherkin Specification · 417 lines
6 Scenario: Generating a method
7 Given the spec file "spec/CodeGeneration/MethodExample1/MarkdownSpec.php" contains:
8 """
9 <?php
11 namespace spec\CodeGeneration\MethodExample1;
13 use PhpSpec\ObjectBehavior;
14 use Prophecy\Argument;
24 """
25 And the class file "src/CodeGeneration/MethodExample1/Markdown.php" contains:
26 """
27 <?php
test.php (https://gitlab.com/LisovyiEvhenii/ismextensions) PHP · 305 lines
1 <?php
2 /**
3 * Magento
8 * that is bundled with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://opensource.org/licenses/osl-3.0.php
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
22 * @package Mage_Sales
23 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25 */
26 include "lib/Varien/Object.php";
50 $frontendStatus = $this->getFrontendStatus();
51 $actions = $this->getOrderActions();
52 $actions = join(', ', array_keys($actions));
53 #echo "<tr><td>$orderStatus</td><td>$paymentStatus</td><td>$shippingStatus</td><td>$refundStatus</td><td>$returnStatus</td><td>$adminStatus</td><td>$frontendStatus</td><td>$actions</td></tr>";
54 echo "<tr><td>$orderStatus</td><td>$paymentStatus</td><td>$refundStatus</td><td>$shippingStatus</td><td>$actions</td></tr>";
FormTest.php (https://gitlab.com/crazybutterfly815/magento2) PHP · 268 lines
1 <?php
2 /**
3 * Copyright © 2016 Magento. All rights reserved.
10 * @magentoAppArea adminhtml
11 */
12 class FormTest extends \PHPUnit_Framework_TestCase
13 {
14 /**
89 * @dataProvider getEntityStoresDataProvider
90 * @magentoAppIsolation enabled
91 * @magentoDataFixture Magento/Store/_files/core_fixturestore.php
92 *
93 * @param array $productData
118 *
119 * @magentoAppIsolation enabled
120 * @magentoDataFixture Magento/Store/_files/core_fixturestore.php
121 */
122 public function testGetEntityStoresProductStoresException()
class-wc-report-taxes-by-date.php (https://gitlab.com/campus-academy/krowkaramel) PHP · 264 lines
33 <a
34 href="#"
35 download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo date_i18n( 'Y-m-d', current_time( 'timestamp' ) ); ?>.csv"
36 class="export_csv"
37 data-export="table"
162 $key = date( ( 'month' === $this->chart_groupby ) ? 'Ym' : 'Ymd', strtotime( $tax_row->post_date ) );
163 $tax_rows[ $key ] = isset( $tax_rows[ $key ] ) ? $tax_rows[ $key ] : (object) array(
164 'tax_amount' => 0,
165 'shipping_tax_amount' => 0,
190 $key = date( ( 'month' === $this->chart_groupby ) ? 'Ym' : 'Ymd', strtotime( $tax_row->post_date ) );
191 $tax_rows[ $key ] = isset( $tax_rows[ $key ] ) ? $tax_rows[ $key ] : (object) array(
192 'tax_amount' => 0,
193 'shipping_tax_amount' => 0,
212 <th class="total_row"><?php _e( 'Number of orders', 'woocommerce' ); ?></th>
213 <th class="total_row"><?php _e( 'Total sales', 'woocommerce' ); ?> <?php echo wc_help_tip( __( "This is the sum of the 'Order total' field within your orders.", 'woocommerce' ) ); ?></th>
214 <th class="total_row"><?php _e( 'Total shipping', 'woocommerce' ); ?> <?php echo wc_help_tip( __( "This is the sum of the 'Shipping total' field within your orders.", 'woocommerce' ) ); ?></th>
wc-meta-box-functions.php (https://github.com/Canuckaholic/Pop-Digital.git) PHP · 223 lines
1 <?php
2 /**
3 * WooCommerce Meta Box Functions
161 foreach ( $field['options'] as $key => $value ) {
163 echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>';
165 }
197 echo '<fieldset class="form-field ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><legend>' . wp_kses_post( $field['label'] ) . '</legend><ul class="wc-radios">';
199 foreach ( $field['options'] as $key => $value ) {
201 echo '<li><label><input
202 name="' . esc_attr( $field['name'] ) . '"
203 value="' . esc_attr( $key ) . '"
204 type="radio"
205 class="' . esc_attr( $field['class'] ) . '"
Feed.php (https://gitlab.com/gregtyka/SiberianCMS) PHP · 320 lines
1 <?php
2 /**
3 * Zend Framework
17 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id: Feed.php 24593 2012-01-05 20:35:02Z matthew $
20 */
23 * @see Zend_Feed_Writer_Extension_RendererAbstract
24 */
25 require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
27 /**
220 protected function _setKeywords(DOMDocument $dom, DOMElement $root)
221 {
222 $keywords = $this->getDataContainer()->getItunesKeywords();
223 if (!$keywords || empty($keywords)) {
content.php (https://github.com/livinglab/openlab.git) PHP · 204 lines
PackageCreator.php (https://bitbucket.org/helfreire/tccsite.git) PHP · 371 lines
1 <?php namespace Illuminate\Workbench;
3 use Illuminate\Filesystem\Filesystem;
102 public function writeSupportFiles(Package $package, $directory, $plain)
103 {
104 foreach (array('PhpUnit', 'Travis', 'Composer', 'Ignore') as $file)
105 {
106 $this->{"write{$file}File"}($package, $directory, $plain);
110 /**
111 * Write the PHPUnit stub file.
112 *
113 * @param \Illuminate\Workbench\Package $package
115 * @return void
116 */
117 protected function writePhpUnitFile(Package $package, $directory)
118 {
119 $stub = __DIR__.'/stubs/phpunit.xml';
field_link_color.php (https://gitlab.com/eita/agencia-consumo-responsavel) PHP · 207 lines
1 <?php
3 /**
157 $styleString = "";
159 foreach ( $style as $key => $value ) {
160 if ( is_numeric( $key ) ) {
162 } else {
163 if ( count( $this->field['output'] ) == 1 ) {
164 $styleString .= $this->field['output'][0] . ":" . $key . "{" . $value . '}';
165 } else {
166 $blah = '';
167 foreach($this->field['output'] as $k => $sel) {
168 $blah .= $sel . ':' . $key . ',';
169 }
VersionableBehavior.php (https://github.com/vworldat/Propel2.git) PHP · 268 lines
114 $versionTable = $database->addTable(array(
115 'name' => $versionTableName,
116 'phpName' => $this->getVersionTablePhpName(),
117 'package' => $table->getPackage(),
118 'schema' => $table->getSchema(),
135 $versionTable->addColumn($columnInVersionTable);
136 }
137 // create the foreign key
138 $fk = new ForeignKey();
143 $tablePKs = $table->getPrimaryKey();
144 foreach ($versionTable->getPrimaryKey() as $key => $column) {
145 $fk->addReference($column, $tablePKs[$key]);
146 }
147 $versionTable->addForeignKey($fk);
149 // add the version column to the primary key
HashMap.class.php (https://bitbucket.org/stk2k/charcoalphp2.1.git) PHP · 386 lines
40 public function keyExists( $key )
41 {
42 return array_key_exists( $key, $this->values );
43 }
330 * Get element value as float
331 *
332 * @param string $key Key string to get
333 * @param float $default_value default value
334 *
376 $b .= '/';
377 }
378 $key = Charcoal_System::toString($key);
379 $value = Charcoal_System::toString($value);
380 $b .= "$key=$value";
GeneralItemCollection.php (https://gitlab.com/laher01/factu40) PHP · 201 lines
1 <?php
3 namespace Modules\Report\Http\Resources;
12 public function toArray($request)
13 {
14 return $this->collection->transform(function ($row, $key) {
15 /** @var \App\Models\Tenant\DocumentItem|\App\Models\Tenant\PurchaseItem|mixed|\App\Models\Tenant\SaleNoteItem|mixed $row */
16 $resource = self::getDocument($row);
WorkflowTypeInterface.php (https://gitlab.com/andecode/theme-spark) PHP · 351 lines
1 <?php
3 namespace Drupal\workflows;
15 /**
16 * The key of the global workflow plugin form.
17 */
18 const PLUGIN_FORM_KEY = 'configure';
82 *
83 * @param array $dependencies
84 * An array of dependencies that will be deleted keyed by dependency type.
85 *
86 * @return bool
126 *
127 * @return \Drupal\workflows\StateInterface[]
128 * An array of workflow states, keyed by state IDs.
129 *
130 * @throws \InvalidArgumentException
Feed.php (https://bitbucket.org/haichau59/manga.git) PHP · 320 lines
1 <?php
2 /**
3 * Zend Framework
17 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id: Feed.php 24594 2012-01-05 21:27:01Z matthew $
20 */
23 * @see Zend_Feed_Writer_Extension_RendererAbstract
24 */
25 //require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
27 /**
220 protected function _setKeywords(DOMDocument $dom, DOMElement $root)
221 {
222 $keywords = $this->getDataContainer()->getItunesKeywords();
223 if (!$keywords || empty($keywords)) {
Feed.php (https://github.com/oveach/tuto-zf-doctrine2.git) PHP · 320 lines
1 <?php
2 /**
3 * Zend Framework
17 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id: Feed.php 24594 2012-01-05 21:27:01Z matthew $
20 */
23 * @see Zend_Feed_Writer_Extension_RendererAbstract
24 */
25 require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
27 /**
220 protected function _setKeywords(DOMDocument $dom, DOMElement $root)
221 {
222 $keywords = $this->getDataContainer()->getItunesKeywords();
223 if (!$keywords || empty($keywords)) {
OS_NS_stdlib.h (https://github.com/Archives/try.git) C Header · 332 lines
ClassRegistry.php (https://github.com/bmcclure/cakephp.git) PHP · 341 lines
7 * PHP 5
8 *
9 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
10 * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
11 *
179 public static function addObject($key, $object) {
180 $_this = ClassRegistry::getInstance();
181 $key = Inflector::underscore($key);
182 if (!isset($_this->_objects[$key])) {
300 public static function map($key, $name) {
301 $_this = ClassRegistry::getInstance();
302 $key = Inflector::underscore($key);
303 $name = Inflector::underscore($name);
304 if (!isset($_this->_map[$key])) {
320 * Return the name of a class in the registry.
321 *
322 * @param string $key Key to find in map
323 * @return string Mapped value
324 */
Collect.php (https://gitlab.com/svillegas/magento2) PHP · 313 lines
1 <?php
2 /**
3 * Copyright © 2016 Magento. All rights reserved.
208 protected function getCleanChangesArray($changes)
209 {
210 $changesArrayKeys = array_keys($changes);
211 foreach ($changesArrayKeys as $changesKey) {
212 if ($changesKey != 'state' && $changesKey != 'active' && $changesKey != 'setup_version') {
213 unset($changes[$changesKey]);
301 }
303 $arrayModuleNames = array_keys($configModules);
304 $uninstalledModuleChanges = $this->setUninstalledModuleChanges($dbModuleArray, $arrayModuleNames);
305 if (is_array($uninstalledModuleChanges)) {
PlatformJobQueue.php (https://github.com/Exercise/zf2.git) PHP · 318 lines
1 <?php
2 /**
3 * Zend Framework
71 $options = $this->_options['daemonOptions'];
73 if (!array_key_exists('host', $options)) {
74 throw new Queue\Exception('Platform Job Queue host should be provided');
75 }
76 if (!array_key_exists('password', $options)) {
77 throw new Queue\Exception('Platform Job Queue password should be provided');
78 }
186 $zendApiJob = new $classname($message);
188 // Unfortunately, the Platform JQ API is PHP4-style...
189 $platformJob = $zendApiJob->getJob();
ezkeywordtype.php (https://bitbucket.org/ericsagnes/ezpublish-multisite.git) PHP · 291 lines
11 /*!
12 \class eZKeywordType ezkeywordtype.php
13 \ingroup eZDatatype
14 \brief A content datatype which handles keyword indexes
192 FROM ezkeyword, ezkeyword_attribute_link
193 WHERE ezkeyword.id = ezkeyword_attribute_link.keyword_id
194 AND ezkeyword.id IN ($keywordIDString)
265 $keyword->fetch( $objectAttribute );
266 $keyWordString = $keyword->keywordString();
267 $dom = $node->ownerDocument;
268 $keywordStringNode = $dom->createElement( 'keyword-string' );
278 $keyword = new eZKeyword();
279 $keyword->initializeKeyword( $keyWordString );
280 $objectAttribute->setContent( $keyword );
Feed.php (https://github.com/timglabisch/pimcore.git) PHP · 320 lines
1 <?php
2 /**
3 * Zend Framework
17 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id: Feed.php 24593 2012-01-05 20:35:02Z matthew $
20 */
23 * @see Zend_Feed_Writer_Extension_RendererAbstract
24 */
25 // require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
27 /**
220 protected function _setKeywords(DOMDocument $dom, DOMElement $root)
221 {
222 $keywords = $this->getDataContainer()->getItunesKeywords();
223 if (!$keywords || empty($keywords)) {
elementindex.html (https://github.com/eXeDK/VirusTotal-API-PHP-class.git) HTML · 243 lines
83 </dt>
84 <dd class="index-item-body">
85 <div class="index-item-details"><a href="default/VirusTotal.html#methodgetApiKey">VirusTotal::getApiKey()</a> in VirusTotal.php</div>
86 <div class="index-item-description">Getter for the API-key</div>
154 </dt>
155 <dd class="index-item-body">
156 <div class="index-item-details"><a href="default/VirusTotal.html#methodscanURL">VirusTotal::scanURL()</a> in VirusTotal.php</div>
157 <div class="index-item-description">Retrieve a URL scan report</div>
158 </dd>
161 </dt>
162 <dd class="index-item-body">
163 <div class="index-item-details"><a href="default/VirusTotal.html#methodsetApiKey">VirusTotal::setApiKey()</a> in VirusTotal.php</div>
164 <div class="index-item-description">Setter for the API-key</div>
210 </dt>
211 <dd class="index-item-body">
212 <div class="index-item-details"><a href="default/_VirusTotal.php.html">VirusTotal.php</a> in VirusTotal.php</div>
213 </dd>
214 </dl>
InstallSchema.php (https://gitlab.com/crazybutterfly815/magento2) PHP · 407 lines
1 <?php
2 /**
3 * Copyright © 2016 Magento. All rights reserved.
18 /**
19 * {@inheritdoc}
20 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
21 */
22 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
163 ['unsigned' => true, 'nullable' => false, 'default' => '0'],
164 'Sort order'
165 )->addForeignKey(
166 $installer->getFkName('widget_instance', 'theme_id', 'theme', 'theme_id'),
167 'theme_id',
230 $installer->getIdxName('widget_instance_page', 'instance_id'),
231 'instance_id'
232 )->addForeignKey(
233 $installer->getFkName('widget_instance_page', 'instance_id', 'widget_instance', 'instance_id'),
234 'instance_id',
table_torch.php (https://github.com/splitfeed/Table-Torch.git) PHP · 374 lines
169 if( isset( $_POST[ $key ] )){
170 $this->url_vals[ $key ] = $_POST[ $key ];
171 }
172 }
197 if( method_exists( $this->CI, 'before_update' ) ){
198 $d = $data;
199 $d[ PRIMARY_KEY ] = $_POST[ PRIMARY_KEY ];
200 $data = $this->CI->before_update( TORCH_TABLE, $d );
201 unset( $data[ PRIMARY_KEY ] );
284 $actions .= anchor( torch_url( array( 'action'=>'delete',
285 'table'=>TORCH_TABLE,
286 'key'=>$row[ PRIMARY_KEY ]), FALSE ),
287 'Delete', array( 'onclick'=>"return confirm('$confirm')", 'class'=>'actionLink' ) );
288 }
294 if( !empty( $prefs[ 'formats' ][ $key ])) {
295 $value = $prefs[ 'formats' ][ $key ]( $value, $key, TORCH_TABLE );
297 } elseif( !empty( $funct )){
Deal.php (https://gitlab.com/Japang-Jawara/jawara-penilaian) PHP · 461 lines
ComprehendClient.php (https://github.com/trob/fabrik.git) PHP · 131 lines
1 <?php
2 namespace Aws\Comprehend;
10 * @method \Aws\Result batchDetectEntities(array $args = [])
11 * @method \GuzzleHttp\Promise\Promise batchDetectEntitiesAsync(array $args = [])
12 * @method \Aws\Result batchDetectKeyPhrases(array $args = [])
13 * @method \GuzzleHttp\Promise\Promise batchDetectKeyPhrasesAsync(array $args = [])
46 * @method \Aws\Result describeEventsDetectionJob(array $args = [])
47 * @method \GuzzleHttp\Promise\Promise describeEventsDetectionJobAsync(array $args = [])
48 * @method \Aws\Result describeKeyPhrasesDetectionJob(array $args = [])
49 * @method \GuzzleHttp\Promise\Promise describeKeyPhrasesDetectionJobAsync(array $args = [])
58 * @method \Aws\Result detectEntities(array $args = [])
59 * @method \GuzzleHttp\Promise\Promise detectEntitiesAsync(array $args = [])
60 * @method \Aws\Result detectKeyPhrases(array $args = [])
61 * @method \GuzzleHttp\Promise\Promise detectKeyPhrasesAsync(array $args = [])
AssertionsTest.class.php (https://github.com/treuter/xp-framework.git) PHP · 617 lines
Renderlet.php (https://github.com/ngocanh/pimcore.git) PHP · 341 lines
1 <?php
2 /**
3 * Pimcore
117 foreach ($this->options as $key => $value) {
118 if (!array_key_exists($key, $params) && !in_array($key, $blockparams)) {
119 $params[$key] = $value;
175 if ($this->o instanceof Document) {
177 $key = "document_" . $this->o->getId();
179 $dependencies[$key] = array(
184 else if ($this->o instanceof Asset) {
186 $key = "asset_" . $this->o->getId();
188 $dependencies[$key] = array(
Diff.php (https://github.com/akelos/v1.git) PHP · 371 lines
1 <?php
2 /**
3 * Text_Diff
6 * two sequences of strings.
7 *
8 * The PHP diff code used in this package was originally written by Geoffrey
9 * T. Dairiki and is used with his permission.
10 *
11 * $Horde: framework/Text_Diff/Diff.php,v 1.17 2006/02/06 00:16:09 jan Exp $
12 *
13 * @package Text_Diff
43 $engine = basename($engine);
45 require_once 'Text/Diff/Engine/' . $engine . '.php';
46 $class = 'Text_Diff_Engine_' . $engine;
47 $diff_engine = &new $class();
definitions.php (https://gitlab.com/scsistemas/superprime) PHP · 262 lines
1 <?php
2 //$urlWS = 'http://qa.superprimeweb.com/admin/index.php?';
3 $urlWS = 'http://localhost:8080/superprime/admin/index.php?';
4 $rutaFotos = '../images/fotos/';
5 //$rutaFotos = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . '/backend/images/fotos/';
6 $variable = array('ml_id','ml_secretKey', 'ml_authCode', 'ml_token', 'ml_fecToken', 'ml_expires', 'ml_redirectUri');
7 //ini_set('display_errors', '1');
8 foreach ($variable as $key ) {
9 $dataML[$key] = obtenerClaveValor($urlWS, $key);
10 }
Cdn_CloudFrontFsd_Popup.php (https://gitlab.com/karlen/ayo_wp) PHP · 345 lines
41 public function w3tc_ajax_cdn_cloudfront_fsd_list_distributions() {
42 $access_key = $_REQUEST['access_key'];
43 $secret_key = $_REQUEST['secret_key'];
77 $details = array(
78 'access_key' => $access_key,
79 'secret_key' => $secret_key,
118 $details['distribution_comment'] = Util_Request::get( 'comment_new' );
119 } else {
120 $api = new Cdn_CloudFrontFsd_Api( $access_key, $secret_key );
122 try {
330 $c->set( 'cdn.cloudfront_fsd.access_key', $access_key );
331 $c->set( 'cdn.cloudfront_fsd.secret_key', $secret_key );
332 $c->set( 'cdn.cloudfront_fsd.distribution_id', $distribution_id );
333 $c->set( 'cdn.cloudfront_fsd.distribution_domain', $distribution_domain );
%%F3^F32^F3218F1A%%siteMap.tpl.php (https://github.com/mcrider/pkpUpgradeTestSuite.git) PHP · 122 lines
77 <li><a href="<?php echo $this->_plugins['function']['url'][0][0]->smartyUrl(array('journal' => ($this->_tpl_vars['currentJournal']->getPath()),'page' => 'search','op' => 'titles'), $this);?>
78 "><?php echo $this->_plugins['function']['translate'][0][0]->smartyTranslate(array('key' => "navigation.browseByTitle"), $this);?>
79 </a></li>
80 </ul>
88 <li><a href="<?php echo $this->_plugins['function']['url'][0][0]->smartyUrl(array('journal' => ($this->_tpl_vars['currentJournal']->getPath()),'page' => 'issue','op' => 'archive'), $this);?>
89 "><?php echo $this->_plugins['function']['translate'][0][0]->smartyTranslate(array('key' => "navigation.archives"), $this);?>
90 </a></li>
91 </ul>
95 foreach ($_from as $this->_tpl_vars['navItem']):
96 ?>
97 <li><a href="<?php if ($this->_tpl_vars['navItem']['isAbsolute']): echo ((is_array($_tmp=$this->_tpl_vars['navItem']['url'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); else: echo $this->_plugins['function']['url'][0][0]->smartyUrl(array('page' => ""), $this); echo ((is_array($_tmp=$this->_tpl_vars['navItem']['url'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); endif; ?>"><?php if ($this->_tpl_vars['navItem']['isLiteral']): echo ((is_array($_tmp=$this->_tpl_vars['navItem']['name'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); else: echo $this->_plugins['function']['translate'][0][0]->smartyTranslate(array('key' => ((is_array($_tmp=$this->_tpl_vars['navItem']['name'])) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp))), $this); endif; ?></a></li>
98 <?php endforeach; endif; unset($_from); ?>
110 <?php endif; ?>
111 <li><a href="http://pkp.sfu.ca/ojs"><?php echo $this->_plugins['function']['translate'][0][0]->smartyTranslate(array('key' => "common.openJournalSystems"), $this);?>
112 </a></li>
113 <li><a href="javascript:openHelp('<?php echo $this->_plugins['function']['url'][0][0]->smartyUrl(array('journal' => 'index','page' => 'help'), $this);?>
TaskStatus.php (https://github.com/michaelmcandrew/lbc.git) PHP · 307 lines
1 <?php
2 /*
3 +--------------------------------------------------------------------+
32 *
33 */
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
100 public $responsible_entity_table;
101 /**
102 * Foreign key to responsible entity (contact, group, etc.).
103 *
104 * @var int unsigned
112 public $target_entity_table;
113 /**
114 * Foreign key to target entity (contact, group, etc.).
115 *
116 * @var int unsigned
content_actionhandler.php (https://github.com/SylvainGuittard/ezlightbox.git) PHP · 364 lines
1 <?php
2 //
3 // Created on: <2007-11-21 13:01:28 ab>
76 {
77 $http = eZHTTPTool::instance();
78 $http->removeSessionVariable( eZLightbox::PREFERENCE_SESSION_HASHKEY );
79 eZPreferences::setValue( 'currentLightboxID', $http->postVariable( 'newLightboxID' ) );
80 $redirectURI = $http->hasPostVariable( 'redirectAfterSelectionURI' ) ?
gallery.tpl.php (https://gitlab.com/endomorphosis/jeffersonsmithmayor) PHP · 122 lines
37 <div class="tubepress_thumb">
38 <a id="tubepress_image_<?php echo $video->getId(); ?>_<?php echo ${org_tubepress_api_const_template_Variable::GALLERY_ID}; ?>" rel="tubepress_<?php echo ${org_tubepress_api_const_template_Variable::EMBEDDED_IMPL_NAME}; ?>_<?php echo ${org_tubepress_api_const_template_Variable::PLAYER_NAME}; ?>_<?php echo ${org_tubepress_api_const_template_Variable::GALLERY_ID}; ?>">
39 <img alt="<?php echo htmlspecialchars($video->getTitle(), ENT_QUOTES, "UTF-8"); ?>" src="<?php echo $video->getThumbnailUrl(); ?>" width="<?php echo ${org_tubepress_api_const_template_Variable::THUMBNAIL_WIDTH}; ?>" height="<?php echo ${org_tubepress_api_const_template_Variable::THUMBNAIL_HEIGHT}; ?>" />
43 <?php if (${org_tubepress_api_const_template_Variable::META_SHOULD_SHOW}[org_tubepress_api_const_options_names_Meta::TITLE]): ?>
44 <dt class="tubepress_meta tubepress_meta_title"><?php echo ${org_tubepress_api_const_template_Variable::META_LABELS}[org_tubepress_api_const_options_names_Meta::TITLE]; ?></dt><dd class="tubepress_meta tubepress_meta_title"><a id="tubepress_title_<?php echo $video->getId(); ?>_<?php echo ${org_tubepress_api_const_template_Variable::GALLERY_ID}; ?>" rel="tubepress_<?php echo ${org_tubepress_api_const_template_Variable::EMBEDDED_IMPL_NAME}; ?>_<?php echo ${org_tubepress_api_const_template_Variable::PLAYER_NAME}; ?>_<?php echo ${org_tubepress_api_const_template_Variable::GALLERY_ID}; ?>"><?php echo htmlspecialchars($video->getTitle(), ENT_QUOTES, "UTF-8"); ?></a></dd>
45 <?php endif; ?>
57 <?php if (${org_tubepress_api_const_template_Variable::META_SHOULD_SHOW}[org_tubepress_api_const_options_names_Meta::KEYWORDS]): ?>
59 <dt class="tubepress_meta tubepress_meta_keywords"><?php echo ${org_tubepress_api_const_template_Variable::META_LABELS}[org_tubepress_api_const_options_names_Meta::KEYWORDS]; ?></dt><dd class="tubepress_meta tubepress_meta_keywords"><?php echo $raw = htmlspecialchars(implode(" ", $video->getKeywords()), ENT_QUOTES, "UTF-8"); ?></dd>
60 <?php endif; ?>
62 <?php if (${org_tubepress_api_const_template_Variable::META_SHOULD_SHOW}[org_tubepress_api_const_options_names_Meta::URL]): ?>
64 <dt class="tubepress_meta tubepress_meta_url"><?php echo ${org_tubepress_api_const_template_Variable::META_LABELS}[org_tubepress_api_const_options_names_Meta::URL]; ?></dt><dd class="tubepress_meta tubepress_meta_url"><a rel="external nofollow" href="<?php echo $video->getHomeUrl(); ?>"><?php echo ${org_tubepress_api_const_template_Variable::META_LABELS}[org_tubepress_api_const_options_names_Meta::URL]; ?></a></dd>
65 <?php endif; ?>
class-cp-user-relationships.php (https://gitlab.com/dev73/clusterpress) PHP · 543 lines
1 <?php
2 /**
3 * ClusterPress User Relationships.
103 }
105 $type['name'] = sanitize_key( $type['name'] );
107 if ( isset( $this->types[ $type['name'] ] ) ) {
109 }
111 $this->types[ $type['name'] ] = (object) array_intersect_key( $type, array(
112 'name' => '',
113 'cluster' => $cluster,
151 }
153 $name = sanitize_key( $name );
155 if ( ! isset( $this->types[ $name ] ) ) {
Entry.php (https://bitbucket.org/cesarmedrano/cesarmedrano.git) PHP · 630 lines
17 * @category Microsoft
18 * @package WindowsAzure\Common\Internal\Atom
19 * @author Azure PHP SDK <azurephpsdk@microsoft.com>
20 * @copyright 2012 Microsoft Corporation
21 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
33 * @category Microsoft
34 * @package WindowsAzure\Common\Internal\Atom
35 * @author Azure PHP SDK <azurephpsdk@microsoft.com>
36 * @copyright 2012 Microsoft Corporation
37 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
163 }
165 if (array_key_exists('content', $entryArray)) {
166 $content = new Content();
167 $content->parseXml($entryArray['content']->asXML());
Abstract.php (https://github.com/bhaumik25/zend-framework.git) PHP · 375 lines
135 {
136 if (1 == count($this)) {
137 $keys = $this->getKeys();
138 $key = array_shift($keys);
265 $this->_captureLock = true;
266 $this->_captureType = $type;
267 if ((null !== $key) && is_scalar($key)) {
268 $this->_captureKey = (string) $key;
283 if (null !== $this->_captureKey) {
284 $key = $this->_captureKey;
285 }
286 switch ($this->_captureType) {
336 public function nextIndex()
337 {
338 $keys = $this->getKeys();
339 if (0 == count($keys)) {
CriteriaReplaceNameTest.php (https://github.com/propelorm/Propel2.git) PHP · 205 lines
107 * @return void
108 */
109 public function testReplaceNameFromBook(string $origClause, ?string $columnPhpName, string $modifiedClause)
110 {
111 include self::PROJECT_ROOT . '/tests/Fixtures/bookstore/build/conf/bookstore-conf.php';
119 * @return void
120 */
121 public function testReplaceNameFromBookstoreContest(string $origClause, ?string $columnPhpName, string $modifiedClause)
122 {
123 include self::PROJECT_ROOT . '/tests/Fixtures/bookstore/build/conf/bookstore-conf.php';
136 if ($columnPhpName) {
137 $this->assertCount(1, $replacedColumns);
138 $columnMap = $c->getTableMap()->getColumnByPhpName($columnPhpName);
139 $this->assertEquals([$columnMap], $replacedColumns);
140 }
Feed.php (https://github.com/cosmocommerce/magento-mirror.git) PHP · 320 lines
1 <?php
2 /**
3 * Zend Framework
17 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id: Feed.php 24593 2012-01-05 20:35:02Z matthew $
20 */
23 * @see Zend_Feed_Writer_Extension_RendererAbstract
24 */
25 #require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
27 /**
220 protected function _setKeywords(DOMDocument $dom, DOMElement $root)
221 {
222 $keywords = $this->getDataContainer()->getItunesKeywords();
223 if (!$keywords || empty($keywords)) {
Barcode.php (https://github.com/leerbag/zf2.git) PHP · 323 lines
Model.class.php (https://github.com/dzx0315/509.git) PHP · 295 lines
1 <?php
2 // +----------------------------------------------------------------------
3 // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
4 // +----------------------------------------------------------------------
5 // | Copyright (c) 2010 http://thinkphp.cn All rights reserved.
6 // +----------------------------------------------------------------------
7 // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
13 /**
14 +------------------------------------------------------------------------------
15 * ThinkPHP 简洁模式Model模型类
16 * 只支持原生SQL操作 支持多数据库连接和切换
17 +------------------------------------------------------------------------------
224 if(NULL === $linkNum && is_array($config)) {
225 // 支持批量增加数据库连接
226 foreach ($config as $key=>$val)
227 $this->_db[$key] = Db::getInstance($val);
AbstractStructureParser.php (https://github.com/RichardDownes/PHPCodeParser.git) PHP · 608 lines
1 <?php
2 namespace Parser;
3 /*
17 */
19 use Meta\AbstractPHPStructure;
20 use Meta\DocBlock;
33 /**
34 * Responsible for parsing a php class
35 *
36 * @author Richard Downes <richard@sculpt.ie>
44 * Responsible for storing the information about the structure being parsed
45 *
46 * @var \Meta\AbstractPHPStructure $structure Stores meta information about the structure
47 */
48 protected $structure;
SetTest.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 295 lines
1 <?php
2 /**
3 *
10 use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set;
12 class SetTest extends \PHPUnit_Framework_TestCase
13 {
14 /**
15 * @var \PHPUnit_Framework_MockObject_MockObject|Set
16 */
17 protected $model;
19 /**
20 * @var \PHPUnit_Framework_MockObject_MockObject
21 */
22 protected $eavConfigMock;
Cloud.php (https://gitlab.com/LisovyiEvhenii/ismextensions) PHP · 410 lines
Config.php (https://bitbucket.org/webpolis/liiv.git) PHP · 514 lines
25 * Include resource type config class
26 */
27 require_once CKFINDER_CONNECTOR_LIB_DIR . "/Core/ResourceTypeConfig.php";
28 /**
29 * Include thumbnails config class
30 */
31 require_once CKFINDER_CONNECTOR_LIB_DIR . "/Core/ThumbnailsConfig.php";
32 /**
33 * Include thumbnails config class
66 * @access private
67 */
68 var $_licenseKey = "";
69 /**
70 * Role session variable name
452 if (isset($GLOBALS['config']['LicenseKey'])) {
453 $this->_licenseKey = (string)$GLOBALS['config']['LicenseKey'];
454 }
455 if (isset($GLOBALS['config']['FilesystemEncoding'])) {
aa_item.php (https://github.com/harz87/Amazon-Affialiate.git) PHP · 227 lines
1 <?php
2 /*
3 * To change this template, choose Tools | Templates
73 break;
74 case '#_MAINPICTURE':
75 foreach ($item->pictures as $key => $value) {
76 $replace = "<img src='".WP_PLUGIN_URL. get_option('dbaa_images_path') . $key . "' title='$value'/>";
82 $joiner = (stristr($AA_URI, "?")) ? "&" : "?";
83 $item_link = $AA_URI.$joiner."item_id=".$item->item_id;
84 foreach ($item->pictures as $key => $value) {
85 $replace = "<a href='{$item_link}'><img src='".WP_PLUGIN_URL. get_option('dbaa_images_path') . $key . "' title='$value'/></a>";
89 case '#_ALTERNATIVEPICTURE':
90 $first = true;
91 foreach ($item->pictures as $key => $value) {
92 if (!$first){
93 $replace .= "<img src='" .WP_PLUGIN_URL. get_option('dbaa_images_path'). $key . "' title='$value'/>";
185 foreach ($item as $key => $value) {
186 if( substr($key, 0, 5) == 'item_' && $key != 'item_id'){
187 $array[$key] = $value;
Base.php (https://github.com/ewandor/horde.git) PHP · 305 lines
1 <?php
2 /**
3 * Utilities for the various XML handlers.
4 *
5 * PHP version 5
6 *
7 * @category Kolab
239 * Validate that the parameter array contains all required parameters.
240 *
241 * @param string $key The parameter name.
242 * @param array $params The parameters.
243 * @param string $attribute The attribute name.
246 * missing.
247 */
248 protected function checkMissing($key, $params, $attribute)
249 {
250 if (!isset($params[$key])) {
PageRepositoryTest.php (https://gitlab.com/crazybutterfly815/magento2) PHP · 282 lines
1 <?php
2 /**
3 * Copyright © 2016 Magento. All rights reserved.
267 $pagesData['second'][PageInterface::IS_ACTIVE] = false;
269 foreach ($pagesData as $key => $pageData) {
270 /** @var \Magento\Cms\Api\Data\PageInterface $pageDataObject */
271 $pageDataObject = $this->pageFactory->create();
275 \Magento\Cms\Api\Data\PageInterface::class
276 );
277 $result[$key] = $this->pageRepository->save($pageDataObject);
278 }
YamlFileLoader.php (https://bitbucket.org/cryofrost/portal.git) PHP · 339 lines
1 <?php
3 /*
54 // parameters
55 if (isset($content['parameters'])) {
56 foreach ($content['parameters'] as $key => $value) {
57 $this->container->setParameter($key, $this->resolveServices($value));
134 return;
135 } elseif (isset($service['alias'])) {
136 $public = !array_key_exists('public', $service) || (Boolean) $service['public'];
137 $this->container->setAlias($id, new Alias($service['alias'], $public));
212 foreach ($service['tags'] as $tag) {
213 if (!isset($tag['name'])) {
214 throw new InvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in %s.', $id, $file));
215 }
fengoffice.php (https://github.com/libersoft/fengoffice-ls.git) PHP · 121 lines
1 <?php return array(
2 'chelp add event invitation' => 'Velg brukerene du vil invitere til arrangementet.',
3 'how to purchase' => 'Hvordan kjøpe',
46 'chelp add milestone reminders' => 'Du kan velge om du vil motta en påminnelse når hendelsen starter. Velg om du vil ha påminnelser som sprettopp-beskjeder i systemet eller om du vil motta e-postvarsel.',
47 'chelp add event reminders' => 'Du kan velge om du vil motta en påminnelse når hendelsen starter. Velg om du vil ha påminnelser som sprettopp-beskjeder i systemet eller om du vil motta e-postvarsel.',
48 'free trial upgrade' => 'Dette er en 30-dagers prøveinstallasjon. Dersom du vil beholde informasjonen og fortsette å bruke våre tjenester: <a class="dashboard-link" href="http://www.fengoffice.com/web/pricing.php">Oppgrader til et abonnement</a>',
49 'chelp personal account' => '<b>Velkommen til kontopanelet</b><br/>
50 I dette menyvalget kan du redigere din personlige informasjon.<br/>
TargetCpaSimulationPoint.php (https://gitlab.com/remyvianne/krowkaramel) PHP · 488 lines
1 <?php
2 # Generated by the protocol buffer compiler. DO NOT EDIT!
3 # source: google/ads/googleads/v9/common/simulation.proto
72 */
73 protected $top_slot_impressions = null;
74 protected $target_cpa_simulation_key_value;
76 /**
480 * @return string
481 */
482 public function getTargetCpaSimulationKeyValue()
483 {
484 return $this->whichOneof("target_cpa_simulation_key_value");
Cloud.php (https://github.com/komola/ZendFramework.git) PHP · 410 lines
posts.php (https://gitlab.com/Ltaimao/wecenter) PHP · 514 lines
1 <?php
2 /*
3 +--------------------------------------------------------------------------
137 public function get_posts_list($post_type, $page = 1, $per_page = 10, $sort = null, $topic_ids = null, $category_id = null, $answer_count = null, $day = 30, $is_recommend = false)
138 {
139 $order_key = 'add_time DESC';
141 switch ($sort)
153 case 'new' :
154 $order_key = 'update_time DESC';
156 break;
159 if (is_array($topic_ids))
160 {
161 foreach ($topic_ids AS $key => $val)
162 {
163 if (!$val)
ConfigListener.php (https://bitbucket.org/alexandretaz/maniac_divers.git) PHP · 383 lines
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
174 public function detach(EventManagerInterface $events)
175 {
176 foreach ($this->listeners as $key => $listener) {
177 $events->detach($listener);
178 unset($this->listeners[$key]);
311 /**
312 * @param string $key
313 * @param array|Traversable $config
314 * @throws Exception\InvalidArgumentException
315 * @return ConfigListener
316 */
317 protected function addConfig($key, $config)
318 {
319 if ($config instanceof Traversable) {
DefaultOptions.php (https://github.com/Exercise/symfony.git) PHP · 320 lines
1 <?php
3 /*
18 * Helper for specifying and resolving inter-dependent options.
19 *
20 * Options are a common pattern for initializing classes in PHP. Avoiding the
21 * problems related to this approach is however a non-trivial task. Usually,
22 * both classes and subclasses should be able to set default option values.
207 * Adds default options.
208 *
209 * @param array $options A list of option names as keys and option values
210 * as values. The option values may be closures
211 * of the following signatures:
224 * Adds allowed values for a list of options.
225 *
226 * @param array $allowedValues A list of option names as keys and arrays
227 * with values acceptable for that option as
228 * values.
Set.php (https://github.com/eexit/Smak.git) PHP · 362 lines
1 <?php
3 namespace Smak\Portfolio\tests\units;
8 use tests\units\Smak\Portfolio\Fs;
10 require_once __DIR__ . '/../../../../vendor/autoload.php';
12 class Set extends Fs\FsAdapter
287 $set_root = new \SplFileInfo($fs->getRoot() . DIRECTORY_SEPARATOR . 'Travels');
288 $set = $this->buildSet($adapter, $set_root);
289 $expected = array_keys($tree['Travels']);
291 $this->object($collection = $set->asCollection())
317 $set_name = $set->name;
319 foreach ($helpers as $key => $value) {
320 $set->$key = $value;
schema.yml (https://github.com/eurotux/ETVA.git) YAML · 204 lines
4 package: lib.model
5 network:
6 _attributes: { phpName: EtvaNetwork }
7 id: { type: INTEGER, primaryKey: true, required: true, autoIncrement: true }
15 intf_model: { type: VARCHAR, size: '255' }
16 server:
17 _attributes: { phpName: EtvaServer }
18 id: { type: INTEGER, primaryKey: true, required: true, autoIncrement: true }
20 description: { type: LONGVARCHAR }
21 ip: { type: VARCHAR, required: true }
22 vnc_keymap: { type: VARCHAR, size: '10' }
23 vnc_keymap_default: { type: INTEGER, required: true, default: '1' }
58 hbnrestarts: { type: INTEGER, default: '0' }
59 node:
60 _attributes: { phpName: EtvaNode }
61 id: { type: INTEGER, primaryKey: true, required: true, autoIncrement: true }
BaseCcBackupQuery.php (https://github.com/DoghouseMedia/Airtime.git) PHP · 292 lines
125 * Filter the query by primary key
126 *
127 * @param mixed $key Primary key to use for the query
128 *
129 * @return CcBackupQuery The current query, for fluid interface
130 */
131 public function filterByPrimaryKey($key)
132 {
133 return $this->addUsingAlias(CcBackupPeer::TOKEN, $key, Criteria::EQUAL);
141 * @return CcBackupQuery The current query, for fluid interface
142 */
143 public function filterByPrimaryKeys($keys)
144 {
145 return $this->addUsingAlias(CcBackupPeer::TOKEN, $keys, Criteria::IN);
external_test.php (https://github.com/markn86/moodle.git) PHP · 200 lines
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
29 global $CFG;
31 require_once($CFG->dirroot . '/webservice/tests/helpers.php');
32 use core_filters\external;
80 // Enable one filter at global level.
81 reset($allfilters);
82 $firstfilter = key($allfilters);
83 filter_set_global_state($firstfilter, TEXTFILTER_ON);
124 // Enable one filter at global level.
125 reset($allfilters);
126 $firstfilter = key($allfilters);
127 filter_set_global_state($firstfilter, TEXTFILTER_ON);
TSqlMapGateway.php (https://bitbucket.org/volatileeight/prado.git) PHP · 259 lines
155 * Executes the SQL and retuns all rows selected in a map that is keyed on
156 * the property named in the keyProperty parameter. The value at each key
157 * will be the value of the property specified in the valueProperty
158 * parameter. If valueProperty is null, the entire result object will be
162 * @param string The property of the result object to be used as the key.
163 * @param string The property of the result object to be used as the value.
164 * @return TMap Array object containing the rows keyed by keyProperty.
165 */
166 public function queryForMap($statementName, $parameter=null, $keyProperty=null, $valueProperty=null, $skip=-1, $max=-1)
167 {
168 $statement = $this->getSqlMapManager()->getMappedStatement($statementName);
169 return $statement->executeQueryForMap($this->getDbConnection(), $parameter, $keyProperty, $valueProperty, $skip, $max);
170 }
181 * @param string The property of the result object to be used as the key.
182 * @param string The property of the result object to be used as the value.
183 * @return TMap Array object containing the rows keyed by keyProperty.
184 */
185 public function queryForMapWithRowDelegate($statementName, $delegate, $parameter=null, $keyProperty=null, $valueProperty=null, $skip=-1, $max=-1)
Type.php (https://bitbucket.org/dnejedly/eaparts.git) PHP · 344 lines
1 <?php
2 /**
3 * Magento
8 * that is bundled with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://opensource.org/licenses/osl-3.0.php
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
22 * @package Mage_Eav
23 * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25 */
40 * @method int getIsDataSharing()
41 * @method Mage_Eav_Model_Entity_Type setIsDataSharing(int $value)
42 * @method string getDataSharingKey()
43 * @method Mage_Eav_Model_Entity_Type setDataSharingKey(string $value)
mysql4-install-0.8.0.php (https://bitbucket.org/dnejedly/eaparts.git) PHP · 222 lines
1 <?php
2 /**
3 * Magento
8 * that is bundled with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://opensource.org/licenses/osl-3.0.php
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
22 * @package Mage_Core
23 * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25 */
149 `translate` varchar(255) NOT NULL default '',
150 `locale` varchar(20) NOT NULL default 'en_US',
151 PRIMARY KEY (`key_id`),
152 UNIQUE KEY `IDX_CODE` (`store_id`,`locale`,`string`),
php.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 4699 lines
6 <MODE NAME="php" FILE="php.xml"
7 FILE_NAME_GLOB="*.{php3,php4,php5,php,phtml}"
8 FIRST_LINE_GLOB="<?php*" />
197 <END>]</END>
198 </SPAN>
199 <SEQ_REGEXP TYPE="KEYWORD4" HASH_CHAR="$" DELEGATE="OBJECT_PHP_LITERAL1_CURLY">\$\w+(?=(\[[\s\w'"]+\])?->)</SEQ_REGEXP>
200 <MARK_FOLLOWING TYPE="KEYWORD3">$</MARK_FOLLOWING>
353 <KEYWORD1>true</KEYWORD1>
354 <KEYWORD1>false</KEYWORD1>
355 <KEYWORD1>null</KEYWORD1>
381 <KEYWORD4>domnamednodemap</KEYWORD4>
382 <KEYWORD4>domnode</KEYWORD4>
383 <KEYWORD4>domnodelist</KEYWORD4>
384 <KEYWORD4>domprocessinginstruction</KEYWORD4>
385 <KEYWORD4>domtext</KEYWORD4>
386 <KEYWORD4>domxpath</KEYWORD4>
jEdit.desktop (https://jedit.svn.sourceforge.net/svnroot/jedit) Unknown · 14 lines
_dynamic.js
(http://enginey.googlecode.com/svn/trunk/)
JavaScript · 19 lines
✨ Summary
This JavaScript code checks if a specific resource is loaded and provides the Dojo toolkit with a reference to it. If not, it sets the resource as loaded and defines a new module named “dojox.highlight.languages._dynamic”. It then requires other languages (Python, Perl, PHP, Ruby) from the same module, making them available for use in the application.
This JavaScript code checks if a specific resource is loaded and provides the Dojo toolkit with a reference to it. If not, it sets the resource as loaded and defines a new module named “dojox.highlight.languages._dynamic”. It then requires other languages (Python, Perl, PHP, Ruby) from the same module, making them available for use in the application.
Preview_Javadoc_of_Buffer.bsh (https://jedit.svn.sourceforge.net/svnroot/jedit) Unknown · 609 lines
Condition.php (git://github.com/alexgorbatchev/SyntaxHighlighter.git) text · 0 lines
posts.php (https://bitbucket.org/simplemediacode/bptrunk.git) PHP · 195 lines
81 <h2><?php _e( 'Posts' ); ?>
82 <?php
83 $h2_search = $post_query->get( 'post_text' );
84 $h2_forum = $post_query->get( 'forum_id' );
143 <?php foreach ( $bulk_actions as $value => $label ) : ?>
145 <option value="<?php echo esc_attr( $value ); ?>"><?php echo esc_html( $label ); ?></option>
146 <?php endforeach; ?>
148 <input type="submit" value="<?php esc_attr_e( 'Apply' ); ?>" class="button submit-input" />
149 <?php bb_nonce_field( 'post-bulk' ); ?>
150 </fieldset>
152 <div class="tablenav">
153 <?php if ( $total ) : ?>
154 <div class="tablenav-pages">
155 <span class="displaying-num"><?php echo $displaying_num = sprintf(
activity.php (https://bitbucket.org/simplemediacode/bptrunk.git) PHP · 78 lines
1 <?php
3 /**
13 <ul>
15 <?php bp_get_options_nav(); ?>
17 <li id="activity-filter-select" class="last">
18 <label for="activity-filter-by"><?php _e( 'Show:', 'buddypress' ); ?></label>
19 <select id="activity-filter-by">
20 <option value="-1"><?php _e( 'Everything', 'buddypress' ); ?></option>
21 <option value="activity_update"><?php _e( 'Updates', 'buddypress' ); ?></option>
23 <?php
director_frob_runme.php
(https://swig.svn.sourceforge.net/svnroot/swig)
PHP · 20 lines
✨ Summary
This PHP code is a test script that verifies the functionality of various functions, classes, and global variables in a specific context. It creates an instance of the Bravo
class, calls its abs_method()
function, and checks if the result matches the expected output using assertions. If all tests pass, it outputs “done”.
This PHP code is a test script that verifies the functionality of various functions, classes, and global variables in a specific context. It creates an instance of the Bravo
class, calls its abs_method()
function, and checks if the result matches the expected output using assertions. If all tests pass, it outputs “done”.
terms.php (http://forceworkbench.googlecode.com/svn/trunk/workbench/) PHP · 8 lines
compil_modules1_1.com (https://swig.svn.sourceforge.net/svnroot/swig) Unknown · 133 lines
Archive.cs (https://bitbucket.org/jens13/cleanzip.git) C# · 29 lines
frame_9.svg (https://bitbucket.org/atchariya/nokia.git) SVG · 3078 lines
105 cd7plK/3PXdF+HEX/lky5nnif+4DX+sDazEOvCqdHJitNqFrnCMxLgR+t+/Z9co1L7ySCp9x45mS
106 Ghyceb0EXo0Lvh6cb6mywREpiMEfdJHjnPhicQwjuIMpOSZyXCAC62nHy75i1y3AnHU7gy9VSOog
107 9d+LVSXtwgrBUv2eR0wqpyMuCEpSp58mohQj6Yx7qEoqNcgFD5GxGFsH7wLPhp5rrqQ8MZeCSGDd
108 r1mlpspSw01AAyaKiSGe+bIbbxfhonOGUsfIYxKvEVnlwkeufHeh3BVl17D0ocFJjkMOTRUizEq9
109 MUV4EDp+RZVRhS9NueK/JaEaySaIGtGVqcxYKKzCkpwzOzNcCrigqrVj9qqeQpUsRpR6LCRrr0GE
149 kqdEOjxR4VCUz9lEHCtcs18SPguboMxAJnCOs1PYipNMcS10IigB86qwcL4v2Ssm/HYnFCI/vasa
150 7BjqRCBeuY1iBqqMXjhUZZlmlrHngy6zscSq4ZJZrJp3Gilr6vRPtbhei5mKVBiMCjtlvDqfMWS3
151 YffeB/hZRmLEgmK5dtLFnCz14UwOJRjZhORVdnlmEw8w7ptzEpQTYPTMgHBoyjoKeykjlzvwES4u
152 /0aRs3Z5Sbfs2ZPAUegwybzsyhdRXgEOApQQ2cXAIFUvfFlmPgZOFDqHZ616Iq47HBTnQIxP3Nmo
153 cb+5ogevE4u0z31EkOYPemS1y4oOV4DDbuDw2hX0YMX08AHz3e/BdmQHbIgspUKZmhy3mWJWDVbu
199 tObsPw8dHwbjn4zGM14h0i0CsefQCqupsAD2raACF6HjUWdcRMdKYHDHS3Vfy9PkBPfWbjjhyRmW
200 nOe/9DJvv/seRZx9gxXOMfCiRLp5x5+J8SAGXiiFVyTy+WQ8zltK7PjpxQrTjlQcG3cYmVwKj8Xr
201 vaSKEyvf6kZXeWsGh7XCZ4g8V4yNVIHNLIVk8ATnYVBuWeEnkvBt2/BvOudfdQP/pzzxOyFw4Maz
202 LZkxSWHjBZFYSXulOuC96gwTjpTMqhT2kzD3C866BbtcgW5thmmzqgRMQYgvLq6wthnyjp0qc3My
203 4hnzQnIj/zVX7mTfLxynwFt94M0ghDjwT6Xntc2Wbc78Yq/87rIjeCT6xMLrh2QURhW2pjzqlL8M
query.php
(http://forceworkbench.googlecode.com/svn/trunk/workbench/)
PHP · 996 lines
✨ Summary
This PHP code is part of a Salesforce Workbench application, handling query-related functionality. It generates query results, exports data to CSV, and allows users to execute queries asynchronously. The code also handles errors, warnings, and export options, providing a user-friendly interface for interacting with Salesforce data.
This PHP code is part of a Salesforce Workbench application, handling query-related functionality. It generates query results, exports data to CSV, and allows users to execute queries asynchronously. The code also handles errors, warnings, and export options, providing a user-friendly interface for interacting with Salesforce data.
3 require_once 'soxl/QueryObjects.php';
4 require_once 'session.php';
5 require_once 'shared.php';
19 }
21 $persistedSavedQueryRequestsKey = "PSQR@";
22 if (getConfig("savedQueriesAndSearchesPersistanceLevel") == 'USER') {
23 $persistedSavedQueryRequestsKey .= WorkbenchContext::get()->getUserInfo()->userId . "@" . WorkbenchContext::get()->getUserInfo()->organizationId;
388 "<select id='QB_filter_compOper_" + filterRowNum + "' name='QB_filter_compOper_" + filterRowNum + "' style='width: 6em;' onChange='buildQuery();' onkeyup='buildQuery();'>";
390 for (var opKey in compOper_array) {
391 row += "<option value='" + opKey + "'";
937 if ($records) {
938 try {
939 $csvFile = fopen('php://output','w') or die("Error opening php://output");
940 $csvFilename = "export" . date('YmdHis') . ".csv";
941 header("Content-Type: application/csv");
XmlReader.java
(http://btalk.googlecode.com/svn/)
Java · 240 lines
✨ Summary
This Java code implements an XML reader that parses and interprets XML documents. It reads input from an InputStream, identifies XML tags, attributes, and text content, and returns information about each element in a stack-based data structure. The reader can be used to parse and process XML files, and provides methods for accessing the parsed elements’ names, attributes, and text content.
This Java code implements an XML reader that parses and interprets XML documents. It reads input from an InputStream, identifies XML tags, attributes, and text content, and returns information about each element in a stack-based data structure. The reader can be used to parse and process XML files, and provides methods for accessing the parsed elements’ names, attributes, and text content.
RoleVoter.php
(git://github.com/symfony/symfony.git)
PHP · 62 lines
✨ Summary
This PHP class, RoleVoter
, implements a voter for Symfony’s security system. It checks if any attribute of an object starts with a given prefix (‘ROLE_’) and grants access if the role is present in the token’s roles. If the attribute is ‘ROLE_PREVIOUS_ADMIN’, it triggers deprecation warnings. The voter returns ACCESS_ABSTAIN
by default, unless the attribute matches one of the token’s roles, in which case it returns ACCESS_GRANTED
.
This PHP class, RoleVoter
, implements a voter for Symfony’s security system. It checks if any attribute of an object starts with a given prefix (‘ROLE_’) and grants access if the role is present in the token’s roles. If the attribute is ‘ROLE_PREVIOUS_ADMIN’, it triggers deprecation warnings. The voter returns ACCESS_ABSTAIN
by default, unless the attribute matches one of the token’s roles, in which case it returns ACCESS_GRANTED
.
question44504-folding.html (https://bitbucket.org/shuangxinyu/emacspack.git) HTML · 29 lines
6 <tr>
7 <td width='50' colspan='1' class='men-met'>
8 <input type='button' value=' < ' onClick='goLastMonth(<?php echo date("t", strtotime("$year1-$month1-$day1")).", ".$month . ", " . $year.", ".date("w", strtotime("$year-$month-$day1")); ?>)' />
9 </td>
10 <td width='250' colspan='5' class='men-met'>
11 <span class='title'><?php echo $men . " " . $year; ?></span><br />
12 </td>
13 <td width='50' colspan='1' align='right' class='men-met'>
14 <input type='button' value=' > ' onClick='goNextMonth(1, <?php echo $month . ", " . $year.", ".date("w", strtotime("$year2-$month2-$day1")); ?>)' />
15 </td>
16 </tr>
UnixFileSystem.php (git://github.com/alexgorbatchev/SyntaxHighlighter.git) text · 0 lines
1 <?php
2 /*
3 * $Id: UnixFileSystem.php 258 2007-10-21 00:46:45Z hans $
20 */
22 include_once 'phing/system/io/FileSystem.php';
24 /**
25 * UnixFileSystem class. This class encapsulates the basic file system functions
26 * for platforms using the unix (posix)-stylish filesystem. It wraps php native
27 * functions suppressing normal PHP error reporting and instead uses Exception
29 *
30 * This class is part of a oop based filesystem abstraction and targeted to run
31 * on all supported php platforms.
32 *
33 * Note: For debugging turn track_errors on in the php.ini. The error messages
PHPParserListener.java
(https://jedit.svn.sourceforge.net/svnroot/jedit)
Java · 15 lines
✨ Summary
This Java interface defines a listener for PHP parsing events, specifically parseError
and parseMessage
. It extends the built-in EventListener
interface, allowing classes to implement this listener and receive notifications when errors or messages occur during PHP parsing.
This Java interface defines a listener for PHP parsing events, specifically parseError
and parseMessage
. It extends the built-in EventListener
interface, allowing classes to implement this listener and receive notifications when errors or messages occur during PHP parsing.
1 package gatchan.phpparser.parser;
3 import java.util.EventListener;
5 /**
6 * The listener to listen to the PHPParserListener
7 *
8 * @author Matthieu Casanova
9 */
10 public interface PHPParserListener extends EventListener {
12 void parseError(PHPParseErrorEvent e);
13 void parseMessage(PHPParseMessageEvent e);
14 }
ConditionalExpression.java
(https://jedit.svn.sourceforge.net/svnroot/jedit)
Java · 70 lines
✨ Summary
This Java class represents a ConditionalExpression, which is an operator expression that evaluates to true if a condition is met and false otherwise. It has three main components: a boolean condition, a value to return if true, and a value to return if false. The class provides methods for getting variables used in the expression, modified by it, and outside of it.
This Java class represents a ConditionalExpression, which is an operator expression that evaluates to true if a condition is met and false otherwise. It has three main components: a boolean condition, a value to return if true, and a value to return if false. The class provides methods for getting variables used in the expression, modified by it, and outside of it.
try.dtd (https://jedit.svn.sourceforge.net/svnroot/jedit) Document Type Definition · 24 lines
catalog (https://jedit.svn.sourceforge.net/svnroot/jedit) Unknown · 546 lines
error.ctp (https://bitbucket.org/floresj/notetime.git) Unknown · 62 lines
4 * PHP 5
5 *
6 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
7 * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
8 *
17 */
19 $cakeDescription = __d('cake_dev', 'CakePHP: the rapid development php framework');
20 ?>
21 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
40 <div id="container">
41 <div id="header">
42 <h1><?php echo $this->Html->link($cakeDescription, 'http://cakephp.org'); ?></h1>
43 </div>
44 <div id="content">
bp-core-options.php (https://bitbucket.org/simplemediacode/bptrunk.git) PHP · 538 lines
253 global $bp;
255 if ( !empty( $keys ) && is_array( $keys ) ) {
256 $errors = false;
293 // Do some magic to get all the root blog options in 1 swoop
294 $blog_options_keys = "'" . join( "', '", (array) $root_blog_option_keys ) . "'";
295 $blog_options_table = bp_is_multiblog_mode() ? $wpdb->options : $wpdb->get_blog_prefix( bp_get_root_blog_id() ) . 'options';
296 $blog_options_query = "SELECT option_name AS name, option_value AS value FROM {$blog_options_table} WHERE option_name IN ( {$blog_options_keys} )";
308 $current_site = get_current_site();
309 $network_option_keys = array_keys( $network_options );
310 $sitemeta_options_keys = "'" . join( "', '", (array) $network_option_keys ) . "'";
311 $sitemeta_options_query = $wpdb->prepare( "SELECT meta_key AS name, meta_value AS value FROM {$wpdb->sitemeta} WHERE meta_key IN ( {$sitemeta_options_keys} ) AND site_id = %d", $current_site->id );
312 $network_options_meta = $wpdb->get_results( $sitemeta_options_query );
default.po (https://bitbucket.org/floresj/notetime.git) Portable Object · 26 lines
gfortran.vim (https://bitbucket.org/ultra_iter/vim-qt.git) Vim Script · 27 lines
default_locale.php (https://bitbucket.org/kraymitchell/fcd.git) PHP · 27 lines
1 <?php
2 /**
3 * @package Joomla.Administrator
12 <div class="width-100">
13 <fieldset class="adminform">
14 <legend><?php echo JText::_('COM_CONFIG_LOCATION_SETTINGS'); ?></legend>
15 <ul class="adminformlist">
16 <?php
17 foreach ($this->form->getFieldset('locale') as $field):
18 ?>
19 <li><?php echo $field->label; ?>
20 <?php echo $field->input; ?></li>
21 <?php
22 endforeach;
23 ?>
Makefile.old (https://swig.svn.sourceforge.net/svnroot/swig) Unknown · 16 lines
2 SWIG = $(TOP)/../swig
3 SRCS = example.c
4 TARGET = php_example
5 INTERFACE = example.i
6 SWIGOPT = -noproxy
8 all::
9 $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
10 SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php4
12 clean::
13 rm -f *_wrap* *.o core *~ *.so *.php php_example.h
15 check: all
category.php (https://bitbucket.org/kraymitchell/fcd.git) PHP · 177 lines
1 <?php
2 /**
3 * @package Joomla.Administrator
67 *
68 * @param array $data An array of input data.
69 * @param string $key The name of the key for the primary key.
70 *
71 * @return boolean
73 * @since 1.6
74 */
75 protected function allowEdit($data = array(), $key = 'parent_id')
76 {
77 // Initialise variables.
78 $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
79 $user = JFactory::getUser();
80 $userId = $user->get('id');
en-GB.plg_finder_weblinks.ini (https://bitbucket.org/kraymitchell/fcd.git) Unknown · 11 lines
tc.php
(http://typecho.googlecode.com/svn/trunk/)
PHP · 29 lines
✨ Summary
This PHP script processes a PHP file by removing unnecessary whitespace, stripping out require_once
statements, and appending the contents of an optional input file to the end of the script. The modified script is then written back to the original output file.
This PHP script processes a PHP file by removing unnecessary whitespace, stripping out require_once
statements, and appending the contents of an optional input file to the end of the script. The modified script is then written back to the original output file.
exploretags.js
(https://code.google.com/p/ontowiki/)
JavaScript · 249 lines
✨ Summary
This JavaScript code is part of a tagging extension for OntoWiki, a semantic web platform. It enables users to add, remove, and manage tags on resources in the platform. The code handles user interactions such as clicking cloud values, deleting properties, and sorting tag clouds, while also refreshing the page with updated tag lists.
This JavaScript code is part of a tagging extension for OntoWiki, a semantic web platform. It enables users to add, remove, and manage tags on resources in the platform. The code handles user interactions such as clicking cloud values, deleting properties, and sorting tag clouds, while also refreshing the page with updated tag lists.
5 * @author Sebastian Dietzold <dietzold@informatik.uni-leipzig.de>
6 * @copyright Copyright (c) 2009, {@link http://aksw.org AKSW}
7 * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
8 * @version $Id: $
9 *
44 $.post(getUri,
45 {
46 "key": $(ui.draggable).attr("about"),
47 "value" : $.toJSON(data)
48 }, //as post because of possible size
63 $('.delete-cloudproperty').live('click', function(event) {
64 $.post(urlBase+"service/session?name=cloudproperties&method=unsetArrayKey",
65 {"key" : $(this).attr("about")},
214 */
215 function resetSelectedTags() {
216 for(key in filter.filters){
217 if(key.substr(0, 7) == "explore"){
i2c-ali1535 (http://photon-android.googlecode.com/svn/) Unknown · 43 lines
ibmphp_res.c
(http://photon-android.googlecode.com/svn/)
C · 2146 lines
✨ Summary
This C code is part of a PCI bus scanner, which discovers and configures resources on a system’s PCI buses. It iterates through each device on the bus, parsing its configuration space to extract resource information (e.g., memory addresses, I/O ports). The extracted data is stored in a bus structure, allowing the system to access these resources later.
This C code is part of a PCI bus scanner, which discovers and configures resources on a system’s PCI buses. It iterates through each device on the bus, parsing its configuration space to extract resource information (e.g., memory addresses, I/O ports). The extracted data is stored in a bus structure, allowing the system to access these resources later.
33 #include <linux/list.h>
34 #include <linux/init.h>
35 #include "ibmphp.h"
37 static int flags = 0; /* for testing */
184 * are not sorted. (no need since use mem node). To not change the entire code, we
185 * also add mem node whenever this case happens so as not to change
186 * ibmphp_check_mem_resource etc (and since it really is taking Mem resource)
187 */
197 * Output: 0, -1 or error codes
198 ***************************************************************************/
199 int __init ibmphp_rsrc_init (void)
200 {
201 struct ebda_pci_rsrc *curr;
TwitterAlikeExample.html
(http://redis.googlecode.com/svn/trunk/)
HTML · 253 lines
✨ Summary
This HTML code outputs a blog post about Redis, a popular in-memory data store. The content explains how to implement a Twitter-like clone using Redis, including setting up followers and posting messages. It also discusses horizontal scaling of the system, including hashing keys, distributing user data across servers, and handling special cases like incrementing IDs and retrieving timeline data.
This HTML code outputs a blog post about Redis, a popular in-memory data store. The content explains how to implement a Twitter-like clone using Redis, including setting up followers and posting messages. It also discusses horizontal scaling of the system, including hashing keys, distributing user data across servers, and handling special cases like incrementing IDs and retrieving timeline data.
17 <div class="index">
18 <!-- This is a (PRE) block. Make sure it's left aligned or your toc title will be off. -->
19 <b>TwitterAlikeExample: Contents</b><br> <a href="#A case study: Design and implementation of a simple Twitter clone using only the Redis key-value store as database and PHP">A case study: Design and implementation of a simple Twitter clone using only the Redis key-value store as database and PHP</a><br> <a href="#Key-value stores basics">Key-value stores basics</a><br> <a href="#Atomic operations">Atomic operations</a><br> <a href="#Beyond key-value stores">Beyond key-value stores</a><br> <a href="#The set data type">The set data type</a><br> <a href="#Prerequisites">Prerequisites</a><br> <a href="#Data layout">Data layout</a><br> <a href="#Following, followers and updates">Following, followers and updates</a><br> <a href="#Authentication">Authentication</a><br> <a href="#Updates">Updates</a><br> <a href="#Paginating updates">Paginating updates</a><br> <a href="#Following users">Following users</a><br> <a href="#Making it horizontally scalable">Making it horizontally scalable</a><br> <a href="#Hashing the key">Hashing the key</a><br> <a href="#Special keys">Special keys</a>
20 </div>
28 <div class="narrow">
29 <h1><a name="A case study: Design and implementation of a simple Twitter clone using only the Redis key-value store as database and PHP">A case study: Design and implementation of a simple Twitter clone using only the Redis key-value store as database and PHP</a></h1>In this article I'll explain the design and the implementation of a <a href="http://retwis.antirez.com" target="_blank">simple clone of Twitter</a> written using PHP and <a href="http://code.google.com/p/redis/" target="_blank">Redis</a> as only database. The programming community uses to look at key-value stores like special databases that can't be used as drop in replacement for a relational database for the development of web applications. This article will try to prove the contrary.<br/><br/>Our Twitter clone, <a href="http://retwis.antirez.com" target="_blank">called Retwis</a>, is structurally simple, has very good performances, and can be distributed among N web servers and M Redis servers with very little efforts. You can find the source code <a href="http://code.google.com/p/redis/downloads/list" target="_blank">here</a>.<br/><br/>We use PHP for the example since it can be read by everybody. The same (or... much better) results can be obtained using Ruby, Python, Erlang, and so on.
30 <h1><a name="Key-value stores basics">Key-value stores basics</a></h1>
79 </pre>Ok I think we are ready to start coding!
80 <h2><a name="Prerequisites">Prerequisites</a></h2>
81 If you didn't download it already please <a href="http://code.google.com/p/redis/wiki/README" target="_blank">grab the source code of Retwis</a>. It's a simple tar.gz file with a few of .php files inside. The implementation is very simple. You will find the PHP library client inside (redis.php) that is used to talk with the Redis server from PHP. This library was written by <a href="http://qix.it" target="_blank">Ludovico Magnocavallo</a> and you are free to reuse this in your own projects, but for updated version of the library please download the Redis distribution.<br/><br/>Another thing you probably want is a working Redis server. Just get the source, compile with make, and run with ./redis-server and you are done. No configuration is required at all in order to play with it or to run Retwis in your computer.
82 <h2><a name="Data layout">Data layout</a></h2>
83 Working with a relational database this is the stage were the database layout should be produced in form of tables, indexes, and so on. We don't have tables, so what should be designed? We need to identify what keys are needed to represent our objects and what kind of values this keys need to hold.<br/><br/>Let's start from Users. We need to represent this users of course, with the username, userid, password, followers and following users, and so on. The first question is, what should identify an user inside our system? The username can be a good idea since it is unique, but it is also too big, and we want to stay low on memory. So like if our DB was a relational one we can associate an unique ID to every user. Every other reference to this user will be done by id. That's very simple to do, because we have our atomic INCR operation! When we create a new user we can do something like this, assuming the user is callled "antirez":<br/><br/><pre class="codeblock python python python python python python python python python python python python" name="code">
243 server_id = crc32(key) % number_of_servers
244 </pre>This has a lot of problems since if you add one server you need to move too much keys and so on, but this is the general idea even if you use a better hashing scheme like consistent hashing.<br/><br/>Ok, are key accesses distributed among the key space? Well, all the user data will be partitioned among different servers. There are no inter-keys operations used (like SINTER, otherwise you need to care that things you want to intersect will end in the same server. <b>This is why Redis unlike memcached does not force a specific hashing scheme, it's application specific</b>). Btw there are keys that are accessed more frequently.<h3><a name="Special keys">Special keys</a></h3>For example every time we post a new message, we <b>need</b> to increment the <code name="code" class="python">global:nextPostId</code> key. How to fix this problem? A Single server will get a lot if increments. The simplest way to handle this is to have a dedicated server just for increments. This is probably an overkill btw unless you have really a lot of traffic. There is another trick. The ID does not really need to be an incremental number, but just <b>it needs to be unique</b>. So you can get a random string long enough to be unlikely (almost impossible, if it's md5-size) to collide, and you are done. We successfully eliminated our main problem to make it really horizontally scalable!<br/><br/>There is another one: global:timeline. There is no fix for this, if you need to take something in order you can split among different servers and <b>then merge</b> when you need to get the data back, or take it ordered and use a single key. Again if you really have so much posts per second, you can use a single server just for this. Remember that with commodity hardware Redis is able to handle 100000 writes for second, that's enough even for Twitter, I guess.<br/><br/>Please feel free to use the comments below for questions and feedbacks.
246 </div>