100+ results for 'php preg_replace_callback'
Not the results you expected?
Tokenizer.php (https://bitbucket.org/hill2steve/mobileroom.git) PHP · 201 lines
1 <?php
3 /*
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);
Query.php (https://github.com/tmccormi/openemr.git) PHP · 195 lines
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
51 }
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 }
XLSX.php (https://gitlab.com/VTTE/sitios-vtte) PHP · 178 lines
1 <?php
3 namespace Box\Spout\Common\Escaper;
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 }
127 return preg_replace_callback("/({$this->escapableControlCharactersPattern})/", function($matches) {
128 return $this->controlCharactersEscapingReverseMap[$matches[0]];
129 }, $escapedString);
143 /**
144 * Converts OpenXML escaped control characters from the given string to PHP control characters
145 *
146 * Excel escapes control characters with _xHHHH_ and also escapes any
UriTemplate.php (https://gitlab.com/fayimora/pp) PHP · 241 lines
1 <?php
2 namespace GuzzleHttp;
45 $this->variables = $variables;
47 return preg_replace_callback(
48 '/\{([^\}]+)\}/',
49 [$this, 'expandMatch'],
93 * Process an expansion
94 *
95 * @param array $matches Matches met in the preg_replace_callback
96 *
97 * @return string Returns the replacement string
Header.php (https://github.com/ggunlugu/ornekler.git) PHP · 247 lines
1 <?php
2 /**
3 *
46 * @author John Gruber <http://daringfireball.net/projects/markdown/>
47 *
48 * @author Michel Fortin <http://www.michelf.com/projects/php-markdown/>
49 *
50 * @author Paul M. Jones <pmjones@solarphp.com>
51 *
52 * @license http://opensource.org/licenses/bsd-license.php BSD
53 *
54 * @version $Id: Header.php 3153 2008-05-05 23:14:16Z pmjones $
87 {
88 // h2
89 $text = preg_replace_callback(
90 // '{ ^=+[ \t]*\n(.+)[ \t]*\n=+[ \t]*\n+ }mx',
91 '{ ^=+[ \t]*\n(.+?) (?:[ ]+\{\#([-_:a-zA-Z0-9]+)\})? [ \t]*\n=+[ \t]*\n+ }mx',
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 }
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()
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 );
634 return $regex;
Parser.php (https://bitbucket.org/ke2083/transfans.co.uk-website.git) PHP · 210 lines
1 <?php
3 /*
4 * @package s9e\TextFormatter
5 * @copyright Copyright (c) 2010-2017 The s9e Authors
6 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
7 */
8 namespace s9e\TextFormatter\Plugins\PipeTables;
170 {
171 if (\strpos($this->text, '`') !== \false)
172 $this->text = \preg_replace_callback('/`[^`]*`/', [$this, 'overwriteInlineCodeCallback'], $this->text);
173 if (\strpos($this->text, '>') !== \false)
174 $this->text = \preg_replace_callback('/^(?:> ?)+/m', [$this, 'overwriteBlockquoteCallback'], $this->text);
Router.php (https://github.com/gimler/symfony.git) PHP · 195 lines
Email.php (https://github.com/silasrm/MyZendAssets.git) PHP · 431 lines
1 <?php
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 );
sfServiceContainerDumperPhp.php (https://bitbucket.org/khuongduybui/openfisma.git) PHP · 359 lines
1 <?php
3 /*
12 /**
13 * sfServiceContainerDumperPhp dumps a service container as a PHP class.
14 *
15 * @package symfony
18 * @version SVN: $Id$
19 */
20 class sfServiceContainerDumperPhp extends sfServiceContainerDumper
21 {
22 /**
23 * Dumps the service container as a PHP class.
24 *
25 * Available options:
ParameterBag.php (https://gitlab.com/reasonat/test8) PHP · 286 lines
1 <?php
3 /*
201 {
202 // we do this to deal with non string values (Boolean, integer, ...)
203 // as the preg_replace_callback throw an exception when trying
204 // a non-string in a parameter value
205 if (preg_match('/^%([^%\s]+)%$/', $value, $match)) {
217 $self = $this;
219 return preg_replace_callback('/%%|%([^%\s]+)%/', function ($match) use ($self, $resolving, $value) {
220 // skip %%
221 if (!isset($match[1])) {
init.php (https://github.com/dbernar1/Project-Pier.git) PHP · 221 lines
1 <?php
2 add_filter('project_description', 'wikilinks_links');
3 add_filter('all_messages_message_text', 'wikilinks_links');
21 function wikilinks_links($content) {
22 $content = preg_replace_callback('/\[message:([0-9]*)\]/', 'replace_message_link_callback', $content);
23 $content = preg_replace_callback('/\[task_list:([0-9]*)\]/', 'replace_task_list_link_callback', $content);
24 $content = preg_replace_callback('/\[ticket:([0-9]*)\]/', 'replace_ticket_link_callback', $content);
25 $content = preg_replace_callback('/\[milestone:([0-9]*)\]/', 'replace_milestone_link_callback', $content);
26 $content = preg_replace_callback('/\[file:([0-9]*)\]/', 'replace_file_link_callback', $content);
27 $content = preg_replace_callback('/\[user:([0-9]*)\]/', 'replace_user_link_callback', $content);
28 $content = preg_replace_callback('/\[link:([0-9]*)\]/', 'replace_link_link_callback', $content);
29 return $content;
30 } // wikilinks_links
URINorm.php (https://gitlab.com/x33n/ampache) PHP · 249 lines
1 <?php
3 /**
10 */
12 require_once 'Auth/Yadis/Misc.php';
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);
226 $path = $uri_matches[5];
227 $path = preg_replace_callback(
228 Auth_OpenID_getEncodedPattern(),
229 'Auth_OpenID_pct_encoded_replace_unreserved', $path);
Abstract.php (https://github.com/ianbogda/FileZ.git) PHP · 305 lines
Url.php (https://github.com/pear/Text_Wiki2.git) PHP · 293 lines
1 <?php
3 /**
10 *
11 * @author Justin Patrin <papercrane@reversefold.com>
12 * @author Paul M. Jones <pmjones@php.net>
13 *
14 * @license LGPL
48 *
49 * @author Justin Patrin <papercrane@reversefold.com>
50 * @author Paul M. Jones <pmjones@php.net>
51 *
52 */
144 // use a custom callback processing method to generate
145 // the replacement text for matches.
146 $this->wiki->source = preg_replace_callback(
147 $tmp_regex,
148 array(&$this, 'processDescr'),
CallCenter.php (https://gitlab.com/Japang-Jawara/jawara-penilaian) PHP · 248 lines
1 <?php
3 /*
63 {
64 // For efficiency exclude 'args' from the generated backtrace
65 if (PHP_VERSION_ID >= 50400) {
66 // Limit backtrace to last 3 calls as we don't use the rest
67 // Limit argument was introduced in PHP 5.4.0
68 $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
69 } elseif (defined('DEBUG_BACKTRACE_IGNORE_ARGS')) {
70 // DEBUG_BACKTRACE_IGNORE_ARGS was introduced in PHP 5.3.6
71 $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
72 } else {
219 private function indentArguments(array $arguments, $indentationLength)
220 {
221 return preg_replace_callback(
222 '/^/m',
223 function () use ($indentationLength) {
CoreExtension.php (https://github.com/herdani/snowcap-website.git) PHP · 218 lines
1 <?php
2 namespace Snowcap\SiteBundle\Twig\Extension;
170 {
171 // links
172 $tweet = preg_replace_callback(
173 '/[a-z]+:\/\/[a-z0-9-_]+\.[a-z0-9-_:~%&\?\+#\/.=]+[^:\.,\)\s*$]/i',
174 function($tweet) { return '<a href="'.$tweet[0].'">'.((strlen($tweet[0]) > 25) ? substr($tweet[0], 0, 24).'...' : $tweet[0]).'</a>'; },
177 // people
178 $tweet = preg_replace_callback(
179 '/(^|[^\w]+)\@([a-zA-Z0-9_]{1,15}(\/[a-zA-Z0-9-_]+)*)/',
180 function($tweet) { return $tweet[1].'<a href="http://twitter.com/'.$tweet[2].'">@'.$tweet[2].'</a>'; },
183 // hashtags
184 $tweet = preg_replace_callback(
185 "/(^|[^&\w'\"]+)\#([a-zA-Z0-9_]+)/",
186 function($tweet) { return $tweet[1].'#<a href="http://search.twitter.com/search?q=%23'.$tweet[2].'">'.$tweet[2].'</a>'; },
EntityParser.php (https://gitlab.com/potion/librechan) PHP · 153 lines
1 <?php
3 // if want to implement error collecting here, we'll need to use some sort
61 {
62 // it will try to detect missing semicolons, but don't rely on it
63 return preg_replace_callback(
64 $this->_substituteEntitiesRegex,
65 array($this, 'nonSpecialEntityCallback'),
116 public function substituteSpecialEntities($string)
117 {
118 return preg_replace_callback(
119 $this->_substituteEntitiesRegex,
120 array($this, 'specialEntityCallback'),
Config.php (https://gitlab.com/Andrey_rus86/kruzenshtern) PHP · 213 lines
1 <?php
3 namespace Tale;
5 use Tale\Config\Format\Ini;
6 use Tale\Config\Format\Json;
7 use Tale\Config\Format\Php;
8 use Tale\Config\Format\Xml;
9 use Tale\Config\Format\Yaml;
17 'ini' => Ini::class,
18 'json' => Json::class,
19 'php' => Php::class,
20 'xml' => Xml::class,
21 'yaml' => Yaml::class
173 $defaultValue = $defaultValue ?: '';
175 return preg_replace_callback('/\{\{([^\}]+)\}\}/i', function ($m) use ($source, $defaultValue, $delimiter) {
177 $key = $m[1];
shortcodes.php (https://github.com/sharpmachine/wakeupmedia.com.git) PHP · 195 lines
1 <?php
3 class WPCF7_ShortcodeManager {
28 $pattern = $this->get_shortcode_regex();
29 return preg_replace_callback( '/' . $pattern . '/s',
30 array( &$this, 'normalize_space_cb' ), $content );
31 }
61 $pattern = $this->get_shortcode_regex();
62 return preg_replace_callback( '/' . $pattern . '/s',
63 array( &$this, 'do_shortcode_tag' ), $content );
64 }
Table.php (https://github.com/ggunlugu/ornekler.git) PHP · 220 lines
1 <?php
2 /**
3 *
27 * @package Solar_Markdown_Extra
28 *
29 * @author Michel Fortin <http://www.michelf.com/projects/php-markdown/>
30 *
31 * @author Paul M. Jones <pmjones@solarphp.com>
32 *
33 * @license http://opensource.org/licenses/bsd-license.php BSD
34 *
35 * @version $Id: Table.php 3153 2008-05-05 23:14:16Z pmjones $
76 // | Cell 3 | Cell 4
77 //
78 $text = preg_replace_callback('
79 {
80 ^ # Start of a line
helpers.php (https://gitlab.com/jjpa2018/dashboard) PHP · 379 lines
1 <?php
3 use Illuminate\Contracts\Support\DeferringDisplayableValue;
203 function preg_replace_array($pattern, array $replacements, $subject)
204 {
205 return preg_replace_callback($pattern, function () use (&$replacements) {
206 foreach ($replacements as $key => $value) {
207 return array_shift($replacements);
361 function windows_os()
362 {
363 return PHP_OS_FAMILY === 'Windows';
364 }
365 }
Regex.php (https://bitbucket.org/dannyelps/rea.git) PHP · 319 lines
sfServiceContainer.php (https://bitbucket.org/khuongduybui/openfisma.git) PHP · 367 lines
class.pdf2txt.inc.php (https://bitbucket.org/xongie/rexsearch.git) PHP · 297 lines
MessageFormatter.php (https://gitlab.com/ealexis.t/trends) PHP · 182 lines
Table.php (https://github.com/pear2/Text_Markdown.git) PHP · 222 lines
1 <?php
2 /**
3 *
27 * @package Markdown_Extra
28 *
29 * @author Michel Fortin <http://www.michelf.com/projects/php-markdown/>
30 *
31 * @author Paul M. Jones <pmjones@solarphp.com>
32 *
33 * @license http://opensource.org/licenses/bsd-license.php BSD
34 *
35 * @version $Id: Table.php 3153 2008-05-05 23:14:16Z pmjones $
78 // | Cell 3 | Cell 4
79 //
80 $text = preg_replace_callback('
81 {
82 ^ # Start of a line
actions.php (https://gitlab.com/oxidigitaluser/liguelista) PHP · 189 lines
1 <?php
2 /**
3 * Base class for columns containing action links for items.
94 ?>
95 <tr class="column_editing">
96 <?php $this->label_view( __( 'Use icons?', 'cpac' ), __( 'Use icons instead of text for displaying the actions.', 'cpac' ), 'use_icons' ); ?>
97 <td class="input">
98 <label for="<?php $this->attr_id( 'use_icons' ); ?>-yes">
99 <input type="radio" value="1" name="<?php $this->attr_name( 'use_icons' ); ?>" id="<?php $this->attr_id( 'use_icons' ); ?>-yes"<?php checked( $this->options->use_icons, '1' ); ?> />
100 <?php _e( 'Yes'); ?>
102 <label for="<?php $this->attr_id( 'use_icons' ); ?>-no">
103 <input type="radio" value="" name="<?php $this->attr_name( 'use_icons' ); ?>" id="<?php $this->attr_id( 'use_icons' ); ?>-no"<?php checked( $this->options->use_icons, '' ); ?> />
104 <?php _e( 'No'); ?>
106 </td>
107 </tr>
108 <?php
109 }
BrowserCache.php (https://github.com/sharpmachine/wakeupmedia.com.git) PHP · 332 lines
1 <?php
3 /**
8 }
10 require_once W3TC_LIB_W3_DIR . '/Plugin.php';
12 /**
131 $domain_url_regexp = w3_get_domain_url_regexp();
133 $buffer = preg_replace_callback('~(href|src|action)=[\'"]((' . $domain_url_regexp . ')?(/[^\'"]*\.([a-z-_]+)(\?[^\'"]*)?))[\'"]~Ui', array(
134 &$this,
135 'link_replace_callback'
259 */
260 function _get_cssjs_types() {
261 $mime_types = include W3TC_INC_DIR . '/mime/cssjs.php';
263 return $mime_types;
formvars.php (https://github.com/craigk5n/webcalendar.git) PHP · 203 lines
1 <?php
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++ ) {
behat_transformations.php (https://github.com/markn86/moodle.git) PHP · 179 lines
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
26 */
28 // NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
30 require_once(__DIR__ . '/../../behat/behat_base.php');
143 */
144 public function replace_nasty_strings($string) {
145 return preg_replace_callback(
146 '/\$NASTYSTRING(\d)/',
147 function ($matches) {
Header.php (https://github.com/ggunlugu/ornekler.git) PHP · 176 lines
1 <?php
2 /**
3 *
41 * @author John Gruber <http://daringfireball.net/projects/markdown/>
42 *
43 * @author Michel Fortin <http://www.michelf.com/projects/php-markdown/>
44 *
45 * @author Paul M. Jones <pmjones@solarphp.com>
46 *
47 * @license http://opensource.org/licenses/bsd-license.php BSD
48 *
49 * @version $Id: Header.php 3153 2008-05-05 23:14:16Z pmjones $
82 {
83 // setext top-level
84 $text = preg_replace_callback(
85 '{ ^(.+)[ \t]*\n=+[ \t]*\n+ }mx',
86 array($this, '_parseTop'),
fx_layout.php (http://comet.googlecode.com/svn/trunk/) PHP · 313 lines
1 <?php
3 class Fx_Layout extends Fx_Block {
88 if (isset($_xmlBlock['method'])) {
89 $method = (string)$_xmlBlock['method'];
90 $param = preg_replace_callback("/{{(.*)}}/",
91 create_function(
92 '$matches',
100 if (count($_attributes) > 0) {
101 foreach ($_attributes as $key => $value) {
102 $value = preg_replace_callback("/{{(.*)}}/",
103 create_function(
104 '$matches',
201 if (isset($_xmlBlock['method'])) {
202 $method = (string)$_xmlBlock['method'];
203 $param = preg_replace_callback("/{{(.*)}}/",
204 create_function(
205 '$matches',
Tag.php (https://bitbucket.org/larryg/powerhut.git) PHP · 485 lines
sfServiceContainerBuilder.php (https://bitbucket.org/khuongduybui/openfisma.git) PHP · 351 lines
1 <?php
3 /*
16 * @subpackage dependency_injection
17 * @author Fabien Potencier <fabien.potencier@symfony-project.com>
18 * @version SVN: $Id: sfServiceContainerBuilder.php 269 2009-03-26 20:39:16Z fabien $
19 */
20 class sfServiceContainerBuilder extends sfServiceContainer
302 {
303 // we do this to deal with non string values (boolean, integer, ...)
304 // the preg_replace_callback converts them to strings
305 if (!$this->hasParameter($name = strtolower($match[1])))
306 {
312 else
313 {
314 $value = str_replace('%%', '%', preg_replace_callback('/(?<!%)(%)([^%]+)\1/', array($this, 'replaceParameter'), $value));
315 }
316 }
MessageFormatter.php (https://github.com/livinglab/openlab.git) PHP · 168 lines
1 <?php
3 namespace SimpleCalendar\plugin_deps\GuzzleHttp;
69 $cache = [];
70 /** @var string */
71 return \preg_replace_callback('/{\\s*([A-Za-z_\\-\\.0-9]+)\\s*}/', function (array $matches) use($request, $response, $error, &$cache) {
72 if (isset($cache[$matches[1]])) {
73 return $cache[$matches[1]];
Minify_css.php (https://github.com/sevir/Creamy.git) PHP · 158 lines
1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2 /**
3 * CodeIgniter Minify
116 // There are different conditions for removing leading and trailing
117 // whitespace.
118 // @see http://php.net/manual/en/regexp.reference.subpatterns.php
119 $contents = preg_replace_callback(
155 }
157 /* End of file Minify_css.php */
158 /* Location: ./application/libraries/Minify/drivers/Minify_css.php */
ExtractStyleBlocks.php (https://github.com/bouthors/gallery3-contrib.git) PHP · 135 lines
1 <?php defined("SYSPATH") or die("No direct script access.");
3 /**
7 *
8 * @note
9 * See tests/HTMLPurifier/Filter/ExtractStyleBlocksTest.php for
10 * sample usage.
11 *
41 $tidy = $config->get('Filter.ExtractStyleBlocks.TidyImpl');
42 if ($tidy !== null) $this->_tidy = $tidy;
43 $html = preg_replace_callback('#<style(?:\s.*)?>(.+)</style>#isU', array($this, 'styleCallback'), $html);
44 $style_blocks = $this->_styleMatches;
45 $this->_styleMatches = array(); // reset
GetSetMethodNormalizer.php (https://bitbucket.org/rkovcs/bigfish_test.git) PHP · 228 lines
fragmentify.class.php (https://github.com/iaindooley/Fragmentify.git) PHP · 312 lines
1 <?php
2 class Fragmentify {
3 private $processed = false;
198 $this->doc = new DomDocument();
199 $data = file_get_contents($this->path);
200 $data = preg_replace_callback('/<!doctype([^>]*)>/',
201 'self::stripDoctype', $data);
202 $this->doc->loadXML($data);
241 }
242 if($f->doctype) {
243 $ret = '<!doctype'.$f->doctype.'>'.PHP_EOL.$ret;
244 }
245 return $ret;
309 private function error($msg) {
310 error_log('while processing '.$this->path.':'.PHP_EOL.$msg);
311 }
312 }
lib.php (https://gitlab.com/MotoSport/morgue) PHP · 132 lines
1 <?php
3 #require_once('Persistence.php');
7 static private function split_terms($terms){
9 $terms = preg_replace_callback("/\"(.*?)\"/", function($m) {return Search::transform_term($m[1]);}, $terms);
10 $terms = preg_split("/\s+|,/", $terms);
14 foreach($terms as $term){
16 $term = preg_replace_callback("/\{WHITESPACE-([0-9]+)\}/", function($m) {return chr($m[1]);}, $term);
17 $term = preg_replace("/\{COMMA\}/", ",", $term);
25 static function transform_term($term){
26 $term = preg_replace_callback("/(\s)/", function($m) {return '{WHITESPACE-'.ord($m[1]).'}';}, $term);
27 $term = preg_replace("/,/", "{COMMA}", $term);
28 return $term;
DateFormatHelper.php (https://github.com/markn86/moodle.git) PHP · 123 lines
19 * @var array Mapping between Excel format characters and PHP format characters
20 */
21 private static $excelDateFormatToPHPDateFormatMapping = [
22 self::KEY_GENERAL => [
23 // Time
56 *
57 * @param string $excelDateFormat Excel date format
58 * @return string PHP date format (as defined here: http://php.net/manual/en/function.date.php)
59 */
60 public static function toPHPDateFormat($excelDateFormat)
103 // all characters that are inside double quotes (and double quotes must be removed).
104 // For instance, ["Day " dd] should become [\D\a\y\ dd]
105 $phpDateFormat = \preg_replace_callback('/"(.+?)"/', function ($matches) {
106 $stringToEscape = $matches[1];
107 $letters = \preg_split('//u', $stringToEscape, -1, PREG_SPLIT_NO_EMPTY);
Tag.php (https://gitlab.com/hatemdigify/digifyblog) PHP · 553 lines
XLSX.php (https://github.com/markn86/moodle.git) PHP · 190 lines
1 <?php
3 namespace Box\Spout\Common\Helper\Escaper;
117 /**
118 * Converts PHP control characters from the given string to OpenXML escaped control characters
119 *
120 * Excel escapes control characters with _xHHHH_ and also escapes any
137 }
139 return \preg_replace_callback("/({$this->escapableControlCharactersPattern})/", function ($matches) {
140 return $this->controlCharactersEscapingReverseMap[$matches[0]];
141 }, $escapedString);
155 /**
156 * Converts OpenXML escaped control characters from the given string to PHP control characters
157 *
158 * Excel escapes control characters with _xHHHH_ and also escapes any
ContentSets.php (https://github.com/kennethjiang/Wolke.git) PHP · 154 lines
cCSSCompiler.php (https://github.com/h6w/amplesdk.git) PHP · 134 lines
post-type-default-template.php (https://gitlab.com/rubengrb/ws.vidrialum) PHP · 208 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( '-1' );
66 protected function getFieldKey() {
67 require_once vc_path_dir( 'SETTINGS_DIR', 'class-vc-settings.php' );
69 return Vc_Settings::getFieldPrefix() . $this->key;
76 protected function getPostTypes() {
77 if ( false === $this->post_types ) {
78 require_once vc_path_dir( 'SETTINGS_DIR', 'class-vc-roles.php' );
79 $vc_roles = new Vc_Roles();
80 $this->post_types = $vc_roles->getPostTypes();
98 */
99 protected function get() {
100 require_once vc_path_dir( 'SETTINGS_DIR', 'class-vc-settings.php' );
102 return ( $value = Vc_Settings::get( $this->key ) ) ? $value : array();
Tokenizer.php (https://github.com/thewiredman/symfony.git) PHP · 168 lines
1 <?php
3 namespace Symfony\Component\CssSelector;
130 protected function unescapeStringLiteral($literal)
131 {
132 return preg_replace_callback('#(\\\\(?:[A-Fa-f0-9]{1,6}(?:\r\n|\s)?|[^A-Fa-f0-9]))#', function ($matches) use ($literal)
133 {
134 if ($matches[0][0] == '\\' && strlen($matches[0]) > 1) {
MessageFormatter.php (https://gitlab.com/jjpa2018/dashboard) PHP · 198 lines
OutputFormatter.php (https://bitbucket.org/iiic/iszp.git) PHP · 248 lines
Router.php (https://github.com/nattaphat/hgis.git) PHP · 158 lines
GetSetMethodNormalizer.php (https://github.com/r1pp3rj4ck/symfony.git) PHP · 228 lines
quotes-collection-shortcodes.php (https://github.com/Canuckaholic/Pop-Digital.git) PHP · 185 lines
1 <?php
3 function quotescollection_shortcode_output_format($quotes)
157 $start = strpos($text,"[quote|id=");
158 if ($start !== FALSE) {
159 $text = preg_replace_callback( "/\[quote\|id=(\d+)\]/i", "quotescollection_displayquote", $text );
160 }
161 $start = strpos($text,"[quote|random]");
162 if ($start !== FALSE) {
163 $text = preg_replace_callback( "/\[quote\|random\]/i", "quotescollection_displayquote", $text );
164 }
165 $start = strpos($text,"[quote|all]");
166 if ($start !== FALSE) {
167 $text = preg_replace_callback( "/\[quote\|all\]/i", "quotescollection_shortcodes", $text );
168 }
169 $start = strpos($text,"[quote|author=");
ProgressIndicator.php (https://gitlab.com/jjpa2018/dashboard) PHP · 249 lines
extension.inc.php (https://github.com/mousey/wp-lifestream.git) PHP · 134 lines
1 <?php
2 class Lifestream_TwitterFeed extends Lifestream_Feed
3 {
51 function parse_users($text)
52 {
53 return preg_replace_callback('/([^\w]*)@([a-z0-9_\-\/]+)\b/i', array($this, '_get_user_link'), $text);
54 }
56 function parse_search_term($text)
57 {
58 return preg_replace_callback('/([^\w]*)(#[a-z0-9_\-\/]+)\b/i', array($this, '_get_search_term_link'), $text);
59 }
Css2Xpath.php (https://gitlab.com/rsilveira1987/Expresso) PHP · 141 lines
1 <?php
2 /**
3 * Zend Framework
26 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
27 * @license http://framework.zend.com/license/new-bsd New BSD License
28 * @version $Id: Css2Xpath.php 10020 2009-08-18 14:34:09Z j.fischer@metaways.de $
29 */
30 class Zend_Dom_Query_Css2Xpath
100 // arbitrary attribute strict equality
101 if (preg_match('|([a-z]+)\[([a-z0-9_-]+)=[\'"]([^\'"]+)[\'"]\]|i', $expression)) {
102 $expression = preg_replace_callback(
103 '|([a-z]+)\[([a-z0-9_-]+)=[\'"]([^\'"]+)[\'"]\]|i',
104 create_function(
112 // arbitrary attribute contains full word
113 if (preg_match('|([a-z]+)\[([a-z0-9_-]+)~=[\'"]([^\'"]+)[\'"]\]|i', $expression)) {
114 $expression = preg_replace_callback(
115 '|([a-z]+)\[([a-z0-9_-]+)~=[\'"]([^\'"]+)[\'"]\]|i',
116 create_function(
renderer.php (https://bitbucket.org/kudutest1/moodlegit.git) PHP · 116 lines
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
27 global $CFG;
28 require_once($CFG->libdir . '/behat/classes/behat_command.php');
30 /**
91 // Replace text selector type arguments with a user-friendly select.
92 $stepsdefinitions = preg_replace_callback('/(TEXT_SELECTOR\d?_STRING)/',
93 function ($matches) {
94 return html_writer::select(behat_command::$allowedtextselectors, uniqid());
99 // Replace selector type arguments with a user-friendly select.
100 $stepsdefinitions = preg_replace_callback('/(SELECTOR\d?_STRING)/',
101 function ($matches) {
102 return html_writer::select(behat_command::$allowedselectors, uniqid());
String.inc.php (https://github.com/mcrider/pkpUpgradeTestSuite.git) PHP · 212 lines
11 * String manipulation wrapper class.
12 *
13 * $Id: String.inc.php,v 1.3 2005/06/16 20:28:05 alec Exp $
14 */
66 */
67 function hasPCREUTF8() {
68 // The PCRE_UTF8 modifier is only supported on PHP >= 4.1.0 (*nix) or PHP >= 4.2.3 (win32)
69 // Evil check to see if PCRE_UTF8 is supported
70 if (@preg_match('//u', '')) {
77 //
78 // Wrappers for basic string manipulation routines.
79 // See the php.net documentation for usage.
80 //
String_.php (https://gitlab.com/Pasantias/pasantiasASLG) PHP · 153 lines
1 <?php
3 namespace PhpParser\Node\Scalar;
5 use PhpParser\Error;
6 use PhpParser\Node\Scalar;
49 *
50 * @param string $str String token content
51 * @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes
52 *
53 * @return string The parsed string
79 * @param string $str String without quotes
80 * @param null|string $quote Quote type
81 * @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes
82 *
83 * @return string String with escape sequences parsed
OutputFormatter.php (https://bitbucket.org/alessandro-aglietti/itis-leonardo-da-vinci.git) PHP · 230 lines
SiteSettingsDAO.inc.php (https://github.com/davekisly/pkp-lib.git) PHP · 240 lines
1 <?php
3 /**
4 * @file classes/site/SiteSettingsDAO.inc.php
5 *
6 * Copyright (c) 2000-2011 John Willinsky
159 */
160 function _performReplacement($rawInput, $paramArray = array()) {
161 $value = preg_replace_callback('{{translate key="([^"]+)"}}', array(&$this, '_installer_regexp_callback'), $rawInput);
162 foreach ($paramArray as $pKey => $pValue) {
163 $value = str_replace('{$' . $pKey . '}', $pValue, $value);
Css2Xpath.php (https://github.com/ftaiolivista/Zend-Framework-Namespaced-.git) PHP · 174 lines
1 <?php
2 /**
3 * Zend Framework
31 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32 * @license http://framework.zend.com/license/new-bsd New BSD License
33 * @version $Id: Css2Xpath.php 22044 2010-04-28 19:58:29Z matthew $
34 */
35 class Css2Xpath
106 // arbitrary attribute strict equality
107 $expression = preg_replace_callback(
108 '|\[([a-z0-9_-]+)=[\'"]([^\'"]+)[\'"]\]|i',
109 array(__CLASS__, '_createEqualityExpression'),
113 // arbitrary attribute contains full word
114 $expression = preg_replace_callback(
115 '|\[([a-z0-9_-]+)~=[\'"]([^\'"]+)[\'"]\]|i',
116 array(__CLASS__, '_normalizeSpaceAttribute'),
Parser.php (https://bitbucket.org/ke2083/transfans.co.uk-website.git) PHP · 178 lines
1 <?php
3 /*
4 * @package s9e\TextFormatter
5 * @copyright Copyright (c) 2010-2017 The s9e Authors
6 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
7 */
8 namespace s9e\TextFormatter\Plugins\MediaEmbed;
112 protected static function replaceTokens($url, array $vars)
113 {
114 return \preg_replace_callback(
115 '#\\{@(\\w+)\\}#',
116 function ($m) use ($vars)
171 return \file_get_contents($prefix . $cacheFile);
172 }
173 $content = @self::getHttpClient()->get($url, ['User-Agent: PHP (not Mozilla)']);
174 if (isset($cacheFile) && !empty($content))
175 \file_put_contents($prefix . $cacheFile, $content);
XLSX.php (https://github.com/mchurchward/moodle.git) PHP · 190 lines
1 <?php
3 namespace Box\Spout\Common\Helper\Escaper;
117 /**
118 * Converts PHP control characters from the given string to OpenXML escaped control characters
119 *
120 * Excel escapes control characters with _xHHHH_ and also escapes any
137 }
139 return preg_replace_callback("/({$this->escapableControlCharactersPattern})/", function ($matches) {
140 return $this->controlCharactersEscapingReverseMap[$matches[0]];
141 }, $escapedString);
155 /**
156 * Converts OpenXML escaped control characters from the given string to PHP control characters
157 *
158 * Excel escapes control characters with _xHHHH_ and also escapes any
OutputFormatter.php (https://github.com/Sa-ryong/Stadioom-php.git) PHP · 185 lines
StringUtil.php (https://gitlab.com/e0/X2CRM) PHP · 127 lines
1 <?php
2 /***********************************************************************************
3 * X2CRM is a customer relationship management program developed by
67 /**
68 * Like preg_replace_callback but with option to have exception thrown if error occurs
69 */
70 public static function pregReplaceCallback (
76 if ($count !== null) {
77 $retVal = preg_replace_callback ($pattern, $callback, $subject, $limit, $count);
78 } elseif ($limit !== null) {
79 $retVal = preg_replace_callback ($pattern, $callback, $subject, $limit);
80 } else {
81 $retVal = preg_replace_callback ($pattern, $callback, $subject);
82 }
83 if ($throws && $retVal === null) {
lmbMultiByteStringDriverTestBase.class.php (https://github.com/limb-php-framework/limb-app-buildman.git) PHP · 233 lines
1 <?php
2 /**
3 * Limb Web Application Framework
7 * @copyright Copyright © 2004-2007 BIT
8 * @license LGPL http://www.gnu.org/copyleft/lesser.html
9 * @version $Id: lmbMultiByteStringDriverTestBase.class.php 4998 2007-02-08 15:36:32Z pachanga $
10 * @package i18n
11 */
212 }
214 function test_preg_replace_callback() {
215 if(!is_object($driver = $this->_createDriver()))
216 return;
218 $this->assertEqual($driver->_preg_replace_callback("/(кошк)(.)/",
219 create_function('$m','return $m[1]."i";'),
220 "кошки"), "кошкi");
ExtractStyleBlocks.php (https://github.com/correl/project-cms.git) PHP · 135 lines
1 <?php
3 /**
7 *
8 * @note
9 * See tests/HTMLPurifier/Filter/ExtractStyleBlocksTest.php for
10 * sample usage.
11 *
41 $tidy = $config->get('Filter.ExtractStyleBlocks.TidyImpl');
42 if ($tidy !== null) $this->_tidy = $tidy;
43 $html = preg_replace_callback('#<style(?:\s.*)?>(.+)</style>#isU', array($this, 'styleCallback'), $html);
44 $style_blocks = $this->_styleMatches;
45 $this->_styleMatches = array(); // reset
ParameterBag.php (https://github.com/gimler/symfony.git) PHP · 289 lines
1 <?php
3 /*
203 {
204 // we do this to deal with non string values (Boolean, integer, ...)
205 // as the preg_replace_callback throw an exception when trying
206 // a non-string in a parameter value
207 if (preg_match('/^%([^%\s]+)%$/', $value, $match)) {
217 }
219 return preg_replace_callback('/%%|%([^%\s]+)%/', function ($match) use ($resolving, $value) {
220 // skip %%
221 if (!isset($match[1])) {
XmlParser.php (https://gitlab.com/3dplex/3d-plex-main-site) PHP · 246 lines
1 <?php
3 namespace PicoFeed\Parser;
90 libxml_use_internal_errors(true);
92 if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
93 $dom->loadHTML($input, LIBXML_NONET);
94 } else {
194 public static function replaceXPathPrefixWithNamespaceURI($query, array $ns)
195 {
196 return preg_replace_callback('/([A-Z0-9]+):([A-Z0-9]+)/iu', function ($matches) use ($ns) {
197 // don't try to map the special prefix XML
198 if (strtolower($matches[1]) === 'xml') {
EntityParser.php (https://bitbucket.org/elijahvsjesus/tandava.git) PHP · 156 lines
1 <?php
3 require_once 'HTMLPurifier/EntityLookup.php';
4 require_once 'HTMLPurifier/Encoder.php';
6 // if want to implement error collecting here, we'll need to use some sort
65 function substituteNonSpecialEntities($string) {
66 // it will try to detect missing semicolons, but don't rely on it
67 return preg_replace_callback(
68 $this->_substituteEntitiesRegex,
69 array($this, 'nonSpecialEntityCallback'),
119 */
120 function substituteSpecialEntities($string) {
121 return preg_replace_callback(
122 $this->_substituteEntitiesRegex,
123 array($this, 'specialEntityCallback'),
DefList.php (https://github.com/ggunlugu/ornekler.git) PHP · 253 lines
1 <?php
2 /**
3 *
21 * @package Solar_Markdown_Extra
22 *
23 * @author Michel Fortin <http://www.michelf.com/projects/php-markdown/>
24 *
25 * @author Paul M. Jones <pmjones@solarphp.com>
26 *
27 * @license http://opensource.org/licenses/bsd-license.php BSD
28 *
29 * @version $Id: DefList.php 4531 2010-04-12 17:23:56Z pmjones $
119 '; // mx
121 $text = preg_replace_callback(
122 '{
123 (?:(?<=\n\n)|\A\n?)
View.php (https://github.com/smarterwebdev/php-willow.git) PHP · 147 lines
BlueScreen.php (https://github.com/premiumcombination/nts.git) PHP · 130 lines
String_.php (https://gitlab.com/kimting254/wbms) PHP · 119 lines
PluginSettingsDAO.inc.php (https://github.com/mbehiels/omp.git) PHP · 276 lines
1 <?php
3 /**
4 * @file classes/plugins/PluginSettingsDAO.inc.php
5 *
6 * Copyright (c) 2003-2011 John Willinsky
190 */
191 function _performReplacement($rawInput, $paramArray = array()) {
192 $value = preg_replace_callback('{{translate key="([^"]+)"}}', '_installer_plugin_regexp_callback', $rawInput);
193 foreach ($paramArray as $pKey => $pValue) {
194 $value = str_replace('{$' . $pKey . '}', $pValue, $value);
Tokenizer.php (https://github.com/sebio/symfony.git) PHP · 168 lines
Url.php (https://github.com/pear/Text_Wiki2.git) PHP · 280 lines
1 <?php
3 /**
9 * @package Text_Wiki
10 *
11 * @author Paul M. Jones <pmjones@php.net>
12 *
13 * @license LGPL
46 * @package Text_Wiki
47 *
48 * @author Paul M. Jones <pmjones@php.net>
49 *
50 */
141 // use a custom callback processing method to generate
142 // the replacement text for matches.
143 $this->wiki->source = preg_replace_callback(
144 $tmp_regex,
145 array(&$this, 'processDescr'),
Table.php (https://github.com/ggunlugu/ornekler.git) PHP · 243 lines
1 <?php
2 /**
3 *
27 * @package Solar_Markdown_Extra
28 *
29 * @author Michel Fortin <http://www.michelf.com/projects/php-markdown/>
30 *
31 * @author Paul M. Jones <pmjones@solarphp.com>
32 *
33 * @license http://opensource.org/licenses/bsd-license.php BSD
34 *
35 * @version $Id: Table.php 4600 2010-06-16 03:27:55Z pmjones $
76 // | Cell 3 | Cell 4
77 //
78 $text = preg_replace_callback('
79 {
80 ( # optional caption
UriTemplate.php (https://bitbucket.org/nbravo777/repo_ratchet.git) PHP · 243 lines
1 <?php
3 namespace Guzzle\Parser\UriTemplate;
45 }
47 return preg_replace_callback(self::$regex, array($this, 'expandMatch'), $this->template);
48 }
93 * Process an expansion
94 *
95 * @param array $matches Matches met in the preg_replace_callback
96 *
97 * @return string Returns the replacement string
SiteSettingsDAO.inc.php (https://github.com/mbehiels/pkp-lib.git) PHP · 240 lines
1 <?php
3 /**
4 * @file SiteSettingsDAO.inc.php
5 *
6 * Copyright (c) 2000-2011 John Willinsky
159 */
160 function _performReplacement($rawInput, $paramArray = array()) {
161 $value = preg_replace_callback('{{translate key="([^"]+)"}}', array(&$this, '_installer_regexp_callback'), $rawInput);
162 foreach ($paramArray as $pKey => $pValue) {
163 $value = str_replace('{$' . $pKey . '}', $pValue, $value);
generate-standalone.php (https://bitbucket.org/hanutimes/hanutimes.git) PHP · 151 lines
58 * @param string $text Text to have leading PHP tag from
59 */
60 function remove_php_tags($text) {
61 $text = preg_replace('#// vim:.+#', '', $text);
62 return substr($text, 5);
91 function copy_and_remove_includes($file, $sfile) {
92 $contents = file_get_contents($file);
93 if (strrchr($file, '.') === '.php') $contents = replace_includes($contents);
94 return file_put_contents($sfile, $contents);
95 }
115 echo 'Generating includes file... ';
116 shell_exec('php generate-includes.php');
117 echo "done!\n";
FileManager.php (https://github.com/livinglab/openlab.git) PHP · 242 lines
1 <?php
3 if ( ! defined( 'ABSPATH' ) ) {
147 */
148 public function json_encode_files( $files ) {
149 if ( version_compare( phpversion(), "5.4.0", ">=" ) ) {
150 $files = json_encode( $files, JSON_UNESCAPED_UNICODE );
151 } else {
152 $files = json_encode( $files );
153 if ( function_exists( 'mb_convert_encoding' ) ) {
154 $files = preg_replace_callback( '/\\\\u([0-9a-f]{4})/i', array(
155 $this,
156 'json_unscaped_unicode_fallback'
164 /**
165 * Fallback for PHP < 5.4 where JSON_UNESCAPED_UNICODE does not exist.
166 *
167 * @param array $matches
OutputFormatter.php (https://github.com/webvpro/RUA-CORE.git) PHP · 243 lines
Formatter.php (https://github.com/sbourget/moodle.git) PHP · 162 lines
1 <?php
3 namespace PhpOffice\PhpSpreadsheet\Style\NumberFormat;
5 use PhpOffice\PhpSpreadsheet\Style\Color;
6 use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
8 class Formatter
93 /**
94 * Convert a value in a pre-defined format to a PHP string.
95 *
96 * @param mixed $value Value to format
113 }
115 $format = preg_replace_callback(
116 '/(["])(?:(?=(\\\\?))\\2.)*?\\1/u',
117 function ($matches) {
Loader.php (https://github.com/patadejaguar/S.A.F.E.-Open-Source-Microfinance-Suite.git) PHP · 376 lines
1 <?php
3 namespace Dotenv;
252 if (strpos($value, '$') !== false) {
253 $loader = $this;
254 $value = preg_replace_callback(
255 '/\${([a-zA-Z0-9_.]+)}/',
256 function ($matchedPatterns) use ($loader) {
331 }
333 // If PHP is running as an Apache module and an existing
334 // Apache environment variable exists, overwrite it
335 if (function_exists('apache_getenv') && function_exists('apache_setenv') && apache_getenv($name) !== false) {
parser.php (https://bitbucket.org/kudutest1/moodlegit.git) PHP · 284 lines
1 <?php
3 /**
57 private static function create_parser_instance($type) {
58 if(empty(self::$parsers[$type])) {
59 if(include(self::$basepath."markups/$type.php")) {
60 $class = strtolower($type)."_parser";
61 if(class_exists($class)) {
77 }
79 require_once('utils.php');
81 abstract class generic_parser {
150 $this->rulestack[] = array('callback' => method_exists($this, $name."_block_rule") ? $name."_block_rule" : null, 'rule' => $block);
152 $this->string = preg_replace_callback($block['expression'], array($this, 'block_callback'), $this->string);
154 array_pop($this->rulestack);
EnvVarProcessor.php (https://github.com/deviantintegral/symfony.git) PHP · 168 lines
1 <?php
3 /*
93 if ('bool' === $prefix) {
94 return (bool) self::phpize($env);
95 }
97 if ('int' === $prefix) {
98 if (!is_numeric($env = self::phpize($env))) {
99 throw new RuntimeException(sprintf('Non-numeric env var "%s" cannot be cast to int.', $name));
100 }
105 if ('float' === $prefix) {
106 if (!is_numeric($env = self::phpize($env))) {
107 throw new RuntimeException(sprintf('Non-numeric env var "%s" cannot be cast to float.', $name));
108 }
ParameterBag.php (https://gitlab.com/suporte.spturis/carnaval2015.spturis.com.br) PHP · 263 lines
1 <?php
3 /*
179 {
180 // we do this to deal with non string values (Boolean, integer, ...)
181 // as the preg_replace_callback throw an exception when trying
182 // a non-string in a parameter value
183 if (\preg_match('/^%([^%\\s]+)%$/', $value, $match)) {
191 return $this->resolved ? $this->get($key) : $this->resolveValue($this->get($key), $resolving);
192 }
193 return \preg_replace_callback('/%%|%([^%\\s]+)%/', function ($match) use($resolving, $value) {
194 // skip %%
195 if (!isset($match[1])) {
preg.h (https://gitlab.com/iranjith4/hhvm) C Header · 149 lines
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2016 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 */
Visit.php (https://bitbucket.org/wl-framework-dev/weblab-framework.git) PHP · 126 lines
RegisterListenersPass.php (https://github.com/pulzarraider/symfony.git) PHP · 152 lines
SaitoHelpHelper.php (https://github.com/Schlaefer/Saito.git) PHP · 112 lines
UriTemplate.php (https://gitlab.com/x33n/ampache) PHP · 254 lines
1 <?php
3 namespace Guzzle\Parser\UriTemplate;
46 $this->variables = $variables;
48 return preg_replace_callback($this->regex, array($this, 'expandMatch'), $this->template);
49 }
104 * Process an expansion
105 *
106 * @param array $matches Matches met in the preg_replace_callback
107 *
108 * @return string Returns the replacement string
Dongle.php (https://gitlab.com/gideonmarked/PLCPortal) PHP · 253 lines
1 <?php namespace October\Rain\Database;
3 use Exception;
74 public function parseGroupConcat($sql)
75 {
76 $result = preg_replace_callback('/group_concat\((.+)\)/i', function($matches){
77 if (!isset($matches[1])) {
78 return $matches[0];
114 public function parseConcat($sql)
115 {
116 return preg_replace_callback('/(?:group_)?concat\((.+)\)(?R)?/i', function($matches){
117 if (!isset($matches[1])) {
118 return $matches[0];
168 }
170 return preg_replace_callback('/(\w+)\s*(=|<>)\s*(true|false)($|\s)/i', function ($matches) {
171 array_shift($matches);
172 $space = array_pop($matches);
NamedResourceLoader.php (https://github.com/richhl/kalturaCE.git) PHP · 301 lines
1 <?php
2 /**
3 * The javascript resource loader handles loading lists of available
4 * javascript classes into php from their defined locations in javascript.
5 */
52 $mwEmbedAbsolutePath = ( $wgMwEmbedDirectory == '' ) ? $IP : $IP .'/' .$wgMwEmbedDirectory;
53 // Add the mwEmbed localizations
54 $wgExtensionMessagesFiles[ 'mwEmbed' ] = $mwEmbedAbsolutePath . '/mwEmbed.i18n.php';
56 // Load javascript classes from mwEmbed.js
68 // Get the list of core component into self::$coreComponentsList
69 preg_replace_callback(
70 '/mwCoreComponentList\s*\=\s*\[(.*)\]/siU',
71 'NamedResourceLoader::preg_buildComponentList',
TexyLongWordsModule.php (https://gitlab.com/zemek1/lahodnakava.cz) PHP · 211 lines
1 <?php
3 /**
16 * @link http://texy.info
17 * @package Texy
18 * @version $Id: TexyLongWordsModule.php 226 2008-12-31 00:16:35Z David Grudl $
19 */
84 public function postLine($text)
85 {
86 return preg_replace_callback(
87 '#[^\ \n\t\x14\x15\x16\x{2013}\x{2014}\x{ad}-]{'.$this->wordLimit.',}#u',
88 array($this, 'pattern'),
ParameterBag.php (https://github.com/Faianca/symfony.git) PHP · 237 lines
1 <?php
3 /*
196 {
197 // we do this to deal with non string values (Boolean, integer, ...)
198 // as the preg_replace_callback throw an exception when trying
199 // a non-string in a parameter value
200 if (preg_match('/^%([^%]+)%$/', $value, $match)) {
212 $self = $this;
214 return preg_replace_callback('/(?<!%)%([^%]+)%/', function ($match) use ($self, $resolving, $value) {
215 $key = strtolower($match[1]);
216 if (isset($resolving[$key])) {
bricks.plugin.php (https://github.com/somefool/habari-extras.git) PHP · 155 lines
markdown_extended.php (https://github.com/davidturner/Wee_.git) PHP · 171 lines
1 <?php
2 /*
3 from: https://github.com/egil/php-markdown-extra-extended
4 */
6 require_once('markdown.php');
7 define( 'MARKDOWNEXTRAEXTENDED_VERSION', "0.3" );
35 # Do hard breaks:
36 # EXTENDED: changed to allow breaks without two spaces and just one new line
37 # original code /* return preg_replace_callback('/ {2,}\n/', */
38 return preg_replace_callback('/ *\n/',
43 function doBlockQuotes($text) {
44 $text = preg_replace_callback('/
45 (?>^[ ]*>[ ]?
46 (?:\((.+?)\))?
Renderer.php (https://github.com/koala-framework/koala-framework.git) PHP · 87 lines
1 <?php
2 abstract class Kwf_Component_View_Renderer extends Kwf_Component_View_Helper_Abstract
3 {
67 public static function replaceHtmlKwfUp($ret)
68 {
69 $ret = preg_replace_callback('#((class|id|for|style)="[^"]*)"#', array('Kwf_Component_View_Renderer', '_replaceKwfUpCb'), $ret);
70 return $ret;
71 }
FixtureLoadingTask.php (https://github.com/dereuromark/upgrade.git) PHP · 110 lines
1 <?php
2 /**
3 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
4 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
5 *
9 *
10 * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
11 * @link http://cakephp.org CakePHP(tm) Project
12 * @since 3.0.0
13 * @license http://www.opensource.org/licenses/mit-license.php MIT License
52 */
53 protected function _replaceFixtureLoading($contents) {
54 // Serializes data from PHP data into PHP code.
55 // Basically a code style conformant version of var_export()
56 $export = function ($values) use (&$export) {
generate-standalone.php (https://gitlab.com/isdzulqor/Slis-Dev) PHP · 159 lines
61 * @param string $text Text to have leading PHP tag from
62 */
63 function remove_php_tags($text)
64 {
65 $text = preg_replace('#// vim:.+#', '', $text);
98 {
99 $contents = file_get_contents($file);
100 if (strrchr($file, '.') === '.php') $contents = replace_includes($contents);
101 return file_put_contents($sfile, $contents);
102 }
123 echo 'Generating includes file... ';
124 shell_exec('php generate-includes.php');
125 echo "done!\n";
Base.php (https://github.com/finger2000/horde.git) PHP · 164 lines
1 <?php
2 /**
3 * Copyright 2010-2011 Horde LLC (http://www.horde.org/)
108 {
109 foreach ($this->TEN_PREFIXES as $tp => $tp_replacement) {
110 $string = preg_replace_callback(
111 "/(?:$tp)( *\d(?=[^\d]|\$))*/i",
112 create_function(
125 {
126 foreach ($this->BIG_PREFIXES as $bp => $bp_replacement) {
127 $string = preg_replace_callback(
128 '/(\d*) *' . $bp . '/i',
129 create_function(
153 protected function _fractionalAddition($string)
154 {
155 return preg_replace_callback(
156 '/(\d+)(?: | and |-)*haAlf/i',
157 create_function(
API.php (https://github.com/Heello/heello-php.git) PHP · 217 lines
1 <?
2 /*
3 * TwitPic API for PHP
4 * Copyright 2010 Ryan LeFevre - @meltingice
5 * PHP version 5.3.0+
8 * included with this software.
9 *
10 * Source code is hosted at http://github.com/meltingice/TwitPic-API-for-PHP
11 */
167 $url = "{$this->category}/{$options->url}";
168 if (strpos($url, ":") !== false) {
169 $url = preg_replace_callback('/(:[A-Za-z]+)/', function ($matches) use ($args) {
170 $argname = substr($matches[0], 1);
171 return $args[$argname];