100+ results for 'php preg_match'

Not the results you expected?

Batch.php (https://github.com/kiranatama/sagalaya.git) PHP · 245 lines

1 <?php

2 /**

3 * Zend Framework

204 // Parse response

205 $errors = null;

206 preg_match_all('/<message (.*)>(.*)<\/message>/', $response->getBody(), $errors);

207

208 // Error?

curl.php (https://github.com/magicmarkker/core.git) PHP · 288 lines

1 <?php

2 /**

3 * Part of the Fuel framework.

8 * @license MIT License

9 * @copyright 2010 - 2011 Fuel Development Team

10 * @link http://fuelphp.com

11 */

12

40 if ( ! function_exists('curl_init'))

41 {

42 throw new \RestException('Your PHP installation doesn\'t have cURL enabled. Rebuild PHP with --with-curl');

43 }

44 }

53 {

54 // If no a protocol in URL, assume its a local link

55 ! preg_match('!^\w+://! i', $url) and $url = Uri::create($url);

56

57 $this->url = $url;

Curl.php (https://gitlab.com/crazybutterfly815/magento2) PHP · 196 lines

1 <?php

2 /**

3 * Copyright © 2016 Magento. All rights reserved.

47 * @return array

48 *

49 * @SuppressWarnings(PHPMD.NPathComplexity)

50 * @SuppressWarnings(PHPMD.CyclomaticComplexity)

187 protected function getData($regularExpression, $response, $isJson = false)

188 {

189 preg_match($regularExpression, $response, $matches);

190 if (!isset($matches[1])) {

191 throw new \Exception("Can't find data in response by regular expression \"{$regularExpression}\".");

Batch.php (https://bitbucket.org/DragonBe/zfform.git) PHP · 241 lines

1 <?php

2 /**

3 * Zend Framework

130 if ($httpVerb == Zend_Http_Client::GET) {

131 if (count($this->_operations) > 0) {

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

133 throw new Zend_Service_WindowsAzure_Exception("Select operations can only be performed in an empty batch transaction.");

134 }

199 // Parse response

200 $errors = null;

201 preg_match_all('/<message (.*)>(.*)<\/message>/', $response->getBody(), $errors);

202

203 // Error?

204 if (count($errors[2]) > 0) {

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

206 throw new Zend_Service_WindowsAzure_Exception('An error has occured while committing a batch: ' . $errors[2][0]);

207 }

qubaid_condition_test.php (https://github.com/pauln/moodle.git) PHP · 161 lines

1 <?php

2 // This file is part of Moodle - http://moodle.org/

3 //

16

17 /**

18 * This file contains tests for some of the code in ../datalib.php.

19 *

20 * @package moodlecore

28

29 global $CFG;

30 require_once(dirname(__FILE__) . '/../lib.php');

31

32

41 protected function normalize_sql($sql, $params) {

42 $newparams = array();

43 preg_match_all('/(?<!:):([a-z][a-z0-9_]*)/', $sql, $named_matches);

44 foreach($named_matches[1] as $param) {

45 if (array_key_exists($param, $params)) {

EpiRoute.php (https://github.com/williamswebworks/DraftApp.git) PHP · 224 lines

1 <?php

2 /**

3 * EpiRoute master file

133 foreach($this->regexes as $ind => $regex)

134 {

135 if(preg_match($regex, $this->route, $arguments))

136 {

137 array_shift($arguments);

171 {

172 $continue = !empty($url);

173 if($offDomain === false && preg_match('#^https?://#', $url))

174 $continue = false;

175

Tokenizer.php (https://bitbucket.org/AdriVanHoudt/school.git) PHP · 201 lines

1 <?php

2

3 /*

44

45 while (true) {

46 if (preg_match('#\s+#A', $s, $match, 0, $pos)) {

47 $precedingWhitespacePos = $pos;

48 $pos += strlen($match[0]);

59 }

60

61 if (preg_match('#[+-]?\d*n(?:[+-]\d+)?#A', $s, $match, 0, $pos) && 'n' !== $match[0]) {

62 $sym = substr($s, $pos, strlen($match[0]));

63 $tokens[] = new Token('Symbol', $sym, $pos);

183 $start = $pos;

184

185 if (!preg_match('#[^\w\-]#', $s, $match, PREG_OFFSET_CAPTURE, $pos)) {

186 // Goes to end of s

187 return array(substr($s, $start), strlen($s));

MonologServiceProviderTest.php (https://gitlab.com/Szedrik/rest) PHP · 212 lines

1 <?php

2

3 /*

25 * @author Igor Wiedler <igor@wiedler.ch>

26 */

27 class MonologServiceProviderTest extends \PHPUnit_Framework_TestCase

28 {

29 public function testRequestLogging()

69 $app->register(new MonologServiceProvider(), array(

70 'monolog.formatter' => new JsonFormatter(),

71 'monolog.logfile' => 'php://memory',

72 ));

73

187 $records = $handler->getRecords();

188 foreach ($records as $record) {

189 if (preg_match($pattern, $record['message']) && $record['level'] == $level) {

190 $found = true;

191 continue;

formatter.php (https://gitlab.com/tjaafar/SuiteCRM) PHP · 155 lines

1 <?php

2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

3 /*********************************************************************************

73 } else if(file_exists("modules/Connectors/connectors/formatters/{$dir}/tpls/default.tpl")) {

74 return $this->_ss->fetch("modules/Connectors/connectors/formatters/{$dir}/tpls/default.tpl");

75 } else if(preg_match('/_soap_/', $class)) {

76 return $this->_ss->fetch("include/connectors/formatters/ext/soap/tpls/default.tpl");

77 } else {

Uploader.php (https://github.com/faktoral/axiscommerce.git) PHP · 242 lines

1 <?php

2 /**

3 * Axis

52

53 /**

54 * Php error codes

55 *

56 * @var array

58 protected $_errorCode = array(

59 0 => "There is no error, the file uploaded with success",

60 1 => "The uploaded file exceeds the upload_max_filesize directive in php.ini",

61 2 => "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form",

62 3 => "The uploaded file was only partially uploaded",

233

234 for ($i = 0; $i < 2; $i++) {

235 if (!preg_match('/[a-zA-Z0-9_]{1}/', $fileName[$i])) {

236 break;

237 }

page_cities.php (https://gitlab.com/oytunistrator/jobberbase) PHP · 277 lines

1 <?php

2 require_once APP_PATH . '_lib/class.CityDAO.php';

246 $errors['asciiName'] = 'Ascii name';

247 else

248 if (preg_match('/([^a-z0-9\-_]+?)/i', $asciiName))

249 $errors['asciiName'] = 'Ascii name must contain only alphanumerical characters, dashes and underscores';

250 }

datalib_test.php (https://github.com/andreabix/moodle.git) PHP · 161 lines

1 <?php

2 // This file is part of Moodle - http://moodle.org/

3 //

16

17 /**

18 * This file contains tests for some of the code in ../datalib.php.

19 *

20 * @package moodlecore

28

29 global $CFG;

30 require_once(dirname(__FILE__) . '/../lib.php');

31

32

33 /**

34 * Unit tests for some of the code in ../datalib.php.

35 *

36 * @copyright 2009 The Open University

utils.php (https://gitlab.com/ebrjose/comcebu) PHP · 237 lines

1 <?php

2

3 namespace Yoast\WP\Duplicate_Post;

22 $parts = \explode( '.', $version );

23

24 if ( \count( $parts ) === 2 && \preg_match( '/^\d+$/', $parts[1] ) === 1 ) {

25 $parts[] = '0';

26 }

xpdoquery.class.php (https://github.com/modxcms-jp/revolution.git) PHP · 157 lines

1 <?php

2 /*

3 * Copyright 2010-2013 by MODX, LLC.

27

28 /** Include the base {@see xPDOQuery} class */

29 include_once (dirname(dirname(__FILE__)) . '/xpdoquery.class.php');

30

31 /**

55 foreach ($this->query['columns'] as $alias => $column) {

56 $ignorealias = is_int($alias);

57 $escape = !preg_match('/\bAS\b/i', $column) && !preg_match('/\./', $column) && !preg_match('/\(/', $column);

58 if ($escape) {

59 $column= $this->xpdo->escape(trim($column));

Batch.php (https://bitbucket.org/areeves42/openfisma.git) PHP · 248 lines

1 <?php

2 /**

3 * Zend Framework

24 * @see Zend_Service_WindowsAzure_Exception

25 */

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

27

28 /**

29 * @see Zend_Service_WindowsAzure_Storage_BatchStorageAbstract

30 */

31 // require_once 'Zend/Service/WindowsAzure/Storage/BatchStorageAbstract.php';

32

33 /**

207 // Parse response

208 $errors = null;

209 preg_match_all('/<message (.*)>(.*)<\/message>/', $response->getBody(), $errors);

210

211 // Error?

patch.class.php (https://github.com/saePixel/jcore.git) PHP · 242 lines

1 <?php

2 ## PhpPatcher class

9 # files will be created, updated and/or deleted

10

11 define('_PHPP_INVALID_INPUT', 'Invalid input');

12 define('_PHPP_UNEXPECTED_EOF', 'Unexpected end of file');

13 define('_PHPP_UNEXPECTED_ADD_LINE', 'Unexpected add line at line %d');

14 define('_PHPP_UNEXPECTED_REMOVE_LINE', 'Unexpected remove line at line %d');

15 define('_PHPP_INVALID_DIFF', 'Invalid unified diff block');

16 define('_PHPP_FAILED_VERIFY', 'Failed source verification of file %s at line %d');

57 $lines = $this->_linesplit($udiff);

58 if (!isset($lines)) {

59 $this->msg = _PHPP_INVALID_INPUT;

60 return false;

61 }

xpdoquery.class.php (https://github.com/gadamiak/modx-revolution-pl.git) PHP · 157 lines

1 <?php

2 /*

3 * Copyright 2010-2012 by MODX, LLC.

27

28 /** Include the base {@see xPDOQuery} class */

29 include_once (dirname(dirname(__FILE__)) . '/xpdoquery.class.php');

30

31 /**

55 foreach ($this->query['columns'] as $alias => $column) {

56 $ignorealias = is_int($alias);

57 $escape = !preg_match('/\bAS\b/i', $column) && !preg_match('/\./', $column) && !preg_match('/\(/', $column);

58 if ($escape) {

59 $column= $this->xpdo->escape(trim($column));

xpdoquery.class.php (https://github.com/splittingred/revolution.git) PHP · 157 lines

1 <?php

2 /*

3 * Copyright 2010-2014 by MODX, LLC.

27

28 /** Include the base {@see xPDOQuery} class */

29 include_once (dirname(dirname(__FILE__)) . '/xpdoquery.class.php');

30

31 /**

55 foreach ($this->query['columns'] as $alias => $column) {

56 $ignorealias = is_int($alias);

57 $escape = !preg_match('/\bAS\b/i', $column) && !preg_match('/\./', $column) && !preg_match('/\(/', $column);

58 if ($escape) {

59 $column= $this->xpdo->escape(trim($column));

benc.php (https://github.com/cybernet/CyBerFuN-CoDeX.git) PHP · 261 lines

1 <?php

2 ini_set("memory_limit","32M");

3 /*

51

52 Returns the object that results from bdecoding the given string. Note

53 that those aren't real php objects, but merely "objects" as described

54 above. The returned objects have two additional keys: "string" and

55 "strlen". They represent the bencoded form of the returned objects, as

177

178 function bdec($s) {

179 if (preg_match('/^(\d+):/', $s, $m)) {

180 $l = $m[1];

181 $pl = strlen($l) + 1;

186 return array("type" => "string", "value" => $v, "strlen" => strlen($ss), "string" => $ss);

187 }

188 if (preg_match('/^i(\d+)e/', $s, $m)) {

189 $v = $m[1];

190 $ss = "i" . $v . "e";

XLSX.php (https://gitlab.com/VTTE/sitios-vtte) PHP · 178 lines

1 <?php

2

3 namespace Box\Spout\Common\Escaper;

93 for ($charValue = 0x00; $charValue <= 0x1F; $charValue++) {

94 $character = chr($charValue);

95 if (preg_match("/{$this->escapableControlCharactersPattern}/", $character)) {

96 $charHexValue = dechex($charValue);

97 $escapedChar = '_x' . sprintf('%04s' , strtoupper($charHexValue)) . '_';

104

105 /**

106 * Converts PHP control characters from the given string to OpenXML escaped control characters

107 *

108 * Excel escapes control characters with _xHHHH_ and also escapes any

121

122 // if no control characters

123 if (!preg_match("/{$this->escapableControlCharactersPattern}/", $escapedString)) {

124 return $escapedString;

125 }

Curl.php (https://gitlab.com/daigiangaitu91/magento) PHP · 196 lines

1 <?php

2 /**

3 * Copyright © 2015 Magento. All rights reserved.

47 * @return array

48 *

49 * @SuppressWarnings(PHPMD.NPathComplexity)

50 * @SuppressWarnings(PHPMD.CyclomaticComplexity)

187 protected function getData($regularExpression, $response, $isJson = false)

188 {

189 preg_match($regularExpression, $response, $matches);

190 if (!isset($matches[1])) {

191 throw new \Exception("Can't find data in response by regular expression \"{$regularExpression}\".");

xpdoquery.class.php (https://github.com/pixelchutes/revolution.git) PHP · 157 lines

1 <?php

2 /*

3 * Copyright 2010-2015 by MODX, LLC.

27

28 /** Include the base {@see xPDOQuery} class */

29 include_once (dirname(dirname(__FILE__)) . '/xpdoquery.class.php');

30

31 /**

55 foreach ($this->query['columns'] as $alias => $column) {

56 $ignorealias = is_int($alias);

57 $escape = !preg_match('/\bAS\b/i', $column) && !preg_match('/\./', $column) && !preg_match('/\(/', $column);

58 if ($escape) {

59 $column= $this->xpdo->escape(trim($column));

TestLoader.php (https://gitlab.com/merial/WETE_Ryhma3) PHP · 231 lines

62 {

63 if (!file_exists($path)

64 && substr(strtolower($path), -strlen('.php')) !== '.php'

65 && file_exists($newPath = $path . '.php')

93

94 foreach (self::$formats as $format) {

95 if (preg_match("~$format.php$~", $path)) {

96 call_user_func([$this, "add$format"], $path);

97 return;

115 foreach (self::$formats as $format) {

116 $formatFinder = clone($finder);

117 $testFiles = $formatFinder->name("*$format.php");

118 foreach ($testFiles as $test) {

119 $pathname = str_replace("//", "/", $test->getPathname());

202 }

203

204 protected function enhancePhpunitTest(\PHPUnit_Framework_TestCase $test)

205 {

206 $className = get_class($test);

StringParser.php (git://github.com/egeniq/adapto.git) PHP · 213 lines

1 <?php

2 /**

3 * This file is part of the Adapto Toolkit.

153 {

154 $matches = array();

155 preg_match_all("/\[[^\]]*\]|[^[]+/", $this->m_string, $matches);

156 return $matches;

157 }

ComponentContainer.php (git://github.com/jakubkulhan/shopaholic.git) PHP · 271 lines

1 <?php

2

3 /**

9 * with this package in the file license.txt.

10 *

11 * For more information please see http://nettephp.com

12 *

13 * @copyright Copyright (c) 2004, 2009 David Grudl

14 * @license http://nettephp.com/license Nette license

15 * @link http://nettephp.com

16 * @category Nette

17 * @package Nette

18 * @version $Id: ComponentContainer.php 234 2009-03-26 21:19:54Z david@grudl.com $

19 */

20

Database.php (https://github.com/Fanli2012/lqycms.git) PHP · 209 lines

1 <?php

2

3 namespace App\Common\Utils;

184 for ($i = 0; $i < 1000; $i++) {

185 $sql .= $this->config['compress'] ? gzgets($gz) : fgets($gz);

186 if (preg_match('/.*;$/', trim($sql))) {

187 //if(false !== $db->query($sql)){

188 if (false !== Db::execute($sql)) {

DateTime.php (https://hg01.codeplex.com/odataphpproducer) PHP · 234 lines

1 <?php

2 /**

3 * Type to represent DateTime

4 *

5 * PHP version 5.3

6 *

7 * @category ODataProducer

8 * @package ODataProducer_Providers_Metadata_Type

9 * @author Anu T Chandy <odataphpproducer_alias@microsoft.com>

10 * @copyright 2011 Microsoft Corp. (http://www.microsoft.com)

11 * @license New BSD license, (http://www.opensource.org/licenses/bsd-license.php)

12 * @version SVN: 1.0

13 * @link http://odataphpproducer.codeplex.com

14 *

15 */

class.ilGlobalCacheService.php (https://github.com/ILIAS-eLearning/ILIAS.git) PHP · 331 lines

1 <?php

2

3 /**

220 $matches = array();

221 $memory_limit = $this->getMemoryLimit();

222 if (preg_match('/([0-9]*)([M|K])/uism', $memory_limit, $matches)) {

223 switch ($matches[2]) {

224 case 'M':

Converter.php (https://github.com/magento/magento2-functional-testing-framework.git) PHP · 218 lines

1 <?php

2 /**

3 * Copyright © Magento, Inc. All rights reserved.

83 * @param \DOMNodeList|array $elements

84 * @return array

85 * @SuppressWarnings(PHPMD.CyclomaticComplexity)

86 * @TODO ported magento code - to be refactored later

87 */

207 {

208 if (is_numeric($nodeValue)) {

209 if (preg_match('/^\d+$/', $nodeValue)) {

210 $nodeValue = (int) $nodeValue;

211 } else {

functions_mysqli.php (https://github.com/ryzom/ryzomcore.git) PHP · 302 lines

1 <?php

2 /***************************************************************************

3 * mysql.php

4 * -------------------

5 * begin : Saturday, Feb 13, 2001

6 * copyright : (C) 2001 The phpBB Group

7 * email : support@phpbb.com

8 *

9 * $Id: functions_mysql.php,v 1.2 2006/07/06 15:17:22 powles Exp $

10 *

11 ***************************************************************************/

22 /***************************************************************************

23 *

24 * NOTE: this is striped down version from phpBB mysql.php file

25 * modified to work with mysqli

26 *

StatsQuery.php (https://github.com/benaich/Doctors.git) PHP · 138 lines

1 <?php

2 namespace Ben\UserBundle\Stats;

3

11 $pattern = '#^[0-9]{4}/[0-9]{1,2}/[0-9]{1,2} - [0-9]{4}/[0-9]{1,2}/[0-9]{1,2}$#';

12 $this->rangeDate = '';

13 if (preg_match($pattern, $daterange)) {

14 $date = explode("-", $daterange);

15 $this->dateFrom = $date[0];

wfNotification.php (https://bitbucket.org/youresolutions/sheffieldcareservices.yes1.co.uk.git) PHP · 160 lines

1 <?php

2 class wfNotification {

3 const PRIORITY_LOW = 1500;

59 $category = $n->category;

60

61 if (preg_match('/^release/i', $category) && !$notification_productUpdates) { $n->markAsRead(); }

62 if (preg_match('/^digest/i', $category) && !$notification_blogHighlights) { $n->markAsRead(); }

63 if (preg_match('/^alert/i', $category) && !$notification_securityAlerts) { $n->markAsRead(); }

64 if (preg_match('/^promo/i', $category) && !$notification_promotions) { $n->markAsRead(); }

114 $notification_scanStatus = wfConfig::get('notification_scanStatus');

115

116 if (preg_match('/^release/i', $category) && !$notification_productUpdates) { return; }

117 if (preg_match('/^digest/i', $category) && !$notification_blogHighlights) { return; }

118 if (preg_match('/^alert/i', $category) && !$notification_securityAlerts) { return; }

119 if (preg_match('/^promo/i', $category) && !$notification_promotions) { return; }

Array.php (git://github.com/atk4/atk4.git) PHP · 212 lines

1 <?php

2 /**

3 * Undocumented

180 case 'like':

181 $pattern = '/^' . str_replace('%', '.*', preg_quote($expected, '/')) . '$/i';

182 return (bool) preg_match($pattern, $value);

183 default:

184 throw $this->exception('Unknown operator')

ShallowParser.php (https://bitbucket.org/leiweiqiang/tra-ai-pm.git) PHP · 233 lines

1 <?php

2

3 /* vim: set shiftwidth=2 expandtab softtabstop=2: */

114

115 private function _initializeHeredoc($result) {

116 if (preg_match('/^([\'"]?)([a-z_][a-z0-9_]*)\\1/i', $result->buffer, $match)) {

117 $docId = $match[2];

118 $result->stmt .= $match[0];

128

129 private function _scanWsp($result) {

130 if (preg_match('/^\s+/', $result->buffer, $match)) {

131 if (!empty($result->statements) && $result->stmt === '') {

132 $result->statements[] = array_pop($result->statements) . $match[0];

144 private function _scanEscapedChar($result) {

145 if (($result->state == '"' || $result->state == "'")

146 && preg_match('/^[^' . $result->state . ']*?\\\\./s', $result->buffer, $match)) {

147

148 $result->stmt .= $match[0];

context.php (git://github.com/m3talsmith/php-liquid.git) PHP · 326 lines

1 <?php

2 /**

3 * Liquid for PHP

6 * @copyright Copyright (c) 2006 Mateo Murphy,

7 * based on Liquid for Ruby (c) 2006 Tobias Luetke

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

9 *

10 */

186 }

187

188 if (preg_match('/^\'(.*)\'$/', $key, $matches)) {

189 return $matches[1];

190 }

191

192 if (preg_match('/^"(.*)"$/', $key, $matches)) {

193 return $matches[1];

194 }

pbxt.lib.php (https://github.com/SniperOJ/Attack-Defense-Challenges.git) PHP · 141 lines

1 <?php

2 /* vim: set expandtab sw=4 ts=4 sts=4: */

3 /**

4 * @package PhpMyAdmin-Engines

5 */

6

7 if (! defined('PHPMYADMIN')) {

8 exit;

9 }

11 /**

12 * the MyISAM storage engine

13 * @package PhpMyAdmin-Engines

14 */

15 class PMA_StorageEngine_pbxt extends PMA_StorageEngine

Regex.php (https://bitbucket.org/dannyelps/rea.git) PHP · 319 lines

1 <?php

2

3 /*

62 public static function create($expr)

63 {

64 if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {

65 $start = substr($m[1], 0, 1);

66 $end = substr($m[1], -1);

67

68 if (

69 ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))

70 || ('{' === $start && '}' === $end)

71 || ('(' === $start && ')' === $end)

CreditCard.php (https://github.com/inacho/php-credit-card-validator.git) PHP · 228 lines

1 <?php

2

3 /**

132 $month = str_pad($month, 2, '0', STR_PAD_LEFT);

133

134 if (! preg_match('/^20\d\d$/', $year)) {

135 return false;

136 }

137

138 if (! preg_match('/^(0[1-9]|1[0-2])$/', $month)) {

139 return false;

140 }

154 {

155 foreach (self::$cards as $type => $card) {

156 if (preg_match($card['pattern'], $number)) {

157 return $type;

158 }

Request.php (https://gitlab.com/dkatolicky/zacatecnice) PHP · 334 lines

1 <?php

2

3 /**

314 $s = strtr($s, '_', '-'); // cs_CZ means cs-CZ

315 rsort($langs); // first more specific

316 preg_match_all('#(' . implode('|', $langs) . ')(?:-[^\s,;=]+)?\s*(?:;\s*q=([0-9.]+))?#', $s, $matches);

317

318 if (!$matches[0]) {

capabilities.php (https://github.com/weissms/owb-mirror.git) PHP · 485 lines

1 <?php

2

3 class WP_Roles {

223

224 function level_reduction($max, $item) {

225 if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {

226 $level = intval($matches[1]);

227 return max($max, $level);

Curl.php (https://bitbucket.org/crismablanco/magento.git) PHP · 196 lines

1 <?php

2 /**

3 * Copyright © Magento, Inc. All rights reserved.

47 * @return array

48 *

49 * @SuppressWarnings(PHPMD.NPathComplexity)

50 * @SuppressWarnings(PHPMD.CyclomaticComplexity)

187 protected function getData($regularExpression, $response, $isJson = false)

188 {

189 preg_match($regularExpression, $response, $matches);

190 if (!isset($matches[1])) {

191 throw new \Exception("Can't find data in response by regular expression \"{$regularExpression}\".");

validate.php (https://bitbucket.org/cisash/fananeen.git) PHP · 422 lines

1 <?php

2 require_once dirname(__FILE__) . '/validation-cakephp.php';

3

4 /**

62 $check = call_user_func_array(array('Wpcf_Validate', $method),

63 array($v, $value));

64 // Use CakePHP method

65 } else if ((isset(self::$_cake_aliases[$method])

66 && is_callable(array('Wpcf_Cake_Validation', self::$_cake_aliases[$method])))

148 private static function _set_messages()

149 {

150 // Set outside in /admin.php

151 self::$messages = wpcf_admin_validation_messages();

152 }

240 public static function rewriteslug($args, $value)

241 {

242 if (preg_match('#[^a-zA-Z0-9\/\_\-\%]#', $value) === false) {

243 return array(

244 'error' => 1,

ApiController.php (https://github.com/sitegeist/Sitegeist.Monocle.git) PHP · 204 lines

1 <?php

2 namespace Sitegeist\Monocle\Controller;

3

191 {

192 foreach ($prototypeStructures as $structure) {

193 if (preg_match(sprintf('!%s!', $structure['match']), $prototypeName)) {

194 return $structure;

195 }

VersionInformation.php (https://bitbucket.org/dprograma/laravelweb.git) PHP · 228 lines

11 use stdClass;

12

13 if (!defined('PHPMYADMIN')) {

14 exit;

15 }

136 * Returns the version and date of the latest phpMyAdmin version compatible

137 * with the available PHP and MySQL versions

138 *

139 * @param array $releases array of information related to each version

144 {

145 foreach ($releases as $release) {

146 $phpVersions = $release->php_versions;

147 $phpConditions = explode(",", $phpVersions);

148 foreach ($phpConditions as $phpCondition) {

149 if (! $this->evaluateVersionCondition("PHP", $phpCondition)) {

150 continue 2;

151 }

Helper.php (https://gitlab.com/x33n/ImpressPages) PHP · 233 lines

1 <?php

2 /**

3 * @package ImpressPages

194 } elseif ($page->getRedirectUrl()) {

195 $url = $page->getRedirectUrl();

196 if (!preg_match('/^((http|https):\/\/)/i', $url)) {

197 $url = 'http://' . $url;

198 }

formvars.php (https://github.com/craigk5n/webcalendar.git) PHP · 203 lines

1 <?php

2

3 /**

4 * WebCalendar's functions to retrieve Predefined Variables

5 *

6 * See http://www.php.net/manual/en/reserved.variables.php

7 * for a complete description and examples

8 *

35 'preventHacking_helper', $instr[$j]);

36 for ( $i = 0; $i < count ( $bannedTags ) && ! $failed; $i++ ) {

37 if ( preg_match ( "/<\s*$bannedTags[$i]/i", $teststr ) ) {

38 $failed = true;

39 }

50 'preventHacking_helper', $instr);

51 for ( $i = 0; $i < count ( $bannedTags ) && ! $failed; $i++ ) {

52 if ( preg_match ( "/<\s*$bannedTags[$i]/i", $teststr ) ) {

53 $failed = true;

54 }

Base.php (https://gitlab.com/jamie/ussocialforum.git) PHP · 245 lines

1 <?php

2 /*

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

217

218 foreach ($excludeStrings as $string) {

219 if (preg_match('/(\s' . $string . ')|(' . $string . '\s)/i', $sql)) {

220 CRM_Core_Error::fatal(ts('Found illegal \'%1\' string in SQL clause.',

221 array(1 => $string)

voucher_theme.php (https://bitbucket.org/DidenkoDima/opta.git) PHP · 152 lines

1 <?php

2 class ModelSaleAqeVoucherTheme extends Model {

3 protected static $count = 0;

121 public function filterInterval($filter, $field, $date=false) {

122 if ($date) {

123 if (preg_match('/^(!=|<>)\s*(\d{2,4}-\d{1,2}-\d{1,2})$/', html_entity_decode(trim($filter)), $matches) && count($matches) == 3) {

124 return "DATE($field) <> DATE('" . $matches[2] . "')";

125 } else if (preg_match('/^(\d{2,4}-\d{1,2}-\d{1,2})\s*(<|<=)\s*(\d{2,4}-\d{1,2}-\d{1,2})$/', html_entity_decode(trim($filter)), $matches) && count($matches) == 4 && strtotime($matches[1]) <= strtotime($matches[3])) {

126 return "DATE('" . $matches[1] . "') ${matches[2]} DATE($field) AND DATE($field) ${matches[2]} DATE('" . $matches[3] . "')";

127 } else if (preg_match('/^(\d{2,4}-\d{1,2}-\d{1,2})\s*(>|>=)\s*(\d{2,4}-\d{1,2}-\d{1,2})$/', html_entity_decode(trim($filter)), $matches) && count($matches) == 4 && strtotime($matches[1]) >= strtotime($matches[3])) {

128 return "DATE('" . $matches[1] . "') ${matches[2]} DATE($field) AND DATE($field) ${matches[2]} DATE('" . $matches[3] . "')";

129 } else if (preg_match('/^(<|<=|>|>=)\s*(\d{2,4}-\d{1,2}-\d{1,2})$/', html_entity_decode(trim($filter)), $matches) && count($matches) == 3) {

130 return "DATE($field) ${matches[1]} DATE('" . $matches[2] . "')";

131 } else if (preg_match('/^(\d{2,4}-\d{1,2}-\d{1,2})\s*(>|>=|<|<=)$/', html_entity_decode(trim($filter)), $matches) && count($matches) == 3) {

132 return "DATE('" . $matches[1] . "') ${matches[2]} DATE($field)";

133 } else {

CakeValidationRule.php (https://bitbucket.org/ManiAdil/jardinorient.git) PHP · 352 lines

1 <?php

2 /**

3 * CakeValidationRule.

7 * PHP versions 5

8 *

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

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

11 *

14 *

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

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

17 * @package Cake.Model.Validator

18 * @since CakePHP(tm) v 2.2.0

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

20 */

21

DefList.php (https://github.com/pear2/Text_Markdown.git) PHP · 255 lines

1 <?php

2 /**

3 *

21 * @package Markdown_Extra

22 *

23 * @author Michel Fortin <http://www.michelf.com/projects/php-markdown/>

24 *

25 * @author Paul M. Jones <pmjones@solarphp.com>

26 *

27 * @license http://opensource.org/licenses/bsd-license.php BSD

28 *

29 * @version $Id: DefList.php 4531 2010-04-12 17:23:56Z pmjones $

243 $def = $matches[2];

244

245 if ($leading_line || preg_match('/\n{2,}/', $def)) {

246 $def = $this->_processBlocks($this->_outdent($def . "\n\n"));

247 $def = "\n". $def ."\n";

field.php (https://gitlab.com/redring-co-in/redring_website.git) PHP · 298 lines

1 <?php

2 /**

3 * @version $Id$

180 return $default;

181 } else {

182 if ( preg_match( '/<[^\>]+>/', $default ) ) {

183 echo '' . $default;

184 } else {

230

231 // Get path to template file

232 $file = WR_CF_Loader::get_path( "form/field/tmpl/{$tpl}.php" );

233

234 if ( empty( $file ) ) {

235 $file = WR_CF_Loader::get_path( 'form/field/tmpl/text.php' );

236 }

237

TableTest.php (https://gitlab.com/DEVLINE/magento2.git) PHP · 213 lines

1 <?php

2 /**

3 * Copyright © 2015 Magento. All rights reserved.

10 namespace Magento\Test\Legacy;

11

12 class TableTest extends \PHPUnit_Framework_TestCase

13 {

14 public function testTableName()

33 $this->assertEmpty($message, $message);

34 },

35 \Magento\Framework\Test\Utility\Files::init()->getPhpFiles()

36 );

37 }

51 foreach ($regexpMethods as $method) {

52 $regexp = self::$method($filePath);

53 if (!preg_match_all($regexp, $content, $matches, PREG_SET_ORDER)) {

54 continue;

55 }

CreateConfigurable.php (https://gitlab.com/DEVLINE/magento2.git) PHP · 168 lines

1 <?php

2 /**

3 * Copyright © 2015 Magento. All rights reserved.

163 throw new \Exception("Product creation by curl handler was not successful! Response: $response");

164 }

165 preg_match("~Location: [^\s]*\/id\/(\d+)~", $response, $matches);

166 return isset($matches[1]) ? $matches[1] : null;

167 }

Http.php (https://github.com/Exercise/zf2.git) PHP · 266 lines

1 <?php

2 /**

3 * Zend Framework

235 'Could not retrieve a valid Token response from Token URL:'

236 . ($response !== null

237 ? PHP_EOL . $response->getBody()

238 : ' No body - check for headers')

239 );

254 $headerValue[] = 'OAuth realm="' . $realm . '"';

255 foreach ($params as $key => $value) {

256 if (!preg_match("/^oauth_/", $key)) {

257 continue;

258 }

BreakpointGroup.php (https://github.com/jessebeach/drupal.git) PHP · 215 lines

1 <?php

2

3 /**

137 }

138 // Check for illegal characters in breakpoint group source.

139 if (preg_match('/[^a-z_]+/', $this->source) || empty($this->source)) {

140 throw new InvalidBreakpointSourceException(format_string("Invalid value '@source' for breakpoint group source property. Breakpoint group source property can only contain lowercase letters and underscores.", array('@source' => $this->source)));

141 }

142 // Check for illegal characters in breakpoint group name.

143 if (preg_match('/[^a-z0-9_]+/', $this->name || empty($this->name))) {

144 throw new InvalidBreakpointNameException(format_string("Invalid value '@name' for breakpoint group name property. Breakpoint group name property can only contain lowercase letters, numbers and underscores.", array('@name' => $this->name)));

145 }

ResponseHeader.php (https://github.com/komola/ZendFramework.git) PHP · 400 lines

23 /** @see PHPUnit_Framework_Constraint */

24 require_once 'PHPUnit/Framework/Constraint.php';

25

26 /**

123

124 if (!in_array($assertType, $this->_assertTypes)) {

125 require_once 'Zend/Test/PHPUnit/Constraint/Exception.php';

126 throw new Zend_Test_PHPUnit_Constraint_Exception(sprintf('Invalid assertion type "%s" provided to %s constraint', $assertType, __CLASS__));

145 case self::ASSERT_HEADER:

146 if (3 > $argc) {

147 require_once 'Zend/Test/PHPUnit/Constraint/Exception.php';

148 throw new Zend_Test_PHPUnit_Constraint_Exception('No header provided against which to match');

190 public function fail($other, $description, $not = false)

191 {

192 require_once 'Zend/Test/PHPUnit/Constraint/Exception.php';

193 switch ($this->_assertType) {

194 case self::ASSERT_RESPONSE_CODE:

Router.php (https://bitbucket.org/jnewing/egs.git) PHP · 298 lines

1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

2

3 class CI_Router {

48 }

49

50 if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))

51 {

52 include(APPPATH.'config/'.ENVIRONMENT.'/routes.php');

53 }

54 elseif (is_file(APPPATH.'config/routes.php'))

55 {

56 include(APPPATH.'config/routes.php');

140 }

141

142 if (file_exists(APPPATH.'controllers/'.$segments[0].'.php'))

143 {

144 return $segments;

basemodel.php (https://github.com/mithereal/yii-runends-template.git) PHP · 242 lines

13 */

14 ?>

15 <?php echo "<?php\n"; ?>

16

17 /**

55 <?php endforeach; ?>

56 */

57 abstract class <?php echo 'Base' . $modelClass; ?> extends <?php echo $this->baseClass."\n"; ?>

58 {

59 <?php

98 public function getItemLabel()

99 {

100 return (string) $this-><?php

101 $found = false;

102 foreach($columns as $name => $column) {

ElementLiteral.php (https://gitlab.com/src-run/scrible) PHP · 310 lines

1 <?php

2

3 namespace Scribe\Jabiru\Component\Element;

224 public function match($pattern, &$matches = null)

225 {

226 return (bool) preg_match($pattern, $this->text, $matches) > 0 ? true : false;

227 }

228

257

258 // @codeCoverageIgnoreStart

259 return preg_match_all("/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/", $this->text);

260 // @codeCoverageIgnoreEnd

261 }

Signature.php (https://github.com/miamiruby/cakestuff.git) PHP · 179 lines

1 <?php

2

3 class ZendL_Tool_Rpc_Provider_Signature

122 $actionableMethods[$methodName]['methodName'] = $methodName;

123

124 if (preg_match($specialtyRegex, $actionableName, $matches)) {

125 $actionableMethods[$methodName]['actionName'] = $matches[1];

126 $actionableMethods[$methodName]['specialty'] = $matches[2];

149

150 if (($docComment = $method->getDocComment()) != '' &&

151 (preg_match_all('/@param\s+(\w+)+\s+(\$\S+)\s+(.*?)(?=(?:\*\s*@)|(?:\*\/))/s', $docComment, $matches)))

152 {

153 for ($i=0; $i <= count($matches[0])-1; $i++) {

AbstractResource.php (https://github.com/unarmedwombat/php-opencloud.git) PHP · 228 lines

1 <?php

2 /**

3 * Copyright 2012-2014 Rackspace US, Inc.

103 $pattern = sprintf('#^%s\-#i', self::GLOBAL_METADATA_PREFIX);

104

105 return preg_match($pattern, $header);

106 }

107

Input.php (https://github.com/bhaumik25/zend-framework.git) PHP · 532 lines

1 <?php

2 /**

3 * Zend Framework

25 * @see Zend_Filter

26 */

27 require_once 'Zend/Filter.php';

28

29

471 /**

472 * Returns value if it matches $pattern, FALSE otherwise. Uses

473 * preg_match() for the matching.

474 *

475 * @deprecated since 0.8.0

BaseCobaQuery.php (https://bitbucket.org/faisaluje/tugasku.git) PHP · 320 lines

1 <?php

2

3

47 *

48 * @param string $dbName The dabase name

49 * @param string $modelName The phpName of a model, e.g. 'Book'

50 * @param string $modelAlias The alias for the model in this query, e.g. 'b'

51 */

177 if (is_array($nama)) {

178 $comparison = Criteria::IN;

179 } elseif (preg_match('/[\%\*]/', $nama)) {

180 $nama = str_replace('*', '%', $nama);

181 $comparison = Criteria::LIKE;

199 if (is_array($deskripsi)) {

200 $comparison = Criteria::IN;

201 } elseif (preg_match('/[\%\*]/', $deskripsi)) {

202 $deskripsi = str_replace('*', '%', $deskripsi);

203 $comparison = Criteria::LIKE;

Parser.php (https://github.com/humansky/qframe.git) PHP · 219 lines

1 <?php

2 /**

3 * This file is part of the CSI SIG.

24

25 /** Haml_Line */

26 require_once 'Haml/Line.php';

27

28

29 /** Haml_Element */

30 require_once 'Haml/Element.php';

31

32

33 /** Haml_Prolog */

34 require_once 'Haml/Prolog.php';

35

36

utf8_functions.php (https://gitlab.com/truongdacngoc1993/tuanviet.git) PHP · 303 lines

1 <?php

2

3 /**

136 }

137

138 preg_match_all( '/.{' . $split_len . '}|[^\x00]{1,' . $split_len . '}$/us', $str, $ar );

139 return $ar[0];

140 }

156 }

157

158 preg_match( '/^[' . $mask . ']+/u', $str, $matches );

159

160 if( isset( $matches[0] ) )

185

186 default:

187 preg_match( '/^(.{1})(.*)$/us', $str, $matches );

188 return nv_strtoupper( $matches[1] ) . $matches[2];

189 break;

template.php (https://bitbucket.org/magnusmanske/magnustools.git) PHP · 326 lines

1 <?php

2

3 /**

5 * @author Soxred93 <soxred93@gmail.com>

6 * @copyright Copyright (c) 2009, Sam Korn

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

8 */

9

71

72 $name = "(?i:" . substr(preg_quote($name,'/'),0,1) . ")" . substr($name,1);

73 preg_match("/\{\{" . $name . "\s*(?:(?:\|.*)|(?:\}.*))/s",$text,$match);

74 if (isset($match[0])) {

75 $from = stripos($text,$match[0]);

103 }

104

105 preg_match('/(\{\{\s*)([^|}]*)(.*)/s',$this->templatestring,$match);

106

107 $this->open = $match[1];

dbsource_admin.php (https://github.com/zstulc/myproject.git) PHP · 127 lines

1 <?php

2 defined('IN_PHPCMS') or exit('No permission resources.');

29 $charset = isset($_POST['charset']) && in_array(trim($_POST['charset']), array('gbk','utf8', 'gb2312', 'latin1')) ? trim($_POST['charset']) : showmessage(L('charset').L('illegal_parameters'));

30 $siteid = $this->get_siteid();

31 if (!preg_match('/^\\w+$/i', $name)) {

32 showmessage(L('data_source_of_the_letters_and_figures'));

33 }

scope.php (https://github.com/DeprecatedCode/Logical-HTML-PHP.git) PHP · 317 lines

1 <?php

2

3 namespace Evolution\LHTML;

264 if(strpos($content, '{') === false) return array();

265 // parse out the variables

266 preg_match_all(

267 "/{([\w:|.\,\(\)\/\-\% \[\]\?'=]+?)}/", //regex

268 $content, // source

283 if(strpos($content, '[') === false) return array();

284 // parse out the variables

285 preg_match_all(

286 "/\[([\w:|.\,\(\)\/\-\% \[\]\?'=]+?)\]/", //regex

287 $content, // source

301 if(strpos($content, '(') === false) return array();

302 // parse out the variables

303 preg_match_all(

304 "/([\w]+?)\(([\w:|.\,=@\(\)\/\-\%& ]*?)\)/", //regex

305 $content, // source

SpdxLicense.php (https://gitlab.com/sea-light/composer.git) PHP · 233 lines

1 <?php

2

3 /*

158

159 foreach ($tokens as $name => $token) {

160 if (false === $r = preg_match('{' . $token . '}', $license, $matches, PREG_OFFSET_CAPTURE, $offset)) {

161 throw new \RuntimeException('Pattern for token %s failed (regex error).', $name);

162 }

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

1 <?php

2 /**

3 * File containing the eZISBN10To13Converter class.

274

275 // If the number only consists of hyphen, it should be emty.

276 if ( preg_match( "/^\-+$/", $isbnValue ) )

277 {

278 $emtyValue = '';

URINorm.php (https://gitlab.com/x33n/ampache) PHP · 249 lines

1 <?php

2

3 /**

10 */

11

12 require_once 'Auth/Yadis/Misc.php';

13

14 // from appendix B of rfc 3986 (http://www.ietf.org/rfc/rfc3986.txt)

143 {

144 $uri_matches = array();

145 preg_match(Auth_OpenID_getURIPattern(), $uri, $uri_matches);

146

147 if (count($uri_matches) < 9) {

152

153 $illegal_matches = array();

154 preg_match(Auth_OpenID_getURLIllegalCharRE(),

155 $uri, $illegal_matches);

156 if ($illegal_matches) {

html.helper.php (https://github.com/SeanJA/ShoestringPHP.git) PHP · 214 lines

1 <?php

2

3 /**

18 }

19 $linkTypes = array('https?:\/\/','mailto:','git:\/\/','git@','ftps?:\/\/');

20 if(!preg_match('/^('.implode('|', $linkTypes).')/', $url)) {

21 $url = $config->base_url.$config->index_file.$url;

22 }

124 */

125 function css($file, array $media=array('all'), $echo) {

126 if(preg_match('/^(https?:\/\//)', $file)) {

127 $str = '<link rel="stylesheet" type="text/css" href="'.h($file, false).'"';

128 } else {

145 */

146 function js($file) {

147 if(preg_match('/^(https?:\/\//)', $file)) {

148 $str = '<script type="text/javascript" src="'.h($file, false).'" ></script>';

149 } else {

settings.php (https://github.com/mgsisk/webcomic.git) PHP · 324 lines

1 <?php

2 /**

3 * Transcribe settings functionality

176 "{$collection}_settings",

177 "{$collection}_transcribe", [

178 'file' => __DIR__ . '/settings-inc-field-comics.php',

179 'option' => webcomic( "option.{$collection}.transcribe_comic" ),

180 'option_close' => webcomic( "option.{$collection}.transcribe_close" ),

202 "{$collection}_settings",

203 "{$collection}_transcribe", [

204 'file' => __DIR__ . '/settings-inc-field-permissions.php',

205 'option' => webcomic( "option.{$collection}.transcribe_require" ),

206 'option_publish' => webcomic( "option.{$collection}.transcribe_publish" ),

229 "{$collection}_settings",

230 "{$collection}_transcribe", [

231 'file' => __DIR__ . '/settings-inc-field-notifications.php',

232 'option' => webcomic( "option.{$collection}.transcribe_alert_pub" ),

233 'option_mod' => webcomic( "option.{$collection}.transcribe_alert_mod" ),

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

1 <?php

2 /**

3 * File containing the ezcWebdavServerConfigurationManager class.

129 foreach ( $this as $transportConfiguration )

130 {

131 if ( preg_match( $transportConfiguration->userAgentRegex, $userAgent ) > 0 )

132 {

133 $transportConfiguration->configure( $server );

latex.php (https://github.com/itamart/moodle.git) PHP · 171 lines

1 <?php

2 // latex.php

49 $doc .= "\\begin{document}\n";

50 //dlnsk $doc .= "$ {$formula} $\n";

51 if (preg_match("/^[[:space:]]*\\\\begin\\{(gather|align|alignat|multline).?\\}/i",$formula)) {

52 $doc .= "$formula\n";

53 } else {

Request.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 289 lines

1 <?php

2 /**

3 * Zend Framework

164 public function setMethod($name)

165 {

166 if (!preg_match($this->_methodRegex, $name)) {

167 $this->_isMethodError = true;

168 } else {

248 public function loadJson($json)

249 {

250 #require_once 'Zend/Json.php';

251 $options = Zend_Json::decode($json);

252 $this->setOptions($options);

274 }

275

276 #require_once 'Zend/Json.php';

277 return Zend_Json::encode($jsonArray);

278 }

content_actionhandler.php (https://github.com/SylvainGuittard/ezlightbox.git) PHP · 364 lines

1 <?php

2 //

3 // Created on: <2007-11-21 13:01:28 ab>

93 }

94 else if ( $http->hasSessionVariable( 'LastAccessesURI' ) &&

95 !preg_match( '/\b\(type\)\b/', $http->sessionVariable( 'LastAccessesURI' ) )

96 )

97 {

Csv.php (https://bitbucket.org/delta98/csv-consumer.git) PHP · 273 lines

1 <?php

2

3 /**

103 * Set Resource used to open file

104 *

105 * @see http://php.net/manual/en/function.fgetcsv.php

106 * @param resource $resource

107 */

253 {

254 // Check for an underscore in the Column Header

255 if(preg_match('/^[a-z0-9]+_[a-z0-9]+$/i', ucwords($header)))

256 {

257 // Split header by underscore to separate strings

ColumnValidator.php (https://bitbucket.org/rejem/wheeldb.git) PHP · 168 lines

1 <?php

2 namespace WDB\Validation;

3 use WDB,

119 break;

120 case ColumnRules::INTEGER:

121 $this->assert($c,$r,$f,preg_match('~[+-]?[0-9]+~', trim($value)));

122 break;

123 case ColumnRules::FLOAT:

137 break;

138 case ColumnRules::PATTERN:

139 $this->assert($c,$r,$f,$isEmpty || preg_match($rule['argument'], $value));

140 break;

141 case ColumnRules::EQUALTO:

Request.php (https://bitbucket.org/netglue/zf-1.12-release.git) PHP · 289 lines

1 <?php

2 /**

3 * Zend Framework

164 public function setMethod($name)

165 {

166 if (!preg_match($this->_methodRegex, $name)) {

167 $this->_isMethodError = true;

168 } else {

248 public function loadJson($json)

249 {

250 require_once 'Zend/Json.php';

251 $options = Zend_Json::decode($json);

252 $this->setOptions($options);

274 }

275

276 require_once 'Zend/Json.php';

277 return Zend_Json::encode($jsonArray);

278 }

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";*/

fsource_Smarty_plugins_smartypluginsmodifier.regex_replace.php.html (https://github.com/lilin01/haha.git) HTML · 52 lines

10 <h1>Source for file modifier.regex_replace.php</h1>

11 <p>Documentation is available at <a href="../Smarty/plugins/_smarty_plugins_modifier_regex_replace_php.html">modifier.regex_replace.php</a></p>

12 <div class="src-code">

13 <pre><ol><li><a name="a1"></a><span class="src-php">&lt;?php</span></li>

25 <li><a name="a13"></a><span class="src-doc"> * Name: regex_replace&lt;br&gt;</span></li>

26 <li><a name="a14"></a><span class="src-doc"> * Purpose: regular epxression search/replace</span></li>

27 <li><a name="a15"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@link</span><span class="src-doc"> http://smarty.php.net/manual/en/language.modifier.regex.replace.php</span></li>

28 <li><a name="a16"></a><span class="src-doc"> * regex_replace (Smarty online manual)</span></li>

29 <li><a name="a17"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span></li>

34 <li><a name="a22"></a><span class="src-key">function </span><a href="../Smarty/plugins/_smarty_plugins_modifier_regex_replace_php.html#functionsmarty_modifier_regex_replace">smarty_modifier_regex_replace</a><span class="src-sym">(</span><span class="src-var">$string</span><span class="src-sym">, </span><span class="src-var">$search</span><span class="src-sym">, </span><span class="src-var">$replace</span><span class="src-sym">)</span></li>

35 <li><a name="a23"></a><span class="src-sym">{</span></li>

36 <li><a name="a24"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/preg_match">preg_match</a><span class="src-sym">(</span><span class="src-str">'!\W(\w+)$!s'</span><span class="src-sym">, </span><span class="src-var">$search</span><span class="src-sym">, </span><span class="src-var">$match</span><span class="src-sym">) </span>&amp;&amp; <span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$match</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">, </span><span class="src-str">'e'</span><span class="src-sym">) </span>!== <span class="src-id">false</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>

37 <li><a name="a25"></a> <span class="src-comm">/* remove eval-modifier from $search */</span></li>

38 <li><a name="a26"></a> <span class="src-var">$search </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$search</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span>-<a href="http://www.php.net/strlen">strlen</a><span class="src-sym">(</span><span class="src-var">$match</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)) </span>. <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'e'</span><span class="src-sym">, </span><span class="src-str">''</span><span class="src-sym">, </span><span class="src-var">$match</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>

47 </div>

48 <p class="notes" id="credit">

49 Documentation generated on Wed, 05 Aug 2009 07:45:47 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.0RC3</a>

50 </p>

51 </body>

FileUtilTest.php (https://github.com/tokushima/rhaco1.git) PHP · 146 lines

1 <?php

2 Rhaco::import("util.UnitTest");

3 Rhaco::import("io.FileUtil");

140 foreach($find as $file){

141 $this->assertTrue(Variable::istype("file",$file));

142 $this->assertTrue(true == preg_match("/\.dat$/",$file->name));

143 }

144 }

auspost.php (https://gitlab.com/reclamare/mao) PHP · 161 lines

1 <?php

2 class ControllerShippingAusPost extends Controller {

3 private $error = array();

153 }

154

155 if (!preg_match('/^[0-9]{4}$/', $this->request->post['auspost_postcode'])) {

156 $this->error['postcode'] = $this->language->get('error_postcode');

157 }

Broadcaster.php (https://gitlab.com/madwanz64/laravel) PHP · 330 lines

1 <?php

2

3 namespace Illuminate\Broadcasting\Broadcasters;

149 protected function extractChannelKeys($pattern, $channel)

150 {

151 preg_match('/^'.preg_replace('/\{(.*?)\}/', '(?<$1>[^\.]+)', $pattern).'/', $channel, $keys);

152

153 return $keys;

Inflector.php (https://github.com/cyclonephp/cyclone.git) PHP · 238 lines

1 <?php

2

3 namespace cyclone;

13 * @author Kohana Team

14 * @copyright (c) 2007-2009 Kohana Team

15 * @license http://kohanaphp.com/license

16 */

17 class Inflector {

105 $str = $irregular;

106 }

107 elseif (preg_match('/[sxz]es$/', $str) OR preg_match('/[^aeioudgkprt]hes$/', $str))

108 {

109 // Remove "es"

174 $str = Inflector::$irregular[$str];

175 }

176 elseif (preg_match('/[sxz]$/', $str) OR preg_match('/[^aeioudgkprt]h$/', $str))

177 {

178 $str .= 'es';

RestRequest.class.php (https://bitbucket.org/pixellight/pixellight-intranet.git) PHP · 254 lines

1 <?php

2

3 /**

4 * Project: dcodr

5 * File: RestRequest.class.php

6 */

7

111 $this->requestLength = strlen($this->requestBody);

112

113 $fh = fopen('php://memory', 'rw');

114 fwrite($fh, $this->requestBody);

115 rewind($fh);

168 curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);

169 curl_setopt($curlHandle, CURLOPT_HEADER, true);

170 curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, !preg_match("!^https!i",$this->url));

171 }

172

Folder.php (https://github.com/810/grav.git) PHP · 221 lines

1 <?php

2 namespace Grav\Common\Filesystem;

3

63 /** @var \RecursiveDirectoryIterator $file */

64 foreach ($iterator as $file) {

65 if ($compare && $pattern && !preg_match($pattern, $file->{$compare}())) {

66 continue;

67 }

FileFinder.php (https://github.com/oddnoc/silverstripe-framework.git) PHP · 229 lines

1 <?php

2 /**

3 * A utility class that finds any files matching a set of rules that are

205 protected function acceptFile($basename, $pathname, $depth) {

206 if ($regex = $this->getOption('name_regex')) {

207 if (!preg_match($regex, $basename)) return false;

208 }

209

ImageStyleTest.php (https://gitlab.com/geeta7/drupal) PHP · 242 lines

1 <?php

2

3 /**

21 * The entity type used for testing.

22 *

23 * @var \Drupal\Core\Entity\EntityTypeInterface|\PHPUnit_Framework_MockObject_MockObject

24 */

25 protected $entityType;

28 * The entity manager used for testing.

29 *

30 * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject

31 */

32 protected $entityManager;

44 * @param string $image_effect_id

45 * The image effect ID.

46 * @param \Drupal\image\ImageEffectInterface|\PHPUnit_Framework_MockObject_MockObject $image_effect

47 * The image effect used for testing.

48 *

find_tested.php (https://gitlab.com/envieidoc/tomato) PHP · 222 lines

65 }

66

67 get_phpt_files($extension_test_path, $count, $phpt_files);

68

69 $extension_method_info = mark_methods_as_tested($extension_method_info, $phpt_files);

84 function mark_methods_as_tested($method_info, $phpt_files) {

85

86 foreach($phpt_files as $phpt_file) {

87 $tested_functions = extract_tests($phpt_file);

176 }

177

178 function get_phpt_files($dir, &$phpt_file_count, &$all_phpt)

179 {

180 $thisdir = dir($dir.'/'); //include the trailing slash

183 $path = $thisdir->path.$file;

184 if(is_dir($path) == true) {

185 get_phpt_files($path , $phpt_file_count , $all_phpt);

186 } else {

187 if (preg_match("/\w+\.phpt$/", $file)) {

Db.php (https://github.com/creaminternet/magento2-opensource.git) PHP · 195 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 Magento_Install

23 * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)

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

25 */

26

103 if (!empty($absenteeExtensions)) {

104 throw new \Magento\Core\Exception(

105 __('PHP Extensions "%1" must be loaded.', implode(',', $absenteeExtensions))

106 );

107 }

translations.php (https://gitlab.com/CueFox/cf-utility-pro) PHP · 284 lines

1 <?php

2 /**

3 * Class for a set of entries for translation and their associated headers

4 *

5 * @version $Id: translations.php 718 2012-10-31 00:32:02Z nbachiyski $

6 * @package pomo

7 * @subpackage translations

8 */

9

10 require_once( dirname( __FILE__ ) . '/entry.php' );

11

12 if ( !class_exists( 'Translations' ) ):

160

161 public function nplurals_and_expression_from_header( $header ) {

162 if ( preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches ) ) {

163 $nplurals = ( int )$matches[1];

164 $expression = trim( $this->parenthesize_plural_exression( $matches[2] ) );

restorelib.php (https://github.com/galitush2005/RTL-BIDI-Hebrew-Moodle-Plugins.git) PHP · 243 lines

1 <?php

2

3 function lightboxgallery_restore_mods($mod, $restore) {

118

119 $searchstring = '/\$@(GALLERYINDEX)\*([0-9]+)@\$/';

120 preg_match_all($searchstring, $content, $foundset);

121 if ($foundset[0]) {

122 foreach ($foundset[2] as $old_id) {

124 $searchstring = '/\$@(GALLERYINDEX)\*('.$old_id.')@\$/';

125 if (!empty($rec->new_id)) {

126 $result = preg_replace($searchstring, $CFG->wwwroot.'/mod/lightboxgallery/index.php?id='.$rec->new_id, $result);

127 } else {

128 $result = preg_replace($searchstring, $restore->original_wwwroot.'/mod/lightboxgallery/index.php?id='.$old_id, $result);

132

133 $searchstring = '/\$@(GALLERYVIEWBYID)\*([0-9]+)@\$/';

134 preg_match_all($searchstring, $result, $foundset);

135 if ($foundset[0]) {

136 foreach($foundset[2] as $old_id) {

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

1 <?php

2 /**

3 * Zend Framework

396 public function setHeight($height)

397 {

398 if (!preg_match('/^\d+(em|px|%)?$/i', $height)) {

399 throw new ElementException('Invalid height provided; must be integer or CSS measurement');

400 }

401 if (!preg_match('/(em|px|%)$/', $height)) {

402 $height .= 'px';

403 }

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 }

Driver.php (https://github.com/alexandresalome/PHP-Selenium.git) PHP · 231 lines

1 <?php

2 /*

3 * This file is part of PHP Selenium Library.

64 $response = $this->doExecute('getNewBrowserSession', $type, $startUrl);

65

66 if (preg_match('/^OK,(.*)$/', $response, $vars)) {

67 $this->sessionId = $vars[1];

68 } else {

103 $result = $this->doExecute($command, $target, $value);

104

105 if (!preg_match('/^OK,/', $result)) {

106 throw new Exception("Unexpected response from Selenium server : ".$result);

107 }

mapper.php (https://github.com/agrias/TerpTaskerRed.git) PHP · 239 lines

1 <?php

2

3 namespace OC\Files;

190

191 // if filename contains periods - add index number before last period

192 if (preg_match('~\.[^\.]+$~i',$last,$extension)){

193 array_push($sluggedElements, substr($last,0,-(strlen($extension[0]))).'-'.$index.$extension[0]);

194 } else {

KalturaDocCommentParser.php (https://github.com/richhl/kalturaCE.git) PHP · 243 lines

1 <?php

2 /**

3 * @ignore

153 function KalturaDocCommentParser($comment , $replacements = null)

154 {

155 $this->readOnly = preg_match( self::DOCCOMMENT_READONLY, $comment);

156 $this->insertOnly = preg_match( self::DOCCOMMENT_INSERTONLY, $comment);

157 $this->writeOnly = preg_match( self::DOCCOMMENT_WRITEONLY, $comment);

158 $this->abstract = preg_match( self::DOCCOMMENT_ABSTRACT, $comment);

159 $this->deprecated = preg_match( self::DOCCOMMENT_DEPRECATED, $comment);

160 $this->serverOnly = preg_match( self::DOCCOMMENT_SERVER_ONLY, $comment);

164 {

165 $pattern = str_replace(self::DOCCOMMENT_REPLACENET_PARAM_NAME, $replacements[self::DOCCOMMENT_REPLACENET_PARAM_NAME], self::DOCCOMMENT_PARAM);

166 if (preg_match( $pattern, $comment, $result ))

167 {

168 $this->param = $result[1];

CoreExtension.php (https://github.com/herdani/snowcap-website.git) PHP · 218 lines

1 <?php

2 namespace Snowcap\SiteBundle\Twig\Extension;

3

119 private function closetags($html)

120 {

121 preg_match_all('#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result);

122 $openedtags = $result[1]; #put all closed tags into an array

123

124 preg_match_all('#</([a-z]+)>#iU', $html, $result);

125 $closedtags = $result[1];

126

151 public function isMenuActive($activeController, $controller, $action = null)

152 {

153 preg_match('/\\\([^\\\]+)Controller/', $activeController, $matches);

154 $activeControllerName = $matches[1];

155 if ($action !== null) {

html_helper.php (https://github.com/djalmaaraujo/pian.in.git) PHP · 278 lines

1 <?php

2 /**

3 * Geração automática dos elementos HTML de acordo com os dados passados.

4 *

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

6 * @copyright Copyright 2008-2009, Spaghetti* Framework (http://spaghettiphp.org/)

144 $output = "";

145 foreach($href as $tag):

146 $output .= $this->stylesheet($tag, $attr, true, $full) . PHP_EOL;

147 endforeach;

148 else:

180 $output = "";

181 foreach($src as $tag):

182 $output .= $this->script($tag, $attr, true, $full) . PHP_EOL;

183 endforeach;

184 else:

IndividualEntrepreneurs.php (https://gitlab.com/aintenebris/memoria) PHP · 234 lines

1 <?php

2

3 namespace common\models\organization;

100

101 public function ogrnValidator($attribute, $params){

102 preg_match('/(\d{14})(\d)/', $this->OGRN, $data);

103

104 $tmp1 = floor($data[1] / 13);

114

115 public function innValidator($attribute, $params){

116 preg_match('/(\d)(\d)$/', $this->INN, $data);

117

118 $crc = 0;

155 * В остальном проверка аналогична.

156 * */

157 preg_match('/(\d{3})$/', $this->BIK, $data);

158

159 $rs = null;

vbx_settings.php (https://github.com/netconstructor/OpenVBX.git) PHP · 289 lines

1 <?php

2 /**

3 * "The contents of this file are subject to the Mozilla Public License

120 }

121

122 if(preg_match('/[^0-9A-Za-z_-]/', $name) > 0)

123 {

124 $errors[] = "Tenant name contains invalid characters. Allowed characters: alphanumeric, dashes, and underscores.";

169

170 if(isset($tenant['name'])

171 && preg_match('/[^0-9A-Za-z_-]/', $name) > 0)

172 {

173 $errors[] = "Tenant name contains invalid characters. Allowed characters: alphanumeric, dashes, and underscores.";