100+ results for 'php min'
Not the results you expected?
AssertionsTest.class.php (https://github.com/treuter/xp-framework.git) PHP · 617 lines
faq.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 114 lines
Editor.php (https://github.com/lazenge/zf2.git) PHP · 601 lines
445 * Set minimum height of editor
446 *
447 * @param string|int $minHeight
448 * @return \Zend\Dojo\Form\Element\Editor
449 */
450 public function setMinHeight($minHeight)
451 {
452 if (!preg_match('/^\d+(em)?$/i', $minHeight)) {
453 throw new ElementException('Invalid minHeight provided; must be integer or CSS measurement');
454 }
455 if ('em' != substr($minHeight, -2)) {
456 $minHeight .= 'em';
457 }
458 return $this->setDijitParam('minHeight', $minHeight);
459 }
sitemailer_.php (https://gitlab.com/nvtdn2006/azora) PHP · 384 lines
1 <?php
2 class SiteMailer
3 {
52 $this->headers .= "MIME-Version: 1.0\r\n";
53 //$this->headers .= "Content-Type: multipart/mixed; boundary=\"PHP-mixed-" . $this->randomHash . "\"\r\n";
54 $this->headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
55 }
89 /*if ($this->attachment != '')
90 {
91 $this->msgBody .= "\r\n--PHP-mixed-" . $this->randomHash . "--";
92 $this->msgBody .= $this->attachment;
93 $this->msgBody .= "\r\n--PHP-mixed-" . $this->randomHash . "--";
132 $this->sendPointshavebeenexpired($property);
133 break;
134 case 'sendReminderforpointexpiration':
135 $this->sendReminderforpointexpiration($property);
SequenceTest.php (https://bitbucket.org/mkjpryor/lazy-sequence.git) PHP · 369 lines
1 <?php
3 namespace Lazy\Test;
16 class SequenceTest extends \PHPUnit_Framework_TestCase {
18 /**
179 // Test that takeWhile works when predicate becomes true again after
180 // becoming false
181 $this->assertEquals(
182 [1, 2],
218 // Test that skipWhile works when predicate becomes true again after
219 // becoming false
220 $this->assertEquals(
221 [3, 1, 2],
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.
150 *
151 * The closure receives as its first parameter a container of class Options
152 * that contains the <em>concrete</em> options determined upon resolving. The
153 * closure is executed once resolve() is called.
154 *
zone.php (https://bitbucket.org/sandeepbhaskar/inspiredliving.git) PHP · 441 lines
1 <?php
2 class ControllerLocalisationZone extends Controller {
3 private $error = array();
166 'sort' => $sort,
167 'order' => $order,
168 'start' => ($page - 1) * $this->config->get('config_admin_limit'),
169 'limit' => $this->config->get('config_admin_limit')
247 $pagination->total = $zone_total;
248 $pagination->page = $page;
249 $pagination->limit = $this->config->get('config_admin_limit');
250 $pagination->text = $this->language->get('text_pagination');
251 $pagination->url = $this->url->link('localisation/zone', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
sfValidatorBaseTest.php (https://github.com/yuya-takeyama/symfony-hackathon-20110924.git) PHP · 246 lines
1 <?php
3 /*
9 */
11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php');
13 $t = new lime_test(47);
132 $t->is($v->clean(''), null, '->setOption() changes options (required for example)');
133 $v->setOption('trim', true);
134 $t->is($v->clean(' foo '), 'foo', '->setOption() can turn on whitespace trimming');
135 try
136 {
Thrift.php
(git://github.com/apache/thrift.git)
PHP · 821 lines
✨ Summary
This PHP code defines a Thrift protocol implementation for a TApplicationException class, which is an exception type used to handle application-level errors. It provides methods for reading and writing the exception’s message and code fields to a Thrift output stream. The code also includes Thrift-related classes and constants, setting up the global THRIFT_ROOT environment variable.
This PHP code defines a Thrift protocol implementation for a TApplicationException class, which is an exception type used to handle application-level errors. It provides methods for reading and writing the exception’s message and code fields to a Thrift output stream. The code also includes Thrift-related classes and constants, setting up the global THRIFT_ROOT environment variable.
1 <?php
2 /*
3 * Licensed to the Apache Software Foundation (ASF) under one
40 const MAP = 13;
41 const SET = 14;
42 const LST = 15; // N.B. cannot use LIST keyword in PHP!
43 const UTF8 = 16;
44 const UTF16 = 17;
60 * because we need to save CPU cycles and this is not yet in an extension.
61 * Ideally we'd multiply-inherit TException from both Exception and Base, but
62 * that's not possible in PHP and there are no modules either, so for now we
63 * apologetically take a trip to HackTown.
64 *
417 * cut back on the size of the generated code which is turning out to have a
418 * nontrivial cost just to load thanks to the wondrously abysmal implementation
419 * of PHP. Note that code is intentionally duplicated in here to avoid making
420 * function calls for every field or member of a container..
421 */
ProcessorTest.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 435 lines
1 <?php
2 /**
3 * Copyright © 2016 Magento. All rights reserved.
8 use Magento\Catalog\Model\Product;
9 use Magento\Quote\Api\Data\CartItemInterface;
10 use Magento\Quote\Model\Quote\Item\Processor;
11 use Magento\Quote\Model\Quote\ItemFactory;
19 * Tests for Magento\Quote\Model\Service\Quote\Processor
20 */
21 class ProcessorTest extends \PHPUnit_Framework_TestCase
22 {
23 /**
28 /**
29 * @var ItemFactory |\PHPUnit_Framework_MockObject_MockObject
30 */
31 protected $quoteItemFactoryMock;
SortedSet.php (https://github.com/netweaver/Rediska.git) PHP · 335 lines
64 * Get count of members from sorted set by min and max score
65 *
66 * @param integer $min Min score
67 * @param integer $max Max score
68 * @return integer
76 * Get Sorted set by score
77 *
78 * @param number $min Min score
79 * @param number $max Max score
80 * @param boolean $withScores Get with scores
91 * Remove members from sorted set by score
92 *
93 * @param $min Min score
94 * @param $max Max score
95 * @return integer
Installerold.php (https://github.com/ArchiCroc/Tower-Web-Platform.git) PHP · 232 lines
sale.php (https://github.com/sansanwawa/e-commerse.git) PHP · 307 lines
1 <?php
2 class ModelReportSale extends Model {
3 public function getOrders($data = array()) {
4 $sql = "SELECT MIN(tmp.date_added) AS date_start, MAX(tmp.date_added) AS date_end, COUNT(tmp.order_id) AS `orders`, SUM(tmp.products) AS products, SUM(tmp.tax) AS tax, SUM(tmp.total) AS total FROM (SELECT o.order_id, (SELECT SUM(op.quantity) FROM `" . DB_PREFIX . "order_product` op WHERE op.order_id = o.order_id GROUP BY op.order_id) AS products, (SELECT SUM(ot.value) FROM `" . DB_PREFIX . "order_total` ot WHERE ot.order_id = o.order_id AND ot.code = 'tax' GROUP BY ot.order_id) AS tax, o.total, o.date_added FROM `" . DB_PREFIX . "order` o";
6 if (isset($data['filter_order_status_id']) && $data['filter_order_status_id']) {
103 public function getTaxes($data = array()) {
104 $sql = "SELECT MIN(o.date_added) AS date_start, MAX(o.date_added) AS date_end, ot.title, SUM(ot.value) AS total, COUNT(o.order_id) AS `orders` FROM `" . DB_PREFIX . "order_total` ot LEFT JOIN `" . DB_PREFIX . "order` o ON (ot.order_id = o.order_id) WHERE ot.code = 'tax'";
106 if (isset($data['filter_order_status_id']) && $data['filter_order_status_id']) {
205 public function getShipping($data = array()) {
206 $sql = "SELECT MIN(o.date_added) AS date_start, MAX(o.date_added) AS date_end, ot.title, SUM(ot.value) AS total, COUNT(o.order_id) AS `orders` FROM `" . DB_PREFIX . "order_total` ot LEFT JOIN `" . DB_PREFIX . "order` o ON (ot.order_id = o.order_id) WHERE ot.code = 'shipping'";
208 if (isset($data['filter_order_status_id']) && $data['filter_order_status_id']) {
query_builder.php (https://github.com/kamarulismail/kamarul-playground.git) PHP · 302 lines
1 <?php
2 /**
3 * File containing the ezcSearchQueryBuilder class.
107 '"' => ezcSearchQueryToken::QUOTE,
108 '+' => ezcSearchQueryToken::PLUS,
109 '-' => ezcSearchQueryToken::MINUS,
110 '(' => ezcSearchQueryToken::BRACE_OPEN,
111 ')' => ezcSearchQueryToken::BRACE_CLOSE,
146 break;
148 case ezcSearchQueryToken::MINUS:
149 $string = $q->not( $string );
150 break;
175 $parts[] = $this->processPrefix( $q, $q->eq( $searchField, $term ) );
176 }
177 if ( $this->prefix == ezcSearchQueryToken::MINUS )
178 {
179 $ret = $q->lAnd( $parts );
Clients.php (https://gitlab.com/my-application.bjoernbartels.earth/module-admin) PHP · 322 lines
1 <?php
2 /**
3 * BB's Zend Framework 2 Components
4 *
5 * AdminModule
6 *
7 * @package [MyApplication]
8 * @package BB's Zend Framework 2 Components
9 * @package AdminModule
10 * @author Björn Bartels <coding@bjoernbartels.earth>
11 * @link https://gitlab.bjoernbartels.earth/groups/zf2
14 */
16 namespace Admin\Model;
18 use Zend\Crypt\Password\Bcrypt;
4_wicked_single_revisions.php (https://github.com/ewandor/horde.git) PHP · 211 lines
1 <?php
2 /**
3 * Changes major.minor revisions to single revision numbers.
20 {
21 parent::__construct($connection, $version);
22 require_once $GLOBALS['registry']->get('fileroot', 'wicked') . '/lib/Wicked.php';
23 $this->_vfs = $GLOBALS['injector']
24 ->getInstance('Horde_Core_Factory_Vfs')
38 $id = $version = null;
39 $query = 'UPDATE wicked_history SET page_version = ? WHERE '
40 . 'page_id = ? AND page_majorversion = ? AND page_minorversion = ?';
41 $pageQuery = 'UPDATE wicked_pages SET page_version = ? WHERE page_id = ?';
42 $history = $this->select(
43 'SELECT page_id, page_majorversion, page_minorversion '
44 . 'FROM wicked_history '
45 . 'ORDER BY page_id, page_majorversion, page_minorversion');
voucher.php (https://bitbucket.org/elena_dyavolova/omf.git) PHP · 263 lines
1 <?php
2 class ControllerAccountVoucher extends Controller {
3 private $error = array();
58 $this->data['entry_theme'] = $this->language->get('entry_theme');
59 $this->data['entry_message'] = $this->language->get('entry_message');
60 $this->data['entry_amount'] = sprintf($this->language->get('entry_amount'), $this->currency->format($this->config->get('config_voucher_min')), $this->currency->format($this->config->get('config_voucher_max')));
62 $this->data['button_continue'] = $this->language->get('button_continue');
246 }
248 if (($this->currency->convert($this->request->post['amount'], $this->currency->getCode(), $this->config->get('config_currency')) < $this->config->get('config_voucher_min')) || ($this->currency->convert($this->request->post['amount'], $this->currency->getCode(), $this->config->get('config_currency')) > $this->config->get('config_voucher_max'))) {
249 $this->error['amount'] = sprintf($this->language->get('error_amount'), $this->currency->format($this->config->get('config_voucher_min')), $this->currency->format($this->config->get('config_voucher_max')) . ' ' . $this->currency->getCode());
BaseUserService.php (https://bitbucket.org/sauron07/friend_social.git) PHP · 399 lines
1 <?php
2 /**
3 * Zend Framework
18 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: BaseUserService.php 24594 2012-01-05 21:27:01Z matthew $
21 */
24 * @see Zend_Service_DeveloperGarden_Client_ClientAbstract
25 */
26 //require_once 'Zend/Service/DeveloperGarden/Client/ClientAbstract.php';
28 /**
29 * @see Zend_Service_DeveloperGarden_Response_BaseUserService_GetQuotaInformationResponse
30 */
31 //require_once 'Zend/Service/DeveloperGarden/Response/BaseUserService/GetQuotaInformationResponse.php';
33 /**
WufooApiWrapper.php (https://github.com/Fourshift/Wufoo-API-Wrappers.git) PHP · 270 lines
1 <?php
3 require_once('WufooApiWrapperBase.php');
4 require_once('WufooValueObjects.php');
6 /**
89 * @param string $from can be left as 'forms'. The call getReportFields uses this parameter.
90 * @param string $getArgs a URL encoded string to filter entries.
91 * @param string $index determines the key of the return hash
92 * @return array of Form/Report Value Objects by hash
93 * @author Timothy S Sabat
AbstractPaginator.php (https://gitlab.com/zan_zan/laravel_sample) PHP · 487 lines
1 <?php
3 namespace Illuminate\Pagination;
11 * All of the items being paginated.
12 *
13 * @var \Illuminate\Support\Collection
14 */
15 protected $items;
80 /**
81 * Determine if the given value is a valid page number.
82 *
83 * @param int $page
271 /**
272 * Determine if there are enough items to split into multiple pages.
273 *
274 * @return bool
provider_test.php (https://github.com/sbourget/moodle.git) PHP · 240 lines
PluginInfo.php (https://gitlab.com/fabiorf/chat) PHP · 383 lines
errors.php (https://github.com/libersoft/fengoffice-ls.git) PHP · 194 lines
1 <?php
3 /**
34 // Password validation errors
35 'password invalid min length' => 'Password length must be at least {0} characters',
36 'password invalid numbers' => 'Password must have at least {0} numerical characters',
37 'password invalid uppercase' => 'Password must have at least {0} uppercase characters',
admin_snippets_edit.php (https://github.com/Thoronador/Frogsystem-2.git) PHP · 326 lines
27 systext ( $FD->text("admin", "changes_saved"),
28 $FD->text("admin", "info"), FALSE, $FD->text("admin", "icon_save_ok") );
30 // Unset Vars
146 <td colspan="2" class="buttontd">
147 <button class="button_new" type="submit">
148 '.$FD->text("admin", "button_arrow").' '.$FD->text("admin", "save_changes_button").'
149 </button>
150 </td>
270 // get other data
271 $data_arr['active_text'] = ( $data_arr['snippet_active'] == 1 ) ? $FD->text("admin", "yes") : $FD->text("admin", "no");
273 echo '
302 <td class="buttontd" colspan="4">
303 <button class="button_new" type="submit">
304 '.$FD->text("admin", "button_arrow").' '.$FD->text("admin", "do_action_button_long").'
305 </button>
306 </td>
Store.php (https://github.com/speedupmate/Magento-CE-Mirror.git) PHP · 510 lines
132 if ($all && $this->_isAdminScopeAllowed) {
133 $options[] = array(
134 'label' => Mage::helper('adminhtml')->__('All Store Views'),
135 'value' => 0
136 );
256 if ($empty) {
257 $options[] = array(
258 'label' => Mage::helper('adminhtml')->__('-- Please Select --'),
259 'value' => ''
260 );
262 if ($all && $this->_isAdminScopeAllowed) {
263 $options[] = array(
264 'label' => Mage::helper('adminhtml')->__('Admin'),
265 'value' => 0
266 );
reflection_php5.php (https://bitbucket.org/volatileeight/prado.git) PHP · 274 lines
1 <?php
2 /**
3 * base include file for SimpleTest
4 * @package SimpleTest
5 * @subpackage UnitTester
6 * @version $Id: reflection_php5.php 1398 2006-09-08 19:31:03Z xue $
7 */
26 /**
27 * Checks that a class has been declared. Versions
28 * before PHP5.0.2 need a check that it's not really
29 * an interface.
30 * @return boolean True if defined.
41 /**
42 * Needed to kill the autoload feature in PHP5
43 * for classes created dynamically.
44 * @return boolean True if defined.
ValidatorTypeGuesser.php (https://github.com/Exercise/symfony.git) PHP · 273 lines
1 <?php
3 /*
69 * {@inheritDoc}
70 */
71 public function guessMinLength($class, $property)
72 {
73 $guesser = $this;
75 return $this->guess($class, $property, function (Constraint $constraint) use ($guesser) {
76 return $guesser->guessMinLengthForConstraint($constraint);
77 });
78 }
146 case 'Symfony\Component\Validator\Constraints\MaxLength':
147 case 'Symfony\Component\Validator\Constraints\MinLength':
148 case 'Symfony\Component\Validator\Constraints\Regex':
149 case 'Symfony\Component\Validator\Constraints\SizeLength':
categories.php (https://github.com/tomtom127/oscommerce.git) PHP · 247 lines
Statistics.php (https://github.com/eschabell/openshift-zendframework.git) PHP · 309 lines
1 <?php
3 /**
19 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 * @version $Id: Statistics.php 23775 2011-03-01 17:25:24Z ralph $
22 */
25 * @see Zend_Gdata_Extension
26 */
27 require_once 'Zend/Gdata/Extension.php';
29 /**
122 * child properties.
123 */
124 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
125 {
126 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
sfValidatorDateTest.php (https://github.com/makerlabs/Symfohub.git) PHP · 246 lines
1 <?php
3 /*
9 */
11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php');
13 $t = new lime_test(52);
120 $t->diag('option with_time');
121 $v->setOption('with_time', true);
122 $t->is($v->clean(array('year' => 2005, 'month' => 10, 'day' => 15, 'hour' => 12, 'minute' => 10, 'second' => 15)), '2005-10-15 12:10:15', '->clean() accepts an array as an input');
123 $t->is($v->clean(array('year' => '2005', 'month' => '10', 'day' => '15', 'hour' => '12', 'minute' => '10', 'second' => '15')), '2005-10-15 12:10:15', '->clean() accepts an array as an input');
124 $t->is($v->clean(array('year' => '', 'month' => '', 'day' => '', 'hour' => '', 'minute' => '', 'second' => '')), null, '->clean() accepts an array as an input');
125 $t->is($v->clean(array('year' => 2005, 'month' => 10, 'day' => 15, 'hour' => 12, 'minute' => 10, 'second' => '')), '2005-10-15 12:10:00', '->clean() accepts an array as an input');
DiscriminatorColumnLineParserTest.java (https://gitlab.com/essere.lab.public/qualitas.class-corpus) Java · 209 lines
1 package org.netbeans.modules.php.doctrine2.annotations.orm.parser;
3 import java.util.Map;
4 import org.netbeans.junit.NbTestCase;
5 import org.netbeans.modules.csl.api.OffsetRange;
6 import org.netbeans.modules.php.spi.annotation.AnnotationLineParser;
7 import org.netbeans.modules.php.spi.annotation.AnnotationParsedLine;
8 import org.netbeans.modules.php.spi.annotation.AnnotationParsedLine.ParsedLine;
10 /*
54 * @author Ondrej Brejla <obrejla@netbeans.org>
55 */
56 public class DiscriminatorColumnLineParserTest extends NbTestCase {
57 private ParameterizedAnnotationLineParser parser;
module.php (https://gitlab.com/mostafame/team_website) PHP · 471 lines
1 <?php
3 class DSLC_TP_Excerpt extends DSLC_Module {
134 ),
135 array(
136 'label' => __( 'Minimum Height', 'live-composer-page-builder' ),
137 'id' => 'css_min_height',
140 'refresh_on_change' => false,
141 'affect_on_change_el' => '.dslc-tp-excerpt',
142 'affect_on_change_rule' => 'min-height',
143 'section' => 'styling',
144 'ext' => 'px',
461 if ( $the_excerpt ) :
462 ?><div class="dslc-tp-excerpt"><?php echo $the_excerpt; ?></div><?php
463 endif;
MonitoredResourceDescriptor.php (https://gitlab.com/remyvianne/krowkaramel) PHP · 262 lines
1 <?php
2 # Generated by the protocol buffer compiler. DO NOT EDIT!
3 # source: google/api/monitored_resource.proto
45 * Optional. A concise name for the monitored resource type that might be
46 * displayed in user interfaces. It should be a Title Cased Noun Phrase,
47 * without any article or other determiners. For example,
48 * `"Google Cloud SQL Database"`.
49 *
87 * Optional. A concise name for the monitored resource type that might be
88 * displayed in user interfaces. It should be a Title Cased Noun Phrase,
89 * without any article or other determiners. For example,
90 * `"Google Cloud SQL Database"`.
91 * @type string $description
172 * Optional. A concise name for the monitored resource type that might be
173 * displayed in user interfaces. It should be a Title Cased Noun Phrase,
174 * without any article or other determiners. For example,
175 * `"Google Cloud SQL Database"`.
176 *
pageTranslations.php (https://gitlab.com/macitsimsek/fastsubtitle) PHP · 217 lines
1 <?php
3 return [
154 'lock' => 'Lock',
155 'click_for_search' => 'Click for Search',
156 'min' => 'Min',
157 'translators' => 'Translators',
158 'finish' => 'Finish',
184 'send_message' => 'Send Message',
185 'member' => 'Member',
186 'admin' => 'Admin',
187 'newTranslator' => 'New Translator',
188 'controllerMember' => 'Controller Member',
DeleteComment.php (https://gitlab.com/Blueprint-Marketing/wordpress-unit-tests) PHP · 355 lines
4 * Admin ajax functions to be tested
5 */
6 require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
8 /**
70 $_POST['_per_page'] = 100;
71 $_POST['_page'] = 1;
72 $_POST['_url'] = admin_url( 'edit-comments.php' );
74 // Make the request
222 $_POST['_per_page'] = 100;
223 $_POST['_page'] = 1;
224 $_POST['_url'] = admin_url( 'edit-comments.php' );
226 // Make the request
ext_reflection.h (https://gitlab.com/0072016/0072016-PHP.LLC) C Header · 282 lines
9 | that is bundled with this package in the file LICENSE, and is |
10 | available through the world-wide-web at the following url: |
11 | http://www.php.net/license/3_01.txt |
12 | If you did not receive a copy of the PHP license and are unable to |
22 #include "hphp/runtime/vm/native-data.h"
24 namespace HPHP {
25 ///////////////////////////////////////////////////////////////////////////////
27 Array HHVM_FUNCTION(hphp_get_extension_info, const String& name);
28 Variant HHVM_FUNCTION(hphp_invoke, const String& name, const Variant& params);
29 Variant HHVM_FUNCTION(hphp_invoke_method, const Variant& obj, const String& cls,
273 Class* get_cls(const Variant& class_or_object);
274 const Func* get_method_func(const Class* cls, const String& meth_name);
275 Variant default_arg_from_php_code(const Func::ParamInfo& fpi, const Func* func);
276 bool resolveDefaultParameterConstant(const char *value, int64_t valueLen,
277 Variant &cns);
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;
51 $this->resetAfterTest(true);
52 $this->setAdminUser();
54 $this->expectException('moodle_exception');
64 $this->resetAfterTest(true);
65 $this->setAdminUser();
67 $category = self::getDataGenerator()->create_category();
tour_filter.feature (https://github.com/markn86/moodle.git) Gherkin Specification · 229 lines
2 Feature: Apply tour filters to a tour
3 In order to give more directed tours
4 As an administrator
5 I need to create a user tour with filters applied
20 | teacher1 | C1 | teacher |
21 | student1 | C1 | student |
22 And I log in as "admin"
23 And I add a new user tour with:
24 | Name | First tour |
25 | Description | My first tour |
26 | Apply to URL match | /course/view.php% |
27 | Tour is enabled | 1 |
28 | Role | Student,Non-editing teacher |
ManagerController.php (https://github.com/ccaballero/yachay.git) PHP · 248 lines
1 <?php
3 class Teams_ManagerController extends Yachay_Controller_Action
55 }
56 if ($this->acl('subjects', array('new', 'import', 'export', 'lock', 'delete'))) {
57 $breadcrumb['Administrador de materias'] = $this->view->url(array(), 'subjects_manager');
58 }
59 if ($this->acl('subjects', 'view')) {
125 }
126 if ($this->acl('subjects', array('new', 'import', 'export', 'lock', 'delete'))) {
127 $breadcrumb['Administrador de materias'] = $this->view->url(array(), 'subjects_manager');
128 }
129 if ($this->acl('subjects', 'view')) {
241 $count = count($check);
243 $this->_helper->flashMessenger->addMessage("Se han eliminado $count equipos");
244 }
Statistics.php (https://github.com/frhumanes/PLM.git) PHP · 309 lines
1 <?php
3 /**
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 * @version $Id: Statistics.php 20096 2010-01-06 02:05:09Z bkarwin $
22 */
25 * @see Zend_Gdata_Extension
26 */
27 require_once 'Zend/Gdata/Extension.php';
29 /**
122 * child properties.
123 */
124 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
125 {
126 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
Collection.php (https://bitbucket.org/dnejedly/eaparts.git) PHP · 333 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_Catalog
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 */
58 /**
59 * Store strong mode flag that determine if needed for inner join or left join of linked products
60 *
61 * @var bool
IPL 3 Origins.md (https://github.com/forkwikiman/enha.git) Markdown · 2034 lines
student_profile.php (https://gitlab.com/varsha_evonix/intranet) PHP · 136 lines
1 <?php
3 include ('header.php');
23 <span class="profile-edit">Edit</span>
24 </a>
25 <img class="img-responsive img-profile" src="<?php echo base_url(); ?>assets/img/profile-full.jpg" alt="">
27 </div>
31 <ul class="list-inline">
32 <li><i class="fa fa-map-marker fa-muted"></i> Bayville, FL</li>
33 <li><i class="fa fa-user fa-muted"> </i> Administrator</li>
34 <li><i class="fa fa-group fa-muted"></i> Sales, Marketing, Management</li>
35 <li><i class="fa fa-trophy fa-muted"></i> Top Seller</li>
NestedTreeRootTest.php (https://github.com/easybib/DoctrineExtensions.git) PHP · 337 lines
1 <?php
3 namespace Gedmo\Tree;
11 * These are tests for Tree behavior
12 *
13 * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
14 * @package Gedmo.Tree
15 * @link http://www.gediminasm.org
16 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
17 */
18 class NestedTreeRootTest extends BaseTestCaseORM
38 $minutes = intval($took / 60); $seconds = $took % 60;
39 echo sprintf("%s --> %02d:%02d", $msg, $minutes, $seconds) . PHP_EOL;
40 };
41 $repo = $this->em->getRepository(self::CATEGORY);
TagController.php (https://github.com/tuteke/isaved.git) PHP · 282 lines
32 * @author Magento Core Team <core@magentocommerce.com>
33 */
34 class Mage_Adminhtml_Report_TagController extends Mage_Adminhtml_Controller_Action
35 {
36 public function _initAction()
140 {
141 $fileName = 'tag_popular.csv';
142 $content = $this->getLayout()->createBlock('adminhtml/report_tag_popular_grid')
143 ->getCsvFile();
208 {
209 $fileName = 'tag_product_detail.csv';
210 $content = $this->getLayout()->createBlock('adminhtml/report_tag_product_detail_grid')
211 ->getCsvFile();
nocache_multiple_element.ctp (https://bitbucket.org/AzuiSleet/cdr-web/) Unknown · 9 lines
lavaPages.php (https://github.com/volcanicpixels/Privacy-Plugin.git) PHP · 360 lines
71 * addPage function.
72 *
73 * This function adds an admin page
74 *
75 * @param mixed $slug
121 if( isset( $this->adminPages[ $slug ] ) )
122 {
123 $this->chain[ "current" ] = $this->adminPages[ $slug ];
124 }
125 return $this;
142 function adminPages( $filter = true )
143 {
144 $adminPages = $this->adminPages;
145 if( true == $filter and defined( 'WP_NETWORK_ADMIN') and WP_NETWORK_ADMIN == true )
154 }
155 }
156 return apply_filters( "admin_pages_order-".$this->_slug(), $adminPages );
157 }
mysqli_stmt_affected_rows.php (https://gitlab.com/iranjith4/hhvm) PHP · 231 lines
1 <?php
2 require_once("connect.inc");
151 /* use it like num_rows */
152 /* PS are unbuffered, num_rows cannot determine the row count before all rows have been fetched and/or buffered */
153 if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
154 printf("[031] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
226 print "done!";
227 ?>
228 <?php error_reporting(0); ?>
229 <?php
PrettyPrinterAbstract.php (https://gitlab.com/xolotsoft/pumasruiz) PHP · 262 lines
87 * Pretty prints an expression.
88 *
89 * @param PHPParser_Node_Expr $node Expression node
90 *
91 * @return string Pretty printed node
92 */
93 public function prettyPrintExpr(PHPParser_Node_Expr $node) {
94 return str_replace("\n" . $this->noIndentToken, "\n", $this->p($node));
95 }
168 }
170 protected function pInfixOp($type, PHPParser_Node $leftNode, $operatorString, PHPParser_Node $rightNode) {
171 list($precedence, $associativity) = $this->precedenceMap[$type];
Shipping.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 254 lines
1 <?php
2 /**
3 * Copyright © 2016 Magento. All rights reserved.
62 $this->_clearTableByDateRange($table, $from, $to, $subSelect);
63 // convert dates to current admin timezone
64 $periodExpr = $connection->getDatePartSql(
65 $this->getStoreTZOffsetQuery($sourceTable, 'created_at', $from, $to)
137 * @return $this
138 * @throws \Exception
139 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
140 */
141 protected function _aggregateByShippingCreatedAt($from, $to)
164 $this->_clearTableByDateRange($table, $from, $to, $subSelect);
165 // convert dates to current admin timezone
166 $periodExpr = $connection->getDatePartSql(
167 $this->getStoreTZOffsetQuery(
SnsClient.php (https://gitlab.com/juanito.abelo/nlmobile) PHP · 378 lines
ecommerce-orders-view.js (https://gitlab.com/worksmit/demo) JavaScript · 237 lines
28 "pageLength": 10, // default record count per page
29 "ajax": {
30 "url": "../demo/ecommerce_order_invoices.php", // ajax source
31 },
32 "order": [
92 "pageLength": 10, // default record count per page
93 "ajax": {
94 "url": "../demo/ecommerce_order_credit_memos.php", // ajax source
95 },
96 "columnDefs": [{ // define columns sorting options(by default all columns are sortable extept the first checkbox column)
126 "pageLength": 10, // default record count per page
127 "ajax": {
128 "url": "../demo/ecommerce_order_shipment.php", // ajax source
129 },
130 "columnDefs": [{ // define columns sorting options(by default all columns are sortable extept the first checkbox column)
EsmtpTransportTest.php (https://gitlab.com/techniconline/kmc) PHP · 297 lines
DictionaryLoader.php (https://github.com/gmimano/newd.git) PHP · 265 lines
1 <?php
2 /**
3 * Zend Framework
40 *
41 * It takes a string which is actually <segment_name>.tii index file data and
42 * returns two arrays - term and tremInfo lists.
43 *
44 * See Zend_Search_Lucene_Index_SegmintInfo class for details
51 {
52 $termDictionary = array();
53 $termInfos = array();
54 $pos = 0;
59 if ($tiVersion != (int)0xFFFFFFFE /* pre-2.1 format */ &&
60 $tiVersion != (int)0xFFFFFFFD /* 2.1+ format */) {
61 require_once 'Zend/Search/Lucene/Exception.php';
62 throw new Zend_Search_Lucene_Exception('Wrong TermInfoIndexFile file format');
class.swfshape.html (https://bitbucket.org/thncr/manuals.git) HTML · 251 lines
9 <div class="prev" style="text-align: left; float: left;"><a href="swfprebuiltclip.construct.html">SWFPrebuiltClip::__construct</a></div>
10 <div class="next" style="text-align: right; float: right;"><a href="swfshape.addfill.html">SWFShape::addFill</a></div>
11 <div class="up"><a href="book.ming.html">Ming</a></div>
12 <div class="home"><a href="index.html">PHP Manual</a></div>
247 <div class="prev" style="text-align: left; float: left;"><a href="swfprebuiltclip.construct.html">SWFPrebuiltClip::__construct</a></div>
248 <div class="next" style="text-align: right; float: right;"><a href="swfshape.addfill.html">SWFShape::addFill</a></div>
249 <div class="up"><a href="book.ming.html">Ming</a></div>
250 <div class="home"><a href="index.html">PHP Manual</a></div>
MassCancelTest.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 292 lines
1 <?php
2 /**
3 * Copyright © 2016 Magento. All rights reserved.
5 */
7 namespace Magento\Sales\Test\Unit\Controller\Adminhtml\Order;
9 use Magento\Framework\App\Action\Context;
12 /**
13 * Class MassCancelTest
14 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
15 */
16 class MassCancelTest extends \PHPUnit_Framework_TestCase
17 {
18 /**
19 * @var \Magento\Sales\Controller\Adminhtml\Order\MassCancel
20 */
21 protected $massAction;
Filesystem.php (https://gitlab.com/techniconline/kmc) PHP · 426 lines
1 <?php namespace Illuminate\Filesystem;
3 use ErrorException;
4 use FilesystemIterator;
5 use Symfony\Component\Finder\Finder;
6 use Illuminate\Support\Traits\Macroable;
7 use Illuminate\Contracts\Filesystem\FileNotFoundException;
14 /**
15 * Determine if a file exists.
16 *
17 * @param string $path
29 * @return string
30 *
31 * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
32 */
33 public function get($path)
PaginatedList.php (https://github.com/sminnee/silverstripe-framework.git) PHP · 420 lines
1 <?php
2 /**
3 * A decorator that wraps around a data list in order to provide pagination.
370 public function LastItem() {
371 if ($start = $this->getPageStart()) {
372 return min($start + $this->pageLength, $this->getTotalItems());
373 } else {
374 return min($this->pageLength, $this->getTotalItems());
article0004Test.php (https://github.com/dextercowley/joomla-cms.git) PHP · 196 lines
68 $this->waitForPageToLoad("30000");
69 $this->jPrint ("Check that first three articles are as expected\n");
70 $this->assertStringStartsWith('Administrator Components', $this->getTable("//form[@id='adminForm']//table.1.3"));
71 $this->assertStringStartsWith('Archive Module', $this->getTable("//form[@id='adminForm']//table.2.3"));
105 $this->jPrint ("Check that first three articles are as expected\n");
106 $this->assertStringStartsWith('Administrator Components', $this->getTable("//form[@id='adminForm']//table.1.3"));
107 $this->assertStringStartsWith('Archive Module', $this->getTable("//form[@id='adminForm']//table.2.3"));
110 $this->jPrint ("Test copying to same category\n");
111 $this->jPrint ("Select first article and copy to Components\n");
112 $this->assertStringStartsWith('Administrator Components', $this->getTable("//form[@id='adminForm']//table.1.3"));
113 $this->click("cb0");
114 $this->click("batch[move_copy]c");
119 $this->assertTrue($this->isElementPresent("//div[@id=\"system-message-container\"][contains(., 'success')]"));
120 $this->jPrint ("Check that new article is created with correct name and alias\n");
121 $this->assertStringStartsWith('Administrator Components', $this->getTable("//form[@id='adminForm']//table.2.3"));
122 $this->jPrint ("Trash and delete new article\n");
123 $this->click("cb1");
class-Shoestrap_Color.php (https://gitlab.com/aristath/shoestrap-3) PHP · 481 lines
1 <?php
132 $hex = self::sanitize_hex( $hex, false );
133 // Steps should be between -255 and 255. Negative = darker, positive = lighter
134 $steps = max( -255, min( 255, $steps ) );
136 // Get decimal values
141 // Adjust number of steps and keep it inside 0 to 255
142 $red = max( 0, min( 255, $red + $steps ) );
143 $green = max( 0, min( 255, $green + $steps ) );
220 $var_b = ( $b / 255 );
222 $var_min = min( $var_r, $var_g, $var_b);
223 $var_max = max( $var_r, $var_g, $var_b);
224 $del_max = $var_max - $var_min;
EmailTest.php (https://gitlab.com/crazybutterfly815/magento2) PHP · 258 lines
1 <?php
2 /**
3 * Copyright © 2016 Magento. All rights reserved.
5 */
7 namespace Magento\Sales\Test\Unit\Controller\Adminhtml\Invoice\AbstractInvoice;
9 use \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoice\Email;
15 * Class EmailTest
16 *
17 * @package Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoice
18 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
19 */
20 class EmailTest extends \PHPUnit_Framework_TestCase
21 {
22 /**
porteren.php (https://github.com/pjwiseman/joomla-cms.git) PHP · 449 lines
1 <?php
2 /**
3 * @package Joomla.Platform
5 *
6 * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
7 * @copyright Copyright (C) 2005 Richard Heyes (http://www.phpguru.org/). All rights reserved.
8 * @license GNU General Public License version 2 or later; see LICENSE
9 */
48 public function stem($token, $lang)
49 {
50 // Check if the token is long enough to merit stemming.
51 if (strlen($token) <= 2)
52 {
352 * @param string $check Ending to check for
353 * @param string $repl Replacement string
354 * @param integer $m Optional minimum number of m() to meet
355 *
356 * @return boolean Whether the $check string was at the end
BaseUserService.php (https://github.com/kervin/kyzstudio.git) PHP · 399 lines
1 <?php
2 /**
3 * Zend Framework
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: BaseUserService.php 20166 2010-01-09 19:00:17Z bkarwin $
21 */
24 * @see Zend_Service_DeveloperGarden_Client_ClientAbstract
25 */
26 #require_once 'Zend/Service/DeveloperGarden/Client/ClientAbstract.php';
28 /**
29 * @see Zend_Service_DeveloperGarden_Response_BaseUserService_GetQuotaInformationResponse
30 */
31 #require_once 'Zend/Service/DeveloperGarden/Response/BaseUserService/GetQuotaInformationResponse.php';
33 /**
Statistics.php (https://bitbucket.org/Dal-Papa/is-340-publish-base.git) PHP · 309 lines
1 <?php
3 /**
19 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 * @version $Id: Statistics.php 24593 2012-01-05 20:35:02Z matthew $
22 */
25 * @see Zend_Gdata_Extension
26 */
27 require_once 'Zend/Gdata/Extension.php';
29 /**
122 * child properties.
123 */
124 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
125 {
126 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
Admin.php (https://github.com/intraweb-modules13/IWstats.git) PHP · 225 lines
127 $recordsArray[substr($record['datetime'], 0, 10)]['skipped'] = ($record['skipped'] == 1) ? 1 : 0;
128 $recordsArray[substr($record['datetime'], 0, 10)]['skippedModule'] = ($record['skippedModule'] == 1) ? 1 : 0;
129 $recordsArray[substr($record['datetime'], 0, 10)]['isadmin'] = ($record['isadmin'] == 1) ? 1 : 0;
130 }
131 }
163 'skipped' => $record['skipped'],
164 'skippedModule' => $record['skippedModule'],
165 'isadmin' => $record['isadmin'],
166 'users' => $users,
167 'nips' => count($record['ips']),
205 /**
206 * get available admin panel links
207 *
208 * @author Mark West
length_class.php (https://bitbucket.org/allanxyh/uniquemall.git) PHP · 412 lines
1 <?php
2 class ControllerLocalisationLengthClass extends Controller {
3 private $error = array();
166 'sort' => $sort,
167 'order' => $order,
168 'start' => ($page - 1) * $this->config->get('config_admin_limit'),
169 'limit' => $this->config->get('config_admin_limit')
247 $pagination->total = $length_class_total;
248 $pagination->page = $page;
249 $pagination->limit = $this->config->get('config_admin_limit');
250 $pagination->text = $this->language->get('text_pagination');
251 $pagination->url = $this->url->link('localisation/length_class', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
Token.java
(https://jedit.svn.sourceforge.net/svnroot/jedit)
Java · 84 lines
✨ Summary
This Java class represents a token in a parser, containing information such as its kind, position, and string image. It also has references to other tokens, including special tokens that occur before regular tokens. The class provides methods for accessing and manipulating this information, allowing it to be used in a parser’s lexical actions.
This Java class represents a token in a parser, containing information such as its kind, position, and string image. It also has references to other tokens, including special tokens that occur before regular tokens. The class provides methods for accessing and manipulating this information, allowing it to be used in a parser’s lexical actions.
1 /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
2 package gatchan.phpparser.parser;
4 /**
10 /**
11 * An integer that describes the kind of this token. This numbering
12 * system is determined by JavaCCParser, and a table of these numbers is
13 * stored in the file ...Constants.java.
14 */
ZipEntryTest.cs (https://bitbucket.org/jens13/cleanzip.git) C# · 193 lines
PathMacrosImpl.java (https://bitbucket.org/nbargnesi/idea.git) Java · 366 lines
24 import com.intellij.openapi.util.InvalidDataException;
25 import com.intellij.openapi.util.NamedJDOMExternalizable;
26 import com.intellij.openapi.util.RoamingTypeDisabled;
27 import com.intellij.openapi.util.WriteExternalException;
28 import com.intellij.openapi.util.io.FileUtil;
42 * @author dsl
43 */
44 public class PathMacrosImpl extends PathMacros implements ApplicationComponent, NamedJDOMExternalizable, RoamingTypeDisabled {
45 private static final Logger LOG = Logger.getInstance("#com.intellij.application.options.PathMacrosImpl");
46 private final Map<String, String> myLegacyMacros = new HashMap<String, String>();
114 "ModuleSdkPath",
115 "OutputPath",
116 "PhpExecutable",
117 "ProjectFileDir",
118 "ProjectFilePath",
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>
XModeHandler.java
(https://jedit.svn.sourceforge.net/svnroot/jedit)
Java · 767 lines
✨ Summary
This Java code defines a class TagDecl
that represents a tag declaration in an XML parser. It stores information about the tag, such as its name, start and end positions, and attributes like default IDs and token IDs. The class also tracks various flags indicating whether certain conditions are met during parsing.
This Java code defines a class TagDecl
that represents a tag declaration in an XML parser. It stores information about the tag, such as its name, start and end positions, and attributes like default IDs and token IDs. The class also tracks various flags indicating whether certain conditions are met during parsing.
160 }
161 } //}}}
162 //{{{ TERMINATE
163 else if (tag.tagName.equals("TERMINATE"))
164 {
165 rules.setTerminateChar(tag.termChar);
166 } //}}}
167 //{{{ SEQ
465 /**
466 * A list of modes to be reloaded at the end, loaded through DELEGATEs
467 * @see http://sourceforge.net/tracker/index.php?func=detail&aid=1742250&group_id=588&atid=100588
468 */
469 private Vector<Mode> reloadModes;
Preview_Javadoc_of_Buffer.bsh (https://jedit.svn.sourceforge.net/svnroot/jedit) Unknown · 609 lines
9 * - Includes the ability to use the Bouvard Doclet.
10 * Visit
11 * http://community.jedit.org/modules.php?
12 * op=modload&name=web_links&file=index&req=viewlink&cid=6
13 * for the Bouvard link
86 }
88 String _determinePackageName()
89 {
90 packageName = "";
233 /* Store Some class/package/path info for use later */
234 // Get the Package name
235 String packName = _determinePackageName();
237 // Get the Class Name
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
221 ro9bxHd0FyNjt2IaVviwJFnmUZ74cBr5Rhn5COdCnEtqntEewgrllVx4tVSi8A2NHBVhJPNJv+TO
222 sudg8zePnNWUiXNiEKU7PsL2l8zLjt29e2zPd7gl1p7ZR1hL4FCqE35qsSNLhH0XzoFzgROq+OHQ
223 nGvAEVVNtlPhTOo4vgQORciqNWV1ueKoG7h6NrK/mxmINYiuJSQr9bXWaIuaE7ZG6Vcr7PiAdHRI
224 VmU4O6U/OyMkQNYQ11hYkHEmm5nzSJp2SB5ZuXFNA5nAvkduSmStijtMWhipDv1zz5yVxGWZAeOK
225 KgOR0FSMjyjs3LiGcK2p6G6UarCdtME1DZYIDp0bgwtLqTFBmZoEvHPoxDhy4cCr1FSlKuto0nSR
262 T4tSOxOpqqOnevsAvJwjn8M4TjOf4Pwfg3A/RNScTirEIW607T6IOE4ieGxB3okR4Q808uYy8nfn
263 zGsl4V55gG+IsLMdX7FAXq745jzxgRiHKG+Kcm0p/MhYc3M6d6JncuNk+uwQ4qebDlOpLs6o7QFR
264 Z2EjV2dlNay5rxOTJwarphpXIZvSDT1y+ybTlUOOvv09oDq283CALdYV700TW9vxSdkxW2alwtaF
265 Dc5PhTX/2Aa2+ZTvCdCtebVbsO+ZL6RMCZF/s+i4s+j5QYQuFWLJf6PJWRlnwvkW3VuxXHbkxRrW
266 E2F7Ua9jCOTYkYe6C0JjoFusWHRdk2smbmYDCSxjxZ77YuzMWMTInb7nqlQMus/VEPoaMKtyzYRy
UnaryExpression.java
(https://jedit.svn.sourceforge.net/svnroot/jedit)
Java · 73 lines
✨ Summary
This Java class represents a unary expression in an abstract syntax tree (AST) for PHP programming language. It extends another class OperatorExpression
and contains an instance of Expression
. The class provides methods to get variables used, modified, and outside the expression, as well as analyze code with a given parser.
This Java class represents a unary expression in an abstract syntax tree (AST) for PHP programming language. It extends another class OperatorExpression
and contains an instance of Expression
. The class provides methods to get variables used, modified, and outside the expression, as well as analyze code with a given parser.
PostfixedUnaryExpression.java
(https://jedit.svn.sourceforge.net/svnroot/jedit)
Java · 21 lines
✨ Summary
This Java class represents a postfix unary expression in an abstract syntax tree (AST). It extends the UnaryExpression
class and adds a specific implementation for postfix unary expressions. The class has a constructor that initializes its fields, including the operator, source end position, line number, and column number. The toStringExpression()
method returns a string representation of the expression by concatenating the original expression’s string with the operator’s string.
This Java class represents a postfix unary expression in an abstract syntax tree (AST). It extends the UnaryExpression
class and adds a specific implementation for postfix unary expressions. The class has a constructor that initializes its fields, including the operator, source end position, line number, and column number. The toStringExpression()
method returns a string representation of the expression by concatenating the original expression’s string with the operator’s string.
PHPDocument.java
(https://jedit.svn.sourceforge.net/svnroot/jedit)
Java · 231 lines
✨ Summary
This Java class represents a PHP document, which is an outlineable object containing HTML and PHP nodes. It provides methods to analyze code, get statements at specific positions, and manage its structure, including adding and retrieving children (e.g., classes, methods). The class also implements the IAsset
interface and has properties for its name, start and end positions, and nodes.
This Java class represents a PHP document, which is an outlineable object containing HTML and PHP nodes. It provides methods to analyze code, get statements at specific positions, and manage its structure, including adding and retrieving children (e.g., classes, methods). The class also implements the IAsset
interface and has properties for its name, start and end positions, and nodes.
7 import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren;
8 import gatchan.phpparser.project.itemfinder.PHPItem;
9 import gatchan.phpparser.parser.PHPParser;
15 /**
16 * It's a php document. This class is an outlineable object It will contains html and php
17 *
18 * @author Matthieu Casanova
109 * Analyze the code of a php document.
110 *
111 * @param phpParser the php parser
112 */
113 public void analyzeCode(PHPParser phpParser) {
155 for (int i = 0; i < children.size(); i++) {
156 Outlineable outlineable = (Outlineable) children.get(i);
157 if (outlineable.getItemType() == PHPItem.METHOD) {
158 MethodDeclaration methodDeclaration = (MethodDeclaration) outlineable;
159 if (line == methodDeclaration.getBodyLineStart() && column > methodDeclaration.getBodyColumnStart()) return methodDeclaration;
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.
RestDataConnectionProvider.php
(http://forceworkbench.googlecode.com/svn/trunk/workbench/)
PHP · 24 lines
✨ Summary
This PHP code defines a class RestDataConnectionProvider
that extends an abstract connection provider. It establishes a REST API connection using the RestApiClient
class, setting various configuration options such as compression, user agent, logging, and proxy settings based on environment variables and configuration files. The endpoint type is set to “Soap/u”.
This PHP code defines a class RestDataConnectionProvider
that extends an abstract connection provider. It establishes a REST API connection using the RestApiClient
class, setting various configuration options such as compression, user agent, logging, and proxy settings based on environment variables and configuration files. The endpoint type is set to “Soap/u”.
CHANGES.txt (https://jedit.svn.sourceforge.net/svnroot/jedit) Plain Text · 2185 lines
31 - Updated BibTeX and LaTeX syntax highlighting (Thomas Alspaugh).
33 - PHP mode now recognizes <script language="PHP">...</script>.
35 - Updated Omnimark syntax highlighting (Lionel Fiol).
95 dialog box, as intended.
97 - Minor fix to VHDL syntax highlighting.
99 - Kill ring was not being loaded properly; the text entries were loaded
264 - Includes new "Create Get/Set Methods" macro (Thomas Galvin).
266 - Minor improvements to "Deep Indent" feature (Brad Mace).
268 - "Reload All Buffers" command now only asks for confirmation if there
WinZipAesException.cs (https://bitbucket.org/jens13/cleanzip.git) C# · 22 lines
news.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 240 lines
31 <title> Preface </title>
33 <para> jEdit is a very mature text editor, and has gone through a very interesting phase of development. Left in a "prerelease" stage for about two years, it's had a long time to solifidy. Many of the original developers, including Slava Pestov, have stopped working directly on jEdit. Fortunately, because of the wonderful nature of open source, there are more and more eyeballs on this code than ever! We have received contributions of plugins, bugfixes, refactoring, and enhancements from around the globe, and our host, sourceforge.net <ulink url = "http://sourceforge.net/project/stats/detail.php?group_id=588&ugn=jedit&type=prdownload&mode=year&package_id=0" >reports</ulink> that there are on average at least a half-million downloads per year, and this has been true for the entire millenium.
34 </para>
99 <title> Regular Expressions </title>
101 <para> Most of the core code has been rewritten to use <literal>java.util.regex</literal> instead of <literal>gnu.regexp</literal>, so be sure to keep that in mind as you are composing your own regular expressions, whether they are in mode files, search expressions, or in your own plugins. </para>
103 </section>
190 <bridgehead>SideKicks and Language Plugins </bridgehead>
191 <para> SideKick has been debugged and the documentation has been improved. Further, there is a new combobox that lets you choose your parser, and a new SplitPane to show you the contents of the hovered element. The combobox is especially important since there are multiple parsers that can be used on a given file, especially when you are working with Python, PHP, HTML, XML, or JavaScript files. </para>
193 <para> Many language-specific plugins have been redesigned to use the new and improved SideKick. In particular, JPyDebug, JythonInterpreter, RubyPlugin, PHPParser, JavaSideKick, XML, and PerlSideKick. Be sure to try them out.
ChunkCache.java
(https://jedit.svn.sourceforge.net/svnroot/jedit)
Java · 919 lines
✨ Summary
This Java code appears to be part of a text editor’s line management system, responsible for calculating and storing information about each line in a document. It handles soft wrapping (line breaks) and hard wrapping (physical line changes), updating line data accordingly. The code provides methods for retrieving line information, checking if a full repaint is needed, and handling backwards compatibility with older versions of the text editor.
This Java code appears to be part of a text editor’s line management system, responsible for calculating and storing information about each line in a document. It handles soft wrapping (line breaks) and hard wrapping (physical line changes), updating line data accordingly. The code provides methods for retrieving line information, checking if a full repaint is needed, and handling backwards compatibility with older versions of the text editor.
catalog (https://jedit.svn.sourceforge.net/svnroot/jedit) Unknown · 546 lines
jsonRpc10.php
(http://enginey.googlecode.com/svn/trunk/)
PHP · 48 lines
✨ Summary
This PHP script processes a JSON-RPC request from a client, determines the requested method and its parameters, and returns a response in JSON format. If the requested method is found, it returns the parameter as the result; otherwise, it returns an error message indicating that the method was not found. The response includes an ID matching the original request’s ID.
This PHP script processes a JSON-RPC request from a client, determines the requested method and its parameters, and returns a response in JSON format. If the requested method is found, it returns the parameter as the result; otherwise, it returns an error message indicating that the method was not found. The response includes an ID matching the original request’s ID.
1 <?php
2 require_once("./JSON.php");
6 // Commenting out.the require and the new File() call.
8 // NOTE: File.php is installed via Pear using:
9 // %> sudo pear install File
10 // Your server will also need the Pear library directory included in PHP's
11 // include_path configuration directive
12 // require_once('File.php');
14 // ensure that we don't try to send "html" down to the client
21 $results['error'] = null;
23 $jsonRequest = file_get_contents('php://input');
24 //$jsonRequest = '{"params":["Blah"],"method":"myecho","id":86}';
posts.php (https://bitbucket.org/simplemediacode/bptrunk.git) PHP · 195 lines
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
default.po (https://bitbucket.org/floresj/notetime.git) Portable Object · 26 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">
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.
ignore_parameter_runme.php
(https://swig.svn.sourceforge.net/svnroot/swig)
PHP · 40 lines
✨ Summary
This PHP script tests a set of functions and classes for various sports cars, including Jaguar, Lotus, Tvr, Ferrari, Sportscars, Minicooper, Morrisminor, Fordanglia, Austinallegro. It checks if the functions return expected values and if the classes are correctly instantiated with the correct parameters. The test passes if all assertions are true, otherwise it fails.
This PHP script tests a set of functions and classes for various sports cars, including Jaguar, Lotus, Tvr, Ferrari, Sportscars, Minicooper, Morrisminor, Fordanglia, Austinallegro. It checks if the functions return expected values and if the classes are correctly instantiated with the correct parameters. The test passes if all assertions are true, otherwise it fails.
1 <?php
2 // Sample test file
4 require "tests.php";
5 require "ignore_parameter.php";
8 check::functions(array(jaguar,lotus,tvr,ferrari));
9 // No new classes
10 check::classes(array(sportscars,minicooper,morrisminor,fordanglia,austinallegro));
11 // now new vars
12 check::globals(array());
24 check::equal($sc->lamborghini(),101,'$sc->lamborghini(2)==101');
26 $mc=new minicooper(2,3.4);
27 check::classname("minicooper",$mc);
users-guide.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 711 lines
106 <para>Hunspell is the spell-checker bundled with OpenOffice.org (as of 2.0.2)
107 and Mozilla firefox (as of 3.0).
108 The java interface is from <ulink url="http://dion.swamp.dk/hunspell.html">Flemming Frandsen</ulink>.
109 </para>
110 <para>The interactions with Hunspell are done via native calls: some string-copying
194 <glossdef>
195 <para>Depending on your distribution, <code>Aspell</code> can be already present.
196 You can check this by typing <code>aspell -v</code> in a terminal console.
197 If you see something like <code>@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.5)</code>,
198 it's OK.
517 <glossdef>
518 <para>Leaves this and all later occurences of the word in the <code>Not in Dictionary</code>
519 text field unchanged. A reminder (wearing sunglasses) will appear.</para>
520 <para>To clear the list of ignored words, go to the menu
521 <guimenu>Plugins</guimenu>><guimenuitem>Spell Check</guimenuitem>><guimenuitem>Clear ignored words</guimenuitem>.
gfortran.vim (https://bitbucket.org/ultra_iter/vim-qt.git) Vim Script · 27 lines
sidebar.php
(https://bitbucket.org/jesseterry/myclientbase/)
PHP · 14 lines
✨ Summary
This PHP code outputs a section of HTML content that displays a title and a list of links. The title is “system” in black, and the links are to various settings pages within an application, including system settings, user accounts, tax rates, invoice statuses, and modules. Each link is generated using the anchor
function and includes a translated label from a language file.
This PHP code outputs a section of HTML content that displays a title and a list of links. The title is “system” in black, and the links are to various settings pages within an application, including system settings, user accounts, tax rates, invoice statuses, and modules. Each link is generated using the anchor
function and includes a translated label from a language file.
1 <div class="section_wrapper">
3 <h3 class="title_black"><?php echo $this->lang->line('system'); ?></h3>
5 <ul class="quicklinks content toggle">
6 <li><?php echo anchor('settings', $this->lang->line('system_settings')); ?></li>
7 <li><?php echo anchor('users', $this->lang->line('user_accounts')); ?></li>
8 <li><?php echo anchor('tax_rates', $this->lang->line('tax_rates')); ?></li>
9 <li><?php echo anchor('invoice_statuses', $this->lang->line('invoice_statuses')); ?></li>
10 <li><?php echo anchor('invoices/invoice_groups', $this->lang->line('invoice_groups')); ?></li>
11 <li class="last"><?php echo anchor('mcb_modules', $this->lang->line('modules')); ?></li>
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
.
SimpleKeyCacheInputStream.php (http://2moons.googlecode.com/svn/trunk/) PHP · 130 lines
test.clj
(git://github.com/richhickey/clojure-clr.git)
Clojure · 39 lines
✨ Summary
This Clojure code defines several test functions to verify the behavior of various language features, including boolean tests, type tagging, and performance optimization techniques like time
and reduce
. The tests cover different scenarios, such as generating boolean tests with known and unknown types, checking performance optimizations, and testing basic language features.
This Clojure code defines several test functions to verify the behavior of various language features, including boolean tests, type tagging, and performance optimization techniques like time
and reduce
. The tests cover different scenarios, such as generating boolean tests with known and unknown types, checking performance optimizations, and testing basic language features.
1 ; Copyright (c) David Miller. All rights reserved.
2 ; The use and distribution terms for this software are covered by the
3 ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4 ; which can be found in the file epl-v10.html at the root of this distribution.
5 ; By using this software in any fashion, you are agreeing to be bound by
en-GB.plg_finder_weblinks.ini (https://bitbucket.org/kraymitchell/fcd.git) Unknown · 11 lines
Exception.php
(http://typecho.googlecode.com/svn/trunk/)
PHP · 20 lines
✨ Summary
This PHP code defines a custom exception class Typecho_Http_Client_Exception
that extends Typecho’s built-in Exception
class. It is part of the Typecho blog platform and provides a specific error handling mechanism for HTTP client-related issues, allowing for more targeted error messages and behavior in the application.
This PHP code defines a custom exception class Typecho_Http_Client_Exception
that extends Typecho’s built-in Exception
class. It is part of the Typecho blog platform and provides a specific error handling mechanism for HTTP client-related issues, allowing for more targeted error messages and behavior in the application.
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
dhd_common.c
(http://omnia2droid.googlecode.com/svn/trunk/)
C · 1733 lines
✨ Summary
This C code snippet appears to be part of a wireless networking driver, specifically related to Wi-Fi scanning and management. It provides functions for requesting Wi-Fi scans, deleting BSS (Basic Service Set) entries, and retrieving partial scan results. The code also handles various error conditions and manages internal data structures, such as the iscan_chain
buffer.
This C code snippet appears to be part of a wireless networking driver, specifically related to Wi-Fi scanning and management. It provides functions for requesting Wi-Fi scans, deleting BSS (Basic Service Set) entries, and retrieving partial scan results. The code also handles various error conditions and manages internal data structures, such as the iscan_chain
buffer.
7 * agreement governing use of this software, this software is licensed to you
8 * under the terms of the GNU General Public License version 2 (the "GPL"),
9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10 * following added to such license:
11 *
129 /* Init global variables at run-time, not as part of the declaration.
130 * This is required to support init/de-init of the driver. Initialization
131 * of globals as part of the declaration results in non-deterministic
132 * behaviour since the value of the globals may be different on the
133 * first time that the driver is initialized vs subsequent initializations.
343 }
345 /* Determine precedence from which to evict packet, if any */
346 if (pktq_pfull(q, prec))
347 eprec = prec;
nsIScriptGlobalObject.h
(git://github.com/zpao/v8monkey.git)
C Header · 172 lines
✨ Summary
This C++ header file defines a class nsIScriptGlobalObject
that represents a global object for scripting languages, such as JavaScript. It provides methods for managing script contexts, handling errors, and enabling/disabling scripts. The class is designed to be used in a web browser context, likely Mozilla Firefox or its derivatives.
This C++ header file defines a class nsIScriptGlobalObject
that represents a global object for scripting languages, such as JavaScript. It provides methods for managing script contexts, handling errors, and enabling/disabling scripts. The class is designed to be used in a web browser context, likely Mozilla Firefox or its derivatives.
42 #include "nsISupports.h"
43 #include "nsEvent.h"
44 #include "nsIProgrammingLanguage.h"
46 class nsIScriptContext;
58 // language's nsIScriptContext in an array indexed by the language ID.
60 // Implementation note: We always ignore nsIProgrammingLanguage::UNKNOWN and
61 // nsIProgrammingLanguage::CPLUSPLUS - this gives javascript slot 0. An
62 // attempted micro-optimization tried to avoid us going all the way to
63 // nsIProgrammingLanguage::MAX; however:
64 // * Someone is reportedly working on a PHP impl - that has value 9
66 // So there is no good reason for us to be more restrictive again...
68 #define NS_STID_FIRST nsIProgrammingLanguage::JAVASCRIPT
69 // like nsGenericElement, only 4 bits worth is valid...
70 #define NS_STID_LAST (nsIProgrammingLanguage::MAX > 0x000FU ? \
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.
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>
31 The essence of a key-value store is the ability to store some data, called <i>value</i>, inside a key. This data can later be retrieved only if we know the exact key used to store it. There is no way to search something by value. So for example I can use the command SET to store the value <b>bar</b> at key <b>foo</b>:<br/><br/><pre class="codeblock python" name="code">
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">