diff --git a/admin/class-admin.php b/admin/class-admin.php index 6c148bb3ad9..5da54b184fb 100644 --- a/admin/class-admin.php +++ b/admin/class-admin.php @@ -407,11 +407,11 @@ function add_action_link( $links, $file ) { } } - // add link to premium support landing page. + // Add link to premium support landing page. $premium_link = '' . __( 'Premium Support', 'wordpress-seo' ) . ''; array_unshift( $links, $premium_link ); - // add link to docs. + // Add link to docs. $faq_link = '' . __( 'FAQ', 'wordpress-seo' ) . ''; array_unshift( $links, $faq_link ); diff --git a/admin/class-bulk-editor-list-table.php b/admin/class-bulk-editor-list-table.php index c763c8e4e59..a864aafb7fc 100644 --- a/admin/class-bulk-editor-list-table.php +++ b/admin/class-bulk-editor-list-table.php @@ -416,7 +416,7 @@ function prepare_page_navigation() { // If current type doesn't compare with objects page_type, than we have to unset some vars in the requested url (which will be use for internal table urls). if ( $_GET['type'] != $this->page_type ) { - $request_url = remove_query_arg( 'paged', $request_url ); // page will be set with value 1 below. + $request_url = remove_query_arg( 'paged', $request_url ); // Page will be set with value 1 below. $request_url = remove_query_arg( 'post_type_filter', $request_url ); $request_url = remove_query_arg( 'post_status', $request_url ); $request_url = remove_query_arg( 'orderby', $request_url ); diff --git a/admin/class-import-external.php b/admin/class-import-external.php index bffe4e08036..cf5638b577a 100644 --- a/admin/class-import-external.php +++ b/admin/class-import-external.php @@ -119,7 +119,7 @@ public function import_robots_meta() { } if ( is_array( $posts ) && $posts !== array() ) { foreach ( $posts as $post ) { - // sync all possible settings. + // Sync all possible settings. if ( $post->robotsmeta ) { $pieces = explode( ',', $post->robotsmeta ); foreach ( $pieces as $meta ) { diff --git a/admin/class-import.php b/admin/class-import.php index 940f0544b66..0cf99b44436 100644 --- a/admin/class-import.php +++ b/admin/class-import.php @@ -69,7 +69,7 @@ public function __construct() { * @return boolean */ private function handle_upload() { - $overrides = array( 'mimes' => array( 'zip' => 'application/zip' ) ); // explicitly allow zip in multisite. + $overrides = array( 'mimes' => array( 'zip' => 'application/zip' ) ); // Explicitly allow zip in multisite. $this->file = wp_handle_upload( $_FILES['settings_import_file'], $overrides ); if ( is_wp_error( $this->file ) ) { diff --git a/admin/class-metabox.php b/admin/class-metabox.php index c57766f0ee3..a99d664bfb6 100644 --- a/admin/class-metabox.php +++ b/admin/class-metabox.php @@ -844,7 +844,7 @@ function save_postdata( $post_id ) { $post = get_post( $post_id ); if ( ! is_object( $post ) ) { - // non-existent post. + // Non-existent post. return false; } @@ -899,7 +899,7 @@ public function enqueue() { } else { if ( 0 != get_queried_object_id() ) { - wp_enqueue_media( array( 'post' => get_queried_object_id() ) ); // enqueue files needed for upload functionality. + wp_enqueue_media( array( 'post' => get_queried_object_id() ) ); // Enqueue files needed for upload functionality. } wp_enqueue_style( 'metabox-tabs', plugins_url( 'css/metabox-tabs' . WPSEO_CSSJS_SUFFIX . '.css', WPSEO_FILE ), array(), WPSEO_VERSION ); wp_enqueue_style( "metabox-$color", plugins_url( 'css/metabox-' . esc_attr( $color ) . WPSEO_CSSJS_SUFFIX . '.css', WPSEO_FILE ), array(), WPSEO_VERSION ); @@ -1302,7 +1302,7 @@ function linkdex_output( $post ) { $output = ''; $perc_score = absint( $results['total'] ); - unset( $results['total'] ); // unset to prevent echoing it. + unset( $results['total'] ); // Unset to prevent echoing it. foreach ( $results as $result ) { if ( is_array( $result ) ) { @@ -1552,18 +1552,18 @@ function strip_separators_and_fold( $inputString, $removeOptionalCharacters = fa $keywordCharactersRemovedOrReplaced = array( '_', '-' ); $keywordWordsRemoved = array( ' a ', ' in ', ' an ', ' on ', ' for ', ' the ', ' and ' ); - // lower. + // Lower. $inputString = $this->strtolower_utf8( $inputString ); - // default characters replaced by space. + // Default characters replaced by space. $inputString = str_replace( $keywordCharactersAlwaysReplacedBySpace, ' ', $inputString ); - // standardise whitespace. + // Standardise whitespace. $inputString = WPSEO_Utils::standardize_whitespace( $inputString ); - // deal with the separators that can be either removed or replaced by space. + // Deal with the separators that can be either removed or replaced by space. if ( $removeOptionalCharacters ) { - // remove word separators with a space. + // Remove word separators with a space. $inputString = str_replace( $keywordWordsRemoved, ' ', $inputString ); $inputString = str_replace( $keywordCharactersRemovedOrReplaced, '', $inputString ); @@ -1572,7 +1572,7 @@ function strip_separators_and_fold( $inputString, $removeOptionalCharacters = fa $inputString = str_replace( $keywordCharactersRemovedOrReplaced, ' ', $inputString ); } - // standardise whitespace again. + // Standardise whitespace again. $inputString = WPSEO_Utils::standardize_whitespace( $inputString ); return trim( $inputString ); @@ -2119,7 +2119,7 @@ function score_body( $job, &$results, $body, $firstp ) { $firstp = $this->strtolower_utf8( $firstp ); // First Paragraph Test. - // check without /u modifier as well as /u might break with non UTF-8 chars. + // Check without /u modifier as well as /u might break with non UTF-8 chars. if ( preg_match( '`\b' . preg_quote( $job['keyword'], '`' ) . '\b`miu', $firstp ) || preg_match( '`\b' . preg_quote( $job['keyword'], '`' ) . '\b`mi', $firstp ) || preg_match( '`\b' . preg_quote( $job['keyword_folded'], '`' ) . '\b`miu', $firstp ) ) { $this->save_score_result( $results, 9, $scoreFirstParagraphHigh, 'keyword_first_paragraph' ); diff --git a/admin/class-pointers.php b/admin/class-pointers.php index cbbfdf7d123..f1d58e58829 100644 --- a/admin/class-pointers.php +++ b/admin/class-pointers.php @@ -83,7 +83,7 @@ public function intro_tour() { * @param array $options The options for the pointer. */ public function print_scripts( $selector, $options ) { - // button1 is the close button, which always exists. + // Button1 is the close button, which always exists. $button_array_defaults = array( 'button2' => array( 'text' => false, diff --git a/admin/class-yoast-textstatistics.php b/admin/class-yoast-textstatistics.php index 300651d0716..8f77cfaec61 100644 --- a/admin/class-yoast-textstatistics.php +++ b/admin/class-yoast-textstatistics.php @@ -132,7 +132,7 @@ protected function clean_text( $strText ) { return $clean[ $key ]; } - // all these tags should be preceeded by a full stop. + // All these tags should be preceeded by a full stop. $fullStopTags = array( 'li', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'dd' ); foreach ( $fullStopTags as $tag ) { $strText = str_ireplace( '', '.', $strText ); diff --git a/admin/pages/dashboard.php b/admin/pages/dashboard.php index 0e9e248b34c..9cec63546ab 100644 --- a/admin/pages/dashboard.php +++ b/admin/pages/dashboard.php @@ -31,11 +31,11 @@ if ( isset( $_GET['fixmetadesc'] ) && check_admin_referer( 'wpseo-fix-metadesc', 'nonce' ) && $options['theme_description_found'] !== '' ) { $path = false; if ( file_exists( get_stylesheet_directory() . '/header.php' ) ) { - // theme or child theme. + // Theme or child theme. $path = get_stylesheet_directory(); } elseif ( file_exists( get_template_directory() . '/header.php' ) ) { - // parent theme in case of a child theme. + // Parent theme in case of a child theme. $path = get_template_directory(); } diff --git a/admin/views/tool-file-editor.php b/admin/views/tool-file-editor.php index c2de5b3e341..48cb3a9161f 100644 --- a/admin/views/tool-file-editor.php +++ b/admin/views/tool-file-editor.php @@ -67,7 +67,7 @@ echo '

', esc_html( $msg ), '

'; } -$action_url = network_admin_url( 'admin.php?page=wpseo_tools&tool=file-editor' ); // auto-falls back on admin_url for non-multisite. +$action_url = network_admin_url( 'admin.php?page=wpseo_tools&tool=file-editor' ); // Auto-falls back on admin_url for non-multisite. echo '

', __( 'Robots.txt', 'wordpress-seo' ), '

'; diff --git a/frontend/class-breadcrumbs.php b/frontend/class-breadcrumbs.php index 26d3e132c3c..996639db0bb 100644 --- a/frontend/class-breadcrumbs.php +++ b/frontend/class-breadcrumbs.php @@ -219,7 +219,7 @@ private function find_deepest_term( $terms ) { /* As we could still have two subcategories, from different parent categories, let's pick the one with the lowest ordered ancestor. */ $parents_count = 0; - $term_order = 9999; // because ASC. + $term_order = 9999; // Because ASC. reset( $terms_by_id ); $deepest_term = current( $terms_by_id ); foreach ( $terms_by_id as $term ) { @@ -228,13 +228,13 @@ private function find_deepest_term( $terms ) { if ( count( $parents ) >= $parents_count ) { $parents_count = count( $parents ); - // if higher count. + // If higher count. if ( count( $parents ) > $parents_count ) { - // reset order. + // Reset order. $term_order = 9999; } - $parent_order = 9999; // set default order. + $parent_order = 9999; // Set default order. foreach ( $parents as $parent ) { if ( $parent->parent == 0 && isset( $parent->term_order ) ) { $parent_order = $parent->term_order; @@ -242,7 +242,7 @@ private function find_deepest_term( $terms ) { } unset( $parent ); - // check if parent has lowest order. + // Check if parent has lowest order. if ( $parent_order < $term_order ) { $term_order = $parent_order; $deepest_term = $term; @@ -302,7 +302,7 @@ private function set_crumbs() { $this->maybe_add_blog_crumb(); if ( ( $this->show_on_front === 'page' && is_front_page() ) || ( $this->show_on_front === 'posts' && is_home() ) ) { - // do nothing. + // Do nothing. } elseif ( $this->show_on_front == 'page' && is_home() ) { $this->add_blog_crumb(); diff --git a/frontend/class-frontend.php b/frontend/class-frontend.php index 0034dd07c57..f373abbe94a 100644 --- a/frontend/class-frontend.php +++ b/frontend/class-frontend.php @@ -560,8 +560,9 @@ private function generate_title( $title, $separator_location ) { $modified_title = false; // If you would like to generate a default title instead, - // the following code could be used instead of the line above: + // the following code could be used // $title_part = $title; + // instead of the line above. } if ( ( $modified_title && empty( $title ) ) || ! empty( $title_part ) ) { @@ -776,7 +777,7 @@ public function robots() { $robotsstr = $robots['index'] . ',' . $robots['follow']; if ( $robots['other'] !== array() ) { - $robots['other'] = array_unique( $robots['other'] ); // most likely no longer needed, needs testing. + $robots['other'] = array_unique( $robots['other'] ); // TODO Most likely no longer needed, needs testing. $robotsstr .= ',' . implode( ',', $robots['other'] ); } @@ -1201,14 +1202,14 @@ public function metakeywords() { } } - $keywords = apply_filters( 'wpseo_metakey', trim( $keywords ) ); // make deprecated. + $keywords = apply_filters( 'wpseo_metakey', trim( $keywords ) ); // TODO Make deprecated. /** * Filter: 'wpseo_metakeywords' - Allow changing the WP SEO meta keywords * * @api string $keywords The meta keywords to be echoed. */ - $keywords = apply_filters( 'wpseo_metakeywords', trim( $keywords ) ); // more appropriately named. + $keywords = apply_filters( 'wpseo_metakeywords', trim( $keywords ) ); // More appropriately named. if ( is_string( $keywords ) && $keywords !== '' ) { echo '', "\n"; diff --git a/frontend/class-json-ld.php b/frontend/class-json-ld.php index 2c691bd48ba..e005f75db01 100644 --- a/frontend/class-json-ld.php +++ b/frontend/class-json-ld.php @@ -110,7 +110,7 @@ private function output( $context ) { $this->data = apply_filters( 'wpseo_json_ld_output', $this->data, $context ); if ( function_exists( 'wp_json_encode' ) ) { - $json_data = wp_json_encode( $this->data ); // wp_json_encode was introduced in WP 4.1. + $json_data = wp_json_encode( $this->data ); // Function wp_json_encode() was introduced in WP 4.1. } else { $json_data = json_encode( $this->data ); diff --git a/frontend/class-opengraph.php b/frontend/class-opengraph.php index b86145f2355..c4d0185714d 100644 --- a/frontend/class-opengraph.php +++ b/frontend/class-opengraph.php @@ -294,7 +294,7 @@ public function locale( $echo = true ) { */ $locale = apply_filters( 'wpseo_locale', get_locale() ); - // catch some weird locales served out by WP that are not easily doubled up. + // Catch some weird locales served out by WP that are not easily doubled up. $fix_locales = array( 'ca' => 'ca_ES', 'en' => 'en_US', @@ -311,7 +311,7 @@ public function locale( $echo = true ) { $locale = $fix_locales[ $locale ]; } - // convert locales like "es" to "es_ES", in case that works for the given locale (sometimes it does). + // Convert locales like "es" to "es_ES", in case that works for the given locale (sometimes it does). if ( strlen( $locale ) == 2 ) { $locale = strtolower( $locale ) . '_' . strtoupper( $locale ); } @@ -410,7 +410,7 @@ public function locale( $echo = true ) { 'zh_TW', // Traditional Chinese (Taiwan). ); - // check to see if the locale is a valid FB one, if not, use en_US as a fallback. + // Check to see if the locale is a valid FB one, if not, use en_US as a fallback. if ( ! in_array( $locale, $fb_valid_fb_locales ) ) { $locale = strtolower( substr( $locale, 0, 2 ) ) . '_' . strtoupper( substr( $locale, 0, 2 ) ); if ( ! in_array( $locale, $fb_valid_fb_locales ) ) { @@ -529,7 +529,7 @@ public function description( $echo = true ) { $ogdesc = $frontend->metadesc( false ); } - // og:description is still blank so grab it from get_the_excerpt(). + // Tag og:description is still blank so grab it from get_the_excerpt(). if ( ! is_string( $ogdesc ) || ( is_string( $ogdesc ) && $ogdesc === '' ) ) { $ogdesc = str_replace( '[…]', '…', strip_tags( get_the_excerpt() ) ); } @@ -861,7 +861,7 @@ private function get_relative_path( $img ) { return false; } - // If it's a relative URL, it's relative to the domain, not necessarily to the WordPress install, we. + // If it's a relative URL, it's relative to the domain, not necessarily to the WordPress install, we // want to preserve domain name and URL scheme (http / https) though. $parsed_url = parse_url( home_url() ); $img = $parsed_url['scheme'] . '://' . $parsed_url['host'] . $img; diff --git a/inc/class-rewrite.php b/inc/class-rewrite.php index 628eaa6cf77..df3b61f4d54 100644 --- a/inc/class-rewrite.php +++ b/inc/class-rewrite.php @@ -132,7 +132,7 @@ function category_rewrite_rules() { foreach ( $categories as $category ) { $category_nicename = $category->slug; if ( $category->parent == $category->cat_ID ) { - // recursive recursion. + // Recursive recursion. $category->parent = 0; } elseif ( $taxonomy->rewrite['hierarchical'] != 0 && $category->parent != 0 ) { diff --git a/inc/class-sitemaps.php b/inc/class-sitemaps.php index 4b0284dd088..ab29aa3620d 100644 --- a/inc/class-sitemaps.php +++ b/inc/class-sitemaps.php @@ -102,7 +102,7 @@ function __construct() { add_filter( 'redirect_canonical', array( $this, 'canonical' ) ); add_action( 'wpseo_hit_sitemap_index', array( $this, 'hit_sitemap_index' ) ); - // default stylesheet. + // Default stylesheet. $this->stylesheet = ''; $this->options = WPSEO_Options::get_all(); @@ -138,7 +138,7 @@ public function reduce_query_load() { */ function invalidate_main_query( $where ) { - // check if $wp_query is properly set which isn't always the case in older WP development versions. + // Check if $wp_query is properly set which isn't always the case in older WP development versions. if ( ! is_object( $GLOBALS['wp_query'] ) ) { return $where; } @@ -169,23 +169,23 @@ private function http_protocol() { */ private function determine_timezone_string() { - // if site timezone string exists, return it. + // If site timezone string exists, return it. if ( $timezone = get_option( 'timezone_string' ) ) { return $timezone; } - // get UTC offset, if it isn't set then return UTC. + // Get UTC offset, if it isn't set then return UTC. if ( 0 === ( $utc_offset = get_option( 'gmt_offset', 0 ) ) ) { return 'UTC'; } - // adjust UTC offset from hours to seconds. + // Adjust UTC offset from hours to seconds. $utc_offset *= HOUR_IN_SECONDS; - // attempt to guess the timezone string from the UTC offset. + // Attempt to guess the timezone string from the UTC offset. $timezone = timezone_name_from_abbr( '', $utc_offset ); - // last try, guess timezone string manually. + // Last try, guess timezone string manually. if ( false === $timezone ) { $is_dst = date( 'I' ); @@ -199,7 +199,7 @@ private function determine_timezone_string() { } } - // fallback to UTC. + // Fallback to UTC. return 'UTC'; } @@ -394,7 +394,7 @@ function build_root_map() { $this->sitemap = '' . "\n"; - // reference post type specific sitemaps. + // Reference post type specific sitemaps. $post_types = get_post_types( array( 'public' => true ) ); if ( is_array( $post_types ) && $post_types !== array() ) { @@ -408,11 +408,11 @@ function build_root_map() { } } - // using same filters for filtering join and where parts of the query. + // Using same filters for filtering join and where parts of the query. $join_filter = apply_filters( 'wpseo_typecount_join', '', $post_type ); $where_filter = apply_filters( 'wpseo_typecount_where', '', $post_type ); - // using the same query with build_post_type_map($post_type) function to count number of posts. + // Using the same query with build_post_type_map($post_type) function to count number of posts. $query = $wpdb->prepare( "SELECT COUNT(ID) FROM $wpdb->posts {$join_filter} WHERE post_status IN ('publish','inherit') AND post_password = '' AND post_date != '0000-00-00 00:00:00' AND post_type = %s " . $where_filter, $post_type ); $count = $wpdb->get_var( $query ); @@ -445,7 +445,7 @@ function build_root_map() { } unset( $post_types, $post_type, $join_filter, $where_filter, $query ); - // reference taxonomy specific sitemaps. + // Reference taxonomy specific sitemaps. $taxonomies = get_taxonomies( array( 'public' => true ), 'objects' ); $taxonomy_names = array_keys( $taxonomies ); @@ -536,7 +536,7 @@ function build_root_map() { if ( $this->options['disable-author'] === false && $this->options['disable_author_sitemap'] === false ) { - // reference user profile specific sitemaps. + // Reference user profile specific sitemaps. $users = get_users( array( 'who' => 'authors', 'fields' => 'id' ) ); $count = count( $users ); @@ -545,7 +545,7 @@ function build_root_map() { for ( $i = 0; $i < $n; $i ++ ) { $count = ( $n > 1 ) ? ( $i + 1 ) : ''; - // must use custom raw query because WP User Query does not support ordering by usermeta. + // Must use custom raw query because WP User Query does not support ordering by usermeta. // Retrieve the newest updated profile timestamp overall. // TODO order by usermeta supported since WP 3.7, update implementation? R. @@ -586,7 +586,7 @@ function build_root_map() { unset( $users, $count, $n, $i, $date_query, $date ); } - // allow other plugins to add their sitemaps to the index. + // Allow other plugins to add their sitemaps to the index. $this->sitemap .= apply_filters( 'wpseo_sitemap_index', '' ); $this->sitemap .= ''; } @@ -709,7 +709,7 @@ function build_post_type_map( $post_type ) { 'pri' => apply_filters( 'wpseo_xml_post_type_archive_priority', 0.8, $post_type ), 'chf' => $this->filter_frequency( $post_type . '_archive', 'weekly', $archive_url ), 'mod' => $this->get_last_modified( $post_type ), - // get_lastpostmodified( 'gmt', $post_type ) #17455. + // Function get_lastpostmodified( 'gmt', $post_type ) #17455. ) ); } @@ -921,9 +921,10 @@ function build_post_type_map( $post_type ) { } } - // Clear the post_meta and the term cache for the post, as we no longer need it now. + // Clear the post_meta and the term cache for the post // wp_cache_delete( $p->ID, 'post_meta' ); // clean_object_term_cache( $p->ID, $post_type ); + // as we no longer need it now. } unset( $p, $url ); } @@ -1084,7 +1085,7 @@ function build_user_map() { $n = (int) $this->n; $offset = ( $n > 1 ) ? ( ( $n - 1 ) * $this->max_entries ) : 0; - // initial query to fill in missing usermeta with the current timestamp. + // Initial query to fill in missing usermeta with the current timestamp. $users = get_users( array( 'who' => 'authors', @@ -1105,7 +1106,7 @@ function build_user_map() { } unset( $users, $user ); - // query for users with this meta. + // Query for users with this meta. $users = get_users( array( 'who' => 'authors', @@ -1121,7 +1122,7 @@ function build_user_map() { $users = apply_filters( 'wpseo_sitemap_exclude_author', $users ); - // ascending sort. + // Ascending sort. usort( $users, array( $this, 'user_map_sorter' ) ); if ( is_array( $users ) && $users !== array() ) { diff --git a/inc/class-upgrade.php b/inc/class-upgrade.php index a1c243f16fd..f2f0eef3a69 100644 --- a/inc/class-upgrade.php +++ b/inc/class-upgrade.php @@ -152,8 +152,8 @@ private function move_pinterest_option() { * Runs the needed cleanup after an update, setting the DB version to latest version, flushing caches etc. */ private function finish_up() { - $this->options = get_option( 'wpseo' ); // re-get to make sure we have the latest version. - update_option( 'wpseo', $this->options ); // this also ensures the DB version is equal to WPSEO_VERSION. + $this->options = get_option( 'wpseo' ); // Re-get to make sure we have the latest version. + update_option( 'wpseo', $this->options ); // This also ensures the DB version is equal to WPSEO_VERSION. add_action( 'shutdown', 'flush_rewrite_rules' ); // Just flush rewrites, always, to at least make them work after an upgrade. WPSEO_Utils::clear_sitemap_cache(); // Flush the sitemap cache. diff --git a/inc/class-wpseo-meta.php b/inc/class-wpseo-meta.php index dbe076cf003..e5ffb808c45 100644 --- a/inc/class-wpseo-meta.php +++ b/inc/class-wpseo-meta.php @@ -101,123 +101,123 @@ class WPSEO_Meta { 'general' => array( 'snippetpreview' => array( 'type' => 'snippetpreview', - 'title' => '', // translation added later. - 'help' => '', // translation added later. + 'title' => '', // Translation added later. + 'help' => '', // Translation added later. ), 'focuskw' => array( 'type' => 'text', - 'title' => '', // translation added later. + 'title' => '', // Translation added later. 'default_value' => '', 'autocomplete' => false, - 'help' => '', // translation added later. + 'help' => '', // Translation added later. 'description' => '
', ), 'title' => array( 'type' => 'text', - 'title' => '', // translation added later. + 'title' => '', // Translation added later. 'default_value' => '', - 'description' => '', // translation added later. - 'help' => '', // translation added later. + 'description' => '', // Translation added later. + 'help' => '', // Translation added later. ), 'metadesc' => array( 'type' => 'textarea', - 'title' => '', // translation added later. + 'title' => '', // Translation added later. 'default_value' => '', 'class' => 'metadesc', 'rows' => 2, - 'description' => '', // translation added later. - 'help' => '', // translation added later. + 'description' => '', // Translation added later. + 'help' => '', // Translation added later. ), 'metakeywords' => array( 'type' => 'text', - 'title' => '', // translation added later. + 'title' => '', // Translation added later. 'default_value' => '', 'class' => 'metakeywords', - 'description' => '', // translation added later. + 'description' => '', // Translation added later. ), ), 'advanced' => array( 'meta-robots-noindex' => array( 'type' => 'select', - 'title' => '', // translation added later. + 'title' => '', // Translation added later. 'default_value' => '0', // = post-type default. 'options' => array( - '0' => '', // post type default - translation added later. - '2' => '', // index - translation added later. - '1' => '', // no-index - translation added later. + '0' => '', // Post type default - translation added later. + '2' => '', // Index - translation added later. + '1' => '', // No-index - translation added later. ), ), 'meta-robots-nofollow' => array( 'type' => 'radio', - 'title' => '', // translation added later. + 'title' => '', // Translation added later. 'default_value' => '0', // = follow. 'options' => array( - '0' => '', // follow - translation added later. - '1' => '', // no-follow - translation added later. + '0' => '', // Follow - translation added later. + '1' => '', // No-follow - translation added later. ), ), 'meta-robots-adv' => array( 'type' => 'multiselect', - 'title' => '', // translation added later. + 'title' => '', // Translation added later. 'default_value' => '-', // = site-wide default. - 'description' => '', // translation added later. + 'description' => '', // Translation added later. 'options' => array( - '-' => '', // site-wide default - translation added later. - 'none' => '', // translation added later. - 'noodp' => '', // translation added later. - 'noydir' => '', // translation added later. - 'noimageindex' => '', // translation added later. - 'noarchive' => '', // translation added later. - 'nosnippet' => '', // translation added later. + '-' => '', // Site-wide default - translation added later. + 'none' => '', // Translation added later. + 'noodp' => '', // Translation added later. + 'noydir' => '', // Translation added later. + 'noimageindex' => '', // Translation added later. + 'noarchive' => '', // Translation added later. + 'nosnippet' => '', // Translation added later. ), ), 'bctitle' => array( 'type' => 'text', - 'title' => '', // translation added later. + 'title' => '', // Translation added later. 'default_value' => '', - 'description' => '', // translation added later. + 'description' => '', // Translation added later. ), 'sitemap-include' => array( 'type' => 'select', - 'title' => '', // translation added later. + 'title' => '', // Translation added later. 'default_value' => '-', - 'description' => '', // translation added later. + 'description' => '', // Translation added later. 'options' => array( - '-' => '', // translation added later. - 'always' => '', // translation added later. - 'never' => '', // translation added later. + '-' => '', // Translation added later. + 'always' => '', // Translation added later. + 'never' => '', // Translation added later. ), ), 'sitemap-prio' => array( 'type' => 'select', - 'title' => '', // translation added later. + 'title' => '', // Translation added later. 'default_value' => '-', - 'description' => '', // translation added later. + 'description' => '', // Translation added later. 'options' => array( - '-' => '', // translation added later. - '1' => '', // translation added later. + '-' => '', // Translation added later. + '1' => '', // Translation added later. '0.9' => '0.9', - '0.8' => '0.8 - ', // translation added later. + '0.8' => '0.8 - ', // Translation added later. '0.7' => '0.7', - '0.6' => '0.6 - ', // translation added later. - '0.5' => '0.5 - ', // translation added later. + '0.6' => '0.6 - ', // Translation added later. + '0.5' => '0.5 - ', // Translation added later. '0.4' => '0.4', '0.3' => '0.3', '0.2' => '0.2', - '0.1' => '0.1 - ', // translation added later. + '0.1' => '0.1 - ', // Translation added later. ), ), 'canonical' => array( 'type' => 'text', - 'title' => '', // translation added later. + 'title' => '', // Translation added later. 'default_value' => '', - 'description' => '', // translation added later. + 'description' => '', // Translation added later. ), 'redirect' => array( 'type' => 'text', - 'title' => '', // translation added later. + 'title' => '', // Translation added later. 'default_value' => '', - 'description' => '', // translation added later. + 'description' => '', // Translation added later. ), ), 'social' => array(), @@ -283,9 +283,9 @@ public static function init() { foreach ( self::$social_fields as $box => $type ) { self::$meta_fields['social'][ $network . '-' . $box ] = array( 'type' => $type, - 'title' => '', // translation added later. + 'title' => '', // Translation added later. 'default_value' => '', - 'description' => '', // translation added later. + 'description' => '', // Translation added later. ); } } @@ -327,7 +327,7 @@ function_exists as a precaution in case they remove it. */ self::$defaults[ self::$meta_prefix . $key ] = $field_def['default_value']; } else { - // meta will always be a string, so let's make the meta meta default also a string. + // Meta will always be a string, so let's make the meta meta default also a string. self::$defaults[ self::$meta_prefix . $key ] = ''; } } @@ -359,7 +359,7 @@ public static function get_meta_field_defs( $tab, $post_type = 'post' ) { switch ( $tab ) { case 'non-form': - // prevent non-form fields from being passed to forms. + // Prevent non-form fields from being passed to forms. $field_defs = array(); break; @@ -410,7 +410,7 @@ public static function get_meta_field_defs( $tab, $post_type = 'post' ) { $robots_adv = array(); foreach ( array( 'noodp', 'noydir' ) as $robot ) { if ( $options[ $robot ] === true ) { - // use translation from field def options - mind that $options and $field_def['options'] keys should be the same! + // Use translation from field def options - mind that $options and $field_def['options'] keys should be the same! $robots_adv[] = $field_defs['meta-robots-adv']['options'][ $robot ]; } } @@ -571,8 +571,7 @@ public static function validate_meta_robots_adv( $meta_value ) { $clean = 'none'; } elseif ( in_array( '-', $meta_value, true ) ) { - // Site-wide defaults is one of the selected values, takes priority over - // individual selected entries. + // Site-wide defaults is one of the selected values, takes priority over individual selected entries. $clean = '-'; } else { @@ -618,10 +617,10 @@ public static function remove_meta_if_default( $null, $object_id, $meta_key, $me delete_post_meta( $object_id, $meta_key ); } - return true; // stop saving the value. + return true; // Stop saving the value. } - return null; // go on with the normal execution (update) in meta.php. + return null; // Go on with the normal execution (update) in meta.php. } @@ -640,10 +639,10 @@ public static function remove_meta_if_default( $null, $object_id, $meta_key, $me public static function dont_save_meta_if_default( $null, $object_id, $meta_key, $meta_value ) { /* If it's one of our meta fields, check against default */ if ( isset( self::$fields_index[ $meta_key ] ) && self::meta_value_is_default( $meta_key, $meta_value ) === true ) { - return true; // stop saving the value. + return true; // Stop saving the value. } - return null; // go on with the normal execution (add) in meta.php. + return null; // Go on with the normal execution (add) in meta.php. } @@ -695,7 +694,7 @@ public static function get_value( $key, $postid = 0 ) { } } - $custom = get_post_custom( $postid ); // array of strings or empty array. + $custom = get_post_custom( $postid ); // Array of strings or empty array. if ( isset( $custom[ self::$meta_prefix . $key ][0] ) ) { $unserialized = maybe_unserialize( $custom[ self::$meta_prefix . $key ][0] ); @@ -879,7 +878,7 @@ public static function clean_up() { } elseif ( isset( $field_def['options'] ) && is_array( $field_def['options'] ) && $field_def['options'] !== array() ) { $valid = $field_def['options']; - // remove the default value from the valid options. + // Remove the default value from the valid options. unset( $valid[ $field_def['default_value'] ] ); $valid = array_keys( $valid ); @@ -910,7 +909,7 @@ public static function clean_up() { $meta_ids = $wpdb->get_col( $query ); if ( is_array( $meta_ids ) && $meta_ids !== array() ) { - // wp native action. + // WP native action. do_action( 'delete_post_meta', $meta_ids, null, null, null ); $query = "DELETE FROM {$wpdb->postmeta} WHERE meta_id IN( " . implode( ',', $meta_ids ) . ' )'; @@ -921,7 +920,7 @@ public static function clean_up() { wp_cache_delete( $object_id, 'post_meta' ); } - // wp native action. + // WP native action. do_action( 'deleted_post_meta', $meta_ids, null, null, null ); } } diff --git a/inc/class-wpseo-options.php b/inc/class-wpseo-options.php index 38c54b94bd6..a5eb5fa2a02 100644 --- a/inc/class-wpseo-options.php +++ b/inc/class-wpseo-options.php @@ -117,19 +117,19 @@ abstract class WPSEO_Option { protected function __construct() { /* Add filters which get applied to the get_options() results */ - $this->add_default_filters(); // return defaults if option not set. - $this->add_option_filters(); // merge with defaults if option *is* set. + $this->add_default_filters(); // Return defaults if option not set. + $this->add_option_filters(); // Merge with defaults if option *is* set. if ( $this->multisite_only !== true ) { /* The option validation routines remove the default filters to prevent failing to insert an option if it's new. Let's add them back afterwards. */ - add_action( 'add_option', array( $this, 'add_default_filters' ) ); // adding back after INSERT. + add_action( 'add_option', array( $this, 'add_default_filters' ) ); // Adding back after INSERT. - if ( version_compare( $GLOBALS['wp_version'], '3.7', '!=' ) ) { // adding back after non-WP 3.7 UPDATE. + if ( version_compare( $GLOBALS['wp_version'], '3.7', '!=' ) ) { // Adding back after non-WP 3.7 UPDATE. add_action( 'update_option', array( $this, 'add_default_filters' ) ); } - else { // adding back after WP 3.7 UPDATE. + else { // Adding back after WP 3.7 UPDATE. add_filter( 'pre_update_option_' . $this->option_name, array( $this, 'wp37_add_default_filters' ) ); } } @@ -284,10 +284,10 @@ public function validate_verification_string( $key, $dirty, $old, &$clean ) { } if ( function_exists( 'add_settings_error' ) ) { add_settings_error( - $this->group_name, // slug title of the setting. - '_' . $key, // suffix-id for the error message box. - sprintf( __( '%s does not seem to be a valid %s verification string. Please correct.', 'wordpress-seo' ), '' . esc_html( $meta ) . '', $service ), // the error message. - 'error' // error type, either 'error' or 'updated'. + $this->group_name, // Slug title of the setting. + '_' . $key, // Suffix-id for the error message box. + sprintf( __( '%s does not seem to be a valid %s verification string. Please correct.', 'wordpress-seo' ), '' . esc_html( $meta ) . '', $service ), // The error message. + 'error' // Error type, either 'error' or 'updated'. ); } } @@ -319,10 +319,10 @@ public function validate_url( $key, $dirty, $old, &$clean ) { if ( function_exists( 'add_settings_error' ) ) { $url = WPSEO_Utils::sanitize_url( $dirty[ $key ] ); add_settings_error( - $this->group_name, // slug title of the setting. - '_' . $key, // suffix-id for the error message box. - sprintf( __( '%s does not seem to be a valid url. Please correct.', 'wordpress-seo' ), '' . esc_html( $url ) . '' ), // the error message. - 'error' // error type, either 'error' or 'updated'. + $this->group_name, // Slug title of the setting. + '_' . $key, // Suffix-id for the error message box. + sprintf( __( '%s does not seem to be a valid url. Please correct.', 'wordpress-seo' ), '' . esc_html( $url ) . '' ), // The error message. + 'error' // Error type, either 'error' or 'updated'. ); } } @@ -665,7 +665,7 @@ protected function retain_variable_keys( $dirty, $clean ) { if ( ( is_array( $this->variable_array_key_patterns ) && $this->variable_array_key_patterns !== array() ) && ( is_array( $dirty ) && $dirty !== array() ) ) { foreach ( $dirty as $key => $value ) { - // do nothing if already in filtered options. + // Do nothing if already in filtered options. if ( isset( $clean[ $key ] ) ) { continue; } @@ -868,22 +868,22 @@ class WPSEO_Option_Wpseo extends WPSEO_Option { // Non-form fields, set via (ajax) function. 'blocking_files' => array(), 'ignore_blog_public_warning' => false, - 'ignore_meta_description_warning' => null, // overwrite in __construct(). + 'ignore_meta_description_warning' => null, // Overwrite in __construct(). 'ignore_page_comments' => false, 'ignore_permalink' => false, 'ms_defaults_set' => false, - 'theme_description_found' => null, // overwrite in __construct(). - 'theme_has_description' => null, // overwrite in __construct(). + 'theme_description_found' => null, // Overwrite in __construct(). + 'theme_has_description' => null, // Overwrite in __construct(). // Non-form field, should only be set via validation routine. - 'version' => '', // leave default as empty to ensure activation/upgrade works. + 'version' => '', // Leave default as empty to ensure activation/upgrade works. // Form fields: - 'alexaverify' => '', // text field. + 'alexaverify' => '', // Text field. 'company_logo' => '', 'company_name' => '', 'company_or_person' => '', 'disableadvanced_meta' => true, - 'googleverify' => '', // text field. - 'msverify' => '', // text field. + 'googleverify' => '', // Text field. + 'msverify' => '', // Text field. 'person_name' => '', 'website_name' => '', 'alternate_website_name' => '', @@ -895,7 +895,7 @@ class WPSEO_Option_Wpseo extends WPSEO_Option { */ public static $desc_defaults = array( 'ignore_meta_description_warning' => false, - 'theme_description_found' => '', // text string description. + 'theme_description_found' => '', // Text string description. 'theme_has_description' => null, ); @@ -1148,7 +1148,7 @@ class WPSEO_Option_Permalinks extends WPSEO_Option { */ protected $defaults = array( 'cleanpermalinks' => false, - 'cleanpermalink-extravars' => '', // text field. + 'cleanpermalink-extravars' => '', // Text field. 'cleanpermalink-googlecampaign' => false, 'cleanpermalink-googlesitesearch' => false, 'cleanreplytocom' => false, @@ -1282,18 +1282,18 @@ class WPSEO_Option_Titles extends WPSEO_Option { 'noodp' => false, 'noydir' => false, 'usemetakeywords' => false, - 'title-home-wpseo' => '%%sitename%% %%page%% %%sep%% %%sitedesc%%', // text field. - 'title-author-wpseo' => '', // text field. - 'title-archive-wpseo' => '%%date%% %%page%% %%sep%% %%sitename%%', // text field. - 'title-search-wpseo' => '', // text field. - 'title-404-wpseo' => '', // text field. + 'title-home-wpseo' => '%%sitename%% %%page%% %%sep%% %%sitedesc%%', // Text field. + 'title-author-wpseo' => '', // Text field. + 'title-archive-wpseo' => '%%date%% %%page%% %%sep%% %%sitename%%', // Text field. + 'title-search-wpseo' => '', // Text field. + 'title-404-wpseo' => '', // Text field. - 'metadesc-home-wpseo' => '', // text area. - 'metadesc-author-wpseo' => '', // text area. - 'metadesc-archive-wpseo' => '', // text area. + 'metadesc-home-wpseo' => '', // Text area. + 'metadesc-author-wpseo' => '', // Text area. + 'metadesc-archive-wpseo' => '', // Text area. - 'metakey-home-wpseo' => '', // text field. - 'metakey-author-wpseo' => '', // text field. + 'metakey-home-wpseo' => '', // Text field. + 'metakey-author-wpseo' => '', // Text field. 'noindex-subpages-wpseo' => false, 'noindex-author-wpseo' => false, @@ -1304,22 +1304,22 @@ class WPSEO_Option_Titles extends WPSEO_Option { /** * Uses enrich_defaults to add more along the lines of: - * - 'title-' . $pt->name => ''; // text field. - * - 'metadesc-' . $pt->name => ''; // text field. - * - 'metakey-' . $pt->name => ''; // text field. + * - 'title-' . $pt->name => ''; // Text field. + * - 'metadesc-' . $pt->name => ''; // Text field. + * - 'metakey-' . $pt->name => ''; // Text field. * - 'noindex-' . $pt->name => false; * - 'showdate-' . $pt->name => false; * - 'hideeditbox-' . $pt->name => false; * - * - 'title-ptarchive-' . $pt->name => ''; // text field. - * - 'metadesc-ptarchive-' . $pt->name => ''; // text field. - * - 'metakey-ptarchive-' . $pt->name => ''; // text field. - * - 'bctitle-ptarchive-' . $pt->name => ''; // text field. + * - 'title-ptarchive-' . $pt->name => ''; // Text field. + * - 'metadesc-ptarchive-' . $pt->name => ''; // Text field. + * - 'metakey-ptarchive-' . $pt->name => ''; // Text field. + * - 'bctitle-ptarchive-' . $pt->name => ''; // Text field. * - 'noindex-ptarchive-' . $pt->name => false; * - * - 'title-tax-' . $tax->name => '''; // text field. - * - 'metadesc-tax-' . $tax->name => ''; // text field. - * - 'metakey-tax-' . $tax->name => ''; // text field. + * - 'title-tax-' . $tax->name => '''; // Text field. + * - 'metadesc-tax-' . $tax->name => ''; // Text field. + * - 'metakey-tax-' . $tax->name => ''; // Text field. * - 'noindex-tax-' . $tax->name => false; * - 'hideeditbox-tax-' . $tax->name => false; */ @@ -1453,9 +1453,9 @@ public function enrich_defaults() { if ( $post_type_names !== array() ) { foreach ( $post_type_names as $pt ) { - $this->defaults[ 'title-' . $pt ] = '%%title%% %%page%% %%sep%% %%sitename%%'; // text field. - $this->defaults[ 'metadesc-' . $pt ] = ''; // text area. - $this->defaults[ 'metakey-' . $pt ] = ''; // text field. + $this->defaults[ 'title-' . $pt ] = '%%title%% %%page%% %%sep%% %%sitename%%'; // Text field. + $this->defaults[ 'metadesc-' . $pt ] = ''; // Text area. + $this->defaults[ 'metakey-' . $pt ] = ''; // Text field. $this->defaults[ 'noindex-' . $pt ] = false; $this->defaults[ 'showdate-' . $pt ] = false; $this->defaults[ 'hideeditbox-' . $pt ] = false; @@ -1470,10 +1470,10 @@ public function enrich_defaults() { continue; } - $this->defaults[ 'title-ptarchive-' . $pt->name ] = $archive . ' %%page%% %%sep%% %%sitename%%'; // text field. - $this->defaults[ 'metadesc-ptarchive-' . $pt->name ] = ''; // text area. - $this->defaults[ 'metakey-ptarchive-' . $pt->name ] = ''; // text field. - $this->defaults[ 'bctitle-ptarchive-' . $pt->name ] = ''; // text field. + $this->defaults[ 'title-ptarchive-' . $pt->name ] = $archive . ' %%page%% %%sep%% %%sitename%%'; // Text field. + $this->defaults[ 'metadesc-ptarchive-' . $pt->name ] = ''; // Text area. + $this->defaults[ 'metakey-ptarchive-' . $pt->name ] = ''; // Text field. + $this->defaults[ 'bctitle-ptarchive-' . $pt->name ] = ''; // Text field. $this->defaults[ 'noindex-ptarchive-' . $pt->name ] = false; } unset( $pt ); @@ -1482,9 +1482,9 @@ public function enrich_defaults() { if ( $taxonomy_names !== array() ) { $archives = sprintf( __( '%s Archives', 'wordpress-seo' ), '%%term_title%%' ); foreach ( $taxonomy_names as $tax ) { - $this->defaults[ 'title-tax-' . $tax ] = $archives . ' %%page%% %%sep%% %%sitename%%'; // text field. - $this->defaults[ 'metadesc-tax-' . $tax ] = ''; // text area. - $this->defaults[ 'metakey-tax-' . $tax ] = ''; // text field. + $this->defaults[ 'title-tax-' . $tax ] = $archives . ' %%page%% %%sep%% %%sitename%%'; // Text field. + $this->defaults[ 'metadesc-tax-' . $tax ] = ''; // Text area. + $this->defaults[ 'metakey-tax-' . $tax ] = ''; // Text field. $this->defaults[ 'hideeditbox-tax-' . $tax ] = false; if ( $tax !== 'post_format' ) { @@ -1817,7 +1817,7 @@ protected function retain_variable_keys( $dirty, $clean ) { foreach ( $dirty as $key => $value ) { - // do nothing if already in filtered option array. + // Do nothing if already in filtered option array. if ( isset( $clean[ $key ] ) ) { continue; } @@ -1854,8 +1854,8 @@ class WPSEO_Option_RSS extends WPSEO_Option { * @internal Note: Some of the default values are added via the translate_defaults() method */ protected $defaults = array( - 'rssbefore' => '', // text area. - 'rssafter' => '', // text area. + 'rssbefore' => '', // Text area. + 'rssafter' => '', // Text area. ); @@ -1921,15 +1921,15 @@ class WPSEO_Option_InternalLinks extends WPSEO_Option { * @internal Note: Some of the default values are added via the translate_defaults() method */ protected $defaults = array( - 'breadcrumbs-404crumb' => '', // text field. + 'breadcrumbs-404crumb' => '', // Text field. 'breadcrumbs-blog-remove' => false, 'breadcrumbs-boldlast' => false, - 'breadcrumbs-archiveprefix' => '', // text field. + 'breadcrumbs-archiveprefix' => '', // Text field. 'breadcrumbs-enable' => false, - 'breadcrumbs-home' => '', // text field. - 'breadcrumbs-prefix' => '', // text field. - 'breadcrumbs-searchprefix' => '', // text field. - 'breadcrumbs-sep' => '»', // text field. + 'breadcrumbs-home' => '', // Text field. + 'breadcrumbs-prefix' => '', // Text field. + 'breadcrumbs-searchprefix' => '', // Text field. + 'breadcrumbs-sep' => '»', // Text field. /** * Uses enrich_defaults() to add more along the lines of: @@ -1989,7 +1989,7 @@ public function enrich_defaults() { foreach ( $post_type_names as $pt ) { $pto_taxonomies = get_object_taxonomies( $pt, 'names' ); if ( $pto_taxonomies !== array() ) { - $this->defaults[ 'post_types-' . $pt . '-maintax' ] = 0; // select box. + $this->defaults[ 'post_types-' . $pt . '-maintax' ] = 0; // Select box. } unset( $pto_taxonomies ); } @@ -1998,7 +1998,7 @@ public function enrich_defaults() { if ( $taxonomy_names_custom !== array() ) { foreach ( $taxonomy_names_custom as $tax ) { - $this->defaults[ 'taxonomy-' . $tax . '-ptparent' ] = 0; // select box;. + $this->defaults[ 'taxonomy-' . $tax . '-ptparent' ] = 0; // Select box;. } unset( $tax ); } @@ -2060,10 +2060,10 @@ protected function validate_option( $dirty, $clean, $old ) { /* @todo [JRF => whomever] maybe change the untranslated $pt name in the * error message to the nicely translated label ? */ add_settings_error( - $this->group_name, // slug title of the setting. - '_' . $key, // suffix-id for the error message box. - sprintf( __( 'Please select a valid taxonomy for post type "%s"', 'wordpress-seo' ), $post_type ), // the error message. - 'error' // error type, either 'error' or 'updated'. + $this->group_name, // Slug title of the setting. + '_' . $key, // Suffix-id for the error message box. + sprintf( __( 'Please select a valid taxonomy for post type "%s"', 'wordpress-seo' ), $post_type ), // The error message. + 'error' // Error type, either 'error' or 'updated'. ); } } @@ -2097,10 +2097,10 @@ protected function validate_option( $dirty, $clean, $old ) { * error message to the nicely translated label ? */ $tax = str_replace( array( 'taxonomy-', '-ptparent' ), '', $key ); add_settings_error( - $this->group_name, // slug title of the setting. - '_' . $tax, // suffix-id for the error message box. - sprintf( __( 'Please select a valid post type for taxonomy "%s"', 'wordpress-seo' ), $tax ), // the error message. - 'error' // error type, either 'error' or 'updated'. + $this->group_name, // Slug title of the setting. + '_' . $tax, // Suffix-id for the error message box. + sprintf( __( 'Please select a valid post type for taxonomy "%s"', 'wordpress-seo' ), $tax ), // The error message. + 'error' // Error type, either 'error' or 'updated'. ); unset( $tax ); } @@ -2410,10 +2410,10 @@ protected function validate_option( $dirty, $clean, $old ) { } if ( function_exists( 'add_settings_error' ) ) { add_settings_error( - $this->group_name, // slug title of the setting. - '_' . $key, // suffix-id for the error message box. - sprintf( __( '"Max entries per sitemap page" should be a positive number, which %s is not. Please correct.', 'wordpress-seo' ), '' . esc_html( sanitize_text_field( $dirty[ $key ] ) ) . '' ), // the error message. - 'error' // error type, either 'error' or 'updated'. + $this->group_name, // Slug title of the setting. + '_' . $key, // Suffix-id for the error message box. + sprintf( __( '"Max entries per sitemap page" should be a positive number, which %s is not. Please correct.', 'wordpress-seo' ), '' . esc_html( sanitize_text_field( $dirty[ $key ] ) ) . '' ), // The error message. + 'error' // Error type, either 'error' or 'updated'. ); } } @@ -2499,31 +2499,31 @@ class WPSEO_Option_Social extends WPSEO_Option { */ protected $defaults = array( // Non-form fields, set via procedural code in admin/pages/social.php. - 'fb_admins' => array(), // array of user id's => array( name => '', link => '' ). + 'fb_admins' => array(), // Array of user id's => array( name => '', link => '' ). // Non-form field, set via translate_defaults() and validate_option() methods. 'fbconnectkey' => '', // Form fields: - 'facebook_site' => '', // text field. + 'facebook_site' => '', // Text field. 'instagram_url' => '', 'linkedin_url' => '', 'myspace_url' => '', - 'og_default_image' => '', // text field. - 'og_frontpage_title' => '', // text field. - 'og_frontpage_desc' => '', // text field. - 'og_frontpage_image' => '', // text field. + 'og_default_image' => '', // Text field. + 'og_frontpage_title' => '', // Text field. + 'og_frontpage_desc' => '', // Text field. + 'og_frontpage_image' => '', // Text field. 'opengraph' => true, 'googleplus' => false, 'pinterest_url' => '', 'pinterestverify' => '', - 'plus-publisher' => '', // text field. + 'plus-publisher' => '', // Text field. 'twitter' => true, - 'twitter_site' => '', // text field. + 'twitter_site' => '', // Text field. 'twitter_card_type' => 'summary', 'youtube_url' => '', 'google_plus_url' => '', // Form field, but not always available: - 'fbadminapp' => '', // facbook app id. + 'fbadminapp' => '', // Facebook app ID. ); /** @@ -2712,10 +2712,10 @@ protected function validate_option( $dirty, $clean, $old ) { } if ( function_exists( 'add_settings_error' ) ) { add_settings_error( - $this->group_name, // slug title of the setting. - '_' . $key, // suffix-id for the error message box. - sprintf( __( '%s does not seem to be a valid Twitter user-id. Please correct.', 'wordpress-seo' ), '' . esc_html( sanitize_text_field( $dirty[ $key ] ) ) . '' ), // the error message. - 'error' // error type, either 'error' or 'updated'. + $this->group_name, // Slug title of the setting. + '_' . $key, // Suffix-id for the error message box. + sprintf( __( '%s does not seem to be a valid Twitter user-id. Please correct.', 'wordpress-seo' ), '' . esc_html( sanitize_text_field( $dirty[ $key ] ) ) . '' ), // The error message. + 'error' // Error type, either 'error' or 'updated'. ); } } @@ -2837,7 +2837,7 @@ class WPSEO_Option_MS extends WPSEO_Option { */ protected $defaults = array( 'access' => 'admin', - 'defaultblog' => '', // numeric blog id or empty. + 'defaultblog' => '', // Numeric blog ID or empty. ); /** @@ -2947,10 +2947,10 @@ protected function validate_option( $dirty, $clean, $old ) { } elseif ( function_exists( 'add_settings_error' ) ) { add_settings_error( - $this->group_name, // slug title of the setting. - '_' . $key, // suffix-id for the error message box. - sprintf( __( '%s is not a valid choice for who should be allowed access to the WP SEO settings. Value reset to the default.', 'wordpress-seo' ), esc_html( sanitize_text_field( $dirty[ $key ] ) ) ), // the error message. - 'error' // error type, either 'error' or 'updated'. + $this->group_name, // Slug title of the setting. + '_' . $key, // Suffix-id for the error message box. + sprintf( __( '%s is not a valid choice for who should be allowed access to the WP SEO settings. Value reset to the default.', 'wordpress-seo' ), esc_html( sanitize_text_field( $dirty[ $key ] ) ) ), // The error message. + 'error' // Error type, either 'error' or 'updated'. ); } break; @@ -2967,20 +2967,20 @@ protected function validate_option( $dirty, $clean, $old ) { } elseif ( function_exists( 'add_settings_error' ) ) { add_settings_error( - $this->group_name, // slug title of the setting. - '_' . $key, // suffix-id for the error message box. - esc_html__( 'The default blog setting must be the numeric blog id of the blog you want to use as default.', 'wordpress-seo' ) . '
' . sprintf( esc_html__( 'This must be an existing blog. Blog %s does not exist or has been marked as deleted.', 'wordpress-seo' ), '' . esc_html( sanitize_text_field( $dirty[ $key ] ) ) . '' ), // the error message. - 'error' // error type, either 'error' or 'updated'. + $this->group_name, // Slug title of the setting. + '_' . $key, // Suffix-id for the error message box. + esc_html__( 'The default blog setting must be the numeric blog id of the blog you want to use as default.', 'wordpress-seo' ) . '
' . sprintf( esc_html__( 'This must be an existing blog. Blog %s does not exist or has been marked as deleted.', 'wordpress-seo' ), '' . esc_html( sanitize_text_field( $dirty[ $key ] ) ) . '' ), // The error message. + 'error' // Error type, either 'error' or 'updated'. ); } unset( $exists ); } elseif ( function_exists( 'add_settings_error' ) ) { add_settings_error( - $this->group_name, // slug title of the setting. - '_' . $key, // suffix-id for the error message box. - esc_html__( 'The default blog setting must be the numeric blog id of the blog you want to use as default.', 'wordpress-seo' ) . '
' . esc_html__( 'No numeric value was received.', 'wordpress-seo' ), // the error message. - 'error' // error type, either 'error' or 'updated'. + $this->group_name, // Slug title of the setting. + '_' . $key, // Suffix-id for the error message box. + esc_html__( 'The default blog setting must be the numeric blog id of the blog you want to use as default.', 'wordpress-seo' ) . '
' . esc_html__( 'No numeric value was received.', 'wordpress-seo' ), // The error message. + 'error' // Error type, either 'error' or 'updated'. ); } unset( $int ); diff --git a/inc/class-wpseo-utils.php b/inc/class-wpseo-utils.php index 0a2bc44d9ad..d012c1c868d 100644 --- a/inc/class-wpseo-utils.php +++ b/inc/class-wpseo-utils.php @@ -533,7 +533,7 @@ public static function clear_sitemap_cache( $types = array() ) { return; } - // not sure about efficiency, but that's what code elsewhere does R. + // Not sure about efficiency, but that's what code elsewhere does R. $options = WPSEO_Options::get_all(); if ( true !== $options['enablexmlsitemap'] ) { @@ -635,7 +635,7 @@ public static function calc( $number1, $action, $number2, $round = false, $decim case 'div': case 'divide': if ( $bc ) { - $result = bcdiv( $number1, $number2, $precision ); // string, or NULL if right_operand is 0. + $result = bcdiv( $number1, $number2, $precision ); // String, or NULL if right_operand is 0. } elseif ( $number2 != 0 ) { $result = ( $number1 / $number2 ); @@ -650,7 +650,7 @@ public static function calc( $number1, $action, $number2, $round = false, $decim case 'mod': case 'modulus': if ( $bc ) { - $result = bcmod( $number1, $number2, $precision ); // string, or NULL if modulus is 0. + $result = bcmod( $number1, $number2, $precision ); // String, or NULL if modulus is 0. } elseif ( $number2 != 0 ) { $result = ( $number1 % $number2 ); @@ -666,7 +666,7 @@ public static function calc( $number1, $action, $number2, $round = false, $decim case 'compare': $compare = true; if ( $bc ) { - $result = bccomp( $number1, $number2, $precision ); // returns int 0, 1 or -1. + $result = bccomp( $number1, $number2, $precision ); // Returns int 0, 1 or -1. } else { $result = ( $number1 == $number2 ) ? 0 : ( ( $number1 > $number2 ) ? 1 : - 1 ); diff --git a/inc/wpseo-functions.php b/inc/wpseo-functions.php index 6cb31e68c70..cbc34d89010 100644 --- a/inc/wpseo-functions.php +++ b/inc/wpseo-functions.php @@ -162,7 +162,7 @@ function wpseo_xml_redirect_sitemap() { $current_url = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) ? 'https://' : 'http://'; $current_url .= sanitize_text_field( $_SERVER['SERVER_NAME'] ) . sanitize_text_field( $_SERVER['REQUEST_URI'] ); - // must be 'sitemap.xml' and must be 404. + // Must be 'sitemap.xml' and must be 404. if ( home_url( '/sitemap.xml' ) == $current_url && $GLOBALS['wp_query']->is_404 ) { wp_redirect( home_url( '/sitemap_index.xml' ), 301 ); exit; @@ -200,7 +200,7 @@ function wpseo_xml_sitemaps_init() { return; } - // redirects sitemap.xml to sitemap_index.xml. + // Redirects sitemap.xml to sitemap_index.xml. add_action( 'template_redirect', 'wpseo_xml_redirect_sitemap', 0 ); if ( ! is_object( $GLOBALS['wp'] ) ) { diff --git a/inc/wpseo-non-ajax-functions.php b/inc/wpseo-non-ajax-functions.php index 24fc311dd75..439a2f6a47c 100644 --- a/inc/wpseo-non-ajax-functions.php +++ b/inc/wpseo-non-ajax-functions.php @@ -59,7 +59,7 @@ function wpseo_title_test() { update_option( 'wpseo_titles', $options ); } -// add_filter( 'switch_theme', 'wpseo_title_test', 0 ); +// Commented out? add_filter( 'switch_theme', 'wpseo_title_test', 0 ); R. /** @@ -81,11 +81,11 @@ function wpseo_description_test() { $file = false; if ( file_exists( get_stylesheet_directory() . '/header.php' ) ) { - // theme or child theme. + // Theme or child theme. $file = get_stylesheet_directory() . '/header.php'; } elseif ( file_exists( get_template_directory() . '/header.php' ) ) { - // parent theme in case of a child theme. + // Parent theme in case of a child theme. $file = get_template_directory() . '/header.php'; } @@ -100,7 +100,7 @@ function wpseo_description_test() { if ( ( strtolower( $meta[1] ) == 'name' && strtolower( $meta[3] ) == 'description' ) || ( strtolower( $meta[5] ) == 'name' && strtolower( $meta[7] ) == 'description' ) ) { $options['theme_description_found'] = $meta[0]; $options['ignore_meta_description_warning'] = false; - break; // no need to run through the rest of the meta's. + break; // No need to run through the rest of the meta's. } } if ( $options['theme_description_found'] !== '' ) { @@ -170,12 +170,12 @@ function wpseo_upgrader_process_complete( $upgrader_object, $context_array, $the if ( ( isset( $context_array['bulk'] ) && $context_array['bulk'] === true ) && ( is_array( $themes ) && count( $themes ) > 0 ) ) { if ( in_array( $theme, $themes ) ) { - // wpseo_title_test(); + // Commented out? wpseo_title_test(); R. wpseo_description_test(); } } elseif ( is_string( $themes ) && $themes === $theme ) { - // wpseo_title_test(); + // Commented out? wpseo_title_test(); R. wpseo_description_test(); } @@ -205,12 +205,12 @@ function wpseo_update_theme_complete_actions( $update_actions, $updated_theme ) if ( is_object( $updated_theme ) ) { /* Bulk update and $updated_theme only contains info on which theme was last in the list of updated themes, so go & test */ - // wpseo_title_test(); + // Commented out? wpseo_title_test(); R. wpseo_description_test(); } elseif ( $updated_theme === $theme ) { /* Single theme update for the active theme */ - // wpseo_title_test(); + // Commented out? wpseo_title_test(); R. wpseo_description_test(); } @@ -460,7 +460,6 @@ function allow_custom_field_edits( $allcaps, $cap, $args ) { // $args[0] holds the capability. // $args[2] holds the post ID. // $args[3] holds the custom field. - // Make sure the request is to edit or add a post meta (this is usually also the second value in $cap, // but this is safer to check). if ( in_array( $args[0], array( 'edit_post_meta', 'add_post_meta' ) ) ) { @@ -482,7 +481,7 @@ function allow_custom_field_edits( $allcaps, $cap, $args ) { * @since 1.5.0 */ function wpseo_robots_meta_message() { - // check if robots meta is running. + // Check if robots meta is running. if ( ( ! isset( $_GET['page'] ) || 'wpseo_import' !== $_GET['page'] ) && is_plugin_active( 'robots-meta/robots-meta.php' ) ) { add_action( 'admin_notices', 'wpseo_import_robots_meta_notice' ); } @@ -500,7 +499,7 @@ function wpseo_disable_robots_meta() { // Deactivate the plugin. deactivate_plugins( 'robots-meta/robots-meta.php' ); - // show notice that robots meta has been deactivated. + // Show notice that robots meta has been deactivated. add_action( 'admin_notices', 'wpseo_deactivate_robots_meta_notice' ); // Clean up the referrer url for later use. @@ -518,7 +517,7 @@ function wpseo_disable_robots_meta() { * @since 1.5.0 */ function wpseo_aioseo_message() { - // check if aioseo is running. + // Check if aioseo is running. if ( ( ! isset( $_GET['page'] ) || 'wpseo_import' != $_GET['page'] ) && is_plugin_active( 'all-in-one-seo-pack/all_in_one_seo_pack.php' ) ) { add_action( 'admin_notices', 'wpseo_import_aioseo_setting_notice' ); } @@ -536,7 +535,7 @@ function wpseo_disable_aioseo() { // Deactivate AIO. deactivate_plugins( 'all-in-one-seo-pack/all_in_one_seo_pack.php' ); - // show notice that aioseo has been deactivated. + // Show notice that aioseo has been deactivated. add_action( 'admin_notices', 'wpseo_deactivate_aioseo_notice' ); // Clean up the referrer url for later use. diff --git a/wp-seo-main.php b/wp-seo-main.php index 7d17fd04bf4..a8ebfae603b 100644 --- a/wp-seo-main.php +++ b/wp-seo-main.php @@ -58,7 +58,7 @@ function wpseo_auto_load( $class ) { if ( file_exists( WPSEO_PATH . '/vendor/autoload_52.php' ) ) { require WPSEO_PATH . '/vendor/autoload_52.php'; } -elseif ( ! class_exists( 'WPSEO_Options' ) ) { // still checking since might be site-level autoload R. +elseif ( ! class_exists( 'WPSEO_Options' ) ) { // Still checking since might be site-level autoload R. add_action( 'admin_init', 'yoast_wpseo_missing_autoload', 1 ); return; } @@ -108,7 +108,7 @@ function wpseo_deactivate( $networkwide = false ) { function wpseo_network_activate_deactivate( $activate = true ) { global $wpdb; - $original_blog_id = get_current_blog_id(); // alternatively use: $wpdb->blogid. + $original_blog_id = get_current_blog_id(); // Alternatively use: $wpdb->blogid. $all_blogs = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); if ( is_array( $all_blogs ) && $all_blogs !== array() ) { @@ -225,7 +225,7 @@ function wpseo_init() { $options = WPSEO_Options::get_all(); if ( version_compare( $options['version'], WPSEO_VERSION, '<' ) ) { new WPSEO_Upgrade(); - // get a cleaned up version of the $options. + // Get a cleaned up version of the $options. $options = WPSEO_Options::get_all(); }