1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Updated dependencies

- hybridauth (3.7.1 => v3.8.0)
- minify (1.3.66 => 1.3.68)
This commit is contained in:
Cameron
2022-05-06 11:01:54 -07:00
parent dec2941882
commit 7a9610740a
37 changed files with 522 additions and 185 deletions

36
composer.lock generated
View File

@@ -118,16 +118,16 @@
}, },
{ {
"name": "hybridauth/hybridauth", "name": "hybridauth/hybridauth",
"version": "3.7.1", "version": "v3.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/hybridauth/hybridauth.git", "url": "https://github.com/hybridauth/hybridauth.git",
"reference": "0ec1b8cb8b230aae739422c5e42bc5733b3a7316" "reference": "c76bea6638376394c74a52791dd637fef4deaf08"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/hybridauth/hybridauth/zipball/0ec1b8cb8b230aae739422c5e42bc5733b3a7316", "url": "https://api.github.com/repos/hybridauth/hybridauth/zipball/c76bea6638376394c74a52791dd637fef4deaf08",
"reference": "0ec1b8cb8b230aae739422c5e42bc5733b3a7316", "reference": "c76bea6638376394c74a52791dd637fef4deaf08",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -174,9 +174,9 @@
"support": { "support": {
"gitter": "https://gitter.im/hybridauth/hybridauth", "gitter": "https://gitter.im/hybridauth/hybridauth",
"issues": "https://github.com/hybridauth/hybridauth/issues", "issues": "https://github.com/hybridauth/hybridauth/issues",
"source": "https://github.com/hybridauth/hybridauth/tree/3.7.1" "source": "https://github.com/hybridauth/hybridauth/tree/v3.8.0"
}, },
"time": "2021-03-13T17:35:33+00:00" "time": "2022-04-08T09:49:25+00:00"
}, },
{ {
"name": "ifsnop/mysqldump-php", "name": "ifsnop/mysqldump-php",
@@ -323,16 +323,16 @@
}, },
{ {
"name": "matthiasmullie/minify", "name": "matthiasmullie/minify",
"version": "1.3.66", "version": "1.3.68",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/matthiasmullie/minify.git", "url": "https://github.com/matthiasmullie/minify.git",
"reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6" "reference": "c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/45fd3b0f1dfa2c965857c6d4a470bea52adc31a6", "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297",
"reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6", "reference": "c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -381,23 +381,15 @@
], ],
"support": { "support": {
"issues": "https://github.com/matthiasmullie/minify/issues", "issues": "https://github.com/matthiasmullie/minify/issues",
"source": "https://github.com/matthiasmullie/minify/tree/1.3.66" "source": "https://github.com/matthiasmullie/minify/tree/1.3.68"
}, },
"funding": [ "funding": [
{ {
"url": "https://github.com/[user1", "url": "https://github.com/matthiasmullie",
"type": "github"
},
{
"url": "https://github.com/matthiasmullie] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g.",
"type": "github"
},
{
"url": "https://github.com/user2",
"type": "github" "type": "github"
} }
], ],
"time": "2021-01-06T15:18:10+00:00" "time": "2022-04-19T08:28:56+00:00"
}, },
{ {
"name": "matthiasmullie/path-converter", "name": "matthiasmullie/path-converter",
@@ -643,5 +635,5 @@
"platform-overrides": { "platform-overrides": {
"php": "5.6" "php": "5.6"
}, },
"plugin-api-version": "2.2.0" "plugin-api-version": "2.3.0"
} }

View File

@@ -2,6 +2,11 @@
// autoload.php @generated by Composer // autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
}
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit4ce406ae486ac58c9aa71537459207ae::getLoader(); return ComposerAutoloaderInit4ce406ae486ac58c9aa71537459207ae::getLoader();

View File

@@ -1,14 +1,117 @@
#!/usr/bin/env sh #!/usr/bin/env php
<?php
dir=$(cd "${0%[/\\]*}" > /dev/null; cd "../matthiasmullie/minify/bin" && pwd) /**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../matthiasmullie/minify/bin/minifycss)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/
if [ -d /proc/cygdrive ]; then namespace Composer;
case $(which php) in
$(readlink -n /proc/cygdrive)/*)
# We are in Cygwin using Windows php, so the path must be translated
dir=$(cygpath -m "$dir");
;;
esac
fi
"${dir}/minifycss" "$@" $GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;
return (bool) $this->handle;
}
public function stream_read($count)
{
$data = fread($this->handle, $count);
if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}
$this->position += strlen($data);
return $data;
}
public function stream_cast($castAs)
{
return $this->handle;
}
public function stream_close()
{
fclose($this->handle);
}
public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}
public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return $this->position;
}
public function stream_eof()
{
return feof($this->handle);
}
public function stream_stat()
{
return array();
}
public function stream_set_option($option, $arg1, $arg2)
{
return true;
}
public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}
return false;
}
}
}
if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) {
include("phpvfscomposer://" . __DIR__ . '/..'.'/matthiasmullie/minify/bin/minifycss');
exit(0);
}
}
include __DIR__ . '/..'.'/matthiasmullie/minify/bin/minifycss';

View File

@@ -0,0 +1,5 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/minifycss
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
php "%BIN_TARGET%" %*

View File

@@ -1,14 +1,117 @@
#!/usr/bin/env sh #!/usr/bin/env php
<?php
dir=$(cd "${0%[/\\]*}" > /dev/null; cd "../matthiasmullie/minify/bin" && pwd) /**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../matthiasmullie/minify/bin/minifyjs)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/
if [ -d /proc/cygdrive ]; then namespace Composer;
case $(which php) in
$(readlink -n /proc/cygdrive)/*)
# We are in Cygwin using Windows php, so the path must be translated
dir=$(cygpath -m "$dir");
;;
esac
fi
"${dir}/minifyjs" "$@" $GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;
return (bool) $this->handle;
}
public function stream_read($count)
{
$data = fread($this->handle, $count);
if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}
$this->position += strlen($data);
return $data;
}
public function stream_cast($castAs)
{
return $this->handle;
}
public function stream_close()
{
fclose($this->handle);
}
public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}
public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return $this->position;
}
public function stream_eof()
{
return feof($this->handle);
}
public function stream_stat()
{
return array();
}
public function stream_set_option($option, $arg1, $arg2)
{
return true;
}
public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}
return false;
}
}
}
if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) {
include("phpvfscomposer://" . __DIR__ . '/..'.'/matthiasmullie/minify/bin/minifyjs');
exit(0);
}
}
include __DIR__ . '/..'.'/matthiasmullie/minify/bin/minifyjs';

5
e107_handlers/vendor/bin/minifyjs.bat vendored Normal file
View File

@@ -0,0 +1,5 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/minifyjs
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
php "%BIN_TARGET%" %*

View File

@@ -21,6 +21,8 @@ use Composer\Semver\VersionParser;
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
* *
* To require its presence, you can require `composer-runtime-api ^2.0` * To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/ */
class InstalledVersions class InstalledVersions
{ {

View File

@@ -2,7 +2,7 @@
// autoload_classmap.php @generated by Composer // autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir)); $baseDir = dirname(dirname($vendorDir));
return array( return array(

View File

@@ -2,7 +2,7 @@
// autoload_files.php @generated by Composer // autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir)); $baseDir = dirname(dirname($vendorDir));
return array( return array(

View File

@@ -2,7 +2,7 @@
// autoload_namespaces.php @generated by Composer // autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir)); $baseDir = dirname(dirname($vendorDir));
return array( return array(

View File

@@ -2,7 +2,7 @@
// autoload_psr4.php @generated by Composer // autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir)); $baseDir = dirname(dirname($vendorDir));
return array( return array(

View File

@@ -23,38 +23,15 @@ class ComposerAutoloaderInit4ce406ae486ac58c9aa71537459207ae
} }
spl_autoload_register(array('ComposerAutoloaderInit4ce406ae486ac58c9aa71537459207ae', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit4ce406ae486ac58c9aa71537459207ae', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit4ce406ae486ac58c9aa71537459207ae', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit4ce406ae486ac58c9aa71537459207ae', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); require __DIR__ . '/autoload_static.php';
if ($useStaticLoader) { call_user_func(\Composer\Autoload\ComposerStaticInit4ce406ae486ac58c9aa71537459207ae::getInitializer($loader));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit4ce406ae486ac58c9aa71537459207ae::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { $includeFiles = \Composer\Autoload\ComposerStaticInit4ce406ae486ac58c9aa71537459207ae::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit4ce406ae486ac58c9aa71537459207ae::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire4ce406ae486ac58c9aa71537459207ae($fileIdentifier, $file); composerRequire4ce406ae486ac58c9aa71537459207ae($fileIdentifier, $file);
} }

View File

@@ -115,17 +115,17 @@
}, },
{ {
"name": "hybridauth/hybridauth", "name": "hybridauth/hybridauth",
"version": "3.7.1", "version": "v3.8.0",
"version_normalized": "3.7.1.0", "version_normalized": "3.8.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/hybridauth/hybridauth.git", "url": "https://github.com/hybridauth/hybridauth.git",
"reference": "0ec1b8cb8b230aae739422c5e42bc5733b3a7316" "reference": "c76bea6638376394c74a52791dd637fef4deaf08"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/hybridauth/hybridauth/zipball/0ec1b8cb8b230aae739422c5e42bc5733b3a7316", "url": "https://api.github.com/repos/hybridauth/hybridauth/zipball/c76bea6638376394c74a52791dd637fef4deaf08",
"reference": "0ec1b8cb8b230aae739422c5e42bc5733b3a7316", "reference": "c76bea6638376394c74a52791dd637fef4deaf08",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -139,7 +139,7 @@
"firebase/php-jwt": "Needed to support Apple provider", "firebase/php-jwt": "Needed to support Apple provider",
"phpseclib/phpseclib": "Needed to support Apple provider" "phpseclib/phpseclib": "Needed to support Apple provider"
}, },
"time": "2021-03-13T17:35:33+00:00", "time": "2022-04-08T09:49:25+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@@ -174,7 +174,7 @@
"support": { "support": {
"gitter": "https://gitter.im/hybridauth/hybridauth", "gitter": "https://gitter.im/hybridauth/hybridauth",
"issues": "https://github.com/hybridauth/hybridauth/issues", "issues": "https://github.com/hybridauth/hybridauth/issues",
"source": "https://github.com/hybridauth/hybridauth/tree/3.7.1" "source": "https://github.com/hybridauth/hybridauth/tree/v3.8.0"
}, },
"install-path": "../hybridauth/hybridauth" "install-path": "../hybridauth/hybridauth"
}, },
@@ -325,17 +325,17 @@
}, },
{ {
"name": "matthiasmullie/minify", "name": "matthiasmullie/minify",
"version": "1.3.66", "version": "1.3.68",
"version_normalized": "1.3.66.0", "version_normalized": "1.3.68.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/matthiasmullie/minify.git", "url": "https://github.com/matthiasmullie/minify.git",
"reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6" "reference": "c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/45fd3b0f1dfa2c965857c6d4a470bea52adc31a6", "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297",
"reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6", "reference": "c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -351,7 +351,7 @@
"suggest": { "suggest": {
"psr/cache-implementation": "Cache implementation to use with Minify::cache" "psr/cache-implementation": "Cache implementation to use with Minify::cache"
}, },
"time": "2021-01-06T15:18:10+00:00", "time": "2022-04-19T08:28:56+00:00",
"bin": [ "bin": [
"bin/minifycss", "bin/minifycss",
"bin/minifyjs" "bin/minifyjs"
@@ -386,19 +386,11 @@
], ],
"support": { "support": {
"issues": "https://github.com/matthiasmullie/minify/issues", "issues": "https://github.com/matthiasmullie/minify/issues",
"source": "https://github.com/matthiasmullie/minify/tree/1.3.66" "source": "https://github.com/matthiasmullie/minify/tree/1.3.68"
}, },
"funding": [ "funding": [
{ {
"url": "https://github.com/[user1", "url": "https://github.com/matthiasmullie",
"type": "github"
},
{
"url": "https://github.com/matthiasmullie] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g.",
"type": "github"
},
{
"url": "https://github.com/user2",
"type": "github" "type": "github"
} }
], ],
@@ -645,6 +637,6 @@
"install-path": "../ralouphie/getallheaders" "install-path": "../ralouphie/getallheaders"
} }
], ],
"dev": true, "dev": false,
"dev-package-names": [] "dev-package-names": []
} }

View File

@@ -5,9 +5,9 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../../', 'install_path' => __DIR__ . '/../../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '632e4347113022b465bb280b46f2c1afbd16becc', 'reference' => 'dec2941882bd8f5d3eacd2c80ed673441821716d',
'name' => 'e107inc/e107', 'name' => 'e107inc/e107',
'dev' => true, 'dev' => false,
), ),
'versions' => array( 'versions' => array(
'e107inc/e107' => array( 'e107inc/e107' => array(
@@ -16,7 +16,7 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../../', 'install_path' => __DIR__ . '/../../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '632e4347113022b465bb280b46f2c1afbd16becc', 'reference' => 'dec2941882bd8f5d3eacd2c80ed673441821716d',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'guzzlehttp/psr7' => array( 'guzzlehttp/psr7' => array(
@@ -29,12 +29,12 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'hybridauth/hybridauth' => array( 'hybridauth/hybridauth' => array(
'pretty_version' => '3.7.1', 'pretty_version' => 'v3.8.0',
'version' => '3.7.1.0', 'version' => '3.8.0.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../hybridauth/hybridauth', 'install_path' => __DIR__ . '/../hybridauth/hybridauth',
'aliases' => array(), 'aliases' => array(),
'reference' => '0ec1b8cb8b230aae739422c5e42bc5733b3a7316', 'reference' => 'c76bea6638376394c74a52791dd637fef4deaf08',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'ifsnop/mysqldump-php' => array( 'ifsnop/mysqldump-php' => array(
@@ -56,12 +56,12 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'matthiasmullie/minify' => array( 'matthiasmullie/minify' => array(
'pretty_version' => '1.3.66', 'pretty_version' => '1.3.68',
'version' => '1.3.66.0', 'version' => '1.3.68.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../matthiasmullie/minify', 'install_path' => __DIR__ . '/../matthiasmullie/minify',
'aliases' => array(), 'aliases' => array(),
'reference' => '45fd3b0f1dfa2c965857c6d4a470bea52adc31a6', 'reference' => 'c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'matthiasmullie/path-converter' => array( 'matthiasmullie/path-converter' => array(

View File

@@ -1,4 +1,4 @@
## [Hybridauth](https://hybridauth.github.io/) 3.7.1 ## [Hybridauth](https://hybridauth.github.io/) 3.8
[![Build Status](https://travis-ci.org/hybridauth/hybridauth.svg?branch=master)](https://travis-ci.org/hybridauth/hybridauth) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/hybridauth/hybridauth/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/hybridauth/hybridauth/?branch=master) [![Latest Stable Version](https://poser.pugx.org/hybridauth/hybridauth/v/stable.png)](https://packagist.org/packages/hybridauth/hybridauth) [![Join the chat at https://gitter.im/hybridauth/hybridauth](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hybridauth/hybridauth?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/hybridauth/hybridauth.svg?branch=master)](https://travis-ci.org/hybridauth/hybridauth) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/hybridauth/hybridauth/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/hybridauth/hybridauth/?branch=master) [![Latest Stable Version](https://poser.pugx.org/hybridauth/hybridauth/v/stable.png)](https://packagist.org/packages/hybridauth/hybridauth) [![Join the chat at https://gitter.im/hybridauth/hybridauth](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hybridauth/hybridauth?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

View File

@@ -24,12 +24,6 @@ final class Collection
*/ */
public function __construct($data = null) public function __construct($data = null)
{ {
$this->collection = new \stdClass();
if (is_object($data)) {
$this->collection = $data;
}
$this->collection = (object)$data; $this->collection = (object)$data;
} }

View File

@@ -106,13 +106,12 @@ final class Parser
* needs to be improved * needs to be improved
* *
* @param $birthday * @param $birthday
* @param $seperator
* *
* @return array * @return array
*/ */
public function parseBirthday($birthday, $seperator) public function parseBirthday($birthday)
{ {
$birthday = date_parse($birthday); $birthday = date_parse((string) $birthday);
return [$birthday['year'], $birthday['month'], $birthday['day']]; return [$birthday['year'], $birthday['month'], $birthday['day']];
} }

View File

@@ -134,6 +134,7 @@ class Guzzle implements HttpClientInterface
]); ]);
break; break;
case 'PUT': case 'PUT':
case 'PATCH':
case 'POST': case 'POST':
$body_type = $multipart ? 'multipart' : 'form_params'; $body_type = $multipart ? 'multipart' : 'form_params';

View File

@@ -7,12 +7,12 @@
namespace Hybridauth\Provider; namespace Hybridauth\Provider;
use Hybridauth\Adapter\OpenID as OpenIDAdapter; use Hybridauth\Adapter\OpenID;
/** /**
* AOL OpenID provider adapter. * AOL OpenID provider adapter.
*/ */
class AOLOpenID extends OpenIDAdapter class AOLOpenID extends OpenID
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}

View File

@@ -42,6 +42,21 @@ class Amazon extends OAuth2
*/ */
protected $apiDocumentation = 'https://developer.amazon.com/docs/login-with-amazon/documentation-overview.html'; protected $apiDocumentation = 'https://developer.amazon.com/docs/login-with-amazon/documentation-overview.html';
/**
* {@inheritdoc}
*/
protected function initialize()
{
parent::initialize();
if ($this->isRefreshTokenAvailable()) {
$this->tokenRefreshParameters += [
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
];
}
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@@ -100,6 +100,13 @@ class Apple extends OAuth2
{ {
parent::initialize(); parent::initialize();
$this->AuthorizeUrlParameters['response_mode'] = 'form_post'; $this->AuthorizeUrlParameters['response_mode'] = 'form_post';
if ($this->isRefreshTokenAvailable()) {
$this->tokenRefreshParameters += [
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
];
}
} }
/** /**

View File

@@ -242,7 +242,7 @@ class Facebook extends OAuth2
*/ */
protected function fetchBirthday(User\Profile $userProfile, $birthday) protected function fetchBirthday(User\Profile $userProfile, $birthday)
{ {
$result = (new Data\Parser())->parseBirthday($birthday, '/'); $result = (new Data\Parser())->parseBirthday($birthday);
$userProfile->birthYear = (int)$result[0]; $userProfile->birthYear = (int)$result[0];
$userProfile->birthMonth = (int)$result[1]; $userProfile->birthMonth = (int)$result[1];

View File

@@ -60,12 +60,12 @@ class Google extends OAuth2
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected $authorizeUrl = 'https://accounts.google.com/o/oauth2/auth'; protected $authorizeUrl = 'https://accounts.google.com/o/oauth2/v2/auth';
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected $accessTokenUrl = 'https://accounts.google.com/o/oauth2/token'; protected $accessTokenUrl = 'https://oauth2.googleapis.com/token';
/** /**
* {@inheritdoc} * {@inheritdoc}

View File

@@ -0,0 +1,96 @@
<?php
/*!
* Hybridauth
* https://hybridauth.github.io | https://github.com/hybridauth/hybridauth
* (c) 2021 Hybridauth authors | https://hybridauth.github.io/license.html
*/
namespace Hybridauth\Provider;
use Hybridauth\Adapter\OAuth2;
use Hybridauth\Exception\InvalidApplicationCredentialsException;
use Hybridauth\Exception\UnexpectedApiResponseException;
use Hybridauth\Data;
use Hybridauth\User;
/**
* Keycloak OpenId Connect provider adapter.
*
* Example:
* 'Keycloak' => [
* 'enabled' => true,
* 'url' => 'https://your-keycloak', // depending on your setup you might need to add '/auth'
* 'realm' => 'your-realm',
* 'keys' => [
* 'id' => 'client-id',
* 'secret' => 'client-secret'
* ]
* ]
*
*/
class Keycloak extends OAuth2
{
/**
* {@inheritdoc}
*/
public $scope = 'openid profile email';
/**
* {@inheritdoc}
*/
protected $apiDocumentation = 'https://www.keycloak.org/docs/latest/securing_apps/#_oidc';
/**
* {@inheritdoc}
*/
protected function configure()
{
parent::configure();
if (!$this->config->exists('url')) {
throw new InvalidApplicationCredentialsException(
'You must define a provider url'
);
}
$url = $this->config->get('url');
if (!$this->config->exists('realm')) {
throw new InvalidApplicationCredentialsException(
'You must define a realm'
);
}
$realm = $this->config->get('realm');
$this->apiBaseUrl = $url . '/realms/' . $realm . '/protocol/openid-connect/';
$this->authorizeUrl = $this->apiBaseUrl . 'auth';
$this->accessTokenUrl = $this->apiBaseUrl . 'token';
}
/**
* {@inheritdoc}
*/
public function getUserProfile()
{
$response = $this->apiRequest('userinfo');
$data = new Data\Collection($response);
if (!$data->exists('sub')) {
throw new UnexpectedApiResponseException('Provider API returned an unexpected response.');
}
$userProfile = new User\Profile();
$userProfile->identifier = $data->get('sub');
$userProfile->displayName = $data->get('preferred_username');
$userProfile->email = $data->get('email');
$userProfile->firstName = $data->get('given_name');
$userProfile->lastName = $data->get('family_name');
$userProfile->emailVerified = $data->get('email_verified');
return $userProfile;
}
}

View File

@@ -20,7 +20,7 @@ class LinkedIn extends OAuth2
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected $scope = 'r_liteprofile r_emailaddress w_member_social'; protected $scope = 'r_liteprofile r_emailaddress';
/** /**
* {@inheritdoc} * {@inheritdoc}
@@ -144,9 +144,14 @@ class LinkedIn extends OAuth2
* {@inheritdoc} * {@inheritdoc}
* *
* @see https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin * @see https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin
* @throws \Exception
*/ */
public function setUserStatus($status, $userID = null) public function setUserStatus($status, $userID = null)
{ {
if (strpos($this->scope, 'w_member_social') === false) {
throw new \Exception('Set user status requires w_member_social permission!');
}
if (is_string($status)) { if (is_string($status)) {
$status = [ $status = [
'author' => 'urn:li:person:' . $userID, 'author' => 'urn:li:person:' . $userID,

View File

@@ -7,7 +7,7 @@
namespace Hybridauth\Provider; namespace Hybridauth\Provider;
use Hybridauth\Adapter\OpenID as OpenIDAdapter; use Hybridauth\Adapter;
/** /**
* Generic OpenID providers adapter. * Generic OpenID providers adapter.
@@ -39,6 +39,6 @@ use Hybridauth\Adapter\OpenID as OpenIDAdapter;
* echo $e->getMessage() ; * echo $e->getMessage() ;
* } * }
*/ */
class OpenID extends OpenIDAdapter class OpenID extends Adapter\OpenID
{ {
} }

View File

@@ -7,13 +7,13 @@
namespace Hybridauth\Provider; namespace Hybridauth\Provider;
use Hybridauth\Adapter\OpenID as OpenIDAdapter; use Hybridauth\Adapter\OpenID;
use Hybridauth\HttpClient; use Hybridauth\HttpClient;
/** /**
* PayPal OpenID provider adapter. * PayPal OpenID provider adapter.
*/ */
class PaypalOpenID extends OpenIDAdapter class PaypalOpenID extends OpenID
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}

View File

@@ -82,7 +82,7 @@ class Spotify extends OAuth2
*/ */
protected function fetchBirthday(User\Profile $userProfile, $birthday) protected function fetchBirthday(User\Profile $userProfile, $birthday)
{ {
$result = (new Data\Parser())->parseBirthday($birthday, '-'); $result = (new Data\Parser())->parseBirthday($birthday);
$userProfile->birthDay = (int)$result[0]; $userProfile->birthDay = (int)$result[0];
$userProfile->birthMonth = (int)$result[1]; $userProfile->birthMonth = (int)$result[1];

View File

@@ -7,12 +7,12 @@
namespace Hybridauth\Provider; namespace Hybridauth\Provider;
use Hybridauth\Adapter\OpenID as OpenIDAdapter; use Hybridauth\Adapter\OpenID;
/** /**
* StackExchange OpenID provider adapter. * StackExchange OpenID provider adapter.
*/ */
class StackExchangeOpenID extends OpenIDAdapter class StackExchangeOpenID extends OpenID
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}

View File

@@ -7,7 +7,7 @@
namespace Hybridauth\Provider; namespace Hybridauth\Provider;
use Hybridauth\Adapter\OpenID as OpenIDAdapter; use Hybridauth\Adapter\OpenID;
use Hybridauth\Exception\UnexpectedApiResponseException; use Hybridauth\Exception\UnexpectedApiResponseException;
use Hybridauth\Data; use Hybridauth\Data;
use Hybridauth\User; use Hybridauth\User;
@@ -32,7 +32,7 @@ use Hybridauth\User;
* echo $e->getMessage() ; * echo $e->getMessage() ;
* } * }
*/ */
class Steam extends OpenIDAdapter class Steam extends OpenID
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}

View File

@@ -104,7 +104,7 @@ class Twitter extends OAuth1
$userProfile->region = $data->get('location'); $userProfile->region = $data->get('location');
$userProfile->profileURL = $data->exists('screen_name') $userProfile->profileURL = $data->exists('screen_name')
? ('http://twitter.com/' . $data->get('screen_name')) ? ('https://twitter.com/' . $data->get('screen_name'))
: ''; : '';
$photoSize = $this->config->get('photo_size') ?: 'original'; $photoSize = $this->config->get('photo_size') ?: 'original';
@@ -181,7 +181,7 @@ class Twitter extends OAuth1
$userContact->description = $item->get('description'); $userContact->description = $item->get('description');
$userContact->profileURL = $item->exists('screen_name') $userContact->profileURL = $item->exists('screen_name')
? ('http://twitter.com/' . $item->get('screen_name')) ? ('https://twitter.com/' . $item->get('screen_name'))
: ''; : '';
return $userContact; return $userContact;
@@ -256,7 +256,7 @@ class Twitter extends OAuth1
$userActivity->user->photoURL = $item->filter('user')->get('profile_image_url'); $userActivity->user->photoURL = $item->filter('user')->get('profile_image_url');
$userActivity->user->profileURL = $item->filter('user')->get('screen_name') $userActivity->user->profileURL = $item->filter('user')->get('screen_name')
? ('http://twitter.com/' . $item->filter('user')->get('screen_name')) ? ('https://twitter.com/' . $item->filter('user')->get('screen_name'))
: ''; : '';
return $userActivity; return $userActivity;

View File

@@ -82,9 +82,11 @@ class WeChat extends OAuth2
unset($this->tokenExchangeParameters['client_id']); unset($this->tokenExchangeParameters['client_id']);
unset($this->tokenExchangeParameters['client_secret']); unset($this->tokenExchangeParameters['client_secret']);
$this->tokenRefreshParameters += [ if ($this->isRefreshTokenAvailable()) {
'appid' => $this->clientId $this->tokenRefreshParameters += [
]; 'appid' => $this->clientId,
];
}
$this->apiRequestParameters = [ $this->apiRequestParameters = [
'appid' => $this->clientId, 'appid' => $this->clientId,

View File

@@ -8,6 +8,7 @@ RUN apt-get update
RUN apt-get install -y zip unzip libzip-dev git RUN apt-get install -y zip unzip libzip-dev git
RUN docker-php-ext-install zip RUN docker-php-ext-install zip
RUN docker-php-ext-install pcntl RUN docker-php-ext-install pcntl
RUN pecl install xdebug || pecl install xdebug-2.7.2 || pecl install -f xdebug-2.5.5 && docker-php-ext-enable xdebug
RUN curl -sS https://getcomposer.org/installer | php RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer RUN mv composer.phar /usr/local/bin/composer
RUN composer install RUN composer install

View File

@@ -8,7 +8,13 @@ services:
- ./src:/var/www/src - ./src:/var/www/src
- ./data:/var/www/data - ./data:/var/www/data
- ./tests:/var/www/tests - ./tests:/var/www/tests
- ./build:/var/www/build
- ./phpunit.xml.dist:/var/www/phpunit.xml.dist - ./phpunit.xml.dist:/var/www/phpunit.xml.dist
'8.1':
extends: php
build:
args:
version: 8.1-cli
'8.0': '8.0':
extends: php extends: php
build: build:

View File

@@ -44,6 +44,10 @@ class CSS extends Minify
'jpeg' => 'data:image/jpeg', 'jpeg' => 'data:image/jpeg',
'svg' => 'data:image/svg+xml', 'svg' => 'data:image/svg+xml',
'woff' => 'data:application/x-font-woff', 'woff' => 'data:application/x-font-woff',
'woff2' => 'data:application/x-font-woff2',
'avif' => 'data:image/avif',
'apng' => 'data:image/apng',
'webp' => 'data:image/webp',
'tif' => 'image/tiff', 'tif' => 'image/tiff',
'tiff' => 'image/tiff', 'tiff' => 'image/tiff',
'xbm' => 'image/x-xbitmap', 'xbm' => 'image/x-xbitmap',
@@ -736,7 +740,7 @@ class CSS extends Minify
// PHP only supports $this inside anonymous functions since 5.4 // PHP only supports $this inside anonymous functions since 5.4
$minifier = $this; $minifier = $this;
$this->registerPattern( $this->registerPattern(
'/(?<=^|[;}])(--[^:;{}"\'\s]+)\s*:([^;{}]+)/m', '/(?<=^|[;}])\s*(--[^:;{}"\'\s]+)\s*:([^;{}]+)/m',
function ($match) use ($minifier) { function ($match) use ($minifier) {
$placeholder = '--custom-'. count($minifier->extracted) . ':0'; $placeholder = '--custom-'. count($minifier->extracted) . ':0';
$minifier->extracted[$placeholder] = $match[1] .':'. trim($match[2]); $minifier->extracted[$placeholder] = $match[1] .':'. trim($match[2]);

View File

@@ -198,15 +198,25 @@ class JS extends Minify
// PHP only supports $this inside anonymous functions since 5.4 // PHP only supports $this inside anonymous functions since 5.4
$minifier = $this; $minifier = $this;
$callback = function ($match) use ($minifier) { $callback = function ($match) use ($minifier) {
$count = count($minifier->extracted); if (
$placeholder = '/*'.$count.'*/'; substr($match[2], 0, 1) === '!' ||
$minifier->extracted[$placeholder] = $match[0]; strpos($match[2], '@license') !== false ||
strpos($match[2], '@preserve') !== false
) {
// preserve multi-line comments that start with /*!
// or contain @license or @preserve annotations
$count = count($minifier->extracted);
$placeholder = '/*'.$count.'*/';
$minifier->extracted[$placeholder] = $match[0];
return $placeholder; return $match[1] . $placeholder . $match[3];
}
return $match[1] . $match[3];
}; };
// multi-line comments // multi-line comments
$this->registerPattern('/\n?\/\*(!|.*?@license|.*?@preserve).*?\*\/\n?/s', $callback); $this->registerPattern('/(\n?)\/\*(.*?)\*\/(\n?)/s', $callback);
$this->registerPattern('/\/\*.*?\*\//s', '');
// single-line comments // single-line comments
$this->registerPattern('/\/\/.*$/m', ''); $this->registerPattern('/\/\/.*$/m', '');
@@ -405,9 +415,26 @@ class JS extends Minify
* to be the for-loop's body... Same goes for while loops. * to be the for-loop's body... Same goes for while loops.
* I'm going to double that semicolon (if any) so after the next line, * I'm going to double that semicolon (if any) so after the next line,
* which strips semicolons here & there, we're still left with this one. * which strips semicolons here & there, we're still left with this one.
* Note the special recursive construct in the three inner parts of the for:
* (\{([^\{\}]*(?-2))*[^\{\}]*\})? - it is intended to match inline
* functions bodies, e.g.: i<arr.map(function(e){return e}).length.
* Also note that the construct is applied only once and multiplied
* for each part of the for, otherwise it risks a catastrophic backtracking.
* The limitation is that it will not allow closures in more than one
* of the three parts for a specific for() case.
* REGEX throwing catastrophic backtracking: $content = preg_replace('/(for\([^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*;[^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*;[^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*\));(\}|$)/s', '\\1;;\\8', $content);
*/ */
$content = preg_replace('/(for\([^;\{]*;[^;\{]*;[^;\{]*\));(\}|$)/s', '\\1;;\\2', $content); $content = preg_replace('/(for\((?:[^;\{]*|[^;\{]*function[^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*);[^;\{]*;[^;\{]*\));(\}|$)/s', '\\1;;\\4', $content);
$content = preg_replace('/(for\([^;\{]*;(?:[^;\{]*|[^;\{]*function[^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*);[^;\{]*\));(\}|$)/s', '\\1;;\\4', $content);
$content = preg_replace('/(for\([^;\{]*;[^;\{]*;(?:[^;\{]*|[^;\{]*function[^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*)\));(\}|$)/s', '\\1;;\\4', $content);
$content = preg_replace('/(for\([^;\{]+\s+in\s+[^;\{]+\));(\}|$)/s', '\\1;;\\2', $content); $content = preg_replace('/(for\([^;\{]+\s+in\s+[^;\{]+\));(\}|$)/s', '\\1;;\\2', $content);
/*
* Do the same for the if's that don't have a body but are followed by ;}
*/
$content = preg_replace('/(\bif\s*\([^{;]*\));\}/s', '\\1;;}', $content);
/* /*
* Below will also keep `;` after a `do{}while();` along with `while();` * Below will also keep `;` after a `do{}while();` along with `while();`
* While these could be stripped after do-while, detecting this * While these could be stripped after do-while, detecting this

View File

@@ -243,6 +243,9 @@ abstract class Minify
/** /**
* Register a pattern to execute against the source content. * Register a pattern to execute against the source content.
* *
* If $replacement is a string, it must be plain text. Placeholders like $1 or \2 don't work.
* If you need that functionality, use a callback instead.
*
* @param string $pattern PCRE pattern * @param string $pattern PCRE pattern
* @param string|callable $replacement Replacement value for matched pattern * @param string|callable $replacement Replacement value for matched pattern
*/ */
@@ -268,11 +271,13 @@ abstract class Minify
*/ */
protected function replace($content) protected function replace($content)
{ {
$processed = ''; $contentLength = strlen($content);
$output = '';
$processedOffset = 0;
$positions = array_fill(0, count($this->patterns), -1); $positions = array_fill(0, count($this->patterns), -1);
$matches = array(); $matches = array();
while ($content) { while ($processedOffset < $contentLength) {
// find first match for all patterns // find first match for all patterns
foreach ($this->patterns as $i => $pattern) { foreach ($this->patterns as $i => $pattern) {
list($pattern, $replacement) = $pattern; list($pattern, $replacement) = $pattern;
@@ -285,12 +290,12 @@ abstract class Minify
// no need to re-run matches that are still in the part of the // no need to re-run matches that are still in the part of the
// content that hasn't been processed // content that hasn't been processed
if ($positions[$i] >= 0) { if ($positions[$i] >= $processedOffset) {
continue; continue;
} }
$match = null; $match = null;
if (preg_match($pattern, $content, $match, PREG_OFFSET_CAPTURE)) { if (preg_match($pattern, $content, $match, PREG_OFFSET_CAPTURE, $processedOffset)) {
$matches[$i] = $match; $matches[$i] = $match;
// we'll store the match position as well; that way, we // we'll store the match position as well; that way, we
@@ -307,61 +312,52 @@ abstract class Minify
// no more matches to find: everything's been processed, break out // no more matches to find: everything's been processed, break out
if (!$matches) { if (!$matches) {
$processed .= $content; // output the remaining content
$output .= substr($content, $processedOffset);
break; break;
} }
// see which of the patterns actually found the first thing (we'll // see which of the patterns actually found the first thing (we'll
// only want to execute that one, since we're unsure if what the // only want to execute that one, since we're unsure if what the
// other found was not inside what the first found) // other found was not inside what the first found)
$discardLength = min($positions); $matchOffset = min($positions);
$firstPattern = array_search($discardLength, $positions); $firstPattern = array_search($matchOffset, $positions);
$match = $matches[$firstPattern][0][0]; $match = $matches[$firstPattern];
// execute the pattern that matches earliest in the content string // execute the pattern that matches earliest in the content string
list($pattern, $replacement) = $this->patterns[$firstPattern]; list(, $replacement) = $this->patterns[$firstPattern];
$replacement = $this->replacePattern($pattern, $replacement, $content);
// figure out which part of the string was unmatched; that's the // add the part of the input between $processedOffset and the first match;
// part we'll execute the patterns on again next // that content wasn't matched by anything
$content = (string) substr($content, $discardLength); $output .= substr($content, $processedOffset, $matchOffset - $processedOffset);
$unmatched = (string) substr($content, strpos($content, $match) + strlen($match)); // add the replacement for the match
$output .= $this->executeReplacement($replacement, $match);
// move the replaced part to $processed and prepare $content to // advance $processedOffset past the match
// again match batch of patterns against $processedOffset = $matchOffset + strlen($match[0][0]);
$processed .= substr($replacement, 0, strlen($replacement) - strlen($unmatched));
$content = $unmatched;
// first match has been replaced & that content is to be left alone,
// the next matches will start after this replacement, so we should
// fix their offsets
foreach ($positions as $i => $position) {
$positions[$i] -= $discardLength + strlen($match);
}
} }
return $processed; return $output;
} }
/** /**
* This is where a pattern is matched against $content and the matches * If $replacement is a callback, execute it, passing in the match data.
* are replaced by their respective value. * If it's a string, just pass it through.
* This function will be called plenty of times, where $content will always
* move up 1 character.
* *
* @param string $pattern Pattern to match
* @param string|callable $replacement Replacement value * @param string|callable $replacement Replacement value
* @param string $content Content to match pattern against * @param array $match Match data, in PREG_OFFSET_CAPTURE form
* *
* @return string * @return string
*/ */
protected function replacePattern($pattern, $replacement, $content) protected function executeReplacement($replacement, $match)
{ {
if (is_callable($replacement)) { if (!is_callable($replacement)) {
return preg_replace_callback($pattern, $replacement, $content, 1, $count); return $replacement;
} else {
return preg_replace($pattern, $replacement, $content, 1, $count);
} }
// convert $match from the PREG_OFFSET_CAPTURE form to the form the callback expects
foreach ($match as &$matchItem) {
$matchItem = $matchItem[0];
}
return $replacement($match);
} }
/** /**