100+ results results for 'php preg_replace_callback' (311 ms)
1<?php 2 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) {Query.php https://github.com/tmccormi/openemr.git | PHP | 195 lines
1<?php 2/** 52 53 if ($xpathPhpfunctions = $document->getXpathPhpFunctions()) { 54 $xpath->registerNamespace('php', 'http://php.net/xpath'); 54 $xpath->registerNamespace('php', 'http://php.net/xpath'); 55 if ($xpathPhpfunctions === true) { 56 $xpath->registerPhpFunctions(); 57 } else { 58 $xpath->registerPhpFunctions($xpathPhpfunctions); 59 } 93 // Arbitrary attribute value contains whitespace 94 $path = preg_replace_callback( 95 '/\[\S+?([\'"])((?!\1|\\\1).*?)\1\]/', 152 // arbitrary attribute strict equality 153 $expression = preg_replace_callback( 154 '/\[@?([a-z0-9_-]+)=([\'"])((?!\2|\\\2).*?)\2\]/i',Base.php https://gitlab.com/code26/selah | PHP | 430 lines
1<?php 2/** 167 168 return preg_replace_callback('/_([a-z])/', function ($char) { 169 return strtoupper($char[1]); 182 183 return preg_replace_callback('/([A-Z])/', function ($char) { 184 return "_" . strtolower($char[1]);XLSX.php https://gitlab.com/VTTE/sitios-vtte | PHP | 178 lines
1<?php 2 105 /** 106 * Converts PHP control characters from the given string to OpenXML escaped control characters 107 * 126 127 return preg_replace_callback("/({$this->escapableControlCharactersPattern})/", function($matches) { 128 return $this->controlCharactersEscapingReverseMap[$matches[0]]; 143 /** 144 * Converts OpenXML escaped control characters from the given string to PHP control characters 145 *shortcodes.php https://bitbucket.org/lessquared/saddleback-eye.git | PHP | 335 lines
1<?php 2/** 150 $pattern = get_shortcode_regex(); 151 return preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content ); 152} 322 323 return preg_replace_callback( "/$pattern/s", 'strip_shortcode_tag', $content ); 324}UriTemplate.php https://gitlab.com/ealexis.t/trends | PHP | 241 lines
1<?php 2namespace GuzzleHttp; 46 47 return preg_replace_callback( 48 '/\{([^\}]+)\}/', 94 * 95 * @param array $matches Matches met in the preg_replace_callback 96 *markdown.php https://github.com/joshuaswarren/weatherhub.git | PHP | 1790 lines
1<?php 2# 4# 5# PHP Markdown & Extra 6# Copyright (c) 2004-2008 Michel Fortin 6# Copyright (c) 2004-2008 Michel Fortin 7# <http://www.michelf.com/projects/php-markdown/> 8# 21 # Regex to match balanced [brackets]. 22 # Needed to insert a maximum bracked depth while converting to PHP. 23 public $nested_brackets_depth = 6; 156 # Link defs are in the form: ^[id]: url "optional title" 157 $text = preg_replace_callback('{ 158 ^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?: # id = $1 257 # match will start at the first `<div>` and stop at the first `</div>`. 258 $text = preg_replace_callback('{(?> 259 (?>time.php https://github.com/cgajardo/repositorium.git | PHP | 744 lines
6 * 7 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) 8 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) 13 * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org) 14 * @link http://cakephp.org CakePHP(tm) Project 15 * @package cake 16 * @subpackage cake.cake.libs.view.helpers 17 * @since CakePHP(tm) v 0.10.0.1076 18 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) 278 * @access public 279 * @link http://book.cakephp.org/view/1471/Formatting 280 */ 304 * @access public 305 * @link http://book.cakephp.org/view/1472/Testing-Time 306 */locallib.php https://bitbucket.org/kudutest1/moodlegit.git | PHP | 566 lines
1<?php 2 28 29require_once("$CFG->libdir/filelib.php"); 30require_once("$CFG->libdir/resourcelib.php"); 30require_once("$CFG->libdir/resourcelib.php"); 31require_once("$CFG->dirroot/mod/url/lib.php"); 32 94 $allowed = "a-zA-Z0-9".preg_quote(';/?:@=&$_.+!*(),-#%', '/'); 95 $fullurl = preg_replace_callback("/[^$allowed]/", 'url_filter_callback', $fullurl); 96 } else { 224 $exteurl = url_get_full_url($url, $cm, $course, $config); 225 $navurl = "$CFG->wwwroot/mod/url/view.php?id=$cm->id&frameset=top"; 226 $coursecontext = context_course::instance($course->id); 356 if (strpos($url->externalurl, $CFG->wwwroot) === 0) { 357 if (strpos($url->externalurl, 'file.php') === false and strpos($url->externalurl, '.php') !== false ) { 358 // most probably our moodle page with navigationDirectLex.php https://bitbucket.org/kudutest1/moodlegit.git | PHP | 490 lines
1<?php 2 5 * 6 * A pure PHP parser, DirectLex has absolutely no dependencies, making 7 * it a reasonably good default for PHP4. Written with efficiency in mind, 36 if ($config->get('HTML.Trusted')) { 37 $html = preg_replace_callback('#(<script[^>]*>)(\s*[^<].+?)(</script>)#si', 38 array($this, 'scriptCallback'), $html); 320 /** 321 * PHP 5.0.x compatible substr_count that implements offset and length 322 */ 325 if ($oldVersion === null) { 326 $oldVersion = version_compare(PHP_VERSION, '5.1', '<'); 327 }post-template.php https://bitbucket.org/jstroschein/wordpress-3.5.1-clean.git | PHP | 1460 lines
1<?php 2/** 224 if ( $preview ) // preview fix for javascript bug with foreign languages 225 $output = preg_replace_callback('/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output); 226 234 * @access private 235 * @param array $match Match array from preg_replace_callback 236 * @return stringmedia.php https://bitbucket.org/jstroschein/wordpress-3.5.1-clean.git | PHP | 1524 lines
1<?php 2/** 148 $caption = str_replace( array("\r\n", "\r"), "\n", $caption); 149 $caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption ); 150 // convert any remaining line breaks to <br> 185var win = window.dialogArguments || opener || parent || top; 186win.send_to_editor('<?php echo addslashes($html); ?>'); 187/* ]]> */ 188</script> 189<?php 190 exit; 329?> 330<title><?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — <?php _e('WordPress'); ?></title> 331<?php 342addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; 343var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time(); ?>'}; 344var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',post-template.php https://github.com/muskmelon/Greemo.git | PHP | 1440 lines
1<?php 2/** 225 if ( $preview ) // preview fix for javascript bug with foreign languages 226 $output = preg_replace_callback('/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output); 227 235 * @access private 236 * @param array $match Match array from preg_replace_callback 237 * @returns stringCdn.php https://github.com/sharpmachine/wakeupmedia.com.git | PHP | 775 lines
1<?php 2 9 10require_once W3TC_INC_DIR . '/functions/file.php'; 11require_once W3TC_LIB_W3_DIR . '/Plugin.php'; 250 if ($this->_config->get_boolean('cdn.uploads.enable')) { 251 require_once W3TC_INC_DIR . '/functions/http.php'; 252 307 foreach ($regexps as $regexp) { 308 $buffer = preg_replace_callback($regexp, array( 309 &$this, 397 398 if (W3TC_PHP5 && $this->_config->get_boolean('minify.rewrite') && (!$this->_config->get_boolean('minify.auto') || w3_is_cdn_mirror($this->_config->get_string('cdn.engine')))) { 399 require_once W3TC_INC_DIR . '/functions/http.php';twitter.php https://github.com/sharpmachine/wakeupmedia.com.git | PHP | 383 lines
127 128 ?><a href="http://twitter.com/<?php echo esc_attr( $account ); ?>" <?php echo $follow_button_attrs; ?>>Follow @<?php echo esc_attr( $account ); ?></a><?php 129 } 272 for ( $i = 1; $i <= 20; ++$i ) : 273 ?><option value="<?php echo esc_attr( $i ); ?>" <?php selected( $show, $i ); ?>><?php echo esc_attr( $i ); ?></option><?php 274 endfor; 295 <label for="<?php echo $this->get_field_id( 'includeretweets' ); ?>"> 296 <input id="<?php echo $this->get_field_id( 'includeretweets' ); ?>" class="checkbox" type="checkbox" name="<?php echo $this->get_field_name( 'includeretweets' ); ?>" <?php checked( $include_retweets, true ); ?> /> 297 <?php esc_html_e( 'Include retweets', 'jetpack' ); ?> 302 <label for="<?php echo $this->get_field_id( 'followbutton' ); ?>"> 303 <input id="<?php echo $this->get_field_id( 'followbutton' ); ?>" class="checkbox" type="checkbox" name="<?php echo $this->get_field_name( 'followbutton' ); ?>" <?php checked( $follow_button, 1 ); ?> /> 304 <?php esc_html_e( 'Display Follow Button', 'jetpack' ); ?> 310 <?php esc_html_e( 'Text to display between Tweet and timestamp:', 'jetpack' ); ?> 311 <input class="widefat" id="<?php echo $this->get_field_id( 'beforetimesince' ); ?>" name="<?php echo $this->get_field_name( 'beforetimesince' ); ?>" type="text" value="<?php echo esc_attr( $before_timesince ); ?>" /> 312 </label>ReplaceTokens.php https://gitlab.com/Isaki/le331.fr | PHP | 475 lines
1<?php 2 22 23include_once 'phing/filters/BaseParamFilterReader.php'; 24include_once 'phing/types/TokenSource.php'; 24include_once 'phing/types/TokenSource.php'; 25include_once 'phing/filters/ChainableReader.php'; 26 174 // filter buffer 175 $buffer = preg_replace_callback( 176 "/" . preg_quote($this->_beginToken, '/') . "([\w\.\-:]+?)" . preg_quote($this->_endToken, '/') . "/",gfm.php https://gitlab.com/juanito.abelo/nlmobile | PHP | 372 lines
1<?php 2/** 93 // escape line-beginning # chars that do not have a space after them. 94 $text = preg_replace_callback( '|^#{1,6}( )?|um', array( $this, '_doEscapeForHashWithoutSpacing' ), $text ); 95 121 public function single_line_code_preserve( $text ) { 122 return preg_replace_callback( '|<code\b[^>]*>(.*?)</code>|', array( $this, 'do_single_line_code_preserve' ), $text ); 123 } 139 public function codeblock_preserve( $text ) { 140 return preg_replace_callback( "/^([`~]{3})([^`\n]+)?\n([^`~]+)(\\1)/m", array( $this, 'do_codeblock_preserve' ), $text ); 141 } 160 public function codeblock_restore( $text ) { 161 return preg_replace_callback( "/^([`~]{3})([^`\n]+)?\n([^`~]+)(\\1)/m", array( $this, 'do_codeblock_restore' ), $text ); 162 } 190 %ix'; 191 $text = preg_replace_callback( $regex, array( $this, '_doRemoveText'), $text ); 192 return $text;post-template.php https://gitlab.com/Gashler/dp | PHP | 1432 lines
1<?php 2/** 229 if ( $preview ) // preview fix for javascript bug with foreign languages 230 $output = preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output ); 231 239 * @access private 240 * @param array $match Match array from preg_replace_callback 241 * @return stringmedia.php https://gitlab.com/Gashler/dp | PHP | 1517 lines
1<?php 2/** 148 $caption = str_replace( array("\r\n", "\r"), "\n", $caption); 149 $caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption ); 150 // convert any remaining line breaks to <br> 185var win = window.dialogArguments || opener || parent || top; 186win.send_to_editor('<?php echo addslashes($html); ?>'); 187/* ]]> */ 188</script> 189<?php 190 exit; 381?> 382<title><?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — <?php _e('WordPress'); ?></title> 383<?php 394addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; 395var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup', 396isRtl = <?php echo (int) is_rtl(); ?>;post-template.php https://gitlab.com/endomorphosis/reservationtelco | PHP | 1236 lines
1<?php 2/** 227 if ( $preview ) // preview fix for javascript bug with foreign languages 228 $output = preg_replace_callback('/\%u([0-9A-F]{4})/', create_function('$match', 'return "&#" . base_convert($match[1], 16, 10) . ";";'), $output); 229classes.php https://gitlab.com/endomorphosis/reservationtelco | PHP | 589 lines
1<?php 2 178 $response_regex = '%\[\s*response\s*\]%'; 179 $form = preg_replace_callback( $response_regex, 180 array( &$this, 'response_replace_callback' ), $form ); 336 337 $subject = preg_replace_callback( $regex, $callback, $mail_template['subject'] ); 338 $sender = preg_replace_callback( $regex, $callback, $mail_template['sender'] ); 338 $sender = preg_replace_callback( $regex, $callback, $mail_template['sender'] ); 339 $recipient = preg_replace_callback( $regex, $callback, $mail_template['recipient'] ); 340 $additional_headers = 340 $additional_headers = 341 preg_replace_callback( $regex, $callback, $mail_template['additional_headers'] ); 342 344 $callback_html = array( &$this, 'mail_callback_html' ); 345 $body = preg_replace_callback( $regex, $callback_html, $mail_template['body'] ); 346 } else {Base.php https://gitlab.com/fiesta-framework/Documentation | PHP | 509 lines
1<?php 2 239 * twister random generator. This function is therefore more random than 240 * PHP's shuffle() function, and it is seedable. 241 * 276 * twister random generator. This function is therefore more random than 277 * PHP's shuffle() function, and it is seedable. Additionally, it is 278 * UTF8 safe if the mb extension is available. 332 } 333 $string = preg_replace_callback('/\%/u', 'static::randomDigitNotNull', $string); 334 345 { 346 return preg_replace_callback('/\?/u', 'static::randomLetter', $string); 347 } 369 { 370 return preg_replace_callback('/\*/u', 'static::randomAscii', $string); 371 }Mbstring.php https://gitlab.com/ealexis.t/trends | PHP | 604 lines
1<?php 2 14/** 15 * Partial mbstring implementation in PHP, iconv based, UTF-8 centric. 16 * 64{ 65 const MB_CASE_FOLD = PHP_INT_MAX; 66 101 102 return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s); 103 } 151 if (MB_CASE_TITLE == $mode) { 152 $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s); 153 $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s);ProgressBar.php https://gitlab.com/ealexis.t/trends | PHP | 585 lines
1<?php 2 82 * @param string $name The placeholder name (including the delimiter char like %) 83 * @param callable $callable A PHP callable 84 */ 98 * 99 * @return callable|null A PHP callable 100 */ 404 405 $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) { 406 if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) {BladeCompiler.php https://gitlab.com/ealexis.t/trends | PHP | 1057 lines
1<?php 2 157 // Here we will loop through all of the tokens returned by the Zend lexer and 158 // parse each one into the corresponding valid PHP. We will then have this 159 // template as the correctly rendered PHP that can be rendered natively. 172 $result = ltrim($result, PHP_EOL) 173 .PHP_EOL.implode(PHP_EOL, array_reverse($this->footer)); 174 } 186 { 187 return preg_replace_callback('/(?<!@)@verbatim(.*?)@endverbatim/s', function ($matches) { 188 $this->verbatimBlocks[] = $matches[1]; 201 { 202 $result = preg_replace_callback('/'.preg_quote($this->verbatimPlaceholder).'/', function () { 203 return array_shift($this->verbatimBlocks); 245 /** 246 * Compile Blade comments into valid PHP. 247 *helpers.php https://gitlab.com/ealexis.t/trends | PHP | 893 lines
1<?php 2 612 { 613 return preg_replace_callback($pattern, function ($match) use (&$replacements) { 614 foreach ($replacements as $key => $value) {UrlGenerator.php https://gitlab.com/ealexis.t/trends | PHP | 754 lines
1<?php 2 208 209 // Once we get the root URL, we will check to see if it contains an index.php 210 // file in the paths. If it does, we will remove it since it is not needed 226 { 227 // Once we get the root URL, we will check to see if it contains an index.php 228 // file in the paths. If it does, we will remove it since it is not needed 235 /** 236 * Remove the index.php file from a path. 237 * 242 { 243 $i = 'index.php'; 244 365 366 $path = preg_replace_callback('/\{.*?\}/', function ($match) use (&$parameters) { 367 return (empty($parameters) && ! Str::endsWith($match[0], '?}'))Uri.php https://gitlab.com/ealexis.t/trends | PHP | 606 lines
1<?php 2namespace GuzzleHttp\Psr7; 578 { 579 return preg_replace_callback( 580 '/(?:[^' . self::$charUnreserved . self::$charSubDelims . ':@\/%]+|%(?![A-Fa-fshortcodes.php https://gitlab.com/VTTE/sitios-vtte | PHP | 671 lines
1<?php 2/** 217 $pattern = get_shortcode_regex( $tagnames ); 218 $content = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $content ); 219 259 260 // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation 261 return '\\[' // Opening bracket. 288 . '(\\]?)'; // 6: Optional second closing brocket for escaping shortcodes: [[tag]]. 289 // phpcs:enable 290} 413 if ( 1 === preg_match( '%^<\s*\[\[?[^\[\]]+\]%', $element ) ) { 414 $element = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $element ); 415 } 444 */ 445 $attr = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $attr ); 446 } else {Url.php https://gitlab.com/x33n/respond | PHP | 595 lines
1<?php 2namespace GuzzleHttp; 453 // Ensure the query does not have illegal characters. 454 $this->query = preg_replace_callback( 455 self::$queryPattern,CSSmin.php https://gitlab.com/x33n/ImpressPages | PHP | 758 lines
7 * 8 * This is a PHP port of the CSS minification tool distributed with YUICompressor, 9 * itself a port of the cssmin utility by Isaac Schlueter - http://foohack.com/ 36 private $pcre_recursion_limit; 37 private $raise_php_limits; 38 50 51 $this->raise_php_limits = (bool) $raise_php_limits; 52 } 66 if ($this->raise_php_limits) { 67 $this->do_raise_php_limits(); 68 } 95 // Let's divide css code in chunks of 25.000 chars aprox. 96 // Reason: PHP's PCRE functions like preg_replace have a "backtrack limit" 97 // of 100.000 chars by default (php < 5.3.7) so if we're dealing with reallyroots-cleanup.php https://gitlab.com/blueprintmrk/bladencountyrecords | PHP | 515 lines
1<?php 2 38function roots_root_relative_url($input) { 39 $output = preg_replace_callback( 40 '!(https?://[^/|"]+)([^"]+)?!', 68$roots_options = roots_get_theme_options(); 69if (!is_admin() && !in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php')) && $roots_options['root_relative_urls']) { 70 add_filter('bloginfo_url', 'roots_root_relative_url'); 183 184 // stop Gravity Forms from outputting CSS since it's linked in header.php 185 if (class_exists('RGForms')) { 190 // why you might want to keep it: http://wordpress.stackexchange.com/questions/5451/what-does-l10n-js-do-in-wordpress-3-1-and-how-do-i-remove-it/5484#5484 191 // don't load jQuery through WordPress since it's linked in header.php 192 if (!is_admin()) {common.php https://gitlab.com/blueprintmrk/bladencountyrecords | PHP | 631 lines
1<?php 2# try to load the wordpress environment from passed in location known by the client 5if ( isset( $_POST["root"] ) ) { 6 require_once( $_POST["root"] . "/wp-load.php" ); 7} else { 7} else { 8 require_once( dirname( __FILE__ ) . "/../../../wp-load.php" ); 9} 10 11require_once( ABSPATH . "wp-admin/includes/admin.php" ); 12 22 function json_encode( $value ) { 23 require_once( "lib/FastJSON.class.php" ); 24 return FastJSON::encode($value); 59 // special consideration for variables that are objects 60 // see: http://www.thoughtlabs.com/2008/02/02/phps-mystical-__set_state-method/ 61 $export = preg_replace_callback( "/(\w+)::__set_state/Ums", "class_set_state_check", $export );cssmin.php https://gitlab.com/Blueprint-Marketing/vip-quickstart | PHP | 777 lines
9 * itself a port of the cssmin utility by Isaac Schlueter - http://foohack.com/ 10 * Permission is hereby granted to use the PHP version under the same 11 * conditions as the YUICompressor. 50 51 $this->raise_php_limits = (bool) $raise_php_limits; 52 } 92 // preserve strings so their content doesn't get accidentally minified 93 $css = preg_replace_callback('/(?:"(?:[^\\\\"]|\\\\.|\\\\)*")|'."(?:'(?:[^\\\\']|\\\\.|\\\\)*')/S", array($this, 'replace_string'), $css); 94 95 // Let's divide css code in chunks of 5.000 chars aprox. 96 // Reason: PHP's PCRE functions like preg_replace have a "backtrack limit" 97 // of 100.000 chars by default (php < 5.3.7) so if we're dealing with really 321 // NOTE: rgb() isn't useful as we replace with #hex later, as well as and() is already done for us 322 $css = preg_replace_callback('/([:,\( ]\s*)(attr|color-stop|from|rgba|to|url|(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?(?:calc|max|min|(?:repeating-)?(?:linear|radial)-gradient)|-webkit-gradient)/iS', array($this, 'lowercase_common_functions_values'), $css); 323ext_pcre.php https://gitlab.com/Blueprint-Marketing/hhvm | PHP | 414 lines
1<?hh 2// @generated by docskel.php 3 45 * PREG_RECURSION_LIMIT_ERROR (see also pcre.recursion_limit) 46 * PREG_BAD_UTF8_ERROR PREG_BAD_UTF8_OFFSET_ERROR (since PHP 5.3.0) 47 */ 147 * stringhandler arraymatches You'll often need the callback 148 * function for a preg_replace_callback() in just one place. In this case 149 * you can use an anonymous function to declare the callback within the 149 * you can use an anonymous function to declare the callback within the 150 * call to preg_replace_callback(). By doing it this way you have all 151 * information for the call in one place and do not clutter the function 152 * namespace with a callback function's name not used anywhere else. 153 * preg_replace_callback() and anonymous function 154 * @param mixed $subject - The string or an array with strings to searchshortcodes.php https://gitlab.com/webkod3r/tripolis | PHP | 614 lines
1<?php 2/** 222 $pattern = get_shortcode_regex( $tagnames ); 223 $content = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $content ); 224 382 if ( 1 === preg_match( '%^<\s*\[\[?[^\[\]]+\]%', $element ) ) { 383 $element = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $element ); 384 } 411 // and we do not need to run KSES here. 412 $attr = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $attr ); 413 } else { 416 $count = 0; 417 $new_attr = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $attr, -1, $count ); 418 if ( $count > 0 ) {post-template.php https://gitlab.com/webkod3r/tripolis | PHP | 1582 lines
1<?php 2/** 318 if ( $preview ) // Preview fix for JavaScript bug with foreign languages. 319 $output = preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output ); 320 329 * 330 * @param array $match Match array from preg_replace_callback. 331 * @return stringclass-emogrifier.php https://gitlab.com/webkod3r/tripolis | PHP | 788 lines
1<?php 2/** 240 foreach ($nodesWithStyleAttributes as $node) { 241 $normalizedOriginalStyle = preg_replace_callback( '/[A-z\\-]+(?=\\:)/S', array( $this, 'strtolower' ), $node->getAttribute('style') ); 242 464 private function splitCssAndMediaQuery($css) { 465 $css = preg_replace_callback( '#@media\\s+(?:only\\s)?(?:[\\s{\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', array( $this, '_media_concat' ), $css ); 466media.php https://gitlab.com/webkod3r/tripolis | PHP | 1554 lines
1<?php 2/** 85 } else { 86 /** This filter is documented in wp-admin/media-upload.php */ 87 $current = apply_filters( 'media_upload_default_tab', $default ); 210 $caption = str_replace( array("\r\n", "\r"), "\n", $caption); 211 $caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption ); 212 254var win = window.dialogArguments || opener || parent || top; 255win.send_to_editor( <?php echo wp_json_encode( $html ); ?> ); 256</script> 454?> 455<title><?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — <?php _e('WordPress'); ?></title> 456<?php 466addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; 467var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup', 468isRtl = <?php echo (int) is_rtl(); ?>;markdown.php https://gitlab.com/valced/anchor-cms | PHP | 1480 lines
1<?php 2 5# 6# PHP Markdown 7# Copyright (c) 2004-2012 Michel Fortin 7# Copyright (c) 2004-2012 Michel Fortin 8# <http://michelf.com/projects/php-markdown/> 9# 37 # Regex to match balanced [brackets]. 38 # Needed to insert a maximum bracked depth while converting to PHP. 39 var $nested_brackets_depth = 6; 161 # Link defs are in the form: ^[id]: url "optional title" 162 $text = preg_replace_callback('{ 163 ^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?: # id = $1 269 # match will start at the first `<div>` and stop at the first `</div>`. 270 $text = preg_replace_callback('{(?> 271 (?>BladeCompiler.php https://gitlab.com/Pasantias/pasantiasASLG | PHP | 889 lines
1<?php 2 139 // Here we will loop through all of the tokens returned by the Zend lexer and 140 // parse each one into the corresponding valid PHP. We will then have this 141 // template as the correctly rendered PHP that can be rendered natively. 150 $result = ltrim($result, PHP_EOL) 151 .PHP_EOL.implode(PHP_EOL, array_reverse($this->footer)); 152 } 191 /** 192 * Compile Blade comments into valid PHP. 193 * 200 201 return preg_replace($pattern, '<?php /*$1*/ ?>', $value); 202 } 204 /** 205 * Compile Blade echos into valid PHP. 206 *UrlGenerator.php https://gitlab.com/Pasantias/pasantiasASLG | PHP | 741 lines
1<?php 2 207 208 // Once we get the root URL, we will check to see if it contains an index.php 209 // file in the paths. If it does, we will remove it since it is not needed 225 { 226 // Once we get the root URL, we will check to see if it contains an index.php 227 // file in the paths. If it does, we will remove it since it is not needed 234 /** 235 * Remove the index.php file from a path. 236 * 241 { 242 $i = 'index.php'; 243 370 { 371 return preg_replace_callback('/\{(.*?)\??\}/', function ($m) use (&$parameters) { 372 return isset($parameters[$m[1]]) ? Arr::pull($parameters, $m[1]) : $m[0];Stringy.php https://gitlab.com/Pasantias/pasantiasASLG | PHP | 1413 lines
1<?php 2 239 240 $camelCase = preg_replace_callback( 241 '/[-_\s]+(.)?/u', 247 248 $stringy->str = preg_replace_callback( 249 '/[\d]+(.)?/u', 329 330 $stringy->str = preg_replace_callback( 331 '/[\S]/u', 357 358 $buffer = preg_replace_callback( 359 '/([\S]+)/u',markdown.php https://bitbucket.org/rezanachmad/php-selenium-training.git | PHP | 1796 lines
1<?php 2# 4# 5# PHP Markdown & Extra 6# Copyright (c) 2004-2012 Michel Fortin 6# Copyright (c) 2004-2012 Michel Fortin 7# <http://michelf.com/projects/php-markdown/> 8# 20 # Regex to match balanced [brackets]. 21 # Needed to insert a maximum bracked depth while converting to PHP. 22 public $nested_brackets_depth = 6; 155 # Link defs are in the form: ^[id]: url "optional title" 156 $text = preg_replace_callback('{ 157 ^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?: # id = $1 261 # match will start at the first `<div>` and stop at the first `</div>`. 262 $text = preg_replace_callback('{(?> 263 (?>UriTemplate.php https://gitlab.com/wuhang2003/rainloop-webmail | PHP | 242 lines
1<?php 2 47 48 return preg_replace_callback( 49 '/\{([^\}]+)\}/', 95 * 96 * @param array $matches Matches met in the preg_replace_callback 97 *abap.php https://gitlab.com/brian0218/rk3066_r-box_android4.2.2_sdk | PHP | 1419 lines
1<?php 2/************************************************************************************* 2/************************************************************************************* 3 * abap.php 4 * -------- 61 * There are many other exceptions. 62 * Note: for adding this functionality within your php program, you can execute this code: 63 * function add_urls_to_multi_tokens( $matches ) { 68 * $html = $geshi->parse_code(); 69 * $html = preg_replace_callback( "£(zzz:(control|statement|data);\">)(.+?)(</span>)£s", "add_urls_to_multi_tokens", $html ); 70 * echo $html;UrlGenerator.php https://gitlab.com/judielsm/Handora | PHP | 707 lines
1<?php 2 197 198 // Once we get the root URL, we will check to see if it contains an index.php 199 // file in the paths. If it does, we will remove it since it is not needed 206 /** 207 * Remove the index.php file from a path. 208 * 213 { 214 $i = 'index.php'; 215 342 { 343 return preg_replace_callback('/\{(.*?)\??\}/', function ($m) use (&$parameters) { 344 return isset($parameters[$m[1]]) ? Arr::pull($parameters, $m[1]) : $m[0]; 360 // not going to be available. We will remove it then append it back on here. 361 if (! is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) { 362 $uri = preg_replace('/#.*/', '', $uri);Base.php https://gitlab.com/judielsm/Handora | PHP | 509 lines
1<?php 2 239 * twister random generator. This function is therefore more random than 240 * PHP's shuffle() function, and it is seedable. 241 * 276 * twister random generator. This function is therefore more random than 277 * PHP's shuffle() function, and it is seedable. Additionally, it is 278 * UTF8 safe if the mb extension is available. 332 } 333 $string = preg_replace_callback('/\%/u', 'static::randomDigitNotNull', $string); 334 345 { 346 return preg_replace_callback('/\?/u', 'static::randomLetter', $string); 347 } 369 { 370 return preg_replace_callback('/\*/u', 'static::randomAscii', $string); 371 }DirectLex.php https://gitlab.com/afzalpotenza/YII_salon | PHP | 539 lines
1<?php 2 5 * 6 * A pure PHP parser, DirectLex has absolutely no dependencies, making 7 * it a reasonably good default for PHP4. Written with efficiency in mind, 47 if ($config->get('HTML.Trusted')) { 48 $html = preg_replace_callback( 49 '#(<script[^>]*>)(\s*[^<].+?)(</script>)#si', 346 /** 347 * PHP 5.0.x compatible substr_count that implements offset and length 348 * @param string $haystack 357 if ($oldVersion === null) { 358 $oldVersion = version_compare(PHP_VERSION, '5.1', '<'); 359 }ExtractStyleBlocks.php https://gitlab.com/Griffolion/Final-Year-Project | PHP | 289 lines
1<?php 2 2 3// why is this a top level function? Because PHP 5.2.0 doesn't seem to 4// understand how to interpret this filter if it's a static method. 14 * @note 15 * See tests/HTMLPurifier/Filter/ExtractStyleBlocksTest.php for 16 * sample usage. 56 if ($tidy !== null) $this->_tidy = $tidy; 57 $html = preg_replace_callback('#<style(?:\s.*)?>(.+)</style>#isU', array($this, 'styleCallback'), $html); 58 $style_blocks = $this->_styleMatches;CakeTime.php https://bitbucket.org/LeThanhDat/firstdummyapp.git | PHP | 1065 lines
6 * 7 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) 8 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) 14 * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) 15 * @link http://cakephp.org CakePHP(tm) Project 16 * @package Cake.Utility 36 * The format should use the locale strings as defined in the PHP docs under 37 * `strftime` (http://php.net/manual/en/function.strftime.php) 38 * 141 self::$_time = $time; 142 return preg_replace_callback('/\%(\w+)/', array('CakeTime', '_translateSpecifier'), $format); 143 } 351 * 352 * See http://php.net/manual/en/function.strftime.php for information on formatting 353 * using locale strings.time.php https://github.com/hack521/contenidopago.git | PHP | 755 lines
6 * 7 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) 8 * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) 13 * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) 14 * @link http://cakephp.org CakePHP(tm) Project 15 * @package cake 16 * @subpackage cake.cake.libs.view.helpers 17 * @since CakePHP(tm) v 0.10.0.1076 18 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) 278 * @access public 279 * @link http://book.cakephp.org/view/1471/Formatting 280 */ 304 * @access public 305 * @link http://book.cakephp.org/view/1472/Testing-Time 306 */ParserOutput.php https://github.com/daevid/MWFork.git | PHP | 447 lines
1<?php 2/** 2/** 3 * Output of the PHP parser 4 * 158 if ( $this->mEditSectionTokens ) { 159 return preg_replace_callback( ParserOutput::EDITSECTION_REGEX, 160 array( &$this, 'replaceEditSectionLinksCallback' ), $this->mText );LinkHolderArray.php https://github.com/daevid/MWFork.git | PHP | 599 lines
1<?php 2/** 111 } 112 $texts = preg_replace_callback( '/(<!--LINK \d+:)(\d+)(-->)/', 113 array( $this, 'mergeForeignCallback' ), $texts ); 120 } 121 $texts = preg_replace_callback( '/(<!--IWLINK )(\d+)(-->)/', 122 array( $this, 'mergeForeignCallback' ), $texts ); 381 wfProfileIn( __METHOD__.'-replace' ); 382 $text = preg_replace_callback( 383 '/(<!--LINK .*?-->)/', 408 409 $text = preg_replace_callback( 410 '/<!--IWLINK (.*?)-->/',DibiTranslator.php https://github.com/premiumcombination/nts.git | PHP | 592 lines
1<?php 2 112/* 113 . preg_replace_callback('/ 114 (?=[`[\'":%?]) ## speed-up 125*/ // note: this can change $this->args & $this->cursor & ... 126 . preg_replace_callback('/(?=[`[\'":%?])(?:`(.+?)`|\[(.+?)\]|(\')((?:\'\'|[^\'])*)\'|(")((?:""|[^"])*)"|(\'|")|:(\S*?:)([a-zA-Z0-9._]?)|%([a-zA-Z~][a-zA-Z0-9~]{0,5})|(\?))/s', 127 array($this, 'cb'), 386 $value = substr($value, 0, $toSkip) 387 . preg_replace_callback( 388 '/(?=[`[\'":])(?:`(.+?)`|\[(.+?)\]|(\')((?:\'\'|[^\'])*)\'|(")((?:""|[^"])*)"|(\'|")|:(\S*?:)([a-zA-Z0-9._]?))/s',ModelAbstract.php https://bitbucket.org/Dal-Papa/is-340-publish-base.git | PHP | 508 lines
1<?php 2/** 130 /** 131 * Converts database column name to php setter/getter function name 132 * @param string $column 143 /** 144 * Converts database column name to PHP setter/getter function name 145 * @param string $column 268 foreach ($options as $key => $value) { 269 $key = preg_replace_callback('/_(.)/', 270 function ($matches) {SphinxMWSearch.php https://github.com/ChuguluGames/mediawiki-svn.git | PHP | 636 lines
1<?php 2 216 $regexp = $this->preparePrefixRegexp(); 217 $part = preg_replace_callback( 218 '/(^|[| :]|-)(' . $regexp . '):([^ ]+)/i', 386 * Wiki-specific search suggestions using enchant library. 387 * Use SphinxSearch_setup.php to create the dictionary 388 */SimpleSecurity_body.php https://github.com/ChuguluGames/mediawiki-svn.git | PHP | 466 lines
1<?php 2/** 98 public function onBeforePageDisplay( &$out ) { 99 $out->mBodytext = preg_replace_callback( 100 "|<a[^>]+title=\"(.+?)\".+?>(.+?)</a>|", 230 static function patchSQL( $sql ) { 231 return preg_replace_callback( "/^SELECT\b\s*(.+?)\s*\bFROM\b/i", 'SimpleSecurity::patchSQL_internal', $sql, 1 ); 232 }MWSearch_body.php https://github.com/ChuguluGames/mediawiki-svn.git | PHP | 740 lines
1<?php 2 111 # replace namespaces 112 $r = preg_replace_callback('/(^|[| :])('.$regexp.'):/i',array($this,'replaceNamespace'),$part); 113 # replace to backend all: notationweb.php https://github.com/XioNoX/Benevolus.git | PHP | 509 lines
1<?php 2 3/** 4 Web pack for the PHP Fat-Free Framework 5 72 // Rewrite relative URLs in CSS 73 $src.=preg_replace_callback( 74 '/\b(?<=url)\(([\"\'])*([^\1]+?)\1\)/', 205 if ($echo) { 206 if (PHP_SAPI!='cli' && !headers_sent()) 207 header(self::HTTP_Content.': '.$mime[$ext[1]].'; '. 295 self::HTTP_Agent.': Mozilla/5.0 '. 296 '(compatible;'.PHP_OS.')'.self::EOL. 297 ($reqhdrs? 330 self::$vars['HEADERS'][]=$hdr; 331 if (PHP_SAPI!='cli' && $forward) 332 // Forward HTTP headerUtil.php https://gitlab.com/johanlindberg/irvato-crm | PHP | 542 lines
1<?php 2/************************************************************************ 89 } 90 return preg_replace_callback('/'.$symbol.'([a-z])/', 'static::toCamelCaseConversion', $name); 91 } 116 $name[0] = strtolower($name[0]); 117 return preg_replace_callback('/([A-Z])/', function ($matches) use ($symbol) { 118 return $symbol . strtolower($matches[1]); 135 /** 136 * Merge arrays recursively (default PHP function is not suitable) 137 * 289 /** 290 * Appends 'Obj' if name is reserved PHP word. 291 * 303 /** 304 * Remove 'Obj' if name is reserved PHP word. 305 *Cdn.php https://gitlab.com/juanito.abelo/nlmobile | PHP | 1022 lines
1<?php 2 9 10w3_require_once(W3TC_INC_DIR . '/functions/file.php'); 11w3_require_once(W3TC_LIB_W3_DIR . '/Plugin.php'); 252 if ($this->_config->get_boolean('cdn.uploads.enable')) { 253 w3_require_once(W3TC_INC_DIR . '/functions/http.php'); 254 316 foreach ($regexps as $regexp) { 317 $buffer = preg_replace_callback($regexp, array( 318 &$this, 338 339 $buffer = preg_replace_callback($regexp, array( 340 &$this,shortcodes.php https://gitlab.com/darmawan.fatria/df-skp-2014 | PHP | 557 lines
1<?php 2/** 211 $pattern = get_shortcode_regex(); 212 $content = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content ); 213 358 if ( 1 === preg_match( '%^<\s*\[\[?[^\[\]]+\]%', $element ) ) { 359 $element = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $element ); 360 } 387 // and we do not need to run KSES here. 388 $attr = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $attr ); 389 } else { 392 $count = 0; 393 $new_attr = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $attr, -1, $count ); 394 if ( $count > 0 ) {post-template.php https://gitlab.com/darmawan.fatria/df-skp-2014 | PHP | 1617 lines
1<?php 2/** 302 if ( $preview ) // Preview fix for JavaScript bug with foreign languages. 303 $output = preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output ); 304 312 * @access private 313 * @param array $match Match array from preg_replace_callback 314 * @return stringmedia.php https://gitlab.com/darmawan.fatria/df-skp-2014 | PHP | 1551 lines
1<?php 2/** 82 } else { 83 /** This filter is documented in wp-admin/media-upload.php */ 84 $current = apply_filters( 'media_upload_default_tab', $default ); 197 $caption = str_replace( array("\r\n", "\r"), "\n", $caption); 198 $caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption ); 199 242var win = window.dialogArguments || opener || parent || top; 243win.send_to_editor('<?php echo addslashes($html); ?>'); 244</script> 442?> 443<title><?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — <?php _e('WordPress'); ?></title> 444<?php 454addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; 455var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup', 456isRtl = <?php echo (int) is_rtl(); ?>;media.php https://github.com/mhoofman/wordpress-heroku.git | PHP | 1554 lines
197 $caption = str_replace( array("\r\n", "\r"), "\n", $caption); 198 $caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption ); 199 243var win = window.dialogArguments || opener || parent || top; 244win.send_to_editor('<?php echo addslashes($html); ?>'); 245/* ]]> */ 246</script> 247<?php 248 exit; 439?> 440<title><?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — <?php _e('WordPress'); ?></title> 441<?php 452addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; 453var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup', 454isRtl = <?php echo (int) is_rtl(); ?>;shortcodes.php https://gitlab.com/Gashler/sg | PHP | 558 lines
1<?php 2/** 209 $pattern = get_shortcode_regex(); 210 $content = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content ); 211 363 if ( 1 === preg_match( '%^<\s*\[\[?[^\[\]]+\]%', $element ) ) { 364 $element = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $element ); 365 } 392 // and we do not need to run KSES here. 393 $attr = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $attr ); 394 } else { 397 $count = 0; 398 $new_attr = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $attr, -1, $count ); 399 if ( $count > 0 ) {media.php https://gitlab.com/Gashler/sg | PHP | 1564 lines
200 $caption = str_replace( array("\r\n", "\r"), "\n", $caption); 201 $caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption ); 202 244var win = window.dialogArguments || opener || parent || top; 245win.send_to_editor('<?php echo addslashes($html); ?>'); 246</script> 246</script> 247<?php 248 exit; 444?> 445<title><?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — <?php _e('WordPress'); ?></title> 446<?php 456addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; 457var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup', 458isRtl = <?php echo (int) is_rtl(); ?>;helpers.php https://gitlab.com/milton2913/myBlog | PHP | 892 lines
1<?php 2 600 { 601 return preg_replace_callback($pattern, function () use (&$replacements) { 602 foreach ($replacements as $key => $value) {BladeCompiler.php https://gitlab.com/mdabutaleb/bitm-laravel-1 | PHP | 1093 lines
157 // Here we will loop through all of the tokens returned by the Zend lexer and 158 // parse each one into the corresponding valid PHP. We will then have this 159 // template as the correctly rendered PHP that can be rendered natively. 172 $result = ltrim($result, PHP_EOL) 173 .PHP_EOL.implode(PHP_EOL, array_reverse($this->footer)); 174 } 186 { 187 return preg_replace_callback('/(?<!@)@verbatim(.*?)@endverbatim/s', function ($matches) { 188 $this->verbatimBlocks[] = $matches[1]; 442 /** 443 * Compile the show statements into valid PHP. 444 * 570 { 571 return "<?php for{$expression}: ?>"; 572 }TokensTest.php https://gitlab.com/I-NOZex/quiz | PHP | 1064 lines
1<?php 2 3/* 4 * This file is part of the PHP CS utility. 5 * 21 */ 22class TokensTest extends \PHPUnit_Framework_TestCase 23{ 47 { 48 $source = <<<'PHP' 49<?php 71} 72PHP; 73 87 { 88 $code = '<?php echo 1;'; 89 $tokens = Tokens::fromCode($code);Markdown.php https://gitlab.com/atelier-bek/atelier-bek.be | PHP | 1616 lines
1<?php 2# 4# 5# PHP Markdown 6# Copyright (c) 2004-2015 Michel Fortin 6# Copyright (c) 2004-2015 Michel Fortin 7# <https://michelf.ca/projects/php-markdown/> 8# 86 # Regex to match balanced [brackets]. 87 # Needed to insert a maximum bracked depth while converting to PHP. 88 protected $nested_brackets_depth = 6; 210 # Link defs are in the form: ^[id]: url "optional title" 211 $text = preg_replace_callback('{ 212 ^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?: # id = $1 318 # match will start at the first `<div>` and stop at the first `</div>`. 319 $text = preg_replace_callback('{(?> 320 (?>Mbstring.php https://gitlab.com/xolotsoft/pumasruiz | PHP | 562 lines
1<?php 2 11 12namespace Patchwork\PHP\Shim; 13 14/** 15 * Partial mbstring implementation in PHP, iconv based, UTF-8 centric. 16 * 60{ 61 const MB_CASE_FOLD = PHP_INT_MAX; 62 92 93 return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s); 94 } 132 if (MB_CASE_TITLE == $mode) { 133 $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s); 134 $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s);Mbstring.php https://gitlab.com/xolotsoft/pumasruiz | PHP | 442 lines
1<?php // vi: set fenc=utf-8 ts=4 sw=4 et: 2/* 10 11namespace Patchwork\PHP\Shim; 12 13/** 14 * Partial mbstring implementation in PHP, iconv based, UTF-8 centric. 15 * 60{ 61 const MB_CASE_FOLD = PHP_INT_MAX; 62 94 || $s = iconv($from_encoding, 'UTF-8//IGNORE', $s); 95 return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s); 96 } 129 { 130 $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s); 131 $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s);ExcelParser.php https://gitlab.com/kimting254/wbms | PHP | 667 lines
4use PHPExcel_Cell; 5use PHPExcel_Exception; 6use PHPExcel_Shared_Date; 7use Illuminate\Support\Str; 8use PHPExcel_Style_NumberFormat; 9use Illuminate\Support\Facades\Config; 41 * Excel object 42 * @var PHPExcel 43 */ 53 * Row object 54 * @var PHPExcel_Worksheet_Row 55 */ 563 // Convert excel time to php date object 564 $date = PHPExcel_Shared_Date::ExcelToPHPObject($this->cell->getCalculatedValue())->format('Y-m-d H:i:s'); 565BladeCompiler.php https://gitlab.com/kimting254/wbms | PHP | 812 lines
1<?php namespace Illuminate\View\Compilers; 2 127 // Here we will loop through all of the tokens returned by the Zend lexer and 128 // parse each one into the corresponding valid PHP. We will then have this 129 // template as the correctly rendered PHP that can be rendered natively. 140 $result = ltrim($result, PHP_EOL) 141 .PHP_EOL.implode(PHP_EOL, array_reverse($this->footer)); 142 } 184 /** 185 * Compile Blade comments into valid PHP. 186 * 193 194 return preg_replace($pattern, '<?php /*$1*/ ?>', $value); 195 } 197 /** 198 * Compile Blade echos into valid PHP. 199 *UrlGenerator.php https://gitlab.com/kimting254/wbms | PHP | 711 lines
1<?php namespace Illuminate\Routing; 2 189 190 // Once we get the root URL, we will check to see if it contains an index.php 191 // file in the paths. If it does, we will remove it since it is not needed 198 /** 199 * Remove the index.php file from a path. 200 * 205 { 206 $i = 'index.php'; 207 338 { 339 return preg_replace_callback('/\{(.*?)\??\}/', function($m) use (&$parameters) 340 { 357 // not going to be available. We will remove it then append it back on here. 358 if ( ! is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) 359 {DBpediaFunctions.php https://gitlab.com/varunkothamachu/extraction-framework | PHP | 517 lines
72 // remove map references 73 // example: http://en.wikipedia.org/w/index.php?title=Attila_the_Hun&oldid=300682051 74 $html = preg_replace("~\s?\(see map below\)~", "", $html); 75 76 // <a href="/wikipedia/index.php/Image:Ltspkr.png" title="Image:Ltspkr.png">Image:Ltspkr.png</a> 77 $html = preg_replace("~<a\s[^>]*Image:Ltspkr\.png[^>]*>[^<]*</a>~", "", $html); 96 // delete parentheses with too many links 97 $html = preg_replace_callback("/\s?\(.*?\)/", 'DBpediaFunctions::replaceTooManyLinks', $html); 98 115 116 // <a href="/wikipedia/index.php?title=Special:Upload&wpDestFile=En-us-Denmark.ogg" class="new" title="En-us-Denmark.ogg">[?d?nm?rk]</a></span> 117 $html = preg_replace("~<a .*?>\[(.*?)\]</a>~", "", $html); 218 } else { 219 //<span class="unicode audiolink"><a href="/wikipedia/index.php?title=Special:Upload&wpDestFile=Eugen_Berthold_Friedrich_Brecht.ogg" class="new" title="Eugen Berthold Friedrich Brecht.ogg"><b>Eugen Berthold Friedrich Brecht</b></a></span> <span class="metadata audiolinkinfo">>(<a href="/wikipedia/index.php/Wikipedia:Media_help" title="Wikipedia:Media help">help</a>�<a href="/wikipedia/index.php?title=Image:Eugen_Berthold_Friedrich_Brecht.ogg&action=edit&redlink=1" class="new" title="Image:Eugen Berthold Friedrich Brecht.ogg (page does not exist)">info</a>)</small></span> 220 $html = preg_replace("~<span class=\"unicode audiolink\"><a [^>]*><b>(.*?)</b></a></span>~s", "$1", $html);RelationModel.class.php https://gitlab.com/fangfangchen/xianpipa | PHP | 412 lines
1<?php 2// +---------------------------------------------------------------------- 2// +---------------------------------------------------------------------- 3// | ThinkPHP [ WE CAN DO IT JUST THINK IT ] 4// +---------------------------------------------------------------------- 4// +---------------------------------------------------------------------- 5// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved. 6// +---------------------------------------------------------------------- 13/** 14 * ThinkPHP关联模型扩展 15 */ 189 if(isset($val['relation_table'])){ 190 $mappingRelationTable = preg_replace_callback("/__([A-Z_-]+)__/sU", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $val['relation_table']); 191 }else{Template.class.php https://gitlab.com/fangfangchen/xianpipa | PHP | 700 lines
127 // 还原被替换的Literal标签 128 $tmplContent = preg_replace_callback('/<!--###literal(\d+)###-->/is', array($this, 'restoreLiteral'), $tmplContent); 129 // 添加安全代码 154 // 首先替换literal标签内容 155 $content = preg_replace_callback('/'.$begin.'literal'.$end.'(.*?)'.$begin.'\/literal'.$end.'/is', array($this, 'parseLiteral'),$content); 156 183 //解析普通模板标签 {$tagName} 184 $content = preg_replace_callback('/('.$this->config['tmpl_begin'].')([^\d\w\s'.$this->config['tmpl_begin'].$this->config['tmpl_end'].'].+?)('.$this->config['tmpl_end'].')/is', array($this, 'parseTag'),$content); 185 return $content; 191 // 开启短标签的情况要将<?标签用echo方式输出 否则无法正常输出xml标识 192 $content = preg_replace('/(<\?(?!php|=|$))/i', '<?php echo \'\\1\'; ?>'."\n", $content ); 193 } 194 // PHP语法检查 195 if(C('TMPL_DENY_PHP') && false !== strpos($content,'<?php')) { 196 E(L('_NOT_ALLOW_PHP_'));search.php https://gitlab.com/alexprowars/bitrix | PHP | 1694 lines
1<?php 2IncludeModuleLangFile(__FILE__); 105 } 106 $strQuery = preg_replace_callback("/&#(\\d+);/", array($this, "chr"), $strQuery); 107 $bTagsSearch = false;query.php https://gitlab.com/alexprowars/bitrix | PHP | 678 lines
1<?php 2 62 //with "expr1 in (<const1>, ...)" 63 $new_sql = preg_replace_callback("/\\( (".$this->equation_regex."(?: OR ".$this->equation_regex.")+) \\)/i", array($this, "_or2in"), CPerfQuery::removeSpaces($sql)); 64 if ($new_sql !== null)livefeed.php https://gitlab.com/alexprowars/bitrix | PHP | 906 lines
1<?php 2use Bitrix\Main\Loader; 37 { 38 $element['NAME'] = preg_replace_callback( 39 '#^[^\[\]]+?\[(\d+)\]#i',form.php https://gitlab.com/alexprowars/bitrix | PHP | 945 lines
1<?php 2 87 { 88 $replace = preg_replace_callback( 89 '/(?<pre><a[^>]+href=|data-b24form=)["\']#crmForm(?<type>Inline|Popup)(?<id>[\d]+)["\']/i', 358 { 359 $link = '/bitrix/admin/b24connector_crm_forms.php?lang=' . LANGUAGE_ID; 360 }functions.php https://gitlab.com/alexprowars/bitrix | PHP | 735 lines
1<?php 2 131 { 132 $text = preg_replace_callback( 133 "/\[imag([^\]]*)id\s*=\s*([0-9]+)([^\]]*)\]/is".BX_UTF_PCRE_MODIFIER, 153 { 154 $text = preg_replace_callback( 155 "/\[tag(?:[^\]])*\](.+?)\[\/tag\]/is".BX_UTF_PCRE_MODIFIER, 200 201 $text = preg_replace_callback( 202 "/\[img([^\]]*)id\s*=\s*([0-9]+)([^\]]*)\]/is".BX_UTF_PCRE_MODIFIER, 268 269 $sourceImage = $this->serverName."/bitrix/components/bitrix/blog/show_file.php?fid=".$imageId; 270// if original size bigger than limits - need resize 327 328 $strImage = $this->serverName."/bitrix/components/bitrix/blog/show_file.php?fid=".$imageId."&width=".$width."&height=".$height; 329 $sourceImage = $this->serverName."/bitrix/components/bitrix/blog/show_file.php?fid=".$imageId;helper.php https://gitlab.com/alexprowars/bitrix | PHP | 728 lines
1<?php 2namespace Bitrix\Bizproc\Automation; 249 250 return preg_replace_callback($pattern, $converter, $source); 251 } 360 361 return preg_replace_callback($pattern, $converter, $source); 362 }AssertContentTrait.php https://gitlab.com/reasonat/test8 | PHP | 1257 lines
1<?php 2 159 * XPath 1.0 (the version supported by libxml2, the underlying XML library 160 * used by PHP) doesn't support any form of quotation. This function 161 * simplifies the building of XPath expression. 195 196 // Use preg_replace_callback() instead of preg_replace() to prevent the 197 // regular expression engine from trying to substitute backreferences. 200 }; 201 $xpath = preg_replace_callback('/' . preg_quote($placeholder) . '\b/', $replacement, $xpath); 202 } 222 * 223 * @see http://php.net/manual/function.simplexml-element-xpath.php 224 */ 228 $result = $this->elements->xpath($xpath); 229 // Some combinations of PHP / libxml versions return an empty array 230 // instead of the documented FALSE. Forcefully convert any falsish valuesBladeCompiler.php https://gitlab.com/techniconline/kmc | PHP | 797 lines
1<?php namespace Illuminate\View\Compilers; 2 126 // Here we will loop through all of the tokens returned by the Zend lexer and 127 // parse each one into the corresponding valid PHP. We will then have this 128 // template as the correctly rendered PHP that can be rendered natively. 137 $result = ltrim($result, PHP_EOL) 138 . PHP_EOL . implode(PHP_EOL, array_reverse($this->footer)); 139 } 178 /** 179 * Compile Blade comments into valid PHP. 180 * 187 188 return preg_replace($pattern, '<?php /*$1*/ ?>', $value); 189 } 191 /** 192 * Compile Blade echos into valid PHP. 193 *UrlGenerator.php https://gitlab.com/techniconline/kmc | PHP | 698 lines
1<?php namespace Illuminate\Routing; 2 190 191 // Once we get the root URL, we will check to see if it contains an index.php 192 // file in the paths. If it does, we will remove it since it is not needed 199 /** 200 * Remove the index.php file from a path. 201 * 206 { 207 $i = 'index.php'; 208 335 { 336 return preg_replace_callback('/\{(.*?)\??\}/', function ($m) use (&$parameters) { 337 return isset($parameters[$m[1]]) ? array_pull($parameters, $m[1]) : $m[0]; 353 // not going to be available. We will remove it then append it back on here. 354 if (!is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) { 355 $uri = preg_replace('/#.*/', '', $uri);CakeTime.php https://gitlab.com/manuperazafa/elsartenbackend | PHP | 1144 lines
4 * 5 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) 6 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) 12 * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) 13 * @link http://cakephp.org CakePHP(tm) Project 14 * @package Cake.Utility 34 * The format should use the locale strings as defined in the PHP docs under 35 * `strftime` (http://php.net/manual/en/function.strftime.php) 36 * 244 * @return int UNIX timestamp 245 * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::convert 246 */ 354 * 355 * See http://php.net/manual/en/function.strftime.php for information on formatting 356 * using locale strings.parser.php https://gitlab.com/nacridan/Nacridan | PHP | 987 lines
1<?php 2 97 // Tidy up lists 98 $temp = preg_replace_callback($re_list, create_function('$matches', 'return preparse_list_tag($matches[2], $matches[1]);'), $text); 99CSSMin.php https://bitbucket.org/hieblmedia/jyaml.git | PHP | 804 lines
23 * 24 * This is a PHP port of the Javascript port of the CSS minification tool 25 * distributed with YUICompressor, itself a port of the cssmin utility by 26 * Isaac Schlueter - http://foohack.com/ 27 * Permission is hereby granted to use the PHP version under the same 28 * conditions as the YUICompressor. 75 76 $this->raise_php_limits = (bool) $raise_php_limits; 77 } 117 // preserve strings so their content doesn't get accidentally minified 118 $css = preg_replace_callback('/(?:"(?:[^\\\\"]|\\\\.|\\\\)*")|'."(?:'(?:[^\\\\']|\\\\.|\\\\)*')/S", array($this, 'replace_string'), $css); 119 120 // Let's divide css code in chunks of 5.000 chars aprox. 121 // Reason: PHP's PCRE functions like preg_replace have a "backtrack limit" 122 // of 100.000 chars by default (php < 5.3.7) so if we're dealing with reallyActionColumn.php https://gitlab.com/isdzulqor/Slis-Dev | PHP | 182 lines
1<?php 2/** 19 * 20 * ```php 21 * 'columns' => [ 62 * 63 * ```php 64 * function ($url, $model, $key) { 74 * 75 * ```php 76 * [ 170 { 171 return preg_replace_callback('/\\{([\w\-\/]+)\\}/', function ($matches) use ($model, $key, $index) { 172 $name = $matches[1];filter.php https://github.com/kpike/moodle.git | PHP | 892 lines
1<?php 2// This file is part of Moodle - http://moodle.org/ 30 31require_once($CFG->libdir.'/filelib.php'); 32 35 * Default media width, some plugins may use automatic sizes or accept resize parameters. 36 * This can be defined in config.php. 37 */ 44 * should calculate it themselves using the FILTER_MEDIAPLUGIN_VIDEO_HEIGHT 45 * This can be defined in config.php. 46 */ 50 51//TODO: we should use /u modifier in regex, unfortunately it may not work properly on some misconfigured servers, see lib/filter/urltolink/filter.php ... 52 87 $search = '/<a\s[^>]*href="(https?:\/\/www\.youtube(-nocookie)?\.com)\/watch\?v=([a-z0-9\-_]+)[^"#]*(#d=([\d]{1,4})x([\d]{1,4}))?"[^>]*>([^>]*)<\/a>/is'; 88 $newtext = preg_replace_callback($search, 'filter_mediaplugin_youtube_callback', $newtext); 89CakeTime.php https://bitbucket.org/00firestar00/ejfirestar.com.git | PHP | 1141 lines
4 * 5 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) 6 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) 12 * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) 13 * @link http://cakephp.org CakePHP(tm) Project 14 * @package Cake.Utility 34 * The format should use the locale strings as defined in the PHP docs under 35 * `strftime` (http://php.net/manual/en/function.strftime.php) 36 * 244 * @return integer UNIX timestamp 245 * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::convert 246 */ 354 * 355 * See http://php.net/manual/en/function.strftime.php for information on formatting 356 * using locale strings.parser.php https://github.com/karpenoktem/punbb.git | PHP | 1009 lines
1<?php 2/** 17{ 18 require FORUM_ROOT.'include/idna/idna_convert.class.php'; 19} 58 $replace_callback = 'preparse_list_tag($matches[2], $matches[1], $errors)'; 59 $text = preg_replace_callback($pattern_callback, create_function('$matches', 'return '.$replace_callback.';'), $text); 60make_link.php https://bitbucket.org/hironow/pukiwiki-skin-bootpuki.git | PHP | 854 lines
1<?php 2// PukiWiki - Yet another WikiWikiWeb clone. 2// PukiWiki - Yet another WikiWikiWeb clone. 3// $Id: make_link.php,v 1.30 2005/12/10 07:57:30 henoheno Exp $ 4// Copyright (C) 35 if (! isset($clone_func)) { 36 if (version_compare(PHP_VERSION, '5.0.0', '<')) { 37 $clone_func = create_function('$a', 'return $a;'); 94 95 $string = preg_replace_callback('/' . $this->pattern . '/x', 96 array(& $this, 'replace'), $string); 249 250 // Re-get true plugin name and patameters (for PHP 4.1.2) 251 $matches = array();classes.php https://github.com/konscript/schroderpartners.git | PHP | 578 lines
1<?php 2 275 276 $subject = preg_replace_callback( $regex, $callback, $mail_template['subject'] ); 277 $sender = preg_replace_callback( $regex, $callback, $mail_template['sender'] ); 277 $sender = preg_replace_callback( $regex, $callback, $mail_template['sender'] ); 278 $recipient = preg_replace_callback( $regex, $callback, $mail_template['recipient'] ); 279 $additional_headers = 279 $additional_headers = 280 preg_replace_callback( $regex, $callback, $mail_template['additional_headers'] ); 281 282 if ( $use_html ) { 283 $body = preg_replace_callback( $regex, $callback_html, $mail_template['body'] ); 284 $body = wpautop( $body ); 285 } else { 286 $body = preg_replace_callback( $regex, $callback, $mail_template['body'] ); 287 }Parser.php https://github.com/marcoscoelho/pyrocms.git | PHP | 789 lines
13{ 14 protected $allow_php = false; 15 protected $regex_setup = false; 51 */ 52 public function parse($text, $data = array(), $callback = false, $allow_php = false) 53 { 54 $this->setup_regex(); 55 $this->allow_php = $allow_php; 56 74 75 // The parse_conditionals method executes any PHP in the text, so clean it up. 76 if ( ! $allow_php) 297 298 $condition = preg_replace_callback('/\b('.$this->variable_regex.')\b/', array($this, 'process_condition_var'), $condition); 299class.xmlDb.php https://bitbucket.org/ferOnti/processmaker.git | PHP | 627 lines
1<?php 2 3/** 4 * class.xmlDb.php 5 * 82{ 83 var $phptype = 'myxml'; 84 var $caseFolding = true; 167 } 168 $sqlWhere = preg_replace_callback( '/(.+)\s+like\s+("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', array ('XMLConnection','sqlWhereLike' 169 ), $sqlWhere ); 169 ), $sqlWhere ); 170 $sqlWhere = preg_replace_callback( '/"(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\'/im', array ('XMLConnection','sqlString' 171 ), $sqlWhere ); 235 /* End Block */ 236 $sqlWhere = preg_replace_callback( '/(.+)\s+like\s+("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', array ('XMLConnection','sqlWhereLike' 237 ), $sqlWhere );Media.php https://bitbucket.org/enurkov/prestashop.git | PHP | 542 lines
1<?php 2/* 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 22* @copyright 2007-2012 PrestaShop SA 23* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 24* International Registered Trademark & Property of PrestaShop SA 67 //set an alphabetical order for args 68 $html_content = preg_replace_callback( 69 '/(<[a-zA-Z0-9]+)((\s?[a-zA-Z0-9]+=[\"\\\'][^\"\\\']*[\"\\\']\s?)*)>/', 72 73 require_once(_PS_TOOL_DIR_.'minify_html/minify_html.class.php'); 74 $html_content = str_replace(chr(194).chr(160), ' ', $html_content); 100 $html_content_copy = $html_content; 101 $html_content = preg_replace_callback( 102 '/\\s*(<script\\b[^>]*?>)([\\s\\S]*?)(<\\/script>)\\s*/i',Advisor.php https://gitlab.com/trungthao379/phpmyadmin | PHP | 547 lines
1<?php 2/* vim: set expandtab sw=4 ts=4 sts=4: */ 4 * A simple rules engine, that parses and executes the rules in advisory_rules.txt. 5 * Adjusted to phpMyAdmin. 6 * 6 * 7 * @package PhpMyAdmin 8 */ 13 14require_once 'libraries/advisor.lib.php'; 15 18 * 19 * @package PhpMyAdmin 20 */ 131 // Add total memory to variables as well 132 include_once 'libraries/sysinfo.lib.php'; 133 $sysinfo = PMA_getSysInfo();DirectLex.php https://github.com/mihalyf/gallery3-contrib.git | PHP | 490 lines
1<?php defined("SYSPATH") or die("No direct script access."); 2 5 * 6 * A pure PHP parser, DirectLex has absolutely no dependencies, making 7 * it a reasonably good default for PHP4. Written with efficiency in mind, 36 if ($config->get('HTML.Trusted')) { 37 $html = preg_replace_callback('#(<script[^>]*>)(\s*[^<].+?)(</script>)#si', 38 array($this, 'scriptCallback'), $html); 320 /** 321 * PHP 5.0.x compatible substr_count that implements offset and length 322 */ 325 if ($oldVersion === null) { 326 $oldVersion = version_compare(PHP_VERSION, '5.1', '<'); 327 }media.php https://gitlab.com/WPonEB/WPonEB | PHP | 1547 lines
1<?php 2/** 85 } else { 86 /** This filter is documented in wp-admin/media-upload.php */ 87 $current = apply_filters( 'media_upload_default_tab', $default ); 210 $caption = str_replace( array("\r\n", "\r"), "\n", $caption); 211 $caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption ); 212 254var win = window.dialogArguments || opener || parent || top; 255win.send_to_editor( <?php echo wp_json_encode( $html ); ?> ); 256</script> 256</script> 257<?php 258 exit; 463?> 464<title><?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — <?php _e('WordPress'); ?></title> 465<?phpUrlGenerator.php https://gitlab.com/zan_zan/laravel_sample | PHP | 707 lines
1<?php 2 197 198 // Once we get the root URL, we will check to see if it contains an index.php 199 // file in the paths. If it does, we will remove it since it is not needed 206 /** 207 * Remove the index.php file from a path. 208 * 213 { 214 $i = 'index.php'; 215 342 { 343 return preg_replace_callback('/\{(.*?)\??\}/', function ($m) use (&$parameters) { 344 return isset($parameters[$m[1]]) ? Arr::pull($parameters, $m[1]) : $m[0]; 360 // not going to be available. We will remove it then append it back on here. 361 if (!is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) { 362 $uri = preg_replace('/#.*/', '', $uri);helper.php https://gitlab.com/unofficial-mirrors/moodle | PHP | 479 lines
1<?php 2// This file is part of Moodle - http://moodle.org/ 25defined('MOODLE_INTERNAL') || die(); 26require_once($CFG->libdir . '/coursecatlib.php'); 27require_once($CFG->dirroot . '/cache/lib.php'); 27require_once($CFG->dirroot . '/cache/lib.php'); 28require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php'); 29require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php'); 59 $callback = partial(array('tool_uploadcourse_helper', 'generate_shortname_callback'), $fullname, $idnumber); 60 $result = preg_replace_callback('/(?<!%)%([+~-])?(\d)*([fi])/', $callback, $templateshortname); 61 77 * @param string $idnumber ID number. 78 * @param array $block result from preg_replace_callback. 79 * @return stringinput.php https://github.com/masuman/elgg-1.git | PHP | 524 lines
1<?php 2 /** 82 83 if (@include_once(dirname(dirname(dirname(__FILE__)))) . "/vendors/kses/kses.php") { 84 142 143 return preg_replace_callback('/(?<!=["\'])((ht|f)tps?:\/\/[^\s\r\n\t<>"\'\!\(\)]+)/i', 144 create_function( 177 if ($br) { 178 $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', create_function('$matches', 'return str_replace("\n", "<WPPreserveNewline />", $matches[0]);'), $pee); 179 $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks 184 if (strpos($pee, '<pre') !== false) 185 $pee = preg_replace_callback('!(<pre.*?>)(.*?)</pre>!is', 'clean_pre', $pee ); 186 $pee = preg_replace( "|\n</p>$|", '</p>', $pee ); 243 if (!empty($_SERVER['PHP_SELF'])) { 244 $_SERVER['PHP_SELF'] = stripslashes($_SERVER['PHP_SELF']); 245 }UriRewriter.php https://bitbucket.org/adatux_/uakami.git | PHP | 381 lines
1<?php 2/** 127 // rewrite 128 $css = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/', array(self::$className, '_processUriCB'), $css); 129 $css = preg_replace_callback('/url\\(\\s*([^\\)\\s]+)\\s*\\)/', array(self::$className, '_processUriCB'), $css); 151 // append 152 $css = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/', array(self::$className, '_processUriCB'), $css); 153 $css = preg_replace_callback('/url\\(\\s*([^\\)\\s]+)\\s*\\)/', array(self::$className, '_processUriCB'), $css);