67+ results for 'php preg_replace' (0 ms)

Not the results you expected?

FileSystem.php (https://gitlab.com/x33n/ImpressPages) PHP · 213 lines

1 <?php

2 /**

3 * @package ImpressPages

201 private function removeTrailingSlash($path)

202 {

203 return preg_replace('{/$}', '', $path);

204 }

205

RouteTest.php (https://github.com/k2052/arthur.git) PHP · 224 lines

1 <?php

2

3 namespace arthur\tests\cases\console\command;

20 public function setUp()

21 {

22 $this->_config['routes_file'] = "{$this->_testPath}/routes.php";

23

24 $testParams = 'array("controller" => "arthur\test\Controller")';

25 $content = array(

26 '<?php',

27 'use arthur\net\http\Router;',

28 'use arthur\core\Environment;',

220 protected function _strip($str)

221 {

222 return preg_replace('/\s/', '', $str);

223 }

224 }

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

47 }

48 }

49 $newsql = preg_replace('/(?<!:):[a-z][a-z0-9_]*/', '?', $sql);

50 return array($newsql, $newparams);

51 }

Tokenizer.php (https://bitbucket.org/hill2steve/mobileroom.git) PHP · 201 lines

1 <?php

2

3 /*

41 $tokens = array();

42 $pos = 0;

43 $s = preg_replace('#/\*.*?\*/#s', '', $s);

44

45 while (true) {

155 private function unescapeStringLiteral($literal)

156 {

157 return preg_replace_callback('#(\\\\(?:[A-Fa-f0-9]{1,6}(?:\r\n|\s)?|[^A-Fa-f0-9]))#', function ($matches) use ($literal) {

158 if ($matches[0][0] == '\\' && strlen($matches[0]) > 1) {

159 $matches[0] = substr($matches[0], 1);

Filesystem.php (https://gitlab.com/jatasya/Slim_framework) PHP · 239 lines

1 <?php

2

3 /*

213 protected function normalizeName($name)

214 {

215 return preg_replace('#/{2,}#', '/', strtr((string) $name, '\\', '/'));

216 }

217

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

1 <?php

2 /**

3 * File containing the eZFunctionHandler class.

10

11 /*!

12 \class eZFunctionHandler ezfunctionhandler.php

13 \brief The class eZFunctionHandler does

14

68 {

69 $constantParameterArray = $aliasSettings->variable( $aliasFunctionName, 'Constant' );

70 // prevent PHP warning in the loop below

71 if ( !is_array( $constantParameterArray ) )

72 $constantParameterArray = array();

93

94 /*

95 Unfortunately, my PHP 4.3.6 doesn't work correctly

96 if flag PREG_SPLIT_NO_EMPTY is set.

97 That's why we need to manually remove

IndexController.php (https://bitbucket.org/dnejedly/eaparts.git) PHP · 167 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_Tag

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

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

25 */

26

102 protected function _extractTags($tagNamesInString)

103 {

104 return explode("\n", preg_replace("/(\'(.*?)\')|(\s+)/i", "$1\n", $tagNamesInString));

105 }

106

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",

215 protected function _getCorrectFileName($fileName)

216 {

217 return preg_replace('/[^a-zA-Z0-9_\.]/', '_', $fileName);

218 }

219

Query.php (https://github.com/tmccormi/openemr.git) PHP · 195 lines

51 }

52

53 if ($xpathPhpfunctions = $document->getXpathPhpFunctions()) {

54 $xpath->registerNamespace('php', 'http://php.net/xpath');

55 if ($xpathPhpfunctions === true) {

56 $xpath->registerPhpFunctions();

57 } else {

58 $xpath->registerPhpFunctions($xpathPhpfunctions);

59 }

60 }

92

93 // Arbitrary attribute value contains whitespace

94 $path = preg_replace_callback(

95 '/\[\S+?([\'"])((?!\1|\\\1).*?)\1\]/',

96 function ($matches) use ($placeholder) {

datalib_test.php (https://github.com/epsd/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

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

1 <?php

2

3 namespace Box\Spout\Common\Escaper;

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

125 }

126

127 return preg_replace_callback("/({$this->escapableControlCharactersPattern})/", function($matches) {

128 return $this->controlCharactersEscapingReverseMap[$matches[0]];

129 }, $escapedString);

138 protected function escapeEscapeCharacter($string)

139 {

140 return preg_replace('/_(x[\dA-F]{4})_/', '_x005F_$1_', $string);

141 }

142

waldo.php (https://bitbucket.org/driftcreate/supermarketetc.git) PHP · 167 lines

1 <?php

2 /**

3 * A Dynamic Responsive CSS Background Images Extension for WordPress

4 * and Other PHP-Based Applications

5 *

6 * Adds support to WordPress themes and other PHP based applications

19 * Credit:

20 * Thank you to Donald Allen <https://github.com/donaldallen> for presenting the

21 * initial idea of PHP generated styles for use with background images.

22 */

23 class Waldo {

59 */

60 public function waldoSavedStyles() {

61 return unserialize(file_get_contents($this->template_dir .'/waldo-styles.php'));

62 }

63

ThemeSuggestionsAlterTest.php (https://github.com/drupal/core.git) PHP · 154 lines

1 <?php

2

3 namespace Drupal\Tests\system\Functional\Theme;

144 'test_theme_theme_suggestions_theme_test_suggestions_alter() executed.',

145 ];

146 $content = preg_replace('/\s+/', ' ', Xss::filter($this->getSession()->getPage()->getContent(), []));

147 $order = 0;

148 foreach ($expected_order as $expected_string) {

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

1 <?php

2

3 /*

289 };

290

291 $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);

292

293 return $this;

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

1 <?php

2

3 /**

106

107 // Strip non-numeric characters

108 $number = preg_replace('/[^0-9]/', '', $number);

109

110 if (empty($type)) {

Email.php (https://github.com/silasrm/MyZendAssets.git) PHP · 431 lines

1 <?php

2

3 /**

248 public function stringf( $template, array $vars = array() )

249 {

250 if( substr( PHP_VERSION, 0, 3 ) >= 5.3 )

251 return preg_replace_callback( '/{{(\w+)}}/'

255 , $template );

256 else

257 return preg_replace_callback( '/{{(\w+)}}/'

258 , create_function( '$match', 'return &$vars[$match[1]];' )

259 , $template );

TextData.php (https://github.com/markn86/moodle.git) PHP · 676 lines

1 <?php

2

3 namespace PhpOffice\PhpSpreadsheet\Calculation;

4

5 use DateTimeInterface;

6 use PhpOffice\PhpSpreadsheet\Shared\Date;

7 use PhpOffice\PhpSpreadsheet\Shared\StringHelper;

8 use PhpOffice\PhpSpreadsheet\Style\NumberFormat;

9

10 class TextData

80

81 if (is_string($stringValue) || is_numeric($stringValue)) {

82 return trim(preg_replace('/ +/', ' ', trim($stringValue, ' ')), ' ');

83 }

84

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

1 <?php

2 /**

3 * Template loading functions.

22 */

23 function get_query_template( $type, $templates = array() ) {

24 $type = preg_replace( '|[^a-z0-9-]+|', '', $type );

25

26 if ( empty( $templates ) ) {

354 */

355 function get_home_template() {

356 $templates = array( 'home.php', 'index.php' );

357

358 return get_query_template( 'home', $templates );

712 * function variables cannot be overwritten.

713 */

714 // phpcs:ignore WordPress.PHP.DontExtract.extract_extract

715 extract( $wp_query->query_vars, EXTR_SKIP );

716 }

tocontents.php (https://gitlab.com/cserobiul/Bitm-PHP-CRUD-Practice) PHP · 778 lines

1 <?php

2

3 class tocontents

390

391 $s .= $this->mpdf->PrintPageBackgrounds();

392 $this->mpdf->pages[$this->mpdf->page] = preg_replace('/(___BACKGROUND___PATTERNS' . $this->mpdf->uniqstr . ')/', "\n" . $s . "\n" . '\\1', $this->mpdf->pages[$this->mpdf->page]);

393 $this->mpdf->pageBackgrounds = array();

394

links_options.php (https://bitbucket.org/wiseintegration/wisetracker-wp.git) PHP · 184 lines

1 <?php

2 /**

3 * @package Adminimize

13 <div id="poststuff" class="ui-sortable meta-box-sortables">

14 <div class="postbox">

15 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>"><br /></div>

16 <h3 class="hndle" id="links_options"><?php esc_attr_e( 'Links options', 'adminimize' ); ?></h3>

21 <table summary="config_edit_links" class="widefat">

22 <colgroup>

23 <?php

24 $col = 0;

25 foreach ( $user_roles_names as $role_name ) {

31 <thead>

32 <tr>

33 <th><?php esc_attr_e( 'Option', 'adminimize' ); ?></th>

34 <?php

4d1aadc854894a46959394647055.php (https://bitbucket.org/ealexandru/pos.git) PHP · 1179 lines

1 <?php

2

3 /* form_div_layout.html.twig */

281 ";

282 }

283 echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));

284 }

285

305 echo "/>

306 ";

307 echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));

308 }

309

336 </div>

337 ";

338 echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));

339 }

340

meta.php (https://gitlab.com/endomorphosis/reservationtelco) PHP · 344 lines

1 <?php

2 /**

3 * Metadata API

273

274 if ( !is_array($object_ids) ) {

275 $object_ids = preg_replace('|[^0-9,]|', '', $object_ids);

276 $object_ids = explode(',', $object_ids);

277 }

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 *

32 for ( $j = 0; $j < count ( $instr ); $j++ ) {

33 // First, replace any escape characters like '\x3c'

34 $teststr = preg_replace_callback("#(\\\x[0-9A-F]{2})#i",

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

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

47 // Not an array

48 // First, replace any escape characters like '\x3c'

49 $teststr = preg_replace_callback("#(\\\x[0-9A-F]{2})#i",

50 'preventHacking_helper', $instr);

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

WebAssert.php (https://bitbucket.org/galvani/flow-resque-board.git) PHP · 593 lines

1 <?php

2

3 namespace Behat\Mink;

47 public function addressEquals($page)

48 {

49 $expected = $this->cleanScriptnameFromPath(parse_url($page, PHP_URL_PATH));

50 $actual = $this->getCurrentUrlPath();

51

65 public function addressNotEquals($page)

66 {

67 $expected = $this->cleanScriptnameFromPath(parse_url($page, PHP_URL_PATH));

68 $actual = $this->getCurrentUrlPath();

69

589 protected function cleanScriptnameFromPath($path)

590 {

591 return preg_replace('/^\/[^\.\/]+\.php/', '', $path);

592 }

593 }

StaticTest.php (https://github.com/leerbag/zf2.git) PHP · 717 lines

1 <?php

2 /**

3 * Zend Framework

50 {

51 $select = $this->_select();

52 $sql = preg_replace('/\\s+/', ' ', $select->__toString());

53 $this->assertEquals('SELECT "zfproducts".* FROM "zfproducts"', $sql);

54 }

62 {

63 $select = $this->_select();

64 $sql = preg_replace('/\\s+/', ' ', $select->__toString());

65 $this->assertEquals('SELECT "zfproducts".* FROM "zfproducts"', $sql);

66 $stmt = $select->query();

77 ->bind(array(':product_id' => 1));

78

79 $sql = preg_replace('/\\s+/', ' ', $select->__toString());

80 $this->assertEquals('SELECT "zfproducts".* FROM "zfproducts" WHERE (product_id = :product_id)', $sql);

81

33fa9ce29de2a83ff6aac72f6fa3.php (https://github.com/tresbe/amcontrol.git) PHP · 1022 lines

1 <?php

2

3 /* form_div_layout.html.twig */

242 </div>

243 ";

244 echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));

245 }

246

264 echo "

265 ";

266 echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));

267 }

268

279 echo "</textarea>

280 ";

281 echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));

282 }

283

address.php (https://github.com/sansanwawa/e-commerse.git) PHP · 532 lines

1 <?php

2 class ControllerAccountAddress extends Controller {

3 private $error = array();

211 $this->data['addresses'][] = array(

212 'address_id' => $result['address_id'],

213 'address' => str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))),

214 'update' => $this->url->link('account/address/update', 'address_id=' . $result['address_id'], 'SSL'),

215 'delete' => $this->url->link('account/address/delete', 'address_id=' . $result['address_id'], 'SSL')

QueryBuilder.php (https://github.com/voidit/chyrp.git) PHP · 449 lines

1 <?php

2 /**

3 * Class: QueryBuilder

290 */

291 public static function safecol($name) {

292 return preg_replace("/(([^a-zA-Z0-9_]|^)(order|group)([^a-zA-Z0-9_]|

293 $))/i",

294 (SQL::current()->adapter == "mysql") ? "\\2`\\3`

427 if (!substr_count($full, ".")) {

428 # Don't replace things that are already either prefixed or paramized.

429 $field = preg_replace("/([^\.:'\"_]|^)".preg_quote($full, "/")."/",

430 "\\1".$before."__".$tables[0].".".$name.$after,

431 $field,

435 if (substr($full, 0, 2) != "__") {

436 # Don't replace things that are already either prefixed or paramized.

437 $field = preg_replace("/([^\.:'\"_]|^)".preg_quote($full, "/")."/",

438 "\\1".$before."__".$name.$after,

439 $field,

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

1 <?php

2 /**

3 * File containing the ezcTemplateStringFunctions class

18 {

19 /**

20 * Translates a function used in the Template language to a PHP function call.

21 * The function call is represented by an array with three elements:

22 *

192

193 // str_simplified( $s )

194 // trim( preg_replace( "/(\n|\t|\r\n|\s)+/", " ", $s ) )

195 case "str_simplify": return array( ezcTemplateAstNode::TYPE_VALUE, array( "%string" ),

196 self::functionCall( "trim", array(

197 self::functionCall( "preg_replace", array( self::constant( '"/(\n|\t|\r\n|\s)+/"' ), self::value( " " ), "%string" ) )

198 ) ) );

199

eztemplatestringoperator.php (https://github.com/GunioRobot/ezpublish.git) PHP · 734 lines

79 $replacer = $staticValues[1];

80 }

81 $result = preg_replace( "/".$replacer."{2,}/", $replacer, $staticValues[0] );',

82 'code1' => '$result = preg_replace( "/ {2,}/", " ", $staticValues[0] );',

190 $this->Count_charsName => array( 'parameters' => false, 'element-transformation-func' => 'phpMapTransformation' ),

191 $this->DowncaseName => array( 'parameters' => false, 'element-transformation-func' => 'phpMapTransformation' ),

192 $this->UpcaseName => array( 'parameters' => false, 'element-transformation-func' => 'phpMapTransformation' ),

266 }

267

268 function phpMapTransformation( $operatorName, $node, $tpl, $resourceData,

269 $element, $lastElement, $elementList, $elementTree, &$parameters )

270 {

271 $values = array();

272 $phpFunctionList = explode( ',', $this->phpMap[$operatorName] );

273 foreach ( $phpFunctionList as $element )

eztemplatemultipassparser.php (https://github.com/GunioRobot/ezpublish.git) PHP · 904 lines

1 <?php

2 /**

3 * File containing the eZTemplateMultiPassParser class.

10

11 /*!

12 \class eZTemplateMultiPassParser eztemplatemultipassparser.php

13 \brief The class eZTemplateMultiPassParser does

14

221

222 $tag = substr( $sourceText, $tagPos, $len );

223 $tag = preg_replace( "/\\\\[}]/", "}", $tag );

224 $tagTrim = trim( $tag );

225 $isEndTag = false;

UsersController.php (https://gitlab.com/4gdevs/online-class-record-system) PHP · 365 lines

1 <?php

2

3 namespace App\Http\Controllers;

95 foreach ($data as $data2) {

96 foreach ($data2 as $data3) {

97 $activities[$count][$count1]['color'] = $sel_color[preg_replace('/[0-9]+/', '', $data2['act_name'])];

98 $activities[$count][$count1]['fontcolor'] = $fon_color[preg_replace('/[0-9]+/', '', $data2['act_name'])];

147 foreach ($data as $data2) {

148 foreach ($data2 as $data3) {

149 $activities[$count][$count1]['color'] = $sel_color[preg_replace('/[0-9]+/', '', $data2['act_name'])];

150 $activities[$count][$count1]['fontcolor'] = $fon_color[preg_replace('/[0-9]+/', '', $data2['act_name'])];

WebAssert.php (https://gitlab.com/reasonat/test8) PHP · 849 lines

1 <?php

2

3 /*

256 {

257 $actual = $this->session->getPage()->getText();

258 $actual = preg_replace('/\s+/u', ' ', $actual);

259 $regex = '/'.preg_quote($text, '/').'/ui';

260 $message = sprintf('The text "%s" was not found anywhere in the text of the current page.', $text);

273 {

274 $actual = $this->session->getPage()->getText();

275 $actual = preg_replace('/\s+/u', ' ', $actual);

276 $regex = '/'.preg_quote($text, '/').'/ui';

277 $message = sprintf('The text "%s" appears in the text of this page, but it should not.', $text);

751 $path = empty($parts['path']) ? '/' : $parts['path'];

752

753 return preg_replace('/^\/[^\.\/]+\.php\//', '/', $path).$fragment;

754 }

755

parsedown.php (https://gitlab.com/websumon/tosnib) PHP · 1285 lines

1 <?php

2

3 #

464

465 if ( ! isset( $Block['interrupted'] ) ) {

466 $text = preg_replace( '/^[ ]{0,4}/', '', $Line['body'] );

467

468 $Block['li']['text'] [] = $text;

474 $Block['li']['text'] [] = '';

475

476 $text = preg_replace( '/^[ ]{0,4}/', '', $Line['body'] );

477

478 $Block['li']['text'] [] = $text;

template.php (https://gitlab.com/WPonEB/WPonEB) PHP · 692 lines

1 <?php

2 /**

3 * Template loading functions.

22 */

23 function get_query_template( $type, $templates = array() ) {

24 $type = preg_replace( '|[^a-z0-9-]+|', '', $type );

25

26 if ( empty( $templates ) )

27 $templates = array("{$type}.php");

28

29 /**

352 */

353 function get_home_template() {

354 $templates = array( 'home.php', 'index.php' );

355

356 return get_query_template( 'home', $templates );

StaticTest.php (https://bitbucket.org/Dal-Papa/is-340-publish-base.git) PHP · 823 lines

1 <?php

2 /**

3 * Zend Framework

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

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

20 * @version $Id: StaticTest.php 24593 2012-01-05 20:35:02Z matthew $

21 */

22

25 * @see Zend_Db_Select_TestCommon

26 */

27 require_once 'Zend/Db/Select/TestCommon.php';

28

29

47 {

48 $select = $this->_select();

49 $sql = preg_replace('/\\s+/', ' ', $select->__toString());

50 $this->assertEquals('SELECT "zfproducts".* FROM "zfproducts"', $sql);

51 }

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

63 * ENUM field values

64 */

65 <?php

66 foreach($enum as $column_name => $enum_values){

67 foreach ($enum_values as $enum_value){

parsedown.php (https://github.com/medieteknik/Medieteknik.nu.git) PHP · 1343 lines

1 <?php

2

3 #

320 $nestedBlocks = array();

321

322 $substring = preg_replace('/^[|][ ]*/', '', $line);

323 $substring = preg_replace('/[|]?[ ]*$/', '', $substring);

420 $nestedBlocks = array();

421

422 $substring = preg_replace('/^[|][ ]*/', '', $block['content']);

423 $substring = preg_replace('/[|]?[ ]*$/', '', $substring);

wpml-query-parser.class.php (https://gitlab.com/woxiprogrammers/infinia-wordpress) PHP · 372 lines

1 <?php

2

3 /**

44 $cat_array = array();

45 foreach ( $categories as $category ) {

46 $cat = get_term_by( 'slug', preg_replace( '#((.*)/)#', '', $category ), 'category' );

47 $cat = $cat ? $cat : get_term_by( 'name', $category, 'category' );

48 if ( is_object( $cat ) && $cat->term_id ) {

203 $current_language,

204 true );

205 $q->query = preg_replace( '/page_id=[0-9]+/',

206 'page_id=' . $q->query_vars['page_id'],

207 $q->query );

254 }

255 }

256 //TODO: [WPML 3.3] Discuss this. Why WP assumes it's there if query vars are altered? Look at wp-includes/query.php line #2468 search: if ( $this->query_vars_changed ) {

257 $q->query_vars['meta_query'] = isset( $q->query_vars['meta_query'] ) ? $q->query_vars['meta_query'] : array();

258 if ( isset( $q->query_vars['tax_query'] ) && is_array( $q->query_vars['tax_query'] ) ) {

icl-admin-notifier.php (https://gitlab.com/woxiprogrammers/infinia-wordpress) PHP · 740 lines

1 <?php

2 /**

3 * @package wpml-core

189 public static function hide_message() {

190 $message_id = isset( $_POST[ 'icl-admin-message-id' ] ) ? $_POST[ 'icl-admin-message-id' ] : '';

191 $message_id = preg_replace( '/^icl-id-/', '', $message_id );

192 $dismiss = isset( $_POST[ 'dismiss' ] ) ? $_POST[ 'dismiss' ] : false;

193 if ( !self::message_id_exists($message_id) ) {

211 public static function show_message() {

212 $message_id = isset( $_POST[ 'icl-admin-message-id' ] ) ? $_POST[ 'icl-admin-message-id' ] : '';

213 $message_id = preg_replace( '/^icl-id-/', '', $message_id );

214 if ( !self::message_id_exists($message_id) ) {

215 exit;

228 public static function engage_message() {

229 $message_id = isset( $_POST[ 'icl-admin-message-id' ] ) ? $_POST[ 'icl-admin-message-id' ] : '';

230 $message_id = preg_replace( '/^icl-id-/', '', $message_id );

231 if ( !self::message_id_exists($message_id) ) {

232 exit;

6ac8d0118e8405e80aa9e9a321ab78b458b56dc4392b0a216f47197982dc.php (https://gitlab.com/fabiorf/qrcode) PHP · 421 lines

1 <?php

2

3 /* common/form_div_layout.html.twig */

54 unset($context['_seq'], $context['_iterated'], $context['_key'], $context['child'], $context['_parent'], $context['loop']);

55 $context = array_intersect_key($context, $_parent) + $_parent;

56 echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));

57 }

58

94 ";

95 }

96 echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));

97 }

98

138 echo " ";

139 }

140 echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));

141 }

142

Db.php (https://github.com/andyburton/Sonic-Framework.git) PHP · 1411 lines

1 <?php

2

3 // Define namespace

621 foreach ($val as &$clause)

622 {

623 $clause = preg_replace ('/[^\w]/', '', $clause);

624 }

625

635 {

636

637 $arr[0] = preg_replace ('/[^\w]/', '', $arr[0]);

638

639 if (!in_array ($arr[1], self::$validOrder))

647 else

648 {

649 $val = preg_replace ('/[^\w]/', '', $val);

650 }

651

QueryBuilder.php (https://github.com/toastwaffle/chyrp.git) PHP · 447 lines

1 <?php

2 /**

3 * Class: QueryBuilder

290 */

291 public static function safecol($name) {

292 return preg_replace("/(([^a-zA-Z0-9_]|^)(order|group)([^a-zA-Z0-9_]|$))/i",

293 (SQL::current()->adapter == "mysql") ? "\\2`\\3`\\4" : '\\2"\\3"\\4',

294 $name);

425 if (!substr_count($full, ".")) {

426 # Don't replace things that are already either prefixed or paramized.

427 $field = preg_replace("/([^\.:'\"_]|^)".preg_quote($full, "/")."/",

428 "\\1".$before."__".$tables[0].".".$name.$after,

429 $field,

433 if (substr($full, 0, 2) != "__") {

434 # Don't replace things that are already either prefixed or paramized.

435 $field = preg_replace("/([^\.:'\"_]|^)".preg_quote($full, "/")."/",

436 "\\1".$before."__".$name.$after,

437 $field,

class.file.php (https://github.com/livinglab/openlab.git) PHP · 582 lines

1 <?php

2 //Code from iThemes Builder

3 class AECFile {

270 foreach ( (array) $args['possible_paths'] as $path ) {

271 foreach ( (array) $vars as $var => $val )

272 $path = preg_replace( '/%' . preg_quote( $var, '/' ) . '%/', $val, $path );

273

274 if ( ! is_dir( $path ) )

301 return new WP_Error( 'no_writable_path', 'Unable to find a writable path' );

302

303 $writable_dir = preg_replace( '|/+$|', '', $writable_dir );

304

305 return $writable_dir;

437

438 if ( true === $args['create_index'] )

439 AECFile::write( "$directory/index.php", '<?php // Silence is golden.' );

440

441 return true;

TextData.php (https://github.com/livinglab/openlab.git) PHP · 672 lines

1 <?php

2

3 namespace PhpOffice\PhpSpreadsheet\Calculation;

4

5 use PhpOffice\PhpSpreadsheet\Shared\Date;

6 use PhpOffice\PhpSpreadsheet\Shared\StringHelper;

7 use PhpOffice\PhpSpreadsheet\Style\NumberFormat;

79

80 if (is_string($stringValue) || is_numeric($stringValue)) {

81 return trim(preg_replace('/ +/', ' ', trim($stringValue, ' ')), ' ');

82 }

83

TableOfContents.php (https://github.com/livinglab/openlab.git) PHP · 856 lines

1 <?php

2

3 namespace Mpdf;

469

470 $s .= $this->mpdf->PrintPageBackgrounds();

471 $this->mpdf->pages[$this->mpdf->page] = preg_replace('/(___BACKGROUND___PATTERNS' . $this->mpdf->uniqstr . ')/', "\n" . $s . "\n" . '\\1', $this->mpdf->pages[$this->mpdf->page]);

472 $this->mpdf->pageBackgrounds = [];

473

slider.php (https://bitbucket.org/lessquared/saddleback-eye.git) PHP · 238 lines

1 <?php

2

3 if(is_array($slides)) {

153 // Custom style

154 if(!empty($sublayer['style'])) {

155 $sublayerStyle = preg_replace('/\s\s+/', ' ', stripslashes($sublayer['style']));

156 } else {

157 $sublayerStyle = '';

menu-header.php (https://gitlab.com/endomorphosis/reservationtelco) PHP · 173 lines

14 * @var string

15 */

16 $self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);

17 $self = preg_replace('|^.*/plugins/|i', '', $self);

84 if ( ( ('index.php' != $submenu[$item[2]][0][2]) && file_exists(WP_PLUGIN_DIR . "/$menu_file") ) || !empty($menu_hook)) {

85 $admin_is_parent = true;

86 echo "<div class='wp-menu-image'><a href='admin.php?page={$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class$tabindex>$title</a>";

87 } else {

88 echo "\n\t<div class='wp-menu-image'><a href='{$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='{$submenu[$item[2]][0][2]}'$class$tabindex>$title</a>";

95 if ( ('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR . "/$menu_file") || !empty($menu_hook) ) {

96 $admin_is_parent = true;

97 echo "\n\t<div class='wp-menu-image'><a href='admin.php?page={$item[2]}'>$img</a></div>$toggle<a href='admin.php?page={$item[2]}'$class$tabindex>{$item[0]}</a>";

98 } else {

99 echo "\n\t<div class='wp-menu-image'><a href='{$item[2]}'>$img</a></div>$toggle<a href='{$item[2]}'$class$tabindex>{$item[0]}</a>";

148 $sub_item_url = add_query_arg( array('page' => $sub_item[2]), $item[2] );

149 else

150 $sub_item_url = add_query_arg( array('page' => $sub_item[2]), 'admin.php' );

151 $sub_item_url = esc_url($sub_item_url);

152 echo "<li$class><a href='$sub_item_url'$class$tabindex>$title</a></li>";

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

1 <?php

2 /**

3 * @version $Id$

195 protected function id() {

196 if ( ! isset( $this->id ) ) {

197 $this->id = isset( $this->name ) ? trim( preg_replace( '/[^a-zA-Z0-9\-_]+/', '_', $this->name ), '_' ) : null;

198 }

199

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

validation.class.php (https://bitbucket.org/tumivn/phpexamples.git) PHP · 927 lines

1 <?php

2 /**

3 * Generic validation class for validation from most sources

4 *

5 * @copyright 2013-03-29

6 * @link http://phpro.org

7 * @author Kevin Waterson

8 * @version: $ID$

443 private function parseCamelCase( $string )

444 {

445 $cc = preg_replace('/(?<=[a-z])(?=[A-Z])/',' ',$string);

446 $cc = ucwords( str_replace( '_', ' ', $cc ) );

447 return $cc;

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)

203 if (strpos($host, '%') !== -1) {

204 $host = strtolower($host);

205 $host = preg_replace_callback(

206 Auth_OpenID_getEncodedPattern(),

207 'Auth_OpenID_pct_encoded_replace', $host);

225

226 $path = $uri_matches[5];

227 $path = preg_replace_callback(

228 Auth_OpenID_getEncodedPattern(),

229 'Auth_OpenID_pct_encoded_replace_unreserved', $path);

address.php (https://gitlab.com/shapcy/opencart) PHP · 541 lines

1 <?php

2 class ControllerAccountAddress extends Controller {

3 private $error = array();

238 $data['addresses'][] = array(

239 'address_id' => $result['address_id'],

240 'address' => str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))),

241 'update' => $this->url->link('account/address/edit', 'address_id=' . $result['address_id'], true),

242 'delete' => $this->url->link('account/address/delete', 'address_id=' . $result['address_id'], true)

class-itsec-lib-ip-tools.php (https://gitlab.com/kath.de/cibedo_cibedo.de) PHP · 649 lines

1 <?php

2 /**

3 * iThemes Security IP tools library.

448 '/^\*([:\.])/', // Match a wildcard as the whole first chunk

449 );

450 return preg_replace_callback( $search, array( 'self', 'clean_wildcards_preg_replace_callback' ), $ip );

451 }

452

453 /**

454 * Used with preg_replace_callback() to replace wildcards with 0 ONLY in cases where the wildcard is the whole chunk

455 *

456 * @param array $matches The matches found by preg_replace_callback()

630

631 // Replace multiple chunks of all zeros with a regular expression that makes them optional but still enforces accurate matching

632 $regex = preg_replace_callback( '/0\?0\?0\?0\?(\:0\?0\?0\?0\?)+/', array( 'self', 'ipv6_regex_preg_replace_callback' ), $regex );

633

634 return $regex;

class_image.php (https://github.com/masterscript/DLE-module-Portfolio.git) PHP · 463 lines

1 <?php

2

3 /* ---------------------------------------------------------------------- *

280 }

281

282 $file_name = preg_replace( "/^(.*)\..+?$/", "\\1", $file_name ) . "." . strtolower ( $this->data['type'] );

283

284 switch ( $this->data['type'] )

ConstraintTest.php (https://gitlab.com/daniruizcamacho/pfcascensores) PHP · 1804 lines

1 <?php

2 /**

3 * PHPUnit

4 *

5 * Copyright (c) 2001-2014, Sebastian Bergmann <sebastian@phpunit.de>.

6 * All rights reserved.

7 *

35 * POSSIBILITY OF SUCH DAMAGE.

36 *

37 * @package PHPUnit

38 * @author Sebastian Bergmann <sebastian@phpunit.de>

39 * @author Bernhard Schussek <bschussek@2bepublished.at>

40 * @copyright 2001-2014 Sebastian Bergmann <sebastian@phpunit.de>

41 * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License

42 * @link http://www.phpunit.de/

StaticTest.php (https://github.com/devilsansclue/ZendFramework.git) PHP · 700 lines

1 <?php

2 /**

3 * Zend Framework

25 * @see Zend_Db_Table_Select_TestCommon

26 */

27 require_once 'Zend/Db/Select/TestCommon.php';

28

29

48 {

49 $select = $this->_select();

50 $sql = preg_replace('/\\s+/', ' ', $select->__toString());

51 $this->assertEquals('SELECT "zfproducts".* FROM "zfproducts"', $sql);

52 }

60 {

61 $select = $this->_select();

62 $sql = preg_replace('/\\s+/', ' ', $select->__toString());

63 $this->assertEquals('SELECT "zfproducts".* FROM "zfproducts"', $sql);

64 $stmt = $select->query();

StaticTest.php (https://github.com/devilsansclue/ZendFramework.git) PHP · 823 lines

1 <?php

2 /**

3 * Zend Framework

25 * @see Zend_Db_Select_TestCommon

26 */

27 require_once 'Zend/Db/Select/TestCommon.php';

28

29

47 {

48 $select = $this->_select();

49 $sql = preg_replace('/\\s+/', ' ', $select->__toString());

50 $this->assertEquals('SELECT "zfproducts".* FROM "zfproducts"', $sql);

51 }

59 {

60 $select = $this->_select();

61 $sql = preg_replace('/\\s+/', ' ', $select->__toString());

62 $this->assertEquals('SELECT "zfproducts".* FROM "zfproducts"', $sql);

63 $stmt = $select->query();

class.tree.php (https://gitlab.com/INF3190/inf2005tpapp) PHP · 986 lines

1 <?php

2 // TO DO: better exceptions, use params

3 class tree

342

343 foreach($sql as $k => $v) {

344 //echo preg_replace('@[\s\t]+@',' ',$v) ."\n";

345 try {

346 $this->db->query($v);

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

1 <?php

2 /**

3 * Copyright 2012-2014 Rackspace US, Inc.

116 $pattern = '#^' . self::GLOBAL_METADATA_PREFIX . '\-(' . static::METADATA_LABEL . '-)?(Meta-)?#i';

117

118 return preg_replace($pattern, '', $header);

119 }

120

CurrencyFormat.php (https://github.com/tmccormi/openemr.git) PHP · 262 lines

1 <?php

2 /**

3 * Zend Framework (http://framework.zend.com/)

72 if (! extension_loaded('intl')) {

73 throw new Exception\ExtensionNotLoadedException(sprintf(

74 '%s component requires the intl PHP extension',

75 __NAMESPACE__

76 ));

258 $pattern = sprintf('/\%s\d+$/', $formatter->getSymbol(NumberFormatter::DECIMAL_SEPARATOR_SYMBOL));

259

260 return preg_replace($pattern, '', $formattedNumber);

261 }

262 }

Packager.php (https://bitbucket.org/squints/greekgeek.git) PHP · 404 lines

1 <<<<<<< HEAD

2 <?php

3 /**

4 * PEAR_Packager for generating releases

5 *

6 * PHP versions 4 and 5

7 *

8 * @category pear

9 * @package PEAR

10 * @author Stig Bakken <ssb@php.net>

11 * @author Tomas V. V. Cox <cox@idecnet.com>

12 * @author Greg Beaver <cellog@php.net>

13 * @copyright 1997-2009 The Authors

14 * @license http://opensource.org/licenses/bsd-license.php New BSD License

15 * @version CVS: $Id: Packager.php 286809 2009-08-04 15:10:26Z dufuz $

xml.php (https://bitbucket.org/valmy/openx.git) PHP · 648 lines

1 <?php

2 /**

3 * base include file for SimpleTest

10 * include other SimpleTest class files

11 */

12 require_once(dirname(__FILE__) . '/scorer.php');

13 /**#@-*/

14

60 array('&amp;', '&lt;', '&gt;', '&quot;', '&apos;'),

61 $text);

62 return preg_replace('/[^(\x20-\x7F)\r\n\t]/','?', $string);

63 }

64

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

1 <?php

2 /**

3 * File containing the eZFileHandler class.

10

11 /*!

12 \class eZFileHandler ezfilehandler.php

13 \brief Interface for file handlers

14

189 $destinationFilename .= '/' . substr( $sourceFilename, $filePosition );

190 }

191 $destinationFilename = preg_replace( "#/+#", '/', $destinationFilename );

192 $sourceDir = $sourceFilename;

193 $sourceName = false;

259 $destinationFilename .= '/' . substr( $sourceFilename, $filePosition );

260 }

261 $destinationFilename = preg_replace( "#/+#", '/', $destinationFilename );

262 if ( file_exists( $destinationFilename ) and

263 !is_dir( $destinationFilename ) )

Test.php (https://github.com/koala-framework/koala-framework.git) PHP · 523 lines

1 <?php

2 /**

3 * @group MailHtmlParser

7 private function _assertHtmlEquals($expected, $html)

8 {

9 $html = preg_replace('#^ +#m', '', $html);

10 $html = str_replace("\n", '', $html);

11 $this->assertEquals($expected, $html);

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

1 <?php

2

3 class ZendL_Tool_Rpc_Provider_Signature

71 $className = get_class($this->_provider);

72 $name = substr($className, strrpos($className, '_')+1);

73 $name = preg_replace('#(Tool|Provider|Manifest)$#', '', $name);

74 $this->_name = $name;

75 }

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;

parser.php (https://bitbucket.org/netgen/bccie.git) PHP · 675 lines

1 <?php

2 /**

3 * File containing the parser class.

238 $attribute = & eZContentClassAttribute::fetch( $attributeid );

239 $attribute_name = $attribute->name();

240 $attribute_name_escaped = preg_replace( "(\r\n|\n|\r)", " ", $attribute_name );

241 $attribute_name_escaped = utf8_decode( $attribute_name_escaped );

242 array_push( $resultstring, $attribute_name_escaped );