100+ results for 'php substr'

Not the results you expected?

Translator.php (https://github.com/Faianca/symfony.git) PHP · 212 lines

1 <?php

2

3 /*

205

206 if (strlen($locale) > 3) {

207 array_unshift($locales, substr($locale, 0, -strlen(strrchr($locale, '_'))));

208 }

209

File.php (https://github.com/robertleeplummerjr/bluebox.git) PHP · 245 lines

1 <?php defined('SYSPATH') OR die('No direct access allowed.');

2 /**

3 * File-based Cache driver.

4 *

5 * $Id: File.php 3769 2008-12-15 00:48:56Z zombor $

6 *

7 * @package Cache

8 * @author Kohana Team

9 * @copyright (c) 2007-2008 Kohana Team

10 * @license http://kohanaphp.com/license.html

11 */

12 class Cache_File_Driver implements Cache_Driver {

124 {

125 // Get the id from the filename

126 $array[] = substr(current(explode('~', $file)), $offset);

127 }

128

commands.php (https://github.com/lxcenter/hypervm.git) PHP · 222 lines

1 <?php

2 /*

3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net

20 * == END LICENSE ==

21 *

22 * This is the File Manager Connector for PHP.

23 */

24

173

174 // Get the extension.

175 $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;

176 $sExtension = strtolower( $sExtension ) ;

177

HttpChannel.cs (https://github.com/iainlane/mono.git) C# · 238 lines

159 return url;

160

161 objectURI = url.Substring (slash);

162

163 return url.Substring (0, slash);

ini.php (https://github.com/bolis97/joomla-cms.git) PHP · 216 lines

1 <?php

2 /**

3 * @package Joomla.Platform

116 // If we are processing sections and the line is a section add the object and continue.

117 if (($line[0] == '[') && ($line[$length-1] == ']')) {

118 $section = substr($line, 1, $length-2);

119 $obj->$section = new stdClass;

120 continue;

143 if ($length && ($value[0] == '"') && ($value[$length-1] == '"')) {

144 // Strip the quotes and Convert the new line characters.

145 $value = stripcslashes(substr($value, 1, ($length-2)));

146 $value = str_replace('\n', "\n", $value);

147 } else {

FsExplorer.class.php (https://github.com/midnightskinhead/tubepress.git) PHP · 297 lines

1 <?php

2 /**

3 * Copyright 2006 - 2011 Eric D. Hough (http://ehough.com)

20 */

21

22 class_exists('org_tubepress_impl_classloader_ClassLoader') || require dirname(__FILE__) . '/../classloader/ClassLoader.class.php';

23 org_tubepress_impl_classloader_ClassLoader::loadClasses(array(

24 'org_tubepress_api_filesystem_Explorer',

293 private static function _spaces($level)

294 {

295 return substr(' ', 0, 3 * $level);

296 }

297 }

smarty_internal_config.php (https://github.com/9px/BookShare.git) PHP · 302 lines

1 <?php

2 /**

3 * Smarty Internal Plugin Config

108 // if use_sub_dirs, break file into directories

109 if ($this->smarty->use_sub_dirs) {

110 $_filepath = substr($_filepath, 0, 2) . DS

111 . substr($_filepath, 2, 2) . DS

112 . substr($_filepath, 4, 2) . DS

113 . $_filepath;

114 }

118 }

119 $_compile_dir = $this->smarty->getCompileDir();

120 return $_compile_dir . $_filepath . '.' . basename($this->source->name) . '.config' . '.php';

121 }

122

url_tools.php (https://github.com/kamarulismail/kamarul-playground.git) PHP · 173 lines

1 <?php

2 /**

3 * File containing the ezcUrlTools class.

14 *

15 * Static methods contained in this class:

16 * - parseQueryString() - It implements the functionality of the PHP function

17 * parse_str(), but without converting dots to underscores in parameter names.

18 * - getCurrentUrl() - Returns the current URL as a string from the provided

27 * Parses the provided string and returns an associative array structure.

28 *

29 * It implements the functionality of the PHP function parse_str(), but

30 * without converting dots to underscores in parameter names.

31 *

75 }

76

77 if ( substr_count( $parts[0], '[' ) === 0 )

78 {

79 $key = $parts[0];

position.php (https://github.com/lucanos/scuttle.git) PHP · 173 lines

1 <?php

2 /**

3 * Locate a byte index given a UTF-8 character index

4 * @version $Id: position.php,v 1.1 2006/10/01 00:01:31 harryf Exp $

5 * @package utf8

6 * @subpackage position

12 * terms of the UTF-8 character position, returns the byte

13 * index of that character. Can be useful when you want to

14 * PHP's native string functions but we warned, locating

15 * the byte can be expensive

16 * Takes variable number of parameters - first must be

44

45 // $c -> character offset into $str

46 $c = strlen(utf8_decode(substr($str,0,$i)));

47

48 // deal with arguments from lowest to highest

FileCellDelegate.java (https://github.com/jehc/MondocosmOS.git) Java · 168 lines

10 * License, Version 2 (the "License"); you may not use this file

11 * except in compliance with the License. A copy of the License is

12 * available at http://www.opensource.org/licenses/gpl-license.php.

13 *

14 * Sun designates this particular file as subject to the "Classpath"

62 String filePath = this.getFile().getAbsolutePath();

63 int index = filePath.indexOf(WFS.CELL_FILE_SUFFIX);

64 String path = filePath.substring(0, index) + WFS.CELL_DIRECTORY_SUFFIX;

65 File newFile = new File(path);

66 return new FileDirectoryDelegate(newFile);

SharedKeyLite.php (https://github.com/ftaiolivista/Zend-Framework-Namespaced-.git) PHP · 173 lines

1 <?php

2 /**

3 * Zend Framework

17 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)

18 * @license http://framework.zend.com/license/new-bsd New BSD License

19 * @version $Id: SharedKeyLite.php 22773 2010-08-03 07:18:27Z maartenba $

20 */

21

30 * @see Zend_Service_WindowsAzure_Credentials_CredentialsAbstract

31 */

32 require_once 'Zend/Service/WindowsAzure/Credentials/CredentialsAbstract.php';

33

34 /**

35 * @see Zend_Service_WindowsAzure_Storage

36 */

37 require_once 'Zend/Service/WindowsAzure/Storage.php';

38

39 /**

DiConfigFilesTest.php (https://gitlab.com/axeltizon/magento-demopoweraccess) PHP · 155 lines

1 <?php

2 /**

3 * Copyright © 2016 Magento. All rights reserved.

8 use Magento\Framework\App\Filesystem\DirectoryList;

9

10 class DiConfigFilesTest extends \PHPUnit_Framework_TestCase

11 {

12 /**

97 $output = [];

98 foreach ($common as $path => $content) {

99 $output[] = [substr($path, strlen(BP)), $content];

100 }

101

HIncludeFragmentRenderer.php (https://gitlab.com/mdabutaleb/bitm-laravel-1) PHP · 160 lines

1 <?php

2

3 /*

89

90 // we need to sign the absolute URI, but want to return the path only.

91 $uri = substr($this->signer->sign($this->generateFragmentUri($uri, $request, true)), strlen($request->getSchemeAndHttpHost()));

92 }

93

Chain.php (https://gitlab.com/rsilveira1987/Expresso) PHP · 169 lines

1 <?php

2 /**

3 * Zend Framework

17 * @subpackage Router

18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)

19 * @version $Id: Chain.php 10020 2009-08-18 14:34:09Z j.fischer@metaways.de $

20 * @license http://framework.zend.com/license/new-bsd New BSD License

21 */

22

23 /** Zend_Controller_Router_Route_Abstract */

24 require_once 'Zend/Controller/Router/Route/Abstract.php';

25

26 /**

79 foreach ($this->_routes as $key => $route) {

80 if ($key > 0 && $matchedPath !== null) {

81 $separator = substr($subPath, 0, strlen($this->_separators[$key]));

82

83 if ($separator !== $this->_separators[$key]) {

InstanceTest.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 139 lines

1 <?php

2 /**

3 * Copyright © 2016 Magento. All rights reserved.

6 namespace Magento\Widget\Model\Widget;

7

8 class InstanceTest extends \PHPUnit_Framework_TestCase

9 {

10 /**

128 $this->assertContains('<body><referenceContainer name="content">', $result);

129 $this->assertContains('<block class="' . $model->getType() . '"', $result);

130 $this->assertEquals(count($params), substr_count($result, '<action method="setData">'));

131 $this->assertContains('<argument name="name" xsi:type="string">display_mode</argument>', $result);

132 $this->assertContains('<argument name="value" xsi:type="string">fixed</argument>', $result);

Math.php (https://bitbucket.org/blackriver/openx.git) PHP · 154 lines

1 <?php

2 /**

3 * Zend Framework

17 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)

18 * @license http://framework.zend.com/license/new-bsd New BSD License

19 * @version $Id: Math.php 8672 2008-03-07 21:20:42Z thomas $

20 */

21

23 /**

24 * Utility class for proxying math function to bcmath functions, if present,

25 * otherwise to PHP builtin math operators, with limited detection of overflow conditions.

26 * Sampling of PHP environments and platforms suggests that at least 80% to 90% support bcmath.

151 if ((defined('TESTS_ZEND_LOCALE_BCMATH_ENABLED') && !TESTS_ZEND_LOCALE_BCMATH_ENABLED)

152 || !extension_loaded('bcmath')) {

153 require_once 'Zend/Locale/Math/PhpMath.php';

154 }

155

NutshellApi.php (https://github.com/Doap/nutshell-api-php.git) PHP · 195 lines

1 <?php

2

3 /**

23 * Requires PHP 5.0+ and the CURL and JSON modules.

24 * CURL: http://php.net/manual/en/book.curl.php

25 * JSON Module: http://pecl.php.net/package/json

160 */

161 protected function _generateRequestId() {

162 return substr(md5(rand()), 0, 8);

163 }

164

166 * Encodes object in JSON

167 *

168 * Can be overridden to support PHP installations without built-in JSON support.

169 */

170 protected function json_encode($x) {

Nlm30CitationSchemaCitationAdapter.inc.php (https://github.com/davekisly/pkp-lib.git) PHP · 164 lines

1 <?php

2

3 /**

4 * @file plugins/metadata/nlm30/filter/Nlm30CitationSchemaCitationAdapter.inc.php

5 *

6 * Copyright (c) 2000-2011 John Willinsky

116 if ($dataObject->hasData($fieldName)) {

117 // Remove the name space prefix

118 $propertyName = substr($fieldName, $namespacePrefixLength);

119 if (in_array($propertyName, array('person-group[@person-group-type="author"]', 'person-group[@person-group-type="editor"]'))) {

120 // Retrieve the names array (must not be by-ref

Database.php (https://gitlab.com/crazybutterfly815/magento2) PHP · 336 lines

1 <?php

2 /**

3 * Copyright © 2016 Magento. All rights reserved.

208 $index = 1;

209 $extension = strrchr($filename, '.');

210 $filenameWoExtension = substr($filename, 0, -1 * strlen($extension));

211 while ($this->fileExists($directory . $filenameWoExtension . '_' . $index . $extension)) {

212 $index++;

Memcached.php (https://bitbucket.org/tschrock52/ethodeshare.git) PHP · 159 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 Varien_Cache

23 * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)

24 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)

25 */

26

128 $data = parent::load($id, $doNotTestCacheValidity);

129

130 if (is_string($data) && (substr($data, 0, strlen(self::CODE_WORD)) == self::CODE_WORD)) {

131 // Seems we've got chunked data

132

FileProfilerStorage.php (https://github.com/outlawscumbag/symfony.git) PHP · 223 lines

1 <?php

2 /*

3 * This file is part of the Symfony package.

37 throw new \InvalidArgumentException("FileStorage DSN must start with file:");

38 }

39 $this->folder = substr($dsn, 5);

40

41 if (!is_dir($this->folder)) {

165 {

166 // Uses 4 last characters, because first are mostly the same.

167 $folderA = substr($token, -2, 2);

168 $folderB = substr($token, -4, 2);

File.php (https://github.com/error10/Ushahidi_Web.git) PHP · 245 lines

1 <?php defined('SYSPATH') OR die('No direct access allowed.');

2 /**

3 * File-based Cache driver.

4 *

5 * $Id: File.php 3917 2009-01-21 03:06:22Z zombor $

6 *

7 * @package Cache

8 * @author Kohana Team

9 * @copyright (c) 2007-2008 Kohana Team

10 * @license http://kohanaphp.com/license.html

11 */

12 class Cache_File_Driver implements Cache_Driver {

124 {

125 // Get the id from the filename

126 $array[] = substr(current(explode('~', $file)), $offset);

127 }

128

Inline.php (https://gitlab.com/noirscape/myimouto) PHP · 193 lines

1 <?php

2 /**

3 * "Inline" diff renderer.

130 $prefix = '';

131 while ($orig[0] !== false && $final[0] !== false &&

132 substr($orig[0], 0, 1) == ' ' &&

133 substr($final[0], 0, 1) == ' ') {

134 $prefix .= substr($orig[0], 0, 1);

135 $orig[0] = substr($orig[0], 1);

136 $final[0] = substr($final[0], 1);

137 }

138 return $prefix . $this->_deleted($orig) . $this->_added($final);

178 while ($pos < $length) {

179 // Eat a word with any preceding whitespace.

180 $spaces = strspn(substr($string, $pos), " \n");

181 $nextpos = strcspn(substr($string, $pos + $spaces), " \n");

class-path-processor.php (https://gitlab.com/campus-academy/krowkaramel) PHP · 186 lines

75 $file = $this->get_real_path( $file );

76

77 // phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged

78 $directory = @is_file( $file ) ? dirname( $file ) : $file;

79 if ( ! @is_file( $directory . '/vendor/composer/jetpack_autoload_classmap.php' ) ) {

152 foreach ( $directories_to_check as $directory ) {

153 $normalized_check = wp_normalize_path( trailingslashit( $directory ) ) . $normalized_path;

154 // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged

155 if ( @is_file( $normalized_check ) ) {

156 return $normalized_check;

170 private function get_real_path( $path ) {

171 // We want to resolve symbolic links for consistency with __DIR__ paths.

172 // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged

173 $real_path = @realpath( $path );

174 if ( false === $real_path ) {

functions.php (https://github.com/Canuckaholic/Pop-Digital.git) PHP · 142 lines

41 foreach ($pageposts as $post) {

42 $here = (is_page($post->ID)) ? ' class="here"' : '';

43 ?><li<?php echo $here ?>><a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title; ?></a></li><?php

44 }

45 }

72 if ($excerpt) {

73 dp_attachment_image($post->ID, 'medium', 'alt="'.$post->post_title.'"');

74 ?><p><?php echo dp_clean($post->post_content, 85); ?>... <a href="<?php echo get_permalink($post->ID); ?>">Read More</a></p><?php

75 }

76 echo $suf;

87 echo $pre;

88 dp_gravatar(52, 'alt="'.$rc->comment_author.'"', $rc->comment_author_email);

89 ?><a href="<?php the_permalink() ?>#comment-<?php echo $rc->comment_ID ?>"><?php echo dp_clean($rc->comment_content, 40); ?></a><?php

90 echo $suf;

91 }

YamlFileLoader.php (https://gitlab.com/fbi/web) PHP · 325 lines

1 <?php

2

3 /*

127 {

128 if (is_string($service) && 0 === strpos($service, '@')) {

129 $this->container->setAlias($id, substr($service, 1));

130

131 return;

283 } else if (is_string($value) && 0 === strpos($value, '@')) {

284 if (0 === strpos($value, '@?')) {

285 $value = substr($value, 2);

286 $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;

287 } else {

288 $value = substr($value, 1);

289 $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;

290 }

File.php (https://github.com/AlinT/socorro.git) PHP · 245 lines

1 <?php defined('SYSPATH') or die('No direct script access.');

2 /**

3 * File-based Cache driver.

4 *

5 * $Id: File.php 3160 2008-07-20 16:03:48Z Shadowhand $

6 *

7 * @package Cache

8 * @author Kohana Team

9 * @copyright (c) 2007-2008 Kohana Team

10 * @license http://kohanaphp.com/license.html

11 */

12 class Cache_File_Driver implements Cache_Driver {

124 {

125 // Get the id from the filename

126 $array[] = substr(current(explode('~', $file)), $offset);

127 }

128

class-credits-options.php (https://gitlab.com/woxiprogrammers/infinia-wordpress) PHP · 161 lines

1 <?php

2 class Footer_Credits_Options {

3

88

89 private static function get_default_site() {

90 $domain = strtolower(parse_url(site_url(),PHP_URL_HOST));

91 $p = strpos($domain,'www.') ;

92 if (($p !== FALSE) && ($p == 0)) $domain = substr($domain,4);

Language.php (https://github.com/azouts/oscommerce.git) PHP · 132 lines

1 <?php

2 /*

3 osCommerce Online Merchant $osCommerce-SIG$

50

51 $this->loadIniFile();

52 $this->loadIniFile(OSCOM::getSiteApplication() . '.php');

53 }

54

83

84 if ( is_null($filename) ) {

85 if ( file_exists(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/Languages/' . $language_code . '.php') ) {

86 $contents = file(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/Languages/' . $language_code . '.php');

89 }

90 } else {

91 if ( substr(realpath(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/Languages/' . $language_code . '/' . $filename), 0, strlen(realpath(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/Languages/' . $language_code))) != realpath(OSCOM::BASE_DIRECTORY . 'Core/Site/' . OSCOM::getSite() . '/Languages/' . $language_code) ) {

92 return array();

93 }

AbstractFieldCoder.php (https://gitlab.com/virtualrealms/d7civicrm) PHP · 158 lines

1 <?php

2 /*

3 +--------------------------------------------------------------------+

34 */

35

36 require_once 'api/Wrapper.php';

37

38 /**

75 }

76 // Field is multilingual and after cutting off _xx_YY should be skipped (CRM-7230)…

77 if ((preg_match('/_[a-z][a-z]_[A-Z][A-Z]$/', $fldName) && in_array(substr($fldName, 0, -6), $skipFields))) {

78 return TRUE;

79 }

smarty_internal_parsetree.php (https://gitlab.com/garabedian.kevin/web2TB) PHP · 393 lines

294 if (substr($subtree, 0, 1) == '?') {

295 $code = substr($code, 0, strlen($code) - 1) . '<<?php ?>?' . substr($subtree, 1);

296 } elseif ($this->parser->asp_tags && substr($subtree, 0, 1) == '%') {

297 $code = substr($code, 0, strlen($code) - 1) . '<<?php ?>%' . substr($subtree, 1);

298 } else {

299 $code .= $subtree;

305 if (substr($subtree, 0, 1) == '>') {

306 $code = substr($code, 0, strlen($code) - 1) . '%<?php ?>>' . substr($subtree, 1);

307 } else {

308 $code .= $subtree;

314 if (substr($subtree, 0, 1) == '>') {

315 $code = substr($code, 0, strlen($code) - 1) . '?<?php ?>>' . substr($subtree, 1);

316 } else {

317 $code .= $subtree;

detect.php (https://gitlab.com/afrizal/projekrenkam) PHP · 261 lines

1 <?php

2

3 /**

11 * @link http://getkirby.com

12 * @copyright Bastian Allgeier

13 * @license http://www.opensource.org/licenses/mit-license.php MIT License

14 */

15 class Detect {

25

26 /**

27 * Checks if the required php version is installed

28 *

29 * @param mixed $min

30 * @return boolean

31 */

32 public static function php($min = '5.3') {

33 return version_compare(PHP_VERSION, $min, '>=');

Bundle.php (https://github.com/jdewit/symfony.git) PHP · 203 lines

1 <?php

2

3 /*

112 $class = get_class($this);

113

114 return substr($class, 0, strrpos($class, '\\'));

115 }

116

160 $pos = strrpos($name, '\\');

161

162 return $this->name = false === $pos ? $name : substr($name, $pos + 1);

163 }

164

180

181 $finder = new Finder();

182 $finder->files()->name('*Command.php')->in($dir);

183

184 $prefix = $this->getNamespace().'\\Command';

changeset.php (https://bitbucket.org/nlabyt/bcf-ball-4eb2.git) PHP · 218 lines

1 <?php

2 /**

3 * @package CMS.Library

12 jimport('joomla.filesystem.file');

13 jimport('joomla.filesystem.folder');

14 JLoader::register('JSchemaChangeitem', JPATH_LIBRARIES . '/cms/schema/changeitem.php');

15

16

175 // get the folder from the database name

176 $sqlFolder = $this->db->name;

177 if (substr($sqlFolder, 0, 5) == 'mysql') {

178 $sqlFolder = 'mysql';

179 }

ArrayInput.php (https://github.com/arimogi/Chimera.git) PHP · 190 lines

1 <?php

2

3 /*

117 {

118 foreach ($this->parameters as $key => $value) {

119 if ('--' === substr($key, 0, 2)) {

120 $this->addLongOption(substr($key, 2), $value);

121 } elseif ('-' === $key[0]) {

122 $this->addShortOption(substr($key, 1), $value);

123 } else {

124 $this->addArgument($key, $value);

LexerNeedle.php (https://github.com/bshaffer/ChartDown.git) PHP · 238 lines

1 <?php

2

3 /*

47 public function getTextAtCursor()

48 {

49 return substr($this->text, $this->cursor);

50 }

51

57 public function rest()

58 {

59 $rest = substr($this->text, $this->cursor);

60 $this->moveToEnd();

61

194 public function getNumLines()

195 {

196 return substr_count(substr($this->text, $this->cursor), "\n") + 1;

197 }

198

InnerJarURLConnection.java (https://bitbucket.org/purewind/atlassian-plugins.git) Java · 201 lines

28 int bangLoc = baseText.indexOf("!");

29

30 String baseResourceText = baseText.substring(0, bangLoc);

31

32 String extraText = "";

38 extraText = "";

39 } else {

40 extraText = baseText.substring(bangLoc + 1);

41 }

42 } else {

193 int j = name.lastIndexOf("/", i - 1);

194

195 name = name.substring(0, j) + name.substring(i + 3);

196 }

197

BasedDocument.php (https://github.com/GunioRobot/Google-Wave-PHP.git) PHP · 198 lines

1 <?php

2

3 namespace echolibre\google_wave\Operations;

136 );

137

138 $left = substr($this->blip->content, 0, $start);

139 $right = substr($this->blip->content, $start, sizeof($this->blip->content) - 1);

191 );

192

193 $left = substr($this->blip->content, 0, $range->start);

194 $right = substr($this->blip->content, $range->start, $range->end);

CurrencyTest.php (https://github.com/MontmereLimited/zf2.git) PHP · 176 lines

1 <?php

2 /**

3 * Zend Framework

41 * @group Zend_View_Helper

42 */

43 class CurrencyTest extends \PHPUnit_Framework_TestCase

44 {

45 /**

116 $helper = new Helper\Currency('something');

117 } catch (\Exception $e) {

118 if (substr($e->getMessage(), 0, 15) == 'No region found') {

119 $this->assertContains('within the locale', $e->getMessage());

120 } else {

129 $this->helper->setCurrency('something');

130 } catch (\Exception $e) {

131 if (substr($e->getMessage(), 0, 15) == 'No region found') {

132 $this->assertContains('within the locale', $e->getMessage());

133 } else {

ezisbnregistrantrange.php (https://bitbucket.org/ericsagnes/ezpublish-multisite.git) PHP · 205 lines

1 <?php

2 /**

3 * File containing the eZISBNRegistrantRange class.

10

11 /*!

12 \class eZISBNRegistrantRange ezisbnregistrantrange.php

13 \brief The class eZISBNRegistrantRange handles Registrant ranges.

14

167

168 $registrantOffset = 3 + $groupLength;

169 $testSegment = substr( $isbnNr, $registrantOffset, 5 );

170 if ( is_numeric( $testSegment ) )

171 {

Bundle.php (https://gitlab.com/daniruizcamacho/pfcascensores) PHP · 203 lines

1 <?php

2

3 /*

112 $class = get_class($this);

113

114 return substr($class, 0, strrpos($class, '\\'));

115 }

116

160 $pos = strrpos($name, '\\');

161

162 return $this->name = false === $pos ? $name : substr($name, $pos + 1);

163 }

164

180

181 $finder = new Finder();

182 $finder->files()->name('*Command.php')->in($dir);

183

184 $prefix = $this->getNamespace().'\\Command';

BufferedReader.php (https://gitlab.com/Isaki/le331.fr) PHP · 196 lines

1 <?php

2 /*

3 * $Id: 860064af39647023c2644e87267184447ceb93ae $

20 */

21

22 include_once 'phing/system/io/Reader.php';

23

24 /**

82 $validSize = $dataSize - $notValidPartSize + 1;

83

84 $data = substr($data, 0, $validSize);

85

86 // Rewind to the beginning of the forgotten stuff.

Default.php (https://github.com/gryzz/crystal_magento.git) PHP · 206 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_Adminhtml

23 * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)

24 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)

25 */

26

180 public function getHtmlId()

181 {

182 return substr($this->getFieldIdPrefix(), 0, -1);

183 }

184

XmlParser.php (https://gitlab.com/thallian/freebsd-roles) PHP · 229 lines

1 <?php

2

3 namespace PicoFeed\Parser;

92 libxml_use_internal_errors(true);

93

94 if (version_compare(PHP_VERSION, '5.4.0', '>=')) {

95 $dom->loadHTML($input, LIBXML_NONET);

96 } else {

154

155 if (strpos($data, '<?xml') !== false) {

156 $data = substr($data, 0, strrpos($data, '?>'));

157 $data = str_replace("'", '"', $data);

158

161

162 if ($p1 !== false && $p2 !== false) {

163 $encoding = substr($data, $p1 + 10, $p2 - $p1 - 10);

164 $encoding = strtolower($encoding);

165 }

ConfigurationManager.php (https://github.com/mneuhaus/FLOW3-Admin.git) PHP · 179 lines

1 <?php

2

3 namespace Admin\Core;

28 /**

29 *

30 * @version $Id: ForViewHelper.php 3346 2009-10-22 17:26:10Z k-fish $

31 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later

32 * @api

145 $activePackages = $this->packageManager->getActivePackages();

146 foreach($activePackages as $packageName => $package) {

147 if(substr($packageName, 0, 8) === "Doctrine") continue;

148 foreach($package->getClassFiles() as $class => $file) {

149 $annotations = $this->getClassConfiguration($class);

TableEntity.php (https://github.com/kervin/kyzstudio.git) PHP · 328 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: TableEntity.php 23167 2010-10-19 17:53:31Z mabe $

21 */

22

24 * @see Zend_Service_WindowsAzure_Exception

25 */

26 #require_once 'Zend/Service/WindowsAzure/Exception.php';

27

28

187 'Value' => $this->$property,

188 );

189 } else if ($accessor->EntityType == 'ReflectionMethod' && substr(strtolower($accessor->EntityAccessor), 0, 3) == 'get') {

190 $method = $accessor->EntityAccessor;

191 $returnValue[] = (object)array(

Math.php (https://github.com/coder-int21h/noses.git) PHP · 154 lines

1 <?php

2 /**

3 * Zend Framework

17 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)

18 * @license http://framework.zend.com/license/new-bsd New BSD License

19 * @version $Id: Math.php 8584 2008-03-06 18:36:46Z thomas $

20 */

21

23 /**

24 * Utility class for proxying math function to bcmath functions, if present,

25 * otherwise to PHP builtin math operators, with limited detection of overflow conditions.

26 * Sampling of PHP environments and platforms suggests that at least 80% to 90% support bcmath.

151 if ((defined('TESTS_ZEND_LOCALE_BCMATH_ENABLED') && !TESTS_ZEND_LOCALE_BCMATH_ENABLED)

152 || !extension_loaded('bcmath')) {

153 require_once 'Zend/Locale/Math/PhpMath.php';

154 }

155

UriParser.php (https://gitlab.com/itlboy/yii2-starter-installed) PHP · 201 lines

1 <?php

2 /**

3 * League.Uri (http://uri.thephpleague.com)

6 * @author Ignace Nyamagana Butera <nyamsprod@gmail.com>

7 * @copyright 2013-2015 Ignace Nyamagana Butera

8 * @license https://github.com/thephpleague/uri/blob/master/LICENSE (MIT License)

9 * @version 4.1.0

10 * @link https://github.com/thephpleague/uri/

70 'scheme' => '' === $parts['scheme'] ? null : $parts['scheme'],

71 'path' => $parts['path'],

72 'query' => '' === $parts['query'] ? null : mb_substr($parts['query'], 1, null, 'UTF-8'),

73 'fragment' => '' === $parts['fragment'] ? null : mb_substr($parts['fragment'], 1, null, 'UTF-8'),

187 protected function setIsAbsolute($host)

188 {

189 return ('.' === mb_substr($host, -1, 1, 'UTF-8')) ? mb_substr($host, 0, -1, 'UTF-8') : $host;

190 }

191

percentage.php (https://github.com/caprenter/IATI-Data-Spotter.git) PHP · 141 lines

1 <?php

2 /* Uses xpath to get directly to the elements in the XML

3 * Then loops through the elements to add the percentage attributes together

10

11 //Helps us check that we only test activity files

12 include ('functions/xml_child_exists.php');

13

14 //$dir = '../data/dfid/'; //needs trailing slash

20

21 //Create a separate results file base on the data directory name

22 $save_directory = substr($dir,8,-1);

23 $data_file = $save_directory . "/" . substr($dir,8,-1) . "_percentages.txt";

65

66 fwrite($fh,$test . "\nNone found\n");

67 echo $test .PHP_EOL . "None found" . PHP_EOL;

68 }

69 }

acymenu.php (https://gitlab.com/phamngsinh/baitaplon_sinhvien) PHP · 83 lines

1 <?php

2 /**

3 * @copyright Copyright (C) 2009-2012 ACYBA SARL - All rights reserved.

6 defined('_JEXEC') or die('Restricted access');

7 ?>

8 <?php

9 class acymenuHelper{

10 function display($selected = ''){

13 $doc->addStyleDeclaration(" #submenu-box{display:none !important;} ");

14 }

15 $selected = substr($selected,0,5);

16 $config = acymailing_config();

17 $mainmenu = array();

18 $submenu = array();

19 if(acymailing_isAllowed($config->get('acl_subscriber_manage','all'))){

20 $mainmenu['subscriber'] = array(JText::_('USERS'), 'index.php?option=com_acymailing&ctrl=subscriber','acyicon-16-users');

21 $submenu['subscriber'] = array();

22 $submenu['subscriber'][] = array(JText::_('USERS'), 'index.php?option=com_acymailing&ctrl=subscriber','acyicon-16-users');

zoo.php (https://gitlab.com/ricardosanchez/prueba) PHP · 281 lines

1 <?php

2 /**

3 * @package Regular Labs Library

12 defined('_JEXEC') or die;

13

14 require_once dirname(__DIR__) . '/assignment.php';

15

16 class RLAssignmentsZoo extends RLAssignment

242 while ($id)

243 {

244 if (substr($id, 0, 3) == 'app')

245 {

246 $parent_ids[] = $id;

TranslatorPathsPass.php (https://gitlab.com/madwanz64/laravel) PHP · 147 lines

1 <?php

2

3 /*

47

48 foreach ($this->findControllerArguments($container) as $controller => $argument) {

49 $id = substr($controller, 0, strpos($controller, ':') ?: \strlen($controller));

50 if ($container->hasDefinition($id)) {

51 [$locatorRef] = $argument->getValues();

write.id3v1.php (https://github.com/kennethjiang/Wolke.git) PHP · 156 lines

1 <?php

2 // +----------------------------------------------------------------------+

3 // | PHP version 5 |

15 // | Allan Hansen <ahØartemis*dk> |

16 // +----------------------------------------------------------------------+

17 // | write.id3v1.php |

18 // | writing module for id3v1 tags |

19 // | dependencies: module.tag.id3v1.php. |

20 // +----------------------------------------------------------------------+

21 //

22 // $Id: write.id3v1.php,v 1.15 2006/11/20 16:09:33 ah Exp $

23

24

94

95 $result = 'TAG';

96 $result .= str_pad(trim(substr($this->title, 0, 30)), 30, "\x00", STR_PAD_RIGHT);

97 $result .= str_pad(trim(substr($this->artist, 0, 30)), 30, "\x00", STR_PAD_RIGHT);

HelperCollection.php (https://github.com/nshahzad/CakePHP-Base.git) PHP · 155 lines

1 <?php

2 /**

3 * Helpers collection is used as a registry for loaded helpers and handles loading

4 * and constructing helper class objects.

5 *

6 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)

7 * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)

8 *

11 *

12 * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)

13 * @link http://cakephp.org CakePHP(tm) Project

14 * @package Cake.View

15 * @since CakePHP(tm) v 2.0

16 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)

17 */

18

client.js (https://github.com/mzupan/varnishspy.git) JavaScript · 193 lines

43 if (messages === false) return this.listener.options.log('Bad message received from client ' + this.sessionId);

44 for (var i = 0, l = messages.length, frame; i < l; i++){

45 frame = messages[i].substr(0, 3);

46 switch (frame){

47 case '~h~':

48 return this._onHeartbeat(messages[i].substr(3));

49 case '~j~':

50 messages[i] = JSON.parse(messages[i].substr(3));

171 Client.prototype._generateSessionId = function(){

172 if (this.sessionId) return this.listener.options.log('This client already has a session id');

173 this.sessionId = Math.random().toString().substr(2);

174 return this;

175 };

usertypepropertydiskfile.php (https://gitlab.com/Rad1calDreamer/honey) PHP · 197 lines

1 <?php

2

3 namespace Bitrix\Iblock\BizprocType;

148

149 $documentType = $fieldType->getDocumentType();

150 $iblockId = intval(substr($documentType[2], strlen("iblock_")));

151

152 $canUpdate = $fileModel->canUpdate($securityContext);

179

180 $documentType = $fieldType->getDocumentType();

181 $iblockId = intval(substr($documentType[2], strlen("iblock_")));

182 if(!$iblockId)

183 return;

TableEntity.php (https://github.com/Doap/iCms---intelligent-Content-management-system.git) PHP · 328 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: TableEntity.php 23167 2010-10-19 17:53:31Z mabe $

21 */

22

24 * @see Zend_Service_WindowsAzure_Exception

25 */

26 require_once 'Zend/Service/WindowsAzure/Exception.php';

27

28

187 'Value' => $this->$property,

188 );

189 } else if ($accessor->EntityType == 'ReflectionMethod' && substr(strtolower($accessor->EntityAccessor), 0, 3) == 'get') {

190 $method = $accessor->EntityAccessor;

191 $returnValue[] = (object)array(

Protector.php (https://github.com/cahnory/DrySocks.git) PHP · 210 lines

1 <?php

2 /**

3 * DrySocks Framework

26 * @author François "cahnory" Germain <cahnory@gmail.com>

27 * @copyright Copyright (c) 2011 François "cahnory" Germain

28 * @license http://www.opensource.org/licenses/mit-license.php

29 */

30

38 * @author François "cahnory" Germain <cahnory@gmail.com>

39 * @copyright Copyright (c) 2011 François "cahnory" Germain

40 * @license http://www.opensource.org/licenses/mit-license.php

41 */

42 class Protector

156

157 // Crypt the hash

158 $password = substr(crypt($password, '$2a$'.sprintf('%02d', $this->bcryptCost).'$'.$this->bcryptSalt), 29);

159

160 // Apply user processing function

WordTrie.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 455 lines ✨ Summary

This Java code implements a Trie data structure, which is used to store and retrieve strings efficiently. It provides methods for inserting, removing, searching, and retrieving words from the trie, as well as generating bloom filters for efficient word filtering. The code also includes functionality for getting all words in the trie that match a given prefix or filter.

189 node.add(new WordChar(cur));

190 }

191 return add(node.get(cur).next, word.substring(1));

192 }

193

230 return false;

231 }

232 return find(node.get(cur).next, word.substring(1));

233 }

234

249 return null;

250 }

251 return findNode(node.get(cur).next, word.substring(1));

252 }

253

dates.php (https://github.com/dionyziz/blogcube.git) PHP · 166 lines

1 <?php

2 # Developer: dionyziz

3

4 include "modules/module.php";

5

6 $shortmonths = Array( "Jan" , "Feb" , "Mar" , "Apr" ,

43 $Asec = explode( " " , microtime() );

44 $Amicro = explode( "." , $Asec[ 0 ] );

45 return $Asec[ 1 ] . substr( $Amicro[ 1 ] , 0 , 4 );

46 }

47

UserProvider.php (https://github.com/Sylius/Sylius.git) PHP · 149 lines

1 <?php

2

3 /*

118

119 // set random password to prevent issue with not nullable field & potential security hole

120 $user->setPlainPassword(substr(sha1($response->getAccessToken()), 0, 10));

121

122 $user->setEnabled(true);

check_config.php (https://github.com/sherdog/GitWitty.git) PHP · 180 lines

1 <?php

2 /**

3 * @file check_config.php

20 * along with this program; if not, write to the Free Software

21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

22 * A full text version of the GNU GPL version 2 can be found in the LICENSE.php file.

23 * @par History:

24 * - V1.2.17 03-NOV-2009: Initial version

51 if ( !$wrapperIsPresent) {

52 $rc = '[NOK]';

53 $result .= JText::_( 'The configuration wrapper is not present in the MASTER ccboard-config.php file.');

54 $result .= '|[ACTION]';

55 $result .= '|Add 6 lines containing the routing wrapper to the slave site.';

71 $patch_dir = implode( DS, $parts );

72

73 include_once( $patch_dir .DS. 'joomla' .DS. 'patchloader.php');

74 $patchStr = jms2win_loadPatch( '..' .DS. 'ccboard' .DS. 'patch_config.php');

FUStringConversion.cpp (https://bitbucket.org/ardalanaz/dava.framework.git) C++ · 319 lines

4 Copyright (C) 2005-2007 Sony Computer Entertainment America

5

6 MIT License: http://www.opensource.org/licenses/mit-license.php

7 */

8 /*

10 Copyright (C) 2005-2006 Feeling Software Inc

11 Copyright (C) 2005-2006 Autodesk Media Entertainment

12 MIT License: http://www.opensource.org/licenses/mit-license.php

13 */

14

102 #ifdef HAS_VECTORTYPES

103

104 // Split a fstring into multiple substrings

105 void FUStringConversion::ToFStringList(const fstring& value, FStringList& array)

106 {

model.php (https://github.com/myagoo/Hello-PHP.git) PHP · 203 lines

1 <?php

2

3 class model {

64 }

65 }

66 $query = substr($query, 0, -2);

67

68 //Mise à jour des champs updated et created

113 $fields .= $this->table . '.' . $fieldName . ' as ' . get_Class($this) . '_' . $fieldName . ', ';

114 }

115 $fields = substr($fields, 0, -2);

116 }

117 $limit = '';

148 foreach ($row as $fieldName => $value) {

149 $pos = strpos($fieldName, '_');

150 $prefix = substr($fieldName, 0, $pos);

151 $sufix = substr($fieldName, $pos + 1, strlen($fieldName));

sitemailer_.php (https://gitlab.com/nvtdn2006/azora) PHP · 384 lines

1 <?php

2 class SiteMailer

3 {

51

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 . "--";

155

156 private function sendActivationToCustomer($property) {

157 /*$htmlCT = "--PHP-alt-" . $this->randomHash . "\r\n";

158 $htmlCT .= 'Content-Type: text/html; charset="iso-8859-1"' . "\r\n";

159 $htmlCT .= 'Content-Transfer-Encoding: 7bit' . "\r\n";*/

position.php (https://github.com/mcrider/pkpUpgradeTestSuite.git) PHP · 173 lines

1 <?php

2 /**

3 * Locate a byte index given a UTF-8 character index

4 * @version $Id: position.php,v 1.1 2008/10/10 20:52:53 mj Exp $

5 * @package utf8

6 * @subpackage position

12 * terms of the UTF-8 character position, returns the byte

13 * index of that character. Can be useful when you want to

14 * PHP's native string functions but we warned, locating

15 * the byte can be expensive

16 * Takes variable number of parameters - first must be

44

45 // $c -> character offset into $str

46 $c = strlen(utf8_decode(substr($str,0,$i)));

47

48 // deal with arguments from lowest to highest

DocCommentAlignmentSniff.php (https://github.com/amumu/modev.git) PHP · 149 lines

27 * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence

28 * @version Release: 1.2.2

29 * @link http://pear.php.net/package/PHP_CodeSniffer

30 */

31 class Squiz_Sniffs_Commenting_DocCommentAlignmentSniff implements PHP_CodeSniffer_Sniff

48 * Processes this test, when one of its tokens is encountered.

49 *

50 * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.

51 * @param int $stackPtr The position of the current token

52 * in the stack passed in $tokens.

59

60 // We are only interested in function/class/interface doc block comments.

61 $nextToken = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);

62 $ignore = array(

63 T_CLASS,

Path.php (https://github.com/kronda/kronda.git) PHP · 170 lines

1 <?php

2

3 /**

64 }

65

66 if (substr_compare($path, "/", 0, 1) !== 0) return "must start with \"/\"";

67 $l = strlen($path);

68 if ($l === 1) return null; // Special case for "/"

113 Dropbox_Checker::argString("path", $path);

114

115 if (substr_compare($path, "/", 0, 1) !== 0) {

116 throw new InvalidArgumentException("'path' must start with \"/\"");

117 }

123

124 $lastSlash = strrpos($path, "/");

125 return substr($path, $lastSlash+1);

126 }

127

index.php (https://github.com/kadishmal/tilchi.com.git) PHP · 110 lines

1 <?php

2 $this->pageTitle = Yii::t('ContentModule.forum', 'Forum') . ' | ' . Yii::app()->name;

3 ?>

6 <div class="forum-body">

7 <div class="frame">

8 <div class="title"><h2><?php echo Yii::t('ContentModule.forum', 'Forums'); ?></h2></div>

9 <div id="forum-search">

10 <?php

22 <div class="body" id="search-container">

23 <div id="results" class="list">

24 <?php

25 $cs = Yii::app()->clientScript;

26 $cs->registerScript('forum-search-form',"

30 </div>

31 <div class="options">

32 <h2><?php echo Yii::t('ContentModule.forum', 'Didn\'t find what you were looking for?'); ?></h2>

33 <div class="option question"><a href="/forum/new/question"><i></i><h3><?php echo Yii::t('ContentModule.forum', 'Ask a question'); ?></h3></a></div>

BaseCiniveles.php (https://github.com/cidesa/siga-universitario.git) PHP · 505 lines

1 <?php

2

3

203 public function __call($m, $a)

204 {

205 $prefijo = substr($m,0,3);

206 $metodo = strtolower(substr($m,3));

325

326

327 public function getByName($name, $type = BasePeer::TYPE_PHPNAME)

328 {

329 $pos = CinivelesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);

362

363

364 public function toArray($keyType = BasePeer::TYPE_PHPNAME)

365 {

366 $keys = CinivelesPeer::getFieldNames($keyType);

Default.php (https://github.com/leochaves/magento-pt_br.git) PHP · 206 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_Adminhtml

23 * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)

24 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)

25 */

26

180 public function getHtmlId()

181 {

182 return substr($this->getFieldIdPrefix(), 0, -1);

183 }

184

AbstractStructureParser.php (https://github.com/RichardDownes/PHPCodeParser.git) PHP · 608 lines

1 <?php

2 namespace Parser;

3 /*

17 */

18

19 use Meta\AbstractPHPStructure;

20 use Meta\DocBlock;

21

32

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;

Editor.php (https://github.com/adaykin/zf2.git) PHP · 601 lines

1 <?php

2 /**

3 * Zend Framework

453 throw new ElementException('Invalid minHeight provided; must be integer or CSS measurement');

454 }

455 if ('em' != substr($minHeight, -2)) {

456 $minHeight .= 'em';

457 }

AtualizacaoExternaPlsController.php (https://gitlab.com/digaotinfo/agendaLegislativa) PHP · 168 lines

1 <?php

2 App::import('Vendor', 'receiveMail/receiveMail');

3 class AtualizacaoExternaPlsController extends AppController{

138 //

139 // if( $acheiTipo > 0 ){

140 // $tratarStr = substr($corpo, $acheiTipo);

141 // $explodeType = explode('/', $tratarStr);

142 // $tipo = str_Replace('-', '', $tipo);

abstract.php (https://github.com/ercanozkaya/nooku-server-base.git) PHP · 201 lines

1 <?php

2 /**

3 * @version $Id: abstract.php 3690 2011-07-13 00:25:08Z johanjanssens $

175 foreach($methods as $method)

176 {

177 if(substr($method, 0, 7) == '_before' || substr($method, 0, 6) == '_after') {

178 return parent::getHandle();

179 }

Nlm30CitationSchemaCitationAdapter.inc.php (https://github.com/ojsde/pkp-lib.git) PHP · 164 lines

1 <?php

2

3 /**

4 * @file plugins/metadata/nlm30/filter/Nlm30CitationSchemaCitationAdapter.inc.php

5 *

6 * Copyright (c) 2000-2012 John Willinsky

116 if ($dataObject->hasData($fieldName)) {

117 // Remove the name space prefix

118 $propertyName = substr($fieldName, $namespacePrefixLength);

119 if (in_array($propertyName, array('person-group[@person-group-type="author"]', 'person-group[@person-group-type="editor"]'))) {

120 // Retrieve the names array (must not be by-ref

File.php (https://github.com/Juuro/Dreamapp-Website.git) PHP · 245 lines

1 <?php defined('SYSPATH') OR die('No direct access allowed.');

2 /**

3 * File-based Cache driver.

4 *

5 * $Id: File.php 19191 2008-12-15 05:35:20Z bharat $

6 *

7 * @package Cache

8 * @author Kohana Team

9 * @copyright (c) 2007-2008 Kohana Team

10 * @license http://kohanaphp.com/license.html

11 */

12 class Cache_File_Driver implements Cache_Driver {

124 {

125 // Get the id from the filename

126 $array[] = substr(current(explode('~', $file)), $offset);

127 }

128

FtpClient.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 1018 lines ✨ Summary

This Java code implements a basic FTP client framework, providing methods for sending and receiving data over an FTP connection. It handles various commands such as login, status, help, and file transfers, and includes features like response logging and buffering. The code is designed to be extensible and adaptable to different network configurations and proxy settings.

297 int bound_l = message.lastIndexOf('(', bound_r - 1) + 1;

298

299 String remoteAddr = message.substring(bound_l, bound_r);

300 int comma1 = remoteAddr.lastIndexOf(',');

301 int port = Integer.parseInt(remoteAddr.substring(comma1 + 1));

302 int comma2 = remoteAddr.lastIndexOf(',', comma1 - 1);

303 port |= Integer.parseInt(remoteAddr.substring(comma2 + 1, comma1)) << 8;

304 remoteAddr = remoteAddr.substring(0, comma2).replace(',', '.');

SystemShell.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 553 lines ✨ Summary

This Java code implements a console shell that allows users to interact with the operating system using commands such as cd, pwd, and echo. It also supports Unix-style variables and expansion, and can print error messages in different colors. The code is part of a larger application, likely an integrated development environment (IDE), and provides a basic command-line interface for users to execute shell-like commands.

74

75 SystemShellBuiltIn.executeBuiltIn(console,output,

76 commandName.substring(1),args);

77 output.commandDone();

78 }

373 break;

374

375 varName = arg.substring(i + 1,index);

376

377 i = index;

400 if(index == -1)

401 index = arg.length();

402 varName = arg.substring(i + 2,index);

403

404 i = index;

dir.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 118 lines ✨ Summary

The dir class is a BASH-like command that displays information about the current directory and its contents. It prints a table with file permissions, last modified date, length, and name for each file in the directory, sorted alphabetically. The output includes a fixed-length field for file length and formatting to align columns.

76 int si = len.toString().indexOf(" ");

77 if ( si != -1 ) {

78 String pad = len.toString().substring(si);

79 len.setLength(si);

80 len.insert(0, pad);

jEdit.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 4373 lines ✨ Summary

This Java code is part of a text editor application, managing views and user interactions. It handles view creation, closing, and switching between views. It also manages settings, garbage collection, and memory usage. The code provides methods for getting and setting various properties, such as the number of open views, the currently active view, and whether jEdit is running in background mode.

173 try

174 {

175 level = Integer.parseInt(arg.substring("-log=".length()));

176 }

177 catch(NumberFormatException nf)

184 else if(arg.startsWith("-settings="))

185 {

186 settingsDirectory = arg.substring(10);

187 shouldRelocateSettings = false;

188 }

192 portFile = "server";

193 else if(arg.startsWith("-server="))

194 portFile = arg.substring(8);

195 else if(arg.startsWith("-background"))

196 background = true;

GalleryView.java (https://bitbucket.org/atchariya/nokia.git) Java · 290 lines

90 String root = (String) roots.nextElement();

91 root = root.replace('/', Constants.FILE_SEPARATOR.charAt(0));

92 append(root.substring(1), ROOT_IMAGE);

93 }

94 fileConnection = null;

153 // Get format

154 int startIndex = selectedFile.indexOf(".");

155 String imageFormat = selectedFile.substring(startIndex + 1, selectedFile.length());

156

157 // Resize

195 try {

196 // Remove system root before display

197 ticker.setString(fileConnection.getURL().substring(Constants.SYSTEM_ROOT.length()));

198

199 // Open the root

JodeVFS.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 235 lines ✨ Summary

This Java code is part of a decompiler for Java bytecode, specifically designed to work with the Jode IDE. It reads a Java class file from disk, decompiles its bytecode into human-readable source code, and writes it to an output stream. The decompilation process can be customized through various options and settings.

76 String pathToClass = path;

77 if (path.startsWith(PROTOCOL + ':')) {

78 pathToClass = pathToClass.substring(PROTOCOL.length() + 1);

79 }

80

ml.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 180 lines

142 <KEYWORD3>ref</KEYWORD3>

143 <KEYWORD3>string</KEYWORD3>

144 <KEYWORD3>substring</KEYWORD3>

145 <KEYWORD3>unit</KEYWORD3>

146 <KEYWORD3>vector</KEYWORD3>

VFS.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 1149 lines ✨ Summary

This Java code is part of a file system browser for a text editor, likely NetBeans. It provides functionality to list files and directories in a file system, filter by type and name, and colorize file names based on regular expressions. The code also handles recursive directory traversal, symlinks, and binary files. It uses an internal configuration system to store user preferences, such as colorizing file names.

289

290 while(path.endsWith("/") || path.endsWith(File.separator))

291 path = path.substring(0,path.length() - 1);

292

293 int index = Math.max(path.lastIndexOf('/'),

300 return path;

301

302 return path.substring(index + 1);

303 } //}}}

304

334 }

335

336 return path.substring(0,index + 1);

337 } //}}}

338

Log.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 258 lines ✨ Summary

This Java code generates a log of changes made to a SVN repository. It takes a list of paths, a start and end revision, and prints out the author, date, and log message for each change. Additionally, it displays the changed paths and their type (added, deleted, or modified). The output is printed to the console.

115 else {

116 for ( File file : localPaths ) {

117 // this feels like a kludge, I shouldn't have to do a substring

118 // call to figure out the path of the file

119 LogHandler handler = new LogHandler( file );

122 String rep_url_string = info.getRepositoryRootURL().toString();

123 String file_url_string = info.getURL().toString();

124 String path = file_url_string.substring(rep_url_string.length());

125 SVNURL rep_url = SVNURL.parseURIEncoded(rep_url_string);

126 String[] rep_paths = new String[]{path};

VFSFileNameField.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 287 lines ✨ Summary

This Java class, VFSFileNameField, extends a text field to provide file name completion and navigation for a file system browser. It processes key events, such as TAB presses, to suggest completions and navigate through directories. When the user selects a directory, it updates the text field with the selected path or file name.

178 directories */

179 String newPath = VFSFile.findCompletion(path,

180 complete.substring(0,index),browser,true);

181 if(newPath == null)

182 return null;

183 path = newPath;

184 complete = complete.substring(index + 1);

185 }

186 } //}}}

192 String dir;

193 if(index != -1)

194 dir = currentText.substring(0,index + 1);

195 else

196 dir = "";

sdl_pr.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 229 lines

12

13 Auto-indentation occurs if the following are at the start of a line (ignoring

14 leading white space): "block", "channel", "connection", "decision", "generator", "input", "macro", "newtype", "operator", "package", "procedure", "process", "refinement", "service", "start", "state", "substructure", "syntype", "system".

15

16 This also happens if the following appear on their own (i.e. also ignoring

23 <PROPERTY NAME="commentEnd" VALUE="*/"/>

24 <PROPERTY NAME="indentNextLines"

25 VALUE="\s*(block|channel|connection|decision|generator|input|macro|newtype|operator|package|procedure|process|refinement|service|start|state|substructure|syntype|system).*|\s*(signal)\s*"/>

26 </PROPS>

27

114 <KEYWORD1>endservice</KEYWORD1>

115 <KEYWORD1>endstate</KEYWORD1>

116 <KEYWORD1>endsubstructure</KEYWORD1>

117 <KEYWORD1>endsyntype</KEYWORD1>

118 <KEYWORD1>endsystem</KEYWORD1>

SystemShellBuiltIn.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 732 lines ✨ Summary

This Java code defines a set of shell commands for a console plugin, including cd, pwd, pushd, popd, and others. It provides basic directory navigation functionality, allowing users to change directories, print their current working directory, and manage aliases and variables. The commands are designed to work within the context of a text editor or IDE, likely for a Java-based project.

40 {

41 name = getClass().getName();

42 name = name.substring(name.lastIndexOf('$') + 1);

43

44 help = jEdit.getProperty("console.shell." + name + ".usage");

117 i--;

118

119 String longName = arg.substring(2);

120 boolean no;

121 if(longName.startsWith("no-"))

122 {

123 no = true;

124 longName = longName.substring(3);

125 }

126 else

json.jj (https://jedit.svn.sourceforge.net/svnroot/jedit) Unknown · 763 lines

627 // and the new string starts with a space, don't want 2 spaces.

628 if (s.startsWith(" ") && endsWith(outputBuffer, " ")) {

629 s = s.substring(1);

630 }

631

737 break;

738 }

739 String leading_ws = s.substring(0, ws_length);

740 String head = s.substring(0, first_break);

741 String tail = s.substring(first_break);

742 //head = head.replaceAll("[\u001c]", "");

743 //tail = tail.replaceAll("[\u001c]", "");

757 if (sb.length() < s.length())

758 return false;

759 String end = sb.substring(sb.length() - s.length());

760 return end.equals(s);

761 }

task.xsl (https://jedit.svn.sourceforge.net/svnroot/jedit) Extensible Stylesheet Language Transformations · 77 lines

17 <xsl:template match="task">

18 <xsl:variable name="param.placement"

19 select="substring-after(normalize-space($formal.title.placement),

20 concat(local-name(.), ' '))"/>

21

23 <xsl:choose>

24 <xsl:when test="contains($param.placement, ' ')">

25 <xsl:value-of select="substring-before($param.placement, ' ')"/>

26 </xsl:when>

27 <xsl:when test="$param.placement = ''">before</xsl:when>

JavaCCParserTokenManager.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 2045 lines ✨ Summary

This Java code is part of a lexical analyzer (tokenizer) for a parser, responsible for breaking input text into individual tokens. It manages the parsing process by switching between different states and handling various token types, including special tokens. The code uses a finite state machine to parse the input stream and generate tokens.

161 // yep, it's a blank, so just print it out

162 if (s.length() >= ls.length()) {

163 s = s.substring(0, s.length() - ls.length());

164 }

165 outputBuffer.append(s);

189 }

190 if (has_or && s.startsWith(" ")) {

191 s = s.substring(2);

192 }

193 }

213 // check that there aren't extra spaces in the buffer already

214 if (s.startsWith(" ") && endsWith(outputBuffer, " ")) {

215 s = s.substring(1);

216 }

217

JCompiler.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 454 lines ✨ Summary

This Java code is a compiler for Java programs. It takes a set of .java files, compiles them into bytecode, and then runs the resulting classes using Sun’s javac tool. The compiled output is displayed in a GUI window, allowing users to view the compilation process and any errors that occur.

321 String pkgPath = pkgName.replace('.', System.getProperty("file.separator").charAt(0));

322 if (parent.endsWith(pkgPath)) {

323 parent = parent.substring(0, parent.length() - pkgPath.length() - 1);

324 args[1] = args[1] + System.getProperty("path.separator") + parent;

325 }

426 return false;

427 }

428 String clazzName = name.substring(0, name.length()-5) + ".class";

429

430 File clazzFile = new File(dir, clazzName);

netrexx.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 155 lines

112 <KEYWORD1>space</KEYWORD1>

113 <KEYWORD1>strip</KEYWORD1>

114 <KEYWORD1>substr</KEYWORD1>

115 <KEYWORD1>subword</KEYWORD1>

116 <KEYWORD1>trunc</KEYWORD1>

TextAreaExtensionLayerChooser.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 92 lines ✨ Summary

This Java class, TextAreaExtensionLayerChooser, creates a combo box to select a textarea extension layer from a predefined list of layers. The combo box is initialized with a specific layer and allows editing. It also provides a method to retrieve the selected layer as an integer value.

86 return layer;

87 }

88 int layer = Integer.parseInt(value.substring(0, value.indexOf(' ')));

89 return layer;

90 } //}}}

JEditHistoryModelSaver.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 225 lines ✨ Summary

This Java class, JEditHistoryModelSaver, is responsible for managing a history model for a text editor. It loads and saves a map of history models to a file, handling encoding differences between versions of the application. The class provides methods for loading and saving the history model, as well as updating the last modified time of the file.

195

196 String modelName = MiscUtilities

197 .escapesToChars(line.substring(

198 1,line.length() - 1));

199 currentModel = new HistoryModel(

CTagsFileProvider.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 57 lines ✨ Summary

This Java class, CTagsFileProvider, is a provider of identifier names from a tags file generated by ctags. It loads and processes the identifiers from the file, storing them in an internal list. The class provides methods to process the file, forget the loaded identifiers, and iterate over the identifiers, allowing for use in other parts of the application.

34 if (tabloc == -1) // malformed line?

35 continue;

36 identifierList.add(line.substring(0, tabloc));

37 }

38

pxa2xx-pcm.h (http://omnia2droid.googlecode.com/svn/trunk/) C++ Header · 31 lines ✨ Summary

This C header file defines an interface for ALSA (Advanced Linux Sound Architecture) PCM (Pulse Code Modulation) on Intel PXA2xx chipsets. It provides structures and functions for managing DMA (Direct Memory Access) operations, playback, capture, and startup/shutdown of PCM devices. The code is part of the Linux kernel’s sound system.

22 struct pxa2xx_pcm_dma_params *playback_params;

23 struct pxa2xx_pcm_dma_params *capture_params;

24 int (*startup)(struct snd_pcm_substream *);

25 void (*shutdown)(struct snd_pcm_substream *);

26 int (*prepare)(struct snd_pcm_substream *);

27 };

28

nsViewSourceHTML.h (git://github.com/zpao/v8monkey.git) C Header · 167 lines ✨ Summary

This C++ header file defines a class CViewSourceHTML that generates HTML content based on a given input. It includes features like syntax highlighting, tokenization, and entity expansion. The class is designed to work with Mozilla’s HTML parser and provides methods for writing tags, attributes, and text content. It also handles errors and verification of the context stack.

64 }

65

66 void SetIndirectString(const nsSubstring& aString) {

67 mIndirectString=&aString;

68 }

69

70 virtual const nsSubstring& GetStringValue(void){

71 return (const nsSubstring&)*mIndirectString;

72 }

73

74 const nsSubstring* mIndirectString;

75 };

76

99

100 nsresult WriteTag(PRInt32 tagType,

101 const nsSubstring &aText,

102 PRInt32 attrCount,

103 bool aTagInError);

groupby3_map.q.out (https://svn.apache.org/repos/asf/incubator/hcatalog/) text · 0 lines

11 avg(DISTINCT substr(src.value,5)),

12 max(substr(src.value,5)),

13 min(substr(src.value,5)),

14 std(substr(src.value,5)),

15 stddev_samp(substr(src.value,5)),

28 stddev_samp(substr(src.value,5)),

29 variance(substr(src.value,5)),

30 var_samp(substr(src.value,5))

31 POSTHOOK: type: QUERY

32 ABSTRACT SYNTAX TREE:

33 (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src))) (TOK_INSERT (TOK_DESTINATION (TOK_TAB (TOK_TABNAME dest1))) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION sum (TOK_FUNCTION substr (. (TOK_TABLE_OR_COL src) value) 5))) (TOK_SELEXPR (TOK_FUNCTION avg (TOK_FUNCTION substr (. (TOK_TABLE_OR_COL src) value) 5))) (TOK_SELEXPR (TOK_FUNCTIONDI avg (TOK_FUNCTION substr (. (TOK_TABLE_OR_COL src) value) 5))) (TOK_SELEXPR (TOK_FUNCTION max (TOK_FUNCTION substr (. (TOK_TABLE_OR_COL src) value) 5))) (TOK_SELEXPR (TOK_FUNCTION min (TOK_FUNCTION substr (. (TOK_TABLE_OR_COL src) value) 5))) (TOK_SELEXPR (TOK_FUNCTION std (TOK_FUNCTION substr (. (TOK_TABLE_OR_COL src) value) 5))) (TOK_SELEXPR (TOK_FUNCTION stddev_samp (TOK_FUNCTION substr (. (TOK_TABLE_OR_COL src) value) 5))) (TOK_SELEXPR (TOK_FUNCTION variance (TOK_FUNCTION substr (. (TOK_TABLE_OR_COL src) value) 5))) (TOK_SELEXPR (TOK_FUNCTION var_samp (TOK_FUNCTION substr (. (TOK_TABLE_OR_COL src) value) 5))))))

34

35 STAGE DEPENDENCIES:

56 expr: avg(DISTINCT substr(value, 5))

57 expr: max(substr(value, 5))

58 expr: min(substr(value, 5))

history-restore.pl (git://github.com/shabble/irssi-scripts.git) Perl · 186 lines ✨ Summary

This Perl script is a template for an IRC bot that displays and restores a fake history of messages. It uses Irssi, a Perl IRC client library, to interact with the IRC server. The script initializes itself, binds commands to display and restore the history, and simulates typing and pressing keys on the keyboard.

103 sub do_next {

104 if (length $buf) {

105 my $char = substr($buf, 0, 1, '');

106 _key($char);

107 do_next();