@@ -5,17 +5,17 @@ |
||
| 5 | 5 | |
| 6 | 6 | interface Plugin { |
| 7 | 7 | |
| 8 | - function get_slug(); |
|
| 8 | + function get_slug(); |
|
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * @throws \Exception |
|
| 12 | - * @return string |
|
| 13 | - */ |
|
| 14 | - function get_zip_url(); |
|
| 10 | + /** |
|
| 11 | + * @throws \Exception |
|
| 12 | + * @return string |
|
| 13 | + */ |
|
| 14 | + function get_zip_url(); |
|
| 15 | 15 | |
| 16 | 16 | |
| 17 | - function is_plugin_installed(); |
|
| 17 | + function is_plugin_installed(); |
|
| 18 | 18 | |
| 19 | - function is_plugin_activated(); |
|
| 19 | + function is_plugin_activated(); |
|
| 20 | 20 | |
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Quiet_Skin extends \WP_Upgrader_Skin { |
| 6 | 6 | |
| 7 | - public function feedback( $feedback, ...$args ) { |
|
| 8 | - // Dont print result. |
|
| 9 | - } |
|
| 7 | + public function feedback( $feedback, ...$args ) { |
|
| 8 | + // Dont print result. |
|
| 9 | + } |
|
| 10 | 10 | |
| 11 | 11 | } |
| 12 | 12 | \ No newline at end of file |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Quiet_Skin extends \WP_Upgrader_Skin { |
| 6 | 6 | |
| 7 | - public function feedback( $feedback, ...$args ) { |
|
| 7 | + public function feedback($feedback, ...$args) { |
|
| 8 | 8 | // Dont print result. |
| 9 | 9 | } |
| 10 | 10 | |
@@ -4,33 +4,33 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Remote_Plugin implements Plugin { |
| 6 | 6 | |
| 7 | - private $slug; |
|
| 7 | + private $slug; |
|
| 8 | 8 | |
| 9 | - private $url; |
|
| 9 | + private $url; |
|
| 10 | 10 | |
| 11 | - public function __construct( $slug, $url ) { |
|
| 12 | - $this->slug = $slug; |
|
| 13 | - $this->url = $url; |
|
| 14 | - } |
|
| 11 | + public function __construct( $slug, $url ) { |
|
| 12 | + $this->slug = $slug; |
|
| 13 | + $this->url = $url; |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - function get_slug() { |
|
| 17 | - return $this->slug; |
|
| 18 | - } |
|
| 16 | + function get_slug() { |
|
| 17 | + return $this->slug; |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - function get_zip_url() { |
|
| 21 | - return $this->url; |
|
| 22 | - } |
|
| 20 | + function get_zip_url() { |
|
| 21 | + return $this->url; |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - function is_plugin_installed() { |
|
| 25 | - if ( ! function_exists( 'get_plugins' ) ) { |
|
| 26 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 27 | - } |
|
| 28 | - $all_plugins = get_plugins(); |
|
| 24 | + function is_plugin_installed() { |
|
| 25 | + if ( ! function_exists( 'get_plugins' ) ) { |
|
| 26 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 27 | + } |
|
| 28 | + $all_plugins = get_plugins(); |
|
| 29 | 29 | |
| 30 | - return array_key_exists( $this->slug, $all_plugins ); |
|
| 31 | - } |
|
| 30 | + return array_key_exists( $this->slug, $all_plugins ); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - function is_plugin_activated() { |
|
| 34 | - return is_plugin_active( $this->slug ); |
|
| 35 | - } |
|
| 33 | + function is_plugin_activated() { |
|
| 34 | + return is_plugin_active( $this->slug ); |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | private $url; |
| 10 | 10 | |
| 11 | - public function __construct( $slug, $url ) { |
|
| 11 | + public function __construct($slug, $url) { |
|
| 12 | 12 | $this->slug = $slug; |
| 13 | 13 | $this->url = $url; |
| 14 | 14 | } |
@@ -22,15 +22,15 @@ discard block |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | function is_plugin_installed() { |
| 25 | - if ( ! function_exists( 'get_plugins' ) ) { |
|
| 26 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 25 | + if ( ! function_exists('get_plugins')) { |
|
| 26 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
| 27 | 27 | } |
| 28 | 28 | $all_plugins = get_plugins(); |
| 29 | 29 | |
| 30 | - return array_key_exists( $this->slug, $all_plugins ); |
|
| 30 | + return array_key_exists($this->slug, $all_plugins); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | function is_plugin_activated() { |
| 34 | - return is_plugin_active( $this->slug ); |
|
| 34 | + return is_plugin_active($this->slug); |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -4,28 +4,28 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Module { |
| 6 | 6 | |
| 7 | - /** |
|
| 8 | - * @var Installer |
|
| 9 | - */ |
|
| 10 | - private $installer; |
|
| 7 | + /** |
|
| 8 | + * @var Installer |
|
| 9 | + */ |
|
| 10 | + private $installer; |
|
| 11 | 11 | |
| 12 | - public function __construct( Installer $installer ) { |
|
| 13 | - $this->installer = $installer; |
|
| 14 | - } |
|
| 12 | + public function __construct( Installer $installer ) { |
|
| 13 | + $this->installer = $installer; |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - public function install_and_activate( $new_value, $old_value ) { |
|
| 17 | - if ( ! $new_value ) { |
|
| 18 | - return; |
|
| 19 | - } |
|
| 20 | - $this->installer->install(); |
|
| 21 | - $this->installer->activate(); |
|
| 16 | + public function install_and_activate( $new_value, $old_value ) { |
|
| 17 | + if ( ! $new_value ) { |
|
| 18 | + return; |
|
| 19 | + } |
|
| 20 | + $this->installer->install(); |
|
| 21 | + $this->installer->activate(); |
|
| 22 | 22 | |
| 23 | - } |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | - public function register_hooks() { |
|
| 27 | - add_action( "wl_feature__change__entity-types-professional", array( $this, 'install_and_activate' ), 10, 2 ); |
|
| 28 | - add_action( "wl_feature__change__entity-types-business", array( $this, 'install_and_activate' ), 10, 2 ); |
|
| 29 | - } |
|
| 26 | + public function register_hooks() { |
|
| 27 | + add_action( "wl_feature__change__entity-types-professional", array( $this, 'install_and_activate' ), 10, 2 ); |
|
| 28 | + add_action( "wl_feature__change__entity-types-business", array( $this, 'install_and_activate' ), 10, 2 ); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | 31 | } |
| 32 | 32 | \ No newline at end of file |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | private $installer; |
| 11 | 11 | |
| 12 | - public function __construct( Installer $installer ) { |
|
| 12 | + public function __construct(Installer $installer) { |
|
| 13 | 13 | $this->installer = $installer; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function install_and_activate( $new_value, $old_value ) { |
|
| 17 | - if ( ! $new_value ) { |
|
| 16 | + public function install_and_activate($new_value, $old_value) { |
|
| 17 | + if ( ! $new_value) { |
|
| 18 | 18 | return; |
| 19 | 19 | } |
| 20 | 20 | $this->installer->install(); |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | public function register_hooks() { |
| 27 | - add_action( "wl_feature__change__entity-types-professional", array( $this, 'install_and_activate' ), 10, 2 ); |
|
| 28 | - add_action( "wl_feature__change__entity-types-business", array( $this, 'install_and_activate' ), 10, 2 ); |
|
| 27 | + add_action("wl_feature__change__entity-types-professional", array($this, 'install_and_activate'), 10, 2); |
|
| 28 | + add_action("wl_feature__change__entity-types-business", array($this, 'install_and_activate'), 10, 2); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | } |
| 32 | 32 | \ No newline at end of file |
@@ -5,43 +5,43 @@ |
||
| 5 | 5 | |
| 6 | 6 | class Installer { |
| 7 | 7 | |
| 8 | - /** |
|
| 9 | - * @var Plugin |
|
| 10 | - */ |
|
| 11 | - private $plugin; |
|
| 12 | - /** |
|
| 13 | - * @var \Plugin_Upgrader |
|
| 14 | - */ |
|
| 15 | - private $upgrader; |
|
| 16 | - |
|
| 17 | - /** |
|
| 18 | - * @param $plugin Plugin |
|
| 19 | - * @param $upgrader \Plugin_Upgrader |
|
| 20 | - */ |
|
| 21 | - function __construct( \Plugin_Upgrader $upgrader, Plugin $plugin ) { |
|
| 22 | - $this->upgrader = $upgrader; |
|
| 23 | - $this->plugin = $plugin; |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - function install() { |
|
| 27 | - |
|
| 28 | - if ( $this->plugin->is_plugin_installed() ) { |
|
| 29 | - return; |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - try { |
|
| 33 | - $this->upgrader->install( $this->plugin->get_zip_url() ); |
|
| 34 | - } catch ( \Exception $e ) { |
|
| 35 | - error_log( "Error caught when installing plugin " . $this->plugin->get_slug() . " error: " . $e->getMessage() ); |
|
| 36 | - } |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - function activate() { |
|
| 40 | - if ( $this->plugin->is_plugin_activated() ) { |
|
| 41 | - return; |
|
| 42 | - } |
|
| 43 | - activate_plugin( $this->plugin->get_slug() ); |
|
| 44 | - } |
|
| 8 | + /** |
|
| 9 | + * @var Plugin |
|
| 10 | + */ |
|
| 11 | + private $plugin; |
|
| 12 | + /** |
|
| 13 | + * @var \Plugin_Upgrader |
|
| 14 | + */ |
|
| 15 | + private $upgrader; |
|
| 16 | + |
|
| 17 | + /** |
|
| 18 | + * @param $plugin Plugin |
|
| 19 | + * @param $upgrader \Plugin_Upgrader |
|
| 20 | + */ |
|
| 21 | + function __construct( \Plugin_Upgrader $upgrader, Plugin $plugin ) { |
|
| 22 | + $this->upgrader = $upgrader; |
|
| 23 | + $this->plugin = $plugin; |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + function install() { |
|
| 27 | + |
|
| 28 | + if ( $this->plugin->is_plugin_installed() ) { |
|
| 29 | + return; |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + try { |
|
| 33 | + $this->upgrader->install( $this->plugin->get_zip_url() ); |
|
| 34 | + } catch ( \Exception $e ) { |
|
| 35 | + error_log( "Error caught when installing plugin " . $this->plugin->get_slug() . " error: " . $e->getMessage() ); |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + function activate() { |
|
| 40 | + if ( $this->plugin->is_plugin_activated() ) { |
|
| 41 | + return; |
|
| 42 | + } |
|
| 43 | + activate_plugin( $this->plugin->get_slug() ); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | \ No newline at end of file |
@@ -18,29 +18,29 @@ |
||
| 18 | 18 | * @param $plugin Plugin |
| 19 | 19 | * @param $upgrader \Plugin_Upgrader |
| 20 | 20 | */ |
| 21 | - function __construct( \Plugin_Upgrader $upgrader, Plugin $plugin ) { |
|
| 21 | + function __construct(\Plugin_Upgrader $upgrader, Plugin $plugin) { |
|
| 22 | 22 | $this->upgrader = $upgrader; |
| 23 | 23 | $this->plugin = $plugin; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | function install() { |
| 27 | 27 | |
| 28 | - if ( $this->plugin->is_plugin_installed() ) { |
|
| 28 | + if ($this->plugin->is_plugin_installed()) { |
|
| 29 | 29 | return; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | try { |
| 33 | - $this->upgrader->install( $this->plugin->get_zip_url() ); |
|
| 34 | - } catch ( \Exception $e ) { |
|
| 35 | - error_log( "Error caught when installing plugin " . $this->plugin->get_slug() . " error: " . $e->getMessage() ); |
|
| 33 | + $this->upgrader->install($this->plugin->get_zip_url()); |
|
| 34 | + } catch (\Exception $e) { |
|
| 35 | + error_log("Error caught when installing plugin ".$this->plugin->get_slug()." error: ".$e->getMessage()); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | function activate() { |
| 40 | - if ( $this->plugin->is_plugin_activated() ) { |
|
| 40 | + if ($this->plugin->is_plugin_activated()) { |
|
| 41 | 41 | return; |
| 42 | 42 | } |
| 43 | - activate_plugin( $this->plugin->get_slug() ); |
|
| 43 | + activate_plugin($this->plugin->get_slug()); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -15,205 +15,205 @@ |
||
| 15 | 15 | use Google\Web_Stories_Dependencies\Symfony\Polyfill\Mbstring as Google_Web_Stories_Mbstring; |
| 16 | 16 | |
| 17 | 17 | if ( ! function_exists( 'mb_convert_encoding' ) ) { |
| 18 | - function mb_convert_encoding( $s, $to, $from = null ) { |
|
| 19 | - return Google_Web_Stories_Mbstring\Mbstring::mb_convert_encoding( $s, $to, $from ); |
|
| 20 | - } |
|
| 18 | + function mb_convert_encoding( $s, $to, $from = null ) { |
|
| 19 | + return Google_Web_Stories_Mbstring\Mbstring::mb_convert_encoding( $s, $to, $from ); |
|
| 20 | + } |
|
| 21 | 21 | } |
| 22 | 22 | if ( ! function_exists( 'mb_decode_mimeheader' ) ) { |
| 23 | - function mb_decode_mimeheader( $s ) { |
|
| 24 | - return Google_Web_Stories_Mbstring\Mbstring::mb_decode_mimeheader( $s ); |
|
| 25 | - } |
|
| 23 | + function mb_decode_mimeheader( $s ) { |
|
| 24 | + return Google_Web_Stories_Mbstring\Mbstring::mb_decode_mimeheader( $s ); |
|
| 25 | + } |
|
| 26 | 26 | } |
| 27 | 27 | if ( ! function_exists( 'mb_encode_mimeheader' ) ) { |
| 28 | - function mb_encode_mimeheader( $s, $charset = null, $transferEnc = null, $lf = null, $indent = null ) { |
|
| 29 | - return Google_Web_Stories_Mbstring\Mbstring::mb_encode_mimeheader( $s, $charset, $transferEnc, $lf, $indent ); |
|
| 30 | - } |
|
| 28 | + function mb_encode_mimeheader( $s, $charset = null, $transferEnc = null, $lf = null, $indent = null ) { |
|
| 29 | + return Google_Web_Stories_Mbstring\Mbstring::mb_encode_mimeheader( $s, $charset, $transferEnc, $lf, $indent ); |
|
| 30 | + } |
|
| 31 | 31 | } |
| 32 | 32 | if ( ! function_exists( 'mb_decode_numericentity' ) ) { |
| 33 | - function mb_decode_numericentity( $s, $convmap, $enc = null ) { |
|
| 34 | - return Google_Web_Stories_Mbstring\Mbstring::mb_decode_numericentity( $s, $convmap, $enc ); |
|
| 35 | - } |
|
| 33 | + function mb_decode_numericentity( $s, $convmap, $enc = null ) { |
|
| 34 | + return Google_Web_Stories_Mbstring\Mbstring::mb_decode_numericentity( $s, $convmap, $enc ); |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | if ( ! function_exists( 'mb_encode_numericentity' ) ) { |
| 38 | - function mb_encode_numericentity( $s, $convmap, $enc = null, $is_hex = false ) { |
|
| 39 | - return Google_Web_Stories_Mbstring\Mbstring::mb_encode_numericentity( $s, $convmap, $enc, $is_hex ); |
|
| 40 | - } |
|
| 38 | + function mb_encode_numericentity( $s, $convmap, $enc = null, $is_hex = false ) { |
|
| 39 | + return Google_Web_Stories_Mbstring\Mbstring::mb_encode_numericentity( $s, $convmap, $enc, $is_hex ); |
|
| 40 | + } |
|
| 41 | 41 | } |
| 42 | 42 | if ( ! function_exists( 'mb_convert_case' ) ) { |
| 43 | - function mb_convert_case( $s, $mode, $enc = null ) { |
|
| 44 | - return Google_Web_Stories_Mbstring\Mbstring::mb_convert_case( $s, $mode, $enc ); |
|
| 45 | - } |
|
| 43 | + function mb_convert_case( $s, $mode, $enc = null ) { |
|
| 44 | + return Google_Web_Stories_Mbstring\Mbstring::mb_convert_case( $s, $mode, $enc ); |
|
| 45 | + } |
|
| 46 | 46 | } |
| 47 | 47 | if ( ! function_exists( 'mb_internal_encoding' ) ) { |
| 48 | - function mb_internal_encoding( $enc = null ) { |
|
| 49 | - return Google_Web_Stories_Mbstring\Mbstring::mb_internal_encoding( $enc ); |
|
| 50 | - } |
|
| 48 | + function mb_internal_encoding( $enc = null ) { |
|
| 49 | + return Google_Web_Stories_Mbstring\Mbstring::mb_internal_encoding( $enc ); |
|
| 50 | + } |
|
| 51 | 51 | } |
| 52 | 52 | if ( ! function_exists( 'mb_language' ) ) { |
| 53 | - function mb_language( $lang = null ) { |
|
| 54 | - return Google_Web_Stories_Mbstring\Mbstring::mb_language( $lang ); |
|
| 55 | - } |
|
| 53 | + function mb_language( $lang = null ) { |
|
| 54 | + return Google_Web_Stories_Mbstring\Mbstring::mb_language( $lang ); |
|
| 55 | + } |
|
| 56 | 56 | } |
| 57 | 57 | if ( ! function_exists( 'mb_list_encodings' ) ) { |
| 58 | - function mb_list_encodings() { |
|
| 59 | - return Google_Web_Stories_Mbstring\Mbstring::mb_list_encodings(); |
|
| 60 | - } |
|
| 58 | + function mb_list_encodings() { |
|
| 59 | + return Google_Web_Stories_Mbstring\Mbstring::mb_list_encodings(); |
|
| 60 | + } |
|
| 61 | 61 | } |
| 62 | 62 | if ( ! function_exists( 'mb_encoding_aliases' ) ) { |
| 63 | - function mb_encoding_aliases( $encoding ) { |
|
| 64 | - return Google_Web_Stories_Mbstring\Mbstring::mb_encoding_aliases( $encoding ); |
|
| 65 | - } |
|
| 63 | + function mb_encoding_aliases( $encoding ) { |
|
| 64 | + return Google_Web_Stories_Mbstring\Mbstring::mb_encoding_aliases( $encoding ); |
|
| 65 | + } |
|
| 66 | 66 | } |
| 67 | 67 | if ( ! function_exists( 'mb_check_encoding' ) ) { |
| 68 | - function mb_check_encoding( $var = null, $encoding = null ) { |
|
| 69 | - return Google_Web_Stories_Mbstring\Mbstring::mb_check_encoding( $var, $encoding ); |
|
| 70 | - } |
|
| 68 | + function mb_check_encoding( $var = null, $encoding = null ) { |
|
| 69 | + return Google_Web_Stories_Mbstring\Mbstring::mb_check_encoding( $var, $encoding ); |
|
| 70 | + } |
|
| 71 | 71 | } |
| 72 | 72 | if ( ! function_exists( 'mb_detect_encoding' ) ) { |
| 73 | - function mb_detect_encoding( $str, $encodingList = null, $strict = false ) { |
|
| 74 | - return Google_Web_Stories_Mbstring\Mbstring::mb_detect_encoding( $str, $encodingList, $strict ); |
|
| 75 | - } |
|
| 73 | + function mb_detect_encoding( $str, $encodingList = null, $strict = false ) { |
|
| 74 | + return Google_Web_Stories_Mbstring\Mbstring::mb_detect_encoding( $str, $encodingList, $strict ); |
|
| 75 | + } |
|
| 76 | 76 | } |
| 77 | 77 | if ( ! function_exists( 'mb_detect_order' ) ) { |
| 78 | - function mb_detect_order( $encodingList = null ) { |
|
| 79 | - return Google_Web_Stories_Mbstring\Mbstring::mb_detect_order( $encodingList ); |
|
| 80 | - } |
|
| 78 | + function mb_detect_order( $encodingList = null ) { |
|
| 79 | + return Google_Web_Stories_Mbstring\Mbstring::mb_detect_order( $encodingList ); |
|
| 80 | + } |
|
| 81 | 81 | } |
| 82 | 82 | if ( ! function_exists( 'mb_parse_str' ) ) { |
| 83 | - function mb_parse_str( $s, &$result = [] ) { |
|
| 84 | - parse_str( $s, $result ); |
|
| 85 | - } |
|
| 83 | + function mb_parse_str( $s, &$result = [] ) { |
|
| 84 | + parse_str( $s, $result ); |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | if ( ! function_exists( 'mb_strlen' ) ) { |
| 88 | - function mb_strlen( $s, $enc = null ) { |
|
| 89 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strlen( $s, $enc ); |
|
| 90 | - } |
|
| 88 | + function mb_strlen( $s, $enc = null ) { |
|
| 89 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strlen( $s, $enc ); |
|
| 90 | + } |
|
| 91 | 91 | } |
| 92 | 92 | if ( ! function_exists( 'mb_strpos' ) ) { |
| 93 | - function mb_strpos( $s, $needle, $offset = 0, $enc = null ) { |
|
| 94 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strpos( $s, $needle, $offset, $enc ); |
|
| 95 | - } |
|
| 93 | + function mb_strpos( $s, $needle, $offset = 0, $enc = null ) { |
|
| 94 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strpos( $s, $needle, $offset, $enc ); |
|
| 95 | + } |
|
| 96 | 96 | } |
| 97 | 97 | if ( ! function_exists( 'mb_strtolower' ) ) { |
| 98 | - function mb_strtolower( $s, $enc = null ) { |
|
| 99 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strtolower( $s, $enc ); |
|
| 100 | - } |
|
| 98 | + function mb_strtolower( $s, $enc = null ) { |
|
| 99 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strtolower( $s, $enc ); |
|
| 100 | + } |
|
| 101 | 101 | } |
| 102 | 102 | if ( ! function_exists( 'mb_strtoupper' ) ) { |
| 103 | - function mb_strtoupper( $s, $enc = null ) { |
|
| 104 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strtoupper( $s, $enc ); |
|
| 105 | - } |
|
| 103 | + function mb_strtoupper( $s, $enc = null ) { |
|
| 104 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strtoupper( $s, $enc ); |
|
| 105 | + } |
|
| 106 | 106 | } |
| 107 | 107 | if ( ! function_exists( 'mb_substitute_character' ) ) { |
| 108 | - function mb_substitute_character( $char = null ) { |
|
| 109 | - return Google_Web_Stories_Mbstring\Mbstring::mb_substitute_character( $char ); |
|
| 110 | - } |
|
| 108 | + function mb_substitute_character( $char = null ) { |
|
| 109 | + return Google_Web_Stories_Mbstring\Mbstring::mb_substitute_character( $char ); |
|
| 110 | + } |
|
| 111 | 111 | } |
| 112 | 112 | if ( ! function_exists( 'mb_substr' ) ) { |
| 113 | - function mb_substr( $s, $start, $length = 2147483647, $enc = null ) { |
|
| 114 | - return Google_Web_Stories_Mbstring\Mbstring::mb_substr( $s, $start, $length, $enc ); |
|
| 115 | - } |
|
| 113 | + function mb_substr( $s, $start, $length = 2147483647, $enc = null ) { |
|
| 114 | + return Google_Web_Stories_Mbstring\Mbstring::mb_substr( $s, $start, $length, $enc ); |
|
| 115 | + } |
|
| 116 | 116 | } |
| 117 | 117 | if ( ! function_exists( 'mb_stripos' ) ) { |
| 118 | - function mb_stripos( $s, $needle, $offset = 0, $enc = null ) { |
|
| 119 | - return Google_Web_Stories_Mbstring\Mbstring::mb_stripos( $s, $needle, $offset, $enc ); |
|
| 120 | - } |
|
| 118 | + function mb_stripos( $s, $needle, $offset = 0, $enc = null ) { |
|
| 119 | + return Google_Web_Stories_Mbstring\Mbstring::mb_stripos( $s, $needle, $offset, $enc ); |
|
| 120 | + } |
|
| 121 | 121 | } |
| 122 | 122 | if ( ! function_exists( 'mb_stristr' ) ) { |
| 123 | - function mb_stristr( $s, $needle, $part = false, $enc = null ) { |
|
| 124 | - return Google_Web_Stories_Mbstring\Mbstring::mb_stristr( $s, $needle, $part, $enc ); |
|
| 125 | - } |
|
| 123 | + function mb_stristr( $s, $needle, $part = false, $enc = null ) { |
|
| 124 | + return Google_Web_Stories_Mbstring\Mbstring::mb_stristr( $s, $needle, $part, $enc ); |
|
| 125 | + } |
|
| 126 | 126 | } |
| 127 | 127 | if ( ! function_exists( 'mb_strrchr' ) ) { |
| 128 | - function mb_strrchr( $s, $needle, $part = false, $enc = null ) { |
|
| 129 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strrchr( $s, $needle, $part, $enc ); |
|
| 130 | - } |
|
| 128 | + function mb_strrchr( $s, $needle, $part = false, $enc = null ) { |
|
| 129 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strrchr( $s, $needle, $part, $enc ); |
|
| 130 | + } |
|
| 131 | 131 | } |
| 132 | 132 | if ( ! function_exists( 'mb_strrichr' ) ) { |
| 133 | - function mb_strrichr( $s, $needle, $part = false, $enc = null ) { |
|
| 134 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strrichr( $s, $needle, $part, $enc ); |
|
| 135 | - } |
|
| 133 | + function mb_strrichr( $s, $needle, $part = false, $enc = null ) { |
|
| 134 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strrichr( $s, $needle, $part, $enc ); |
|
| 135 | + } |
|
| 136 | 136 | } |
| 137 | 137 | if ( ! function_exists( 'mb_strripos' ) ) { |
| 138 | - function mb_strripos( $s, $needle, $offset = 0, $enc = null ) { |
|
| 139 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strripos( $s, $needle, $offset, $enc ); |
|
| 140 | - } |
|
| 138 | + function mb_strripos( $s, $needle, $offset = 0, $enc = null ) { |
|
| 139 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strripos( $s, $needle, $offset, $enc ); |
|
| 140 | + } |
|
| 141 | 141 | } |
| 142 | 142 | if ( ! function_exists( 'mb_strrpos' ) ) { |
| 143 | - function mb_strrpos( $s, $needle, $offset = 0, $enc = null ) { |
|
| 144 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strrpos( $s, $needle, $offset, $enc ); |
|
| 145 | - } |
|
| 143 | + function mb_strrpos( $s, $needle, $offset = 0, $enc = null ) { |
|
| 144 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strrpos( $s, $needle, $offset, $enc ); |
|
| 145 | + } |
|
| 146 | 146 | } |
| 147 | 147 | if ( ! function_exists( 'mb_strstr' ) ) { |
| 148 | - function mb_strstr( $s, $needle, $part = false, $enc = null ) { |
|
| 149 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strstr( $s, $needle, $part, $enc ); |
|
| 150 | - } |
|
| 148 | + function mb_strstr( $s, $needle, $part = false, $enc = null ) { |
|
| 149 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strstr( $s, $needle, $part, $enc ); |
|
| 150 | + } |
|
| 151 | 151 | } |
| 152 | 152 | if ( ! function_exists( 'mb_get_info' ) ) { |
| 153 | - function mb_get_info( $type = 'all' ) { |
|
| 154 | - return Google_Web_Stories_Mbstring\Mbstring::mb_get_info( $type ); |
|
| 155 | - } |
|
| 153 | + function mb_get_info( $type = 'all' ) { |
|
| 154 | + return Google_Web_Stories_Mbstring\Mbstring::mb_get_info( $type ); |
|
| 155 | + } |
|
| 156 | 156 | } |
| 157 | 157 | if ( ! function_exists( 'mb_http_output' ) ) { |
| 158 | - function mb_http_output( $enc = null ) { |
|
| 159 | - return Google_Web_Stories_Mbstring\Mbstring::mb_http_output( $enc ); |
|
| 160 | - } |
|
| 158 | + function mb_http_output( $enc = null ) { |
|
| 159 | + return Google_Web_Stories_Mbstring\Mbstring::mb_http_output( $enc ); |
|
| 160 | + } |
|
| 161 | 161 | } |
| 162 | 162 | if ( ! function_exists( 'mb_strwidth' ) ) { |
| 163 | - function mb_strwidth( $s, $enc = null ) { |
|
| 164 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strwidth( $s, $enc ); |
|
| 165 | - } |
|
| 163 | + function mb_strwidth( $s, $enc = null ) { |
|
| 164 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strwidth( $s, $enc ); |
|
| 165 | + } |
|
| 166 | 166 | } |
| 167 | 167 | if ( ! function_exists( 'mb_substr_count' ) ) { |
| 168 | - function mb_substr_count( $haystack, $needle, $enc = null ) { |
|
| 169 | - return Google_Web_Stories_Mbstring\Mbstring::mb_substr_count( $haystack, $needle, $enc ); |
|
| 170 | - } |
|
| 168 | + function mb_substr_count( $haystack, $needle, $enc = null ) { |
|
| 169 | + return Google_Web_Stories_Mbstring\Mbstring::mb_substr_count( $haystack, $needle, $enc ); |
|
| 170 | + } |
|
| 171 | 171 | } |
| 172 | 172 | if ( ! function_exists( 'mb_output_handler' ) ) { |
| 173 | - function mb_output_handler( $contents, $status ) { |
|
| 174 | - return Google_Web_Stories_Mbstring\Mbstring::mb_output_handler( $contents, $status ); |
|
| 175 | - } |
|
| 173 | + function mb_output_handler( $contents, $status ) { |
|
| 174 | + return Google_Web_Stories_Mbstring\Mbstring::mb_output_handler( $contents, $status ); |
|
| 175 | + } |
|
| 176 | 176 | } |
| 177 | 177 | if ( ! function_exists( 'mb_http_input' ) ) { |
| 178 | - function mb_http_input( $type = '' ) { |
|
| 179 | - return Google_Web_Stories_Mbstring\Mbstring::mb_http_input( $type ); |
|
| 180 | - } |
|
| 178 | + function mb_http_input( $type = '' ) { |
|
| 179 | + return Google_Web_Stories_Mbstring\Mbstring::mb_http_input( $type ); |
|
| 180 | + } |
|
| 181 | 181 | } |
| 182 | 182 | if ( ! function_exists( 'mb_convert_variables' ) ) { |
| 183 | - function mb_convert_variables( $toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null ) { |
|
| 184 | - return Google_Web_Stories_Mbstring\Mbstring::mb_convert_variables( $toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f ); |
|
| 185 | - } |
|
| 183 | + function mb_convert_variables( $toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null ) { |
|
| 184 | + return Google_Web_Stories_Mbstring\Mbstring::mb_convert_variables( $toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f ); |
|
| 185 | + } |
|
| 186 | 186 | } |
| 187 | 187 | if ( ! function_exists( 'mb_ord' ) ) { |
| 188 | - function mb_ord( $s, $enc = null ) { |
|
| 189 | - return Google_Web_Stories_Mbstring\Mbstring::mb_ord( $s, $enc ); |
|
| 190 | - } |
|
| 188 | + function mb_ord( $s, $enc = null ) { |
|
| 189 | + return Google_Web_Stories_Mbstring\Mbstring::mb_ord( $s, $enc ); |
|
| 190 | + } |
|
| 191 | 191 | } |
| 192 | 192 | if ( ! function_exists( 'mb_chr' ) ) { |
| 193 | - function mb_chr( $code, $enc = null ) { |
|
| 194 | - return Google_Web_Stories_Mbstring\Mbstring::mb_chr( $code, $enc ); |
|
| 195 | - } |
|
| 193 | + function mb_chr( $code, $enc = null ) { |
|
| 194 | + return Google_Web_Stories_Mbstring\Mbstring::mb_chr( $code, $enc ); |
|
| 195 | + } |
|
| 196 | 196 | } |
| 197 | 197 | if ( ! function_exists( 'mb_scrub' ) ) { |
| 198 | - function mb_scrub( $s, $enc = null ) { |
|
| 199 | - $enc = $enc ?? mb_internal_encoding(); |
|
| 200 | - return mb_convert_encoding( $s, $enc, $enc ); |
|
| 201 | - } |
|
| 198 | + function mb_scrub( $s, $enc = null ) { |
|
| 199 | + $enc = $enc ?? mb_internal_encoding(); |
|
| 200 | + return mb_convert_encoding( $s, $enc, $enc ); |
|
| 201 | + } |
|
| 202 | 202 | } |
| 203 | 203 | if ( ! function_exists( 'mb_str_split' ) ) { |
| 204 | - function mb_str_split( $string, $split_length = 1, $encoding = null ) { |
|
| 205 | - return Google_Web_Stories_Mbstring\Mbstring::mb_str_split( $string, $split_length, $encoding ); |
|
| 206 | - } |
|
| 204 | + function mb_str_split( $string, $split_length = 1, $encoding = null ) { |
|
| 205 | + return Google_Web_Stories_Mbstring\Mbstring::mb_str_split( $string, $split_length, $encoding ); |
|
| 206 | + } |
|
| 207 | 207 | } |
| 208 | 208 | if ( extension_loaded( 'mbstring' ) ) { |
| 209 | - return; |
|
| 209 | + return; |
|
| 210 | 210 | } |
| 211 | 211 | if ( ! defined( 'MB_CASE_UPPER' ) ) { |
| 212 | - define( 'MB_CASE_UPPER', 0 ); |
|
| 212 | + define( 'MB_CASE_UPPER', 0 ); |
|
| 213 | 213 | } |
| 214 | 214 | if ( ! defined( 'MB_CASE_LOWER' ) ) { |
| 215 | - define( 'MB_CASE_LOWER', 1 ); |
|
| 215 | + define( 'MB_CASE_LOWER', 1 ); |
|
| 216 | 216 | } |
| 217 | 217 | if ( ! defined( 'MB_CASE_TITLE' ) ) { |
| 218 | - define( 'MB_CASE_TITLE', 2 ); |
|
| 218 | + define( 'MB_CASE_TITLE', 2 ); |
|
| 219 | 219 | } |
@@ -14,206 +14,206 @@ |
||
| 14 | 14 | |
| 15 | 15 | use Google\Web_Stories_Dependencies\Symfony\Polyfill\Mbstring as Google_Web_Stories_Mbstring; |
| 16 | 16 | |
| 17 | -if ( ! function_exists( 'mb_convert_encoding' ) ) { |
|
| 18 | - function mb_convert_encoding( $s, $to, $from = null ) { |
|
| 19 | - return Google_Web_Stories_Mbstring\Mbstring::mb_convert_encoding( $s, $to, $from ); |
|
| 17 | +if ( ! function_exists('mb_convert_encoding')) { |
|
| 18 | + function mb_convert_encoding($s, $to, $from = null) { |
|
| 19 | + return Google_Web_Stories_Mbstring\Mbstring::mb_convert_encoding($s, $to, $from); |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | -if ( ! function_exists( 'mb_decode_mimeheader' ) ) { |
|
| 23 | - function mb_decode_mimeheader( $s ) { |
|
| 24 | - return Google_Web_Stories_Mbstring\Mbstring::mb_decode_mimeheader( $s ); |
|
| 22 | +if ( ! function_exists('mb_decode_mimeheader')) { |
|
| 23 | + function mb_decode_mimeheader($s) { |
|
| 24 | + return Google_Web_Stories_Mbstring\Mbstring::mb_decode_mimeheader($s); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | -if ( ! function_exists( 'mb_encode_mimeheader' ) ) { |
|
| 28 | - function mb_encode_mimeheader( $s, $charset = null, $transferEnc = null, $lf = null, $indent = null ) { |
|
| 29 | - return Google_Web_Stories_Mbstring\Mbstring::mb_encode_mimeheader( $s, $charset, $transferEnc, $lf, $indent ); |
|
| 27 | +if ( ! function_exists('mb_encode_mimeheader')) { |
|
| 28 | + function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { |
|
| 29 | + return Google_Web_Stories_Mbstring\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | -if ( ! function_exists( 'mb_decode_numericentity' ) ) { |
|
| 33 | - function mb_decode_numericentity( $s, $convmap, $enc = null ) { |
|
| 34 | - return Google_Web_Stories_Mbstring\Mbstring::mb_decode_numericentity( $s, $convmap, $enc ); |
|
| 32 | +if ( ! function_exists('mb_decode_numericentity')) { |
|
| 33 | + function mb_decode_numericentity($s, $convmap, $enc = null) { |
|
| 34 | + return Google_Web_Stories_Mbstring\Mbstring::mb_decode_numericentity($s, $convmap, $enc); |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | -if ( ! function_exists( 'mb_encode_numericentity' ) ) { |
|
| 38 | - function mb_encode_numericentity( $s, $convmap, $enc = null, $is_hex = false ) { |
|
| 39 | - return Google_Web_Stories_Mbstring\Mbstring::mb_encode_numericentity( $s, $convmap, $enc, $is_hex ); |
|
| 37 | +if ( ! function_exists('mb_encode_numericentity')) { |
|
| 38 | + function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { |
|
| 39 | + return Google_Web_Stories_Mbstring\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | -if ( ! function_exists( 'mb_convert_case' ) ) { |
|
| 43 | - function mb_convert_case( $s, $mode, $enc = null ) { |
|
| 44 | - return Google_Web_Stories_Mbstring\Mbstring::mb_convert_case( $s, $mode, $enc ); |
|
| 42 | +if ( ! function_exists('mb_convert_case')) { |
|
| 43 | + function mb_convert_case($s, $mode, $enc = null) { |
|
| 44 | + return Google_Web_Stories_Mbstring\Mbstring::mb_convert_case($s, $mode, $enc); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | -if ( ! function_exists( 'mb_internal_encoding' ) ) { |
|
| 48 | - function mb_internal_encoding( $enc = null ) { |
|
| 49 | - return Google_Web_Stories_Mbstring\Mbstring::mb_internal_encoding( $enc ); |
|
| 47 | +if ( ! function_exists('mb_internal_encoding')) { |
|
| 48 | + function mb_internal_encoding($enc = null) { |
|
| 49 | + return Google_Web_Stories_Mbstring\Mbstring::mb_internal_encoding($enc); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | -if ( ! function_exists( 'mb_language' ) ) { |
|
| 53 | - function mb_language( $lang = null ) { |
|
| 54 | - return Google_Web_Stories_Mbstring\Mbstring::mb_language( $lang ); |
|
| 52 | +if ( ! function_exists('mb_language')) { |
|
| 53 | + function mb_language($lang = null) { |
|
| 54 | + return Google_Web_Stories_Mbstring\Mbstring::mb_language($lang); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | -if ( ! function_exists( 'mb_list_encodings' ) ) { |
|
| 57 | +if ( ! function_exists('mb_list_encodings')) { |
|
| 58 | 58 | function mb_list_encodings() { |
| 59 | 59 | return Google_Web_Stories_Mbstring\Mbstring::mb_list_encodings(); |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | -if ( ! function_exists( 'mb_encoding_aliases' ) ) { |
|
| 63 | - function mb_encoding_aliases( $encoding ) { |
|
| 64 | - return Google_Web_Stories_Mbstring\Mbstring::mb_encoding_aliases( $encoding ); |
|
| 62 | +if ( ! function_exists('mb_encoding_aliases')) { |
|
| 63 | + function mb_encoding_aliases($encoding) { |
|
| 64 | + return Google_Web_Stories_Mbstring\Mbstring::mb_encoding_aliases($encoding); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | -if ( ! function_exists( 'mb_check_encoding' ) ) { |
|
| 68 | - function mb_check_encoding( $var = null, $encoding = null ) { |
|
| 69 | - return Google_Web_Stories_Mbstring\Mbstring::mb_check_encoding( $var, $encoding ); |
|
| 67 | +if ( ! function_exists('mb_check_encoding')) { |
|
| 68 | + function mb_check_encoding($var = null, $encoding = null) { |
|
| 69 | + return Google_Web_Stories_Mbstring\Mbstring::mb_check_encoding($var, $encoding); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | -if ( ! function_exists( 'mb_detect_encoding' ) ) { |
|
| 73 | - function mb_detect_encoding( $str, $encodingList = null, $strict = false ) { |
|
| 74 | - return Google_Web_Stories_Mbstring\Mbstring::mb_detect_encoding( $str, $encodingList, $strict ); |
|
| 72 | +if ( ! function_exists('mb_detect_encoding')) { |
|
| 73 | + function mb_detect_encoding($str, $encodingList = null, $strict = false) { |
|
| 74 | + return Google_Web_Stories_Mbstring\Mbstring::mb_detect_encoding($str, $encodingList, $strict); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | -if ( ! function_exists( 'mb_detect_order' ) ) { |
|
| 78 | - function mb_detect_order( $encodingList = null ) { |
|
| 79 | - return Google_Web_Stories_Mbstring\Mbstring::mb_detect_order( $encodingList ); |
|
| 77 | +if ( ! function_exists('mb_detect_order')) { |
|
| 78 | + function mb_detect_order($encodingList = null) { |
|
| 79 | + return Google_Web_Stories_Mbstring\Mbstring::mb_detect_order($encodingList); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | -if ( ! function_exists( 'mb_parse_str' ) ) { |
|
| 83 | - function mb_parse_str( $s, &$result = [] ) { |
|
| 84 | - parse_str( $s, $result ); |
|
| 82 | +if ( ! function_exists('mb_parse_str')) { |
|
| 83 | + function mb_parse_str($s, &$result = []) { |
|
| 84 | + parse_str($s, $result); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | -if ( ! function_exists( 'mb_strlen' ) ) { |
|
| 88 | - function mb_strlen( $s, $enc = null ) { |
|
| 89 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strlen( $s, $enc ); |
|
| 87 | +if ( ! function_exists('mb_strlen')) { |
|
| 88 | + function mb_strlen($s, $enc = null) { |
|
| 89 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strlen($s, $enc); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | -if ( ! function_exists( 'mb_strpos' ) ) { |
|
| 93 | - function mb_strpos( $s, $needle, $offset = 0, $enc = null ) { |
|
| 94 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strpos( $s, $needle, $offset, $enc ); |
|
| 92 | +if ( ! function_exists('mb_strpos')) { |
|
| 93 | + function mb_strpos($s, $needle, $offset = 0, $enc = null) { |
|
| 94 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strpos($s, $needle, $offset, $enc); |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | -if ( ! function_exists( 'mb_strtolower' ) ) { |
|
| 98 | - function mb_strtolower( $s, $enc = null ) { |
|
| 99 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strtolower( $s, $enc ); |
|
| 97 | +if ( ! function_exists('mb_strtolower')) { |
|
| 98 | + function mb_strtolower($s, $enc = null) { |
|
| 99 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strtolower($s, $enc); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | -if ( ! function_exists( 'mb_strtoupper' ) ) { |
|
| 103 | - function mb_strtoupper( $s, $enc = null ) { |
|
| 104 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strtoupper( $s, $enc ); |
|
| 102 | +if ( ! function_exists('mb_strtoupper')) { |
|
| 103 | + function mb_strtoupper($s, $enc = null) { |
|
| 104 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strtoupper($s, $enc); |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | -if ( ! function_exists( 'mb_substitute_character' ) ) { |
|
| 108 | - function mb_substitute_character( $char = null ) { |
|
| 109 | - return Google_Web_Stories_Mbstring\Mbstring::mb_substitute_character( $char ); |
|
| 107 | +if ( ! function_exists('mb_substitute_character')) { |
|
| 108 | + function mb_substitute_character($char = null) { |
|
| 109 | + return Google_Web_Stories_Mbstring\Mbstring::mb_substitute_character($char); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | -if ( ! function_exists( 'mb_substr' ) ) { |
|
| 113 | - function mb_substr( $s, $start, $length = 2147483647, $enc = null ) { |
|
| 114 | - return Google_Web_Stories_Mbstring\Mbstring::mb_substr( $s, $start, $length, $enc ); |
|
| 112 | +if ( ! function_exists('mb_substr')) { |
|
| 113 | + function mb_substr($s, $start, $length = 2147483647, $enc = null) { |
|
| 114 | + return Google_Web_Stories_Mbstring\Mbstring::mb_substr($s, $start, $length, $enc); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | -if ( ! function_exists( 'mb_stripos' ) ) { |
|
| 118 | - function mb_stripos( $s, $needle, $offset = 0, $enc = null ) { |
|
| 119 | - return Google_Web_Stories_Mbstring\Mbstring::mb_stripos( $s, $needle, $offset, $enc ); |
|
| 117 | +if ( ! function_exists('mb_stripos')) { |
|
| 118 | + function mb_stripos($s, $needle, $offset = 0, $enc = null) { |
|
| 119 | + return Google_Web_Stories_Mbstring\Mbstring::mb_stripos($s, $needle, $offset, $enc); |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | -if ( ! function_exists( 'mb_stristr' ) ) { |
|
| 123 | - function mb_stristr( $s, $needle, $part = false, $enc = null ) { |
|
| 124 | - return Google_Web_Stories_Mbstring\Mbstring::mb_stristr( $s, $needle, $part, $enc ); |
|
| 122 | +if ( ! function_exists('mb_stristr')) { |
|
| 123 | + function mb_stristr($s, $needle, $part = false, $enc = null) { |
|
| 124 | + return Google_Web_Stories_Mbstring\Mbstring::mb_stristr($s, $needle, $part, $enc); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | -if ( ! function_exists( 'mb_strrchr' ) ) { |
|
| 128 | - function mb_strrchr( $s, $needle, $part = false, $enc = null ) { |
|
| 129 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strrchr( $s, $needle, $part, $enc ); |
|
| 127 | +if ( ! function_exists('mb_strrchr')) { |
|
| 128 | + function mb_strrchr($s, $needle, $part = false, $enc = null) { |
|
| 129 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strrchr($s, $needle, $part, $enc); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | -if ( ! function_exists( 'mb_strrichr' ) ) { |
|
| 133 | - function mb_strrichr( $s, $needle, $part = false, $enc = null ) { |
|
| 134 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strrichr( $s, $needle, $part, $enc ); |
|
| 132 | +if ( ! function_exists('mb_strrichr')) { |
|
| 133 | + function mb_strrichr($s, $needle, $part = false, $enc = null) { |
|
| 134 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strrichr($s, $needle, $part, $enc); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | -if ( ! function_exists( 'mb_strripos' ) ) { |
|
| 138 | - function mb_strripos( $s, $needle, $offset = 0, $enc = null ) { |
|
| 139 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strripos( $s, $needle, $offset, $enc ); |
|
| 137 | +if ( ! function_exists('mb_strripos')) { |
|
| 138 | + function mb_strripos($s, $needle, $offset = 0, $enc = null) { |
|
| 139 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strripos($s, $needle, $offset, $enc); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | -if ( ! function_exists( 'mb_strrpos' ) ) { |
|
| 143 | - function mb_strrpos( $s, $needle, $offset = 0, $enc = null ) { |
|
| 144 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strrpos( $s, $needle, $offset, $enc ); |
|
| 142 | +if ( ! function_exists('mb_strrpos')) { |
|
| 143 | + function mb_strrpos($s, $needle, $offset = 0, $enc = null) { |
|
| 144 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strrpos($s, $needle, $offset, $enc); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | -if ( ! function_exists( 'mb_strstr' ) ) { |
|
| 148 | - function mb_strstr( $s, $needle, $part = false, $enc = null ) { |
|
| 149 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strstr( $s, $needle, $part, $enc ); |
|
| 147 | +if ( ! function_exists('mb_strstr')) { |
|
| 148 | + function mb_strstr($s, $needle, $part = false, $enc = null) { |
|
| 149 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strstr($s, $needle, $part, $enc); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | -if ( ! function_exists( 'mb_get_info' ) ) { |
|
| 153 | - function mb_get_info( $type = 'all' ) { |
|
| 154 | - return Google_Web_Stories_Mbstring\Mbstring::mb_get_info( $type ); |
|
| 152 | +if ( ! function_exists('mb_get_info')) { |
|
| 153 | + function mb_get_info($type = 'all') { |
|
| 154 | + return Google_Web_Stories_Mbstring\Mbstring::mb_get_info($type); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | -if ( ! function_exists( 'mb_http_output' ) ) { |
|
| 158 | - function mb_http_output( $enc = null ) { |
|
| 159 | - return Google_Web_Stories_Mbstring\Mbstring::mb_http_output( $enc ); |
|
| 157 | +if ( ! function_exists('mb_http_output')) { |
|
| 158 | + function mb_http_output($enc = null) { |
|
| 159 | + return Google_Web_Stories_Mbstring\Mbstring::mb_http_output($enc); |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | -if ( ! function_exists( 'mb_strwidth' ) ) { |
|
| 163 | - function mb_strwidth( $s, $enc = null ) { |
|
| 164 | - return Google_Web_Stories_Mbstring\Mbstring::mb_strwidth( $s, $enc ); |
|
| 162 | +if ( ! function_exists('mb_strwidth')) { |
|
| 163 | + function mb_strwidth($s, $enc = null) { |
|
| 164 | + return Google_Web_Stories_Mbstring\Mbstring::mb_strwidth($s, $enc); |
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | -if ( ! function_exists( 'mb_substr_count' ) ) { |
|
| 168 | - function mb_substr_count( $haystack, $needle, $enc = null ) { |
|
| 169 | - return Google_Web_Stories_Mbstring\Mbstring::mb_substr_count( $haystack, $needle, $enc ); |
|
| 167 | +if ( ! function_exists('mb_substr_count')) { |
|
| 168 | + function mb_substr_count($haystack, $needle, $enc = null) { |
|
| 169 | + return Google_Web_Stories_Mbstring\Mbstring::mb_substr_count($haystack, $needle, $enc); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | -if ( ! function_exists( 'mb_output_handler' ) ) { |
|
| 173 | - function mb_output_handler( $contents, $status ) { |
|
| 174 | - return Google_Web_Stories_Mbstring\Mbstring::mb_output_handler( $contents, $status ); |
|
| 172 | +if ( ! function_exists('mb_output_handler')) { |
|
| 173 | + function mb_output_handler($contents, $status) { |
|
| 174 | + return Google_Web_Stories_Mbstring\Mbstring::mb_output_handler($contents, $status); |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | -if ( ! function_exists( 'mb_http_input' ) ) { |
|
| 178 | - function mb_http_input( $type = '' ) { |
|
| 179 | - return Google_Web_Stories_Mbstring\Mbstring::mb_http_input( $type ); |
|
| 177 | +if ( ! function_exists('mb_http_input')) { |
|
| 178 | + function mb_http_input($type = '') { |
|
| 179 | + return Google_Web_Stories_Mbstring\Mbstring::mb_http_input($type); |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | -if ( ! function_exists( 'mb_convert_variables' ) ) { |
|
| 183 | - function mb_convert_variables( $toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null ) { |
|
| 184 | - return Google_Web_Stories_Mbstring\Mbstring::mb_convert_variables( $toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f ); |
|
| 182 | +if ( ! function_exists('mb_convert_variables')) { |
|
| 183 | + function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { |
|
| 184 | + return Google_Web_Stories_Mbstring\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | -if ( ! function_exists( 'mb_ord' ) ) { |
|
| 188 | - function mb_ord( $s, $enc = null ) { |
|
| 189 | - return Google_Web_Stories_Mbstring\Mbstring::mb_ord( $s, $enc ); |
|
| 187 | +if ( ! function_exists('mb_ord')) { |
|
| 188 | + function mb_ord($s, $enc = null) { |
|
| 189 | + return Google_Web_Stories_Mbstring\Mbstring::mb_ord($s, $enc); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | -if ( ! function_exists( 'mb_chr' ) ) { |
|
| 193 | - function mb_chr( $code, $enc = null ) { |
|
| 194 | - return Google_Web_Stories_Mbstring\Mbstring::mb_chr( $code, $enc ); |
|
| 192 | +if ( ! function_exists('mb_chr')) { |
|
| 193 | + function mb_chr($code, $enc = null) { |
|
| 194 | + return Google_Web_Stories_Mbstring\Mbstring::mb_chr($code, $enc); |
|
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | -if ( ! function_exists( 'mb_scrub' ) ) { |
|
| 198 | - function mb_scrub( $s, $enc = null ) { |
|
| 197 | +if ( ! function_exists('mb_scrub')) { |
|
| 198 | + function mb_scrub($s, $enc = null) { |
|
| 199 | 199 | $enc = $enc ?? mb_internal_encoding(); |
| 200 | - return mb_convert_encoding( $s, $enc, $enc ); |
|
| 200 | + return mb_convert_encoding($s, $enc, $enc); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | -if ( ! function_exists( 'mb_str_split' ) ) { |
|
| 204 | - function mb_str_split( $string, $split_length = 1, $encoding = null ) { |
|
| 205 | - return Google_Web_Stories_Mbstring\Mbstring::mb_str_split( $string, $split_length, $encoding ); |
|
| 203 | +if ( ! function_exists('mb_str_split')) { |
|
| 204 | + function mb_str_split($string, $split_length = 1, $encoding = null) { |
|
| 205 | + return Google_Web_Stories_Mbstring\Mbstring::mb_str_split($string, $split_length, $encoding); |
|
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | -if ( extension_loaded( 'mbstring' ) ) { |
|
| 208 | +if (extension_loaded('mbstring')) { |
|
| 209 | 209 | return; |
| 210 | 210 | } |
| 211 | -if ( ! defined( 'MB_CASE_UPPER' ) ) { |
|
| 212 | - define( 'MB_CASE_UPPER', 0 ); |
|
| 211 | +if ( ! defined('MB_CASE_UPPER')) { |
|
| 212 | + define('MB_CASE_UPPER', 0); |
|
| 213 | 213 | } |
| 214 | -if ( ! defined( 'MB_CASE_LOWER' ) ) { |
|
| 215 | - define( 'MB_CASE_LOWER', 1 ); |
|
| 214 | +if ( ! defined('MB_CASE_LOWER')) { |
|
| 215 | + define('MB_CASE_LOWER', 1); |
|
| 216 | 216 | } |
| 217 | -if ( ! defined( 'MB_CASE_TITLE' ) ) { |
|
| 218 | - define( 'MB_CASE_TITLE', 2 ); |
|
| 217 | +if ( ! defined('MB_CASE_TITLE')) { |
|
| 218 | + define('MB_CASE_TITLE', 2); |
|
| 219 | 219 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function checkPatches(Event $event) |
| 88 | 88 | { |
| 89 | - if (!$this->isPatchingEnabled()) { |
|
| 89 | + if ( ! $this->isPatchingEnabled()) { |
|
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | 92 | try { |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | // Remove packages for which the patch set has changed. |
| 120 | 120 | $promises = array(); |
| 121 | 121 | foreach ($packages as $package) { |
| 122 | - if (!$package instanceof AliasPackage) { |
|
| 122 | + if ( ! $package instanceof AliasPackage) { |
|
| 123 | 123 | $package_name = $package->getName(); |
| 124 | 124 | $extra = $package->getExtra(); |
| 125 | 125 | $has_patches = isset($tmp_patches[$package_name]); |
| 126 | 126 | $has_applied_patches = isset($extra['patches_applied']) && \count($extra['patches_applied']) > 0; |
| 127 | - if ($has_patches && !$has_applied_patches || !$has_patches && $has_applied_patches || $has_patches && $has_applied_patches && $tmp_patches[$package_name] !== $extra['patches_applied']) { |
|
| 127 | + if ($has_patches && ! $has_applied_patches || ! $has_patches && $has_applied_patches || $has_patches && $has_applied_patches && $tmp_patches[$package_name] !== $extra['patches_applied']) { |
|
| 128 | 128 | $uninstallOperation = new UninstallOperation($package, 'Removing package so it can be re-installed and re-patched.'); |
| 129 | - $this->io->write('<info>Removing package ' . $package_name . ' so that it can be re-installed and re-patched.</info>'); |
|
| 129 | + $this->io->write('<info>Removing package '.$package_name.' so that it can be re-installed and re-patched.</info>'); |
|
| 130 | 130 | $promises[] = $installationManager->uninstall($localRepository, $uninstallOperation); |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | if (isset($this->patches['_patchesGathered'])) { |
| 151 | 151 | $this->io->write('<info>Patches already gathered. Skipping</info>', \TRUE, IOInterface::VERBOSE); |
| 152 | 152 | return; |
| 153 | - } elseif (!$this->isPatchingEnabled()) { |
|
| 153 | + } elseif ( ! $this->isPatchingEnabled()) { |
|
| 154 | 154 | $this->io->write('<info>Patching is disabled. Skipping.</info>', \TRUE, IOInterface::VERBOSE); |
| 155 | 155 | return; |
| 156 | 156 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | if ($this->io->isVerbose()) { |
| 192 | 192 | foreach ($this->patches as $package => $patches) { |
| 193 | 193 | $number = \count($patches); |
| 194 | - $this->io->write('<info>Found ' . $number . ' patches for ' . $package . '.</info>'); |
|
| 194 | + $this->io->write('<info>Found '.$number.' patches for '.$package.'.</info>'); |
|
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | // Make sure we don't gather patches again. Extra keys in $this->patches |
@@ -237,12 +237,12 @@ discard block |
||
| 237 | 237 | $msg = ' - Unknown error'; |
| 238 | 238 | break; |
| 239 | 239 | } |
| 240 | - throw new \Exception('There was an error in the supplied patches file:' . $msg); |
|
| 240 | + throw new \Exception('There was an error in the supplied patches file:'.$msg); |
|
| 241 | 241 | } |
| 242 | 242 | if (isset($patches['patches'])) { |
| 243 | 243 | $patches = $patches['patches']; |
| 244 | 244 | return $patches; |
| 245 | - } elseif (!$patches) { |
|
| 245 | + } elseif ( ! $patches) { |
|
| 246 | 246 | throw new \Exception('There was an error in the supplied patch file'); |
| 247 | 247 | } |
| 248 | 248 | } else { |
@@ -257,20 +257,20 @@ discard block |
||
| 257 | 257 | { |
| 258 | 258 | // Check if we should exit in failure. |
| 259 | 259 | $extra = $this->composer->getPackage()->getExtra(); |
| 260 | - $exitOnFailure = \getenv('COMPOSER_EXIT_ON_PATCH_FAILURE') || !empty($extra['composer-exit-on-patch-failure']); |
|
| 261 | - $skipReporting = \getenv('COMPOSER_PATCHES_SKIP_REPORTING') || !empty($extra['composer-patches-skip-reporting']); |
|
| 260 | + $exitOnFailure = \getenv('COMPOSER_EXIT_ON_PATCH_FAILURE') || ! empty($extra['composer-exit-on-patch-failure']); |
|
| 261 | + $skipReporting = \getenv('COMPOSER_PATCHES_SKIP_REPORTING') || ! empty($extra['composer-patches-skip-reporting']); |
|
| 262 | 262 | // Get the package object for the current operation. |
| 263 | 263 | $operation = $event->getOperation(); |
| 264 | 264 | /** @var PackageInterface $package */ |
| 265 | 265 | $package = $this->getPackageFromOperation($operation); |
| 266 | 266 | $package_name = $package->getName(); |
| 267 | - if (!isset($this->patches[$package_name])) { |
|
| 267 | + if ( ! isset($this->patches[$package_name])) { |
|
| 268 | 268 | if ($this->io->isVerbose()) { |
| 269 | - $this->io->write('<info>No patches found for ' . $package_name . '.</info>'); |
|
| 269 | + $this->io->write('<info>No patches found for '.$package_name.'.</info>'); |
|
| 270 | 270 | } |
| 271 | 271 | return; |
| 272 | 272 | } |
| 273 | - $this->io->write(' - Applying patches for <info>' . $package_name . '</info>'); |
|
| 273 | + $this->io->write(' - Applying patches for <info>'.$package_name.'</info>'); |
|
| 274 | 274 | // Get the install path from the package object. |
| 275 | 275 | $manager = $event->getComposer()->getInstallationManager(); |
| 276 | 276 | $install_path = $manager->getInstaller($package->getType())->getInstallPath($package); |
@@ -282,14 +282,14 @@ discard block |
||
| 282 | 282 | $extra = $localPackage->getExtra(); |
| 283 | 283 | $extra['patches_applied'] = array(); |
| 284 | 284 | foreach ($this->patches[$package_name] as $description => $url) { |
| 285 | - $this->io->write(' <info>' . $url . '</info> (<comment>' . $description . '</comment>)'); |
|
| 285 | + $this->io->write(' <info>'.$url.'</info> (<comment>'.$description.'</comment>)'); |
|
| 286 | 286 | try { |
| 287 | 287 | $this->eventDispatcher->dispatch(NULL, new PatchEvent(PatchEvents::PRE_PATCH_APPLY, $package, $url, $description)); |
| 288 | 288 | $this->getAndApplyPatch($downloader, $install_path, $url, $package); |
| 289 | 289 | $this->eventDispatcher->dispatch(NULL, new PatchEvent(PatchEvents::POST_PATCH_APPLY, $package, $url, $description)); |
| 290 | 290 | $extra['patches_applied'][$description] = $url; |
| 291 | 291 | } catch (\Exception $e) { |
| 292 | - $this->io->write(' <error>Could not apply patch! Skipping. The error was: ' . $e->getMessage() . '</error>'); |
|
| 292 | + $this->io->write(' <error>Could not apply patch! Skipping. The error was: '.$e->getMessage().'</error>'); |
|
| 293 | 293 | if ($exitOnFailure) { |
| 294 | 294 | throw new \Exception("Cannot apply patch {$description} ({$url})!"); |
| 295 | 295 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | } elseif ($operation instanceof UpdateOperation) { |
| 316 | 316 | $package = $operation->getTargetPackage(); |
| 317 | 317 | } else { |
| 318 | - throw new \Exception('Unknown operation: ' . \get_class($operation)); |
|
| 318 | + throw new \Exception('Unknown operation: '.\get_class($operation)); |
|
| 319 | 319 | } |
| 320 | 320 | return $package; |
| 321 | 321 | } |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | $filename = \realpath($patch_url); |
| 336 | 336 | } else { |
| 337 | 337 | // Generate random (but not cryptographically so) filename. |
| 338 | - $filename = \uniqid(\sys_get_temp_dir() . '/') . ".patch"; |
|
| 338 | + $filename = \uniqid(\sys_get_temp_dir().'/').".patch"; |
|
| 339 | 339 | // Download file from remote filesystem to this location. |
| 340 | 340 | $hostname = \parse_url($patch_url, \PHP_URL_HOST); |
| 341 | 341 | try { |
@@ -352,14 +352,14 @@ discard block |
||
| 352 | 352 | $patch_levels = array('-p1', '-p0', '-p2', '-p4'); |
| 353 | 353 | // Check for specified patch level for this package. |
| 354 | 354 | $extra = $this->composer->getPackage()->getExtra(); |
| 355 | - if (!empty($extra['patchLevel'][$package->getName()])) { |
|
| 355 | + if ( ! empty($extra['patchLevel'][$package->getName()])) { |
|
| 356 | 356 | $patch_levels = array($extra['patchLevel'][$package->getName()]); |
| 357 | 357 | } |
| 358 | 358 | // Attempt to apply with git apply. |
| 359 | 359 | $patched = $this->applyPatchWithGit($install_path, $patch_levels, $filename); |
| 360 | 360 | // In some rare cases, git will fail to apply a patch, fallback to using |
| 361 | 361 | // the 'patch' command. |
| 362 | - if (!$patched) { |
|
| 362 | + if ( ! $patched) { |
|
| 363 | 363 | foreach ($patch_levels as $patch_level) { |
| 364 | 364 | // --no-backup-if-mismatch here is a hack that fixes some |
| 365 | 365 | // differences between how patch works on windows and unix. |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | // If the patch *still* isn't applied, then give up and throw an Exception. |
| 376 | 376 | // Otherwise, let the user know it worked. |
| 377 | - if (!$patched) { |
|
| 377 | + if ( ! $patched) { |
|
| 378 | 378 | throw new \Exception("Cannot apply patch {$patch_url}"); |
| 379 | 379 | } |
| 380 | 380 | } |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | protected function isPatchingEnabled() |
| 388 | 388 | { |
| 389 | 389 | $extra = $this->composer->getPackage()->getExtra(); |
| 390 | - if (empty($extra['patches']) && empty($extra['patches-ignore']) && !isset($extra['patches-file'])) { |
|
| 390 | + if (empty($extra['patches']) && empty($extra['patches-ignore']) && ! isset($extra['patches-file'])) { |
|
| 391 | 391 | // The root package has no patches of its own, so only allow patching if |
| 392 | 392 | // it has specifically opted in. |
| 393 | 393 | return isset($extra['enable-patching']) ? $extra['enable-patching'] : \FALSE; |
@@ -406,10 +406,10 @@ discard block |
||
| 406 | 406 | $output = "This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches)\n"; |
| 407 | 407 | $output .= "Patches applied to this directory:\n\n"; |
| 408 | 408 | foreach ($patches as $description => $url) { |
| 409 | - $output .= $description . "\n"; |
|
| 410 | - $output .= 'Source: ' . $url . "\n\n\n"; |
|
| 409 | + $output .= $description."\n"; |
|
| 410 | + $output .= 'Source: '.$url."\n\n\n"; |
|
| 411 | 411 | } |
| 412 | - \file_put_contents($directory . "/PATCHES.txt", $output); |
|
| 412 | + \file_put_contents($directory."/PATCHES.txt", $output); |
|
| 413 | 413 | } |
| 414 | 414 | /** |
| 415 | 415 | * Executes a shell command with escaping. |
@@ -430,13 +430,13 @@ discard block |
||
| 430 | 430 | $command = \call_user_func_array('sprintf', $args); |
| 431 | 431 | $output = ''; |
| 432 | 432 | if ($this->io->isVerbose()) { |
| 433 | - $this->io->write('<comment>' . $command . '</comment>'); |
|
| 433 | + $this->io->write('<comment>'.$command.'</comment>'); |
|
| 434 | 434 | $io = $this->io; |
| 435 | - $output = function ($type, $data) use($io) { |
|
| 435 | + $output = function($type, $data) use($io) { |
|
| 436 | 436 | if ($type == Process::ERR) { |
| 437 | - $io->write('<error>' . $data . '</error>'); |
|
| 437 | + $io->write('<error>'.$data.'</error>'); |
|
| 438 | 438 | } else { |
| 439 | - $io->write('<comment>' . $data . '</comment>'); |
|
| 439 | + $io->write('<comment>'.$data.'</comment>'); |
|
| 440 | 440 | } |
| 441 | 441 | }; |
| 442 | 442 | } |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | { |
| 485 | 485 | // Do not use git apply unless the install path is itself a git repo |
| 486 | 486 | // @see https://stackoverflow.com/a/27283285 |
| 487 | - if (!\is_dir($install_path . '/.git')) { |
|
| 487 | + if ( ! \is_dir($install_path.'/.git')) { |
|
| 488 | 488 | return \FALSE; |
| 489 | 489 | } |
| 490 | 490 | $patched = \FALSE; |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | if ($this->io->isVerbose()) { |
| 493 | 493 | $comment = 'Testing ability to patch with git apply.'; |
| 494 | 494 | $comment .= ' This command may produce errors that can be safely ignored.'; |
| 495 | - $this->io->write('<comment>' . $comment . '</comment>'); |
|
| 495 | + $this->io->write('<comment>'.$comment.'</comment>'); |
|
| 496 | 496 | } |
| 497 | 497 | $checked = $this->executeCommand('git -C %s apply --check -v %s %s', $install_path, $patch_level, $filename); |
| 498 | 498 | $output = $this->executor->getErrorOutput(); |
@@ -2,6 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | // autoload.php @generated by Composer |
| 4 | 4 | |
| 5 | -require_once __DIR__ . '/composer/autoload_real.php'; |
|
| 5 | +require_once __DIR__.'/composer/autoload_real.php'; |
|
| 6 | 6 | |
| 7 | 7 | return ComposerAutoloaderInite0c9a7454d54053f1869d2801bc0a201::getLoader(); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare (strict_types=1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | namespace Wordlift\Modules\Plugin_Installer_Dependencies\Psr\Container; |
| 5 | 5 | |
| 6 | 6 | /** |