@@ -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,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 |
@@ -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 |
@@ -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 |
@@ -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 | } |
@@ -15,43 +15,43 @@ |
||
| 15 | 15 | use Wordlift\Modules\Plugin_Installer_Dependencies\Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
| 16 | 16 | |
| 17 | 17 | if ( ! defined( 'ABSPATH' ) ) { |
| 18 | - exit; |
|
| 18 | + exit; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | define( 'WL_PLUGIN_INSTALLER_DIR_PATH', dirname( __FILE__ ) ); |
| 22 | 22 | |
| 23 | 23 | function __wl_plugin_installer_load() { |
| 24 | 24 | |
| 25 | - // Autoloader for dependencies. |
|
| 26 | - if ( file_exists( WL_PLUGIN_INSTALLER_DIR_PATH . '/third-party/vendor/scoper-autoload.php' ) ) { |
|
| 27 | - require WL_PLUGIN_INSTALLER_DIR_PATH . '/third-party/vendor/scoper-autoload.php'; |
|
| 28 | - } |
|
| 25 | + // Autoloader for dependencies. |
|
| 26 | + if ( file_exists( WL_PLUGIN_INSTALLER_DIR_PATH . '/third-party/vendor/scoper-autoload.php' ) ) { |
|
| 27 | + require WL_PLUGIN_INSTALLER_DIR_PATH . '/third-party/vendor/scoper-autoload.php'; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - // Autoloader for plugin itself. |
|
| 31 | - if ( file_exists( WL_PLUGIN_INSTALLER_DIR_PATH . '/includes/vendor/autoload.php' ) ) { |
|
| 32 | - require WL_PLUGIN_INSTALLER_DIR_PATH . '/includes/vendor/autoload.php'; |
|
| 33 | - } |
|
| 30 | + // Autoloader for plugin itself. |
|
| 31 | + if ( file_exists( WL_PLUGIN_INSTALLER_DIR_PATH . '/includes/vendor/autoload.php' ) ) { |
|
| 32 | + require WL_PLUGIN_INSTALLER_DIR_PATH . '/includes/vendor/autoload.php'; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - if ( ! file_exists(ABSPATH . 'wp-admin/includes/plugin-install.php') || |
|
| 36 | - ! file_exists( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ) ) { |
|
| 37 | - return; |
|
| 38 | - } |
|
| 35 | + if ( ! file_exists(ABSPATH . 'wp-admin/includes/plugin-install.php') || |
|
| 36 | + ! file_exists( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ) ) { |
|
| 37 | + return; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
| 41 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
| 40 | + require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
| 41 | + require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
| 42 | 42 | |
| 43 | - $container_builder = new ContainerBuilder(); |
|
| 44 | - $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
| 45 | - $loader->load( 'services.yml' ); |
|
| 43 | + $container_builder = new ContainerBuilder(); |
|
| 44 | + $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
| 45 | + $loader->load( 'services.yml' ); |
|
| 46 | 46 | |
| 47 | - $container_builder->compile(); |
|
| 47 | + $container_builder->compile(); |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var $module Module |
|
| 52 | - */ |
|
| 53 | - $module = $container_builder->get( Module::class ); |
|
| 54 | - $module->register_hooks(); |
|
| 50 | + /** |
|
| 51 | + * @var $module Module |
|
| 52 | + */ |
|
| 53 | + $module = $container_builder->get( Module::class ); |
|
| 54 | + $module->register_hooks(); |
|
| 55 | 55 | |
| 56 | 56 | } |
| 57 | 57 | |
@@ -16,90 +16,90 @@ |
||
| 16 | 16 | $wp_constants = json_decode( file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-constants.json' ), true ); |
| 17 | 17 | |
| 18 | 18 | return [ |
| 19 | - // The prefix configuration. If a non null value is be used, a random prefix |
|
| 20 | - // will be generated instead. |
|
| 21 | - // |
|
| 22 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#prefix |
|
| 23 | - 'prefix' => 'Wordlift\Modules\Plugin_Installer_Dependencies', |
|
| 19 | + // The prefix configuration. If a non null value is be used, a random prefix |
|
| 20 | + // will be generated instead. |
|
| 21 | + // |
|
| 22 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#prefix |
|
| 23 | + 'prefix' => 'Wordlift\Modules\Plugin_Installer_Dependencies', |
|
| 24 | 24 | |
| 25 | - // By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working |
|
| 26 | - // directory. You can however define which files should be scoped by defining a collection of Finders in the |
|
| 27 | - // following configuration key. |
|
| 28 | - // |
|
| 29 | - // This configuration entry is completely ignored when using Box. |
|
| 30 | - // |
|
| 31 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#finders-and-paths |
|
| 32 | - 'finders' => [ |
|
| 33 | - Finder::create() |
|
| 34 | - ->files() |
|
| 35 | - ->ignoreVCS( true ) |
|
| 36 | - ->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' ) |
|
| 37 | - ->exclude( [ |
|
| 38 | - 'doc', |
|
| 39 | - 'test', |
|
| 40 | - 'test_old', |
|
| 41 | - 'tests', |
|
| 42 | - 'Tests', |
|
| 43 | - 'vendor-bin', |
|
| 44 | - ] ) |
|
| 45 | - ->in( [ |
|
| 46 | - 'vendor/cweagans/composer-patches', |
|
| 47 | - 'vendor/mcaskill/composer-exclude-files', |
|
| 48 | - 'vendor/psr/container', |
|
| 49 | - 'vendor/symfony/config', |
|
| 50 | - 'vendor/symfony/dependency-injection', |
|
| 51 | - 'vendor/symfony/filesystem', |
|
| 52 | - 'vendor/symfony/polyfill-ctype', |
|
| 53 | - 'vendor/symfony/polyfill-php73', |
|
| 54 | - 'vendor/symfony/polyfill-php80', |
|
| 55 | - 'vendor/symfony/yaml', |
|
| 56 | - ] ), |
|
| 25 | + // By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working |
|
| 26 | + // directory. You can however define which files should be scoped by defining a collection of Finders in the |
|
| 27 | + // following configuration key. |
|
| 28 | + // |
|
| 29 | + // This configuration entry is completely ignored when using Box. |
|
| 30 | + // |
|
| 31 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#finders-and-paths |
|
| 32 | + 'finders' => [ |
|
| 33 | + Finder::create() |
|
| 34 | + ->files() |
|
| 35 | + ->ignoreVCS( true ) |
|
| 36 | + ->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' ) |
|
| 37 | + ->exclude( [ |
|
| 38 | + 'doc', |
|
| 39 | + 'test', |
|
| 40 | + 'test_old', |
|
| 41 | + 'tests', |
|
| 42 | + 'Tests', |
|
| 43 | + 'vendor-bin', |
|
| 44 | + ] ) |
|
| 45 | + ->in( [ |
|
| 46 | + 'vendor/cweagans/composer-patches', |
|
| 47 | + 'vendor/mcaskill/composer-exclude-files', |
|
| 48 | + 'vendor/psr/container', |
|
| 49 | + 'vendor/symfony/config', |
|
| 50 | + 'vendor/symfony/dependency-injection', |
|
| 51 | + 'vendor/symfony/filesystem', |
|
| 52 | + 'vendor/symfony/polyfill-ctype', |
|
| 53 | + 'vendor/symfony/polyfill-php73', |
|
| 54 | + 'vendor/symfony/polyfill-php80', |
|
| 55 | + 'vendor/symfony/yaml', |
|
| 56 | + ] ), |
|
| 57 | 57 | |
| 58 | - // Symfony mbstring polyfill. |
|
| 59 | - Finder::create() |
|
| 60 | - ->files() |
|
| 61 | - ->ignoreVCS( true ) |
|
| 62 | - ->ignoreDotFiles( true ) |
|
| 63 | - ->name( '/\.*.php8?/' ) |
|
| 64 | - ->in( 'vendor/symfony/polyfill-mbstring/Resources' ) |
|
| 65 | - ->append( [ |
|
| 66 | - 'vendor/symfony/polyfill-mbstring/Mbstring.php', |
|
| 67 | - 'vendor/symfony/polyfill-mbstring/composer.json', |
|
| 68 | - ] ), |
|
| 58 | + // Symfony mbstring polyfill. |
|
| 59 | + Finder::create() |
|
| 60 | + ->files() |
|
| 61 | + ->ignoreVCS( true ) |
|
| 62 | + ->ignoreDotFiles( true ) |
|
| 63 | + ->name( '/\.*.php8?/' ) |
|
| 64 | + ->in( 'vendor/symfony/polyfill-mbstring/Resources' ) |
|
| 65 | + ->append( [ |
|
| 66 | + 'vendor/symfony/polyfill-mbstring/Mbstring.php', |
|
| 67 | + 'vendor/symfony/polyfill-mbstring/composer.json', |
|
| 68 | + ] ), |
|
| 69 | 69 | |
| 70 | - Finder::create()->append( [ |
|
| 71 | - 'composer.json', |
|
| 72 | - ] ), |
|
| 73 | - ], |
|
| 70 | + Finder::create()->append( [ |
|
| 71 | + 'composer.json', |
|
| 72 | + ] ), |
|
| 73 | + ], |
|
| 74 | 74 | |
| 75 | - // List of excluded files, i.e. files for which the content will be left untouched. |
|
| 76 | - // Paths are relative to the configuration file unless if they are already absolute |
|
| 77 | - // |
|
| 78 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
| 79 | - 'exclude-files' => [ |
|
| 80 | - ], |
|
| 75 | + // List of excluded files, i.e. files for which the content will be left untouched. |
|
| 76 | + // Paths are relative to the configuration file unless if they are already absolute |
|
| 77 | + // |
|
| 78 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
| 79 | + 'exclude-files' => [ |
|
| 80 | + ], |
|
| 81 | 81 | |
| 82 | - // When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the |
|
| 83 | - // original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited |
|
| 84 | - // support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your |
|
| 85 | - // heart contents. |
|
| 86 | - // |
|
| 87 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
| 88 | - 'patchers' => [], |
|
| 82 | + // When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the |
|
| 83 | + // original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited |
|
| 84 | + // support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your |
|
| 85 | + // heart contents. |
|
| 86 | + // |
|
| 87 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
| 88 | + 'patchers' => [], |
|
| 89 | 89 | |
| 90 | - // List of symbols to consider internal i.e. to leave untouched. |
|
| 91 | - // |
|
| 92 | - // For more information see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#excluded-symbols |
|
| 93 | - 'exclude-namespaces' => [ |
|
| 94 | - // 'Acme\Foo' // The Acme\Foo namespace (and sub-namespaces) |
|
| 95 | - // '~^PHPUnit\\\\Framework$~', // The whole namespace PHPUnit\Framework (but not sub-namespaces) |
|
| 96 | - // '~^$~', // The root namespace only |
|
| 97 | - // '', // Any namespace |
|
| 98 | - ], |
|
| 99 | - 'exclude-classes' => $wp_classes, |
|
| 90 | + // List of symbols to consider internal i.e. to leave untouched. |
|
| 91 | + // |
|
| 92 | + // For more information see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#excluded-symbols |
|
| 93 | + 'exclude-namespaces' => [ |
|
| 94 | + // 'Acme\Foo' // The Acme\Foo namespace (and sub-namespaces) |
|
| 95 | + // '~^PHPUnit\\\\Framework$~', // The whole namespace PHPUnit\Framework (but not sub-namespaces) |
|
| 96 | + // '~^$~', // The root namespace only |
|
| 97 | + // '', // Any namespace |
|
| 98 | + ], |
|
| 99 | + 'exclude-classes' => $wp_classes, |
|
| 100 | 100 | |
| 101 | - 'exclude-functions' => $wp_functions, |
|
| 101 | + 'exclude-functions' => $wp_functions, |
|
| 102 | 102 | |
| 103 | - 'exclude-constants' => $wp_constants, |
|
| 103 | + 'exclude-constants' => $wp_constants, |
|
| 104 | 104 | |
| 105 | 105 | ]; |