1 parent
9737a7c310
commit
358542eef5
1078 files changed
+33799
-65099
No files matched your search
@@ -87,14 +87,12 @@ class WPSEO_Admin {
|
||||
}
|
||||
|
||||
if ( WPSEO_Utils::is_api_available() ) {
|
||||
$configuration = new WPSEO_Configuration_Page;
|
||||
$configuration->catch_configuration_request();
|
||||
$configuration = new WPSEO_Configuration_Page();
|
||||
|
||||
if ( filter_input( INPUT_GET, 'page' ) === self::PAGE_IDENTIFIER ) {
|
||||
$configuration->catch_configuration_request();
|
||||
}
|
||||
}
|
||||
|
||||
$this->set_upsell_notice();
|
||||
|
||||
$this->check_php_version();
|
||||
$this->initialize_cornerstone_content();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -270,10 +268,6 @@ class WPSEO_Admin {
|
||||
public function enqueue_assets() {
|
||||
$asset_manager = new WPSEO_Admin_Asset_Manager();
|
||||
$asset_manager->enqueue_style( 'help-center' );
|
||||
|
||||
if ( 'wpseo_licenses' === filter_input( INPUT_GET, 'page' ) ) {
|
||||
$asset_manager->enqueue_style( 'extensions' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -308,12 +302,8 @@ class WPSEO_Admin {
|
||||
array(
|
||||
'id' => 'basic-help',
|
||||
'title' => __( 'Template explanation', 'wordpress-seo' ),
|
||||
'content' => "\n\t\t<h2>" . __( 'Template explanation', 'wordpress-seo' ) . "</h2>\n\t\t" . '<p>' .
|
||||
sprintf(
|
||||
/* translators: %1$s expands to Yoast SEO. */
|
||||
__( 'The title & metas settings for %1$s are made up of variables that are replaced by specific values from the page when the page is displayed. The tabs on the left explain the available variables.', 'wordpress-seo' ),
|
||||
'Yoast SEO' ) .
|
||||
'</p><p>' . __( 'Note that not all variables can be used in every template.', 'wordpress-seo' ) . '</p>',
|
||||
/* translators: %1$s expands to Yoast SEO */
|
||||
'content' => '<p>' . sprintf( __( 'The title & metas settings for %1$s are made up of variables that are replaced by specific values from the page when the page is displayed. The tabs on the left explain the available variables.', 'wordpress-seo' ), 'Yoast SEO' ) . '</p>' . '<p>' . __( 'Note that not all variables can be used in every template.', 'wordpress-seo' ) . '</p>',
|
||||
)
|
||||
);
|
||||
|
||||
@@ -584,16 +574,12 @@ class WPSEO_Admin {
|
||||
* @return array
|
||||
*/
|
||||
public function filter_settings_pages( array $pages ) {
|
||||
if ( wpseo_advanced_settings_enabled( $this->options ) ) {
|
||||
|
||||
if ( $this->options['enable_setting_pages'] ) {
|
||||
return $pages;
|
||||
}
|
||||
|
||||
$pages_to_hide = WPSEO_Advanced_Settings::get_advanced_pages();
|
||||
$page = filter_input( INPUT_GET, 'page' );
|
||||
|
||||
if ( WPSEO_Advanced_Settings::is_advanced_settings_page( $page ) ) {
|
||||
$pages_to_hide = $this->temporarily_enable_page( $pages_to_hide, $page );
|
||||
}
|
||||
$pages_to_hide = array( 'wpseo_titles', 'wpseo_social', 'wpseo_xml', 'wpseo_advanced', 'wpseo_tools' );
|
||||
|
||||
foreach ( $pages as $page_key => $page ) {
|
||||
$page_name = $page[4];
|
||||
@@ -607,21 +593,49 @@ class WPSEO_Admin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a list of passed pages that will be disabled, removes the given page from the list so that it will no longer be disabled.
|
||||
* Returns the stopwords for the current language
|
||||
*
|
||||
* @param array $pages The pages to search through.
|
||||
* @param string $page The page to temporarily enable.
|
||||
* @since 1.1.7
|
||||
* @deprecated 3.1 Use WPSEO_Admin_Stop_Words::list_stop_words() instead.
|
||||
*
|
||||
* @return array The remaining pages that need to be disabled.
|
||||
* @return array $stopwords array of stop words to check and / or remove from slug
|
||||
*/
|
||||
private function temporarily_enable_page( $pages, $page ) {
|
||||
$enable_page = array_search( $page, $pages );
|
||||
function stopwords() {
|
||||
$stop_words = new WPSEO_Admin_Stop_Words();
|
||||
return $stop_words->list_stop_words();
|
||||
}
|
||||
|
||||
if ( $enable_page !== false ) {
|
||||
unset( $pages[ $enable_page ] );
|
||||
|
||||
/**
|
||||
* Check whether the stopword appears in the string
|
||||
*
|
||||
* @deprecated 3.1
|
||||
*
|
||||
* @param string $haystack The string to be checked for the stopword.
|
||||
* @param bool $checkingUrl Whether or not we're checking a URL.
|
||||
*
|
||||
* @return bool|mixed
|
||||
*/
|
||||
function stopwords_check( $haystack, $checkingUrl = false ) {
|
||||
$stopWords = $this->stopwords();
|
||||
|
||||
if ( is_array( $stopWords ) && $stopWords !== array() ) {
|
||||
foreach ( $stopWords as $stopWord ) {
|
||||
// If checking a URL remove the single quotes.
|
||||
if ( $checkingUrl ) {
|
||||
$stopWord = str_replace( "'", '', $stopWord );
|
||||
}
|
||||
|
||||
// Check whether the stopword appears as a whole word.
|
||||
// @todo [JRF => whomever] check whether the use of \b (=word boundary) would be more efficient ;-).
|
||||
$res = preg_match( "`(^|[ \n\r\t\.,'\(\)\"\+;!?:])" . preg_quote( $stopWord, '`' ) . "($|[ \n\r\t\.,'\(\)\"\+;!?:])`iu", $haystack );
|
||||
if ( $res > 0 ) {
|
||||
return $stopWord;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $pages;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -646,7 +660,6 @@ class WPSEO_Admin {
|
||||
'dismiss_about_url' => $this->get_dismiss_url( 'wpseo-dismiss-about' ),
|
||||
'dismiss_tagline_url' => $this->get_dismiss_url( 'wpseo-dismiss-tagline-notice' ),
|
||||
'help_video_iframe_title' => __( 'Yoast SEO video tutorial', 'wordpress-seo' ),
|
||||
'scrollable_table_hint' => __( 'Scroll to see the table content.', 'wordpress-seo' ),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -690,7 +703,7 @@ class WPSEO_Admin {
|
||||
$text = apply_filters( 'wpseo_premium_indicator_text', __( 'Disabled', 'wordpress-seo' ) );
|
||||
|
||||
$premium_indicator = sprintf(
|
||||
"<span class='%s' aria-hidden='true'><svg width=\"20\" height=\"20\" viewBox=\"0 0 1792 1792\" xmlns=\"http://www.w3.org/2000/svg\"><path fill=\"currentColor\" d=\"M1728 647q0 22-26 48l-363 354 86 500q1 7 1 20 0 21-10.5 35.5t-30.5 14.5q-19 0-40-12l-449-236-449 236q-22 12-40 12-21 0-31.5-14.5t-10.5-35.5q0-6 2-20l86-500-364-354q-25-27-25-48 0-37 56-46l502-73 225-455q19-41 49-41t49 41l225 455 502 73q56 9 56 46z\"/></svg></span><span class='screen-reader-text'>%s</span>",
|
||||
"<span class='%s'><svg alt=\"\" width=\"1792\" height=\"1792\" viewBox=\"0 0 1792 1792\" xmlns=\"http://www.w3.org/2000/svg\"><path fill=\"currentColor\" d=\"M1728 647q0 22-26 48l-363 354 86 500q1 7 1 20 0 21-10.5 35.5t-30.5 14.5q-19 0-40-12l-449-236-449 236q-22 12-40 12-21 0-31.5-14.5t-10.5-35.5q0-6 2-20l86-500-364-354q-25-27-25-48 0-37 56-46l502-73 225-455q19-41 49-41t49 41l225 455 502 73q56 9 56 46z\"/></svg><span class='screen-reader-text'>%s</span></span>",
|
||||
esc_attr( implode( ' ', $classes ) ),
|
||||
esc_html( $text )
|
||||
);
|
||||
@@ -698,59 +711,8 @@ class WPSEO_Admin {
|
||||
return $premium_indicator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the upsell notice.
|
||||
*/
|
||||
protected function set_upsell_notice() {
|
||||
$upsell = new WPSEO_Product_Upsell_Notice();
|
||||
$upsell->dismiss_notice_listener();
|
||||
$upsell->initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes Whip to show a notice for outdated PHP versions.
|
||||
*/
|
||||
protected function check_php_version() {
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! $this->on_dashboard_page() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
whip_wp_check_versions( array(
|
||||
'php' => '>=5.3',
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether we are on the admin dashboard page.
|
||||
*
|
||||
* @returns bool
|
||||
*/
|
||||
protected function on_dashboard_page() {
|
||||
return 'index.php' === $GLOBALS['pagenow'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the cornerstone filter
|
||||
*/
|
||||
protected function initialize_cornerstone_content() {
|
||||
if ( ! $this->options['enable_cornerstone_content'] ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$cornerstone = new WPSEO_Cornerstone();
|
||||
$cornerstone->register_hooks();
|
||||
|
||||
$cornerstone_filter = new WPSEO_Cornerstone_Filter();
|
||||
$cornerstone_filter->register_hooks();
|
||||
}
|
||||
|
||||
/********************** DEPRECATED METHODS **********************/
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
/**
|
||||
* Check whether the current user is allowed to access the configuration.
|
||||
*
|
||||
@@ -819,7 +781,7 @@ class WPSEO_Admin {
|
||||
* @deprecated 3.3
|
||||
*/
|
||||
function blog_public_warning() {
|
||||
_deprecated_function( __METHOD__, 'WPSEO 3.3.0' );
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -832,55 +794,4 @@ class WPSEO_Admin {
|
||||
function meta_description_warning() {
|
||||
_deprecated_function( __FUNCTION__, 'WPSEO 3.3.0' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the stopwords for the current language
|
||||
*
|
||||
* @since 1.1.7
|
||||
* @deprecated 3.1 Use WPSEO_Admin_Stop_Words::list_stop_words() instead.
|
||||
*
|
||||
* @return array $stopwords array of stop words to check and / or remove from slug
|
||||
*/
|
||||
function stopwords() {
|
||||
_deprecated_function( __METHOD__, 'WPSEO 3.1', 'WPSEO_Admin_Stop_Words::list_stop_words' );
|
||||
|
||||
$stop_words = new WPSEO_Admin_Stop_Words();
|
||||
return $stop_words->list_stop_words();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the stopword appears in the string
|
||||
*
|
||||
* @deprecated 3.1
|
||||
*
|
||||
* @param string $haystack The string to be checked for the stopword.
|
||||
* @param bool $checking_url Whether or not we're checking a URL.
|
||||
*
|
||||
* @return bool|mixed
|
||||
*/
|
||||
function stopwords_check( $haystack, $checking_url = false ) {
|
||||
_deprecated_function( __METHOD__, 'WPSEO 3.1' );
|
||||
|
||||
$stop_words = $this->stopwords();
|
||||
|
||||
if ( is_array( $stop_words ) && $stop_words !== array() ) {
|
||||
foreach ( $stop_words as $stop_word ) {
|
||||
// If checking a URL remove the single quotes.
|
||||
if ( $checking_url ) {
|
||||
$stop_word = str_replace( "'", '', $stop_word );
|
||||
}
|
||||
|
||||
// Check whether the stopword appears as a whole word.
|
||||
// @todo [JRF => whomever] check whether the use of \b (=word boundary) would be more efficient ;-).
|
||||
$res = preg_match( "`(^|[ \n\r\t\.,'\(\)\"\+;!?:])" . preg_quote( $stop_word, '`' ) . "($|[ \n\r\t\.,'\(\)\"\+;!?:])`iu", $haystack );
|
||||
if ( $res > 0 ) {
|
||||
return $stop_word;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
Reference in new issue
Block a user