| @@ -29,15 +29,12 @@ | ||
| 29 | 29 | public function __construct() { |
| 30 | 30 | require_once PLL_INC . '/functions.php'; // VIP functions |
| 31 | 31 | spl_autoload_register( array( $this, 'autoload' ) ); // Autoload classes |
| 32 | 32 | |
| 33 | - // register an action when plugin is activating. | |
| 34 | - register_activation_hook( POLYLANG_BASENAME, array( 'PLL_Wizard', 'start_wizard' ) ); | |
| 35 | - | |
| 36 | 33 | $install = new PLL_Install( POLYLANG_BASENAME ); |
| 37 | 34 | |
| 38 | 35 | // Stopping here if we are going to deactivate the plugin ( avoids breaking rewrite rules ) |
| 39 | - if ( $install->is_deactivation() || ! $install->can_activate() ) { | |
| 36 | + if ( $install->is_deactivation() ) { | |
| 40 | 37 | return; |
| 41 | 38 | } |
| 42 | 39 | |
| 43 | 40 | // Plugin initialization |
| @@ -100,9 +97,9 @@ | ||
| 100 | 97 | ); |
| 101 | 98 | |
| 102 | 99 | foreach ( $dirs as $dir ) { |
| 103 | 100 | if ( file_exists( $file = "$dir/$class.php" ) ) { |
| 104 | - require_once $file; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable | |
| 101 | + require_once $file; | |
| 105 | 102 | return; |
| 106 | 103 | } |
| 107 | 104 | } |
| 108 | 105 | } |
| @@ -139,9 +136,8 @@ | ||
| 139 | 136 | * |
| 140 | 137 | * @return bool |
| 141 | 138 | */ |
| 142 | 139 | public static function is_rest_request() { |
| 143 | - // Handle pretty permalinks. | |
| 144 | 140 | $home_path = trim( wp_parse_url( home_url(), PHP_URL_PATH ), '/' ); |
| 145 | 141 | $home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) ); |
| 146 | 142 | |
| 147 | 143 | $req_uri = trim( wp_parse_url( pll_get_requested_url(), PHP_URL_PATH ), '/' ); |
| @@ -149,28 +145,12 @@ | ||
| 149 | 145 | $req_uri = trim( $req_uri, '/' ); |
| 150 | 146 | $req_uri = str_replace( 'index.php', '', $req_uri ); |
| 151 | 147 | $req_uri = trim( $req_uri, '/' ); |
| 152 | 148 | |
| 153 | - // And also test rest_route query string parameter is not empty for plain permalinks. | |
| 154 | - $query_string = array(); | |
| 155 | - wp_parse_str( wp_parse_url( pll_get_requested_url(), PHP_URL_QUERY ), $query_string ); | |
| 156 | - $rest_route = isset( $query_string['rest_route'] ) ? trim( $query_string['rest_route'], '/' ) : false; | |
| 157 | - | |
| 158 | - return 0 === strpos( $req_uri, rest_get_url_prefix() . '/' ) || ! empty( $rest_route ); | |
| 149 | + return 0 === strpos( $req_uri, rest_get_url_prefix() . '/' ); | |
| 159 | 150 | } |
| 160 | 151 | |
| 161 | 152 | /** |
| 162 | - * Tells if we are in the wizard process. | |
| 163 | - * | |
| 164 | - * @since 2.7 | |
| 165 | - * | |
| 166 | - * @return bool | |
| 167 | - */ | |
| 168 | - public static function is_wizard() { | |
| 169 | - return isset( $_GET['page'] ) && ! empty( $_GET['page'] ) && 'mlang_wizard' === sanitize_key( $_GET['page'] ); // phpcs:ignore WordPress.Security.NonceVerification | |
| 170 | - } | |
| 171 | - | |
| 172 | - /** | |
| 173 | 153 | * Defines constants |
| 174 | 154 | * May be overridden by a plugin if set before plugins_loaded, 1 |
| 175 | 155 | * |
| 176 | 156 | * @since 1.6 |
| @@ -190,11 +170,11 @@ | ||
| 190 | 170 | if ( ! defined( 'PLL_ADMIN' ) ) { |
| 191 | 171 | define( 'PLL_ADMIN', wp_doing_cron() || ( defined( 'WP_CLI' ) && WP_CLI ) || ( is_admin() && ! PLL_AJAX_ON_FRONT ) ); |
| 192 | 172 | } |
| 193 | 173 | |
| 194 | - // Settings page whatever the tab except for the wizard which needs to be an admin process. | |
| 174 | + // Settings page whatever the tab | |
| 195 | 175 | if ( ! defined( 'PLL_SETTINGS' ) ) { |
| 196 | - define( 'PLL_SETTINGS', is_admin() && ( ( isset( $_GET['page'] ) && 0 === strpos( sanitize_key( $_GET['page'] ), 'mlang' ) && ! self::is_wizard() ) || ! empty( $_REQUEST['pll_ajax_settings'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification | |
| 176 | + define( 'PLL_SETTINGS', is_admin() && ( ( isset( $_GET['page'] ) && 0 === strpos( sanitize_key( $_GET['page'] ), 'mlang' ) ) || ! empty( $_REQUEST['pll_ajax_settings'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification | |
| 197 | 177 | } |
| 198 | 178 | } |
| 199 | 179 | |
| 200 | 180 | /** |
| @@ -216,13 +196,8 @@ | ||
| 216 | 196 | return; |
| 217 | 197 | } |
| 218 | 198 | } |
| 219 | 199 | |
| 220 | - // In some edge cases, it's possible that no options were found in the database. Load default options as we need some. | |
| 221 | - if ( ! $options ) { | |
| 222 | - $options = PLL_Install::get_default_options(); | |
| 223 | - } | |
| 224 | - | |
| 225 | 200 | // Make sure that this filter is *always* added before PLL_Model::get_languages_list() is called for the first time |
| 226 | 201 | add_filter( 'pll_languages_list', array( 'PLL_Static_Pages', 'pll_languages_list' ), 2, 2 ); // Before PLL_Links_Model |
| 227 | 202 | |
| 228 | 203 | /** |
| @@ -232,9 +207,9 @@ | ||
| 232 | 207 | * @since 1.5 |
| 233 | 208 | * |
| 234 | 209 | * @param string $class either PLL_Model or PLL_Admin_Model |
| 235 | 210 | */ |
| 236 | - $class = apply_filters( 'pll_model', PLL_SETTINGS || self::is_wizard() ? 'PLL_Admin_Model' : 'PLL_Model' ); | |
| 211 | + $class = apply_filters( 'pll_model', PLL_SETTINGS ? 'PLL_Admin_Model' : 'PLL_Model' ); | |
| 237 | 212 | $model = new $class( $options ); |
| 238 | 213 | $links_model = $model->get_links_model(); |
| 239 | 214 | |
| 240 | 215 | if ( ! $model->get_languages_list() ) { |