Archived
Updates to wp 4.0.1
This commit is contained in:
1 parent
03777ef2b0
commit
70d2335bba
184 files changed
+9953
-3052
No files matched your search
@@ -130,9 +130,9 @@ add_action( 'wp_ajax_wpseo_replace_vars', 'wpseo_ajax_replace_vars' );
|
||||
function wpseo_save_title() {
|
||||
check_ajax_referer( 'wpseo-bulk-editor' );
|
||||
|
||||
$new_title = $_POST['new_title'];
|
||||
$new_title = $_POST['new_value'];
|
||||
$id = intval( $_POST['wpseo_post_id'] );
|
||||
$original_title = $_POST['existing_title'];
|
||||
$original_title = $_POST['existing_value'];
|
||||
|
||||
$results = wpseo_upsert_new_title( $id, $new_title, $original_title );
|
||||
|
||||
@@ -159,6 +159,10 @@ function wpseo_upsert_new_title( $post_id, $new_title, $original_title ) {
|
||||
*/
|
||||
function wpseo_upsert_meta( $post_id, $new_meta_value, $orig_meta_value, $meta_key, $return_key ) {
|
||||
|
||||
$post_id = intval( $post_id );
|
||||
$sanitized_new_meta_value = wp_strip_all_tags( $new_meta_value );
|
||||
$orig_meta_value = wp_strip_all_tags( $orig_meta_value );
|
||||
|
||||
$upsert_results = array(
|
||||
'status' => 'success',
|
||||
'post_id' => $post_id,
|
||||
@@ -201,7 +205,14 @@ function wpseo_upsert_meta( $post_id, $new_meta_value, $orig_meta_value, $meta_k
|
||||
|
||||
}
|
||||
|
||||
$res = update_post_meta( $post_id, $meta_key, $new_meta_value );
|
||||
if ( $sanitized_new_meta_value === $orig_meta_value && $sanitized_new_meta_value !== $new_meta_value ) {
|
||||
$upsert_results['status'] = 'failure';
|
||||
$upsert_results['results'] = __( 'You have used HTML in your value which is not allowed.', 'wordpress-seo' );
|
||||
|
||||
return $upsert_results;
|
||||
}
|
||||
|
||||
$res = update_post_meta( $post_id, $meta_key, $sanitized_new_meta_value );
|
||||
|
||||
$upsert_results['status'] = ( $res !== false ) ? 'success' : 'failure';
|
||||
$upsert_results['results'] = $res;
|
||||
@@ -215,8 +226,8 @@ function wpseo_upsert_meta( $post_id, $new_meta_value, $orig_meta_value, $meta_k
|
||||
function wpseo_save_all_titles() {
|
||||
check_ajax_referer( 'wpseo-bulk-editor' );
|
||||
|
||||
$new_titles = $_POST['titles'];
|
||||
$original_titles = $_POST['existing_titles'];
|
||||
$new_titles = $_POST['items'];
|
||||
$original_titles = $_POST['existing_items'];
|
||||
|
||||
$results = array();
|
||||
|
||||
@@ -236,11 +247,12 @@ add_action( 'wp_ajax_wpseo_save_all_titles', 'wpseo_save_all_titles' );
|
||||
* Save an individual meta description from the Bulk Editor.
|
||||
*/
|
||||
function wpseo_save_description() {
|
||||
|
||||
check_ajax_referer( 'wpseo-bulk-editor' );
|
||||
|
||||
$new_metadesc = $_POST['new_metadesc'];
|
||||
$new_metadesc = $_POST['new_value'];
|
||||
$id = intval( $_POST['wpseo_post_id'] );
|
||||
$original_metadesc = $_POST['existing_metadesc'];
|
||||
$original_metadesc = $_POST['existing_value'];
|
||||
|
||||
$results = wpseo_upsert_new_description( $id, $new_metadesc, $original_metadesc );
|
||||
|
||||
@@ -248,7 +260,7 @@ function wpseo_save_description() {
|
||||
die();
|
||||
}
|
||||
|
||||
add_action( 'wp_ajax_wpseo_save_desc', 'wpseo_save_description' );
|
||||
add_action( 'wp_ajax_wpseo_save_metadesc', 'wpseo_save_description' );
|
||||
|
||||
/**
|
||||
* Helper function to create or update a post's meta description.
|
||||
@@ -266,8 +278,8 @@ function wpseo_upsert_new_description( $post_id, $new_metadesc, $original_metade
|
||||
function wpseo_save_all_descriptions() {
|
||||
check_ajax_referer( 'wpseo-bulk-editor' );
|
||||
|
||||
$new_metadescs = $_POST['metadescs'];
|
||||
$original_metadescs = $_POST['existing_metadescs'];
|
||||
$new_metadescs = $_POST['items'];
|
||||
$original_metadescs = $_POST['existing_items'];
|
||||
|
||||
$results = array();
|
||||
|
||||
@@ -281,4 +293,4 @@ function wpseo_save_all_descriptions() {
|
||||
die();
|
||||
}
|
||||
|
||||
add_action( 'wp_ajax_wpseo_save_all_descs', 'wpseo_save_all_descriptions' );
|
||||
add_action( 'wp_ajax_wpseo_save_all_descriptions', 'wpseo_save_all_descriptions' );
|
||||
@@ -66,6 +66,8 @@ if ( ! class_exists( 'WPSEO_Admin' ) ) {
|
||||
add_filter( 'set-screen-option', array( $this, 'save_bulk_edit_options' ), 10, 3 );
|
||||
|
||||
add_filter( 'upgrader_post_install', array( $this, 'remove_transients_on_update' ), 10, 1 );
|
||||
|
||||
add_action( 'activated_plugin', array( 'WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts' ), 10, 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,11 +88,14 @@ if ( ! class_exists( 'WPSEO_Admin' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Base 64 encoded SVG image
|
||||
$icon_svg = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCIgWw0KCTwhRU5USVRZIG5zX2Zsb3dzICJodHRwOi8vbnMuYWRvYmUuY29tL0Zsb3dzLzEuMC8iPg0KCTwhRU5USVRZIG5zX2V4dGVuZCAiaHR0cDovL25zLmFkb2JlLmNvbS9FeHRlbnNpYmlsaXR5LzEuMC8iPg0KCTwhRU5USVRZIG5zX2FpICJodHRwOi8vbnMuYWRvYmUuY29tL0Fkb2JlSWxsdXN0cmF0b3IvMTAuMC8iPg0KCTwhRU5USVRZIG5zX2dyYXBocyAiaHR0cDovL25zLmFkb2JlLmNvbS9HcmFwaHMvMS4wLyI+DQpdPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYWFnXzEiIHhtbG5zOng9IiZuc19leHRlbmQ7IiB4bWxuczppPSImbnNfYWk7IiB4bWxuczpncmFwaD0iJm5zX2dyYXBoczsiDQoJIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOmE9Imh0dHA6Ly9ucy5hZG9iZS5jb20vQWRvYmVTVkdWaWV3ZXJFeHRlbnNpb25zLzMuMC8iDQoJIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDAgMzEuODkiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDQwIDMxLjg5IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KPHBhdGggZmlsbD0iI0ZGRkZGRiIgZD0iTTQwLDEyLjUyNEM0MCw1LjYwOCwzMS40NjksMCwyMCwwQzguNTMsMCwwLDUuNjA4LDAsMTIuNTI0YzAsNS41Niw1LjI0MywxMC4yNzIsMTMuNTU3LDExLjkwN3YtNC4wNjUNCgljMCwwLDAuMDQtMS0wLjI4LTEuOTJjLTAuMzItMC45MjEtMS43Ni0zLjAwMS0xLjc2LTUuMTIxYzAtMi4xMjEsMi41NjEtOS41NjMsNS4xMjItMTAuNDQ0Yy0wLjQsMS4yMDEtMC4zMiw3LjY4My0wLjMyLDcuNjgzDQoJczEuNCwyLjcyLDQuNjQxLDIuNzJjMy4yNDIsMCw0LjUxMS0xLjc2LDQuNzE1LTIuMmMwLjIwNi0wLjQ0LDAuODQ2LTguNzIzLDAuODQ2LTguNzIzczQuMDgyLDQuNDAyLDMuNjgyLDkuMzYzDQoJYy0wLjQwMSw0Ljk2Mi00LjQ4Miw3LjIwMy02LjEyMiw5LjEyM2MtMS4yODYsMS41MDUtMi4yMjQsMy4xMy0yLjYyOSw0LjE2OGMwLjgwMS0wLjAzNCwxLjU4Ny0wLjA5OCwyLjM2MS0wLjE4NGw5LjE1MSw3LjA1OQ0KCWwtNC44ODQtNy44M0MzNS41MzUsMjIuMTYxLDQwLDE3LjcxMyw0MCwxMi41MjR6Ii8+DQo8L2c+DQo8L3N2Zz4=';
|
||||
|
||||
// Add main page
|
||||
$admin_page = add_menu_page( __( 'Yoast WordPress SEO:', 'wordpress-seo' ) . ' ' . __( 'General Settings', 'wordpress-seo' ), __( 'SEO', 'wordpress-seo' ), 'manage_options', 'wpseo_dashboard', array(
|
||||
$this,
|
||||
'load_page',
|
||||
), plugins_url( 'images/yoast-icon.png', WPSEO_FILE ), '99.31337' );
|
||||
), $icon_svg, '99.31337' );
|
||||
|
||||
/**
|
||||
* Filter: 'wpseo_manage_options_capability' - Allow changing the capability users need to view the settings pages
|
||||
@@ -158,7 +163,7 @@ if ( ! class_exists( 'WPSEO_Admin' ) ) {
|
||||
array(
|
||||
'wpseo_dashboard',
|
||||
'',
|
||||
__( 'Import & Export', 'wordpress-seo' ),
|
||||
esc_html__( 'Import & Export', 'wordpress-seo' ),
|
||||
$manage_options_cap,
|
||||
'wpseo_import',
|
||||
array( $this, 'load_page' ),
|
||||
@@ -266,10 +271,12 @@ if ( ! class_exists( 'WPSEO_Admin' ) ) {
|
||||
*/
|
||||
function register_network_settings_page() {
|
||||
if ( WPSEO_Options::grant_access() ) {
|
||||
// Base 64 encoded SVG image
|
||||
$icon_svg = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCIgWw0KCTwhRU5USVRZIG5zX2Zsb3dzICJodHRwOi8vbnMuYWRvYmUuY29tL0Zsb3dzLzEuMC8iPg0KCTwhRU5USVRZIG5zX2V4dGVuZCAiaHR0cDovL25zLmFkb2JlLmNvbS9FeHRlbnNpYmlsaXR5LzEuMC8iPg0KCTwhRU5USVRZIG5zX2FpICJodHRwOi8vbnMuYWRvYmUuY29tL0Fkb2JlSWxsdXN0cmF0b3IvMTAuMC8iPg0KCTwhRU5USVRZIG5zX2dyYXBocyAiaHR0cDovL25zLmFkb2JlLmNvbS9HcmFwaHMvMS4wLyI+DQpdPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYWFnXzEiIHhtbG5zOng9IiZuc19leHRlbmQ7IiB4bWxuczppPSImbnNfYWk7IiB4bWxuczpncmFwaD0iJm5zX2dyYXBoczsiDQoJIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOmE9Imh0dHA6Ly9ucy5hZG9iZS5jb20vQWRvYmVTVkdWaWV3ZXJFeHRlbnNpb25zLzMuMC8iDQoJIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDAgMzEuODkiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDQwIDMxLjg5IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KPHBhdGggZmlsbD0iI0ZGRkZGRiIgZD0iTTQwLDEyLjUyNEM0MCw1LjYwOCwzMS40NjksMCwyMCwwQzguNTMsMCwwLDUuNjA4LDAsMTIuNTI0YzAsNS41Niw1LjI0MywxMC4yNzIsMTMuNTU3LDExLjkwN3YtNC4wNjUNCgljMCwwLDAuMDQtMS0wLjI4LTEuOTJjLTAuMzItMC45MjEtMS43Ni0zLjAwMS0xLjc2LTUuMTIxYzAtMi4xMjEsMi41NjEtOS41NjMsNS4xMjItMTAuNDQ0Yy0wLjQsMS4yMDEtMC4zMiw3LjY4My0wLjMyLDcuNjgzDQoJczEuNCwyLjcyLDQuNjQxLDIuNzJjMy4yNDIsMCw0LjUxMS0xLjc2LDQuNzE1LTIuMmMwLjIwNi0wLjQ0LDAuODQ2LTguNzIzLDAuODQ2LTguNzIzczQuMDgyLDQuNDAyLDMuNjgyLDkuMzYzDQoJYy0wLjQwMSw0Ljk2Mi00LjQ4Miw3LjIwMy02LjEyMiw5LjEyM2MtMS4yODYsMS41MDUtMi4yMjQsMy4xMy0yLjYyOSw0LjE2OGMwLjgwMS0wLjAzNCwxLjU4Ny0wLjA5OCwyLjM2MS0wLjE4NGw5LjE1MSw3LjA1OQ0KCWwtNC44ODQtNy44M0MzNS41MzUsMjIuMTYxLDQwLDE3LjcxMyw0MCwxMi41MjR6Ii8+DQo8L2c+DQo8L3N2Zz4=';
|
||||
add_menu_page( __( 'Yoast WordPress SEO:', 'wordpress-seo' ) . ' ' . __( 'MultiSite Settings', 'wordpress-seo' ), __( 'SEO', 'wordpress-seo' ), 'delete_users', 'wpseo_dashboard', array(
|
||||
$this,
|
||||
'network_config_page',
|
||||
), plugins_url( 'images/yoast-icon.png', WPSEO_FILE ) );
|
||||
), $icon_svg );
|
||||
|
||||
if ( wpseo_allow_system_file_edit() === true ) {
|
||||
add_submenu_page( 'wpseo_dashboard', __( 'Yoast WordPress SEO:', 'wordpress-seo' ) . ' ' . __( 'Edit Files', 'wordpress-seo' ), __( 'Edit Files', 'wordpress-seo' ), 'delete_users', 'wpseo_files', array(
|
||||
@@ -569,6 +576,11 @@ if ( ! class_exists( 'WPSEO_Admin' ) ) {
|
||||
return $slug;
|
||||
}
|
||||
|
||||
// Don't change slug if the post is a draft, this conflicts with polylang
|
||||
if ( 'draft' == $_POST['post_status'] ) {
|
||||
return $slug;
|
||||
}
|
||||
|
||||
// Lowercase the slug and strip slashes
|
||||
$clean_slug = sanitize_title( stripslashes( $_POST['post_title'] ) );
|
||||
|
||||
@@ -590,7 +602,7 @@ if ( ! class_exists( 'WPSEO_Admin' ) ) {
|
||||
*/
|
||||
function stopwords() {
|
||||
/* translators: this should be an array of stopwords for your language, separated by comma's. */
|
||||
$stopwords = explode( ',', __( "a,about,above,after,again,against,all,am,an,and,any,are,aren't,as,at,be,because,been,before,being,below,between,both,but,by,can't,cannot,could,couldn't,did,didn't,do,does,doesn't,doing,don't,down,during,each,few,for,from,further,had,hadn't,has,hasn't,have,haven't,having,he,he'd,he'll,he's,her,here,here's,hers,herself,him,himself,his,how,how's,i,i'd,i'll,i'm,i've,if,in,into,is,isn't,it,it's,its,itself,let's,me,more,most,mustn't,my,myself,no,nor,not,of,off,on,once,only,or,other,ought,our,ours,ourselves,out,over,own,same,shan't,she,she'd,she'll,she's,should,shouldn't,so,some,such,than,that,that's,the,their,theirs,them,themselves,then,there,there's,these,they,they'd,they'll,they're,they've,this,those,through,to,too,under,until,up,very,was,wasn't,we,we'd,we'll,we're,we've,were,weren't,what,what's,when,when's,where,where's,which,while,who,who's,whom,why,why's,with,won't,would,wouldn't,you,you'd,you'll,you're,you've,your,yours,yourself,yourselves", 'wordpress-seo' ) );
|
||||
$stopwords = explode( ',', __( "a,about,above,after,again,against,all,am,an,and,any,are,as,at,be,because,been,before,being,below,between,both,but,by,could,did,do,does,doing,down,during,each,few,for,from,further,had,has,have,having,he,he'd,he'll,he's,her,here,here's,hers,herself,him,himself,his,how,how's,i,i'd,i'll,i'm,i've,if,in,into,is,it,it's,its,itself,let's,me,more,most,my,myself,nor,of,on,once,only,or,other,ought,our,ours,ourselves,out,over,own,same,she,she'd,she'll,she's,should,so,some,such,than,that,that's,the,their,theirs,them,themselves,then,there,there's,these,they,they'd,they'll,they're,they've,this,those,through,to,too,under,until,up,very,was,we,we'd,we'll,we're,we've,were,what,what's,when,when's,where,where's,which,while,who,who's,whom,why,why's,with,would,you,you'd,you'll,you're,you've,your,yours,yourself,yourselves", 'wordpress-seo' ) );
|
||||
|
||||
/**
|
||||
* Allows filtering of the stop words list
|
||||
|
||||
+23
-34
@@ -35,58 +35,47 @@ if ( ! class_exists( 'WPSEO_Bulk_Description_List_Table' ) ) {
|
||||
'ajax' => true,
|
||||
);
|
||||
|
||||
/**
|
||||
* The field in the database where meta field is saved.
|
||||
* @var string
|
||||
*/
|
||||
protected $target_db_field = 'metadesc';
|
||||
|
||||
/**
|
||||
* The columns shown on the table
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_columns() {
|
||||
return $columns = array(
|
||||
'col_page_title' => __( 'WP Page Title', 'wordpress-seo' ),
|
||||
'col_post_type' => __( 'Post Type', 'wordpress-seo' ),
|
||||
'col_post_status' => __( 'Post Status', 'wordpress-seo' ),
|
||||
'col_post_date' => __( 'Publication date', 'wordpress-seo' ),
|
||||
'col_page_slug' => __( 'Page URL/Slug', 'wordpress-seo' ),
|
||||
public function get_columns() {
|
||||
$columns = array(
|
||||
'col_existing_yoast_seo_metadesc' => __( 'Existing Yoast Meta Description', 'wordpress-seo' ),
|
||||
'col_new_yoast_seo_metadesc' => __( 'New Yoast Meta Description', 'wordpress-seo' ),
|
||||
'col_row_action' => __( 'Action', 'wordpress-seo' ),
|
||||
);
|
||||
|
||||
return $this->merge_columns( $columns );
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for setting the meta data, which belongs to the records that will be shown on the current page
|
||||
* Parse the metadescription
|
||||
*
|
||||
* This method will loop through the current items ($this->items) for getting the post_id. With this data
|
||||
* ($needed_ids) the method will query the meta-data table for getting the metadescription.
|
||||
* @param string $column_name
|
||||
* @param object $record
|
||||
* @param string $attributes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_meta_data() {
|
||||
protected function parse_page_specific_column( $column_name, $record, $attributes ) {
|
||||
switch ( $column_name ) {
|
||||
case 'col_new_yoast_seo_metadesc' :
|
||||
return sprintf( '<textarea id="%1$s" name="%1$s" class="wpseo-new-metadesc" data-id="%2$s"></textarea>', 'wpseo-new-metadesc-' . $record->ID, $record->ID );
|
||||
break;
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$needed_ids = array();
|
||||
foreach ( $this->items AS $item ) {
|
||||
$needed_ids[] = $item->ID;
|
||||
case 'col_existing_yoast_seo_metadesc':
|
||||
echo $this->parse_meta_data_field( $record->ID, $attributes );
|
||||
break;
|
||||
}
|
||||
|
||||
$post_ids = "'" . implode( "', '", $needed_ids ) . "'";
|
||||
$meta_data = $wpdb->get_results(
|
||||
"
|
||||
SELECT *
|
||||
FROM {$wpdb->postmeta}
|
||||
WHERE post_id IN({$post_ids}) && meta_key = '" . WPSEO_Meta::$meta_prefix . "metadesc'
|
||||
"
|
||||
);
|
||||
|
||||
foreach ( $meta_data AS $row ) {
|
||||
$this->meta_data[$row->post_id][$row->meta_key] = $row->meta_value;
|
||||
}
|
||||
|
||||
// Little housekeeping
|
||||
unset( $needed_ids, $post_ids, $meta_data );
|
||||
|
||||
}
|
||||
|
||||
|
||||
} /* End of class */
|
||||
} /* End of class-exists wrapper */
|
||||
@@ -89,6 +89,8 @@ if ( ! class_exists( 'WPSEO_Bulk_List_Table' ) ) {
|
||||
*/
|
||||
protected $settings;
|
||||
|
||||
protected $pagination = array();
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
@@ -109,6 +111,14 @@ if ( ! class_exists( 'WPSEO_Bulk_List_Table' ) ) {
|
||||
|
||||
}
|
||||
|
||||
public function show_page() {
|
||||
$this->prepare_page_navigation();
|
||||
$this->prepare_items();
|
||||
|
||||
$this->views();
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used in the constructor to build a reference list of post types the current user can edit.
|
||||
*/
|
||||
@@ -148,13 +158,13 @@ if ( ! class_exists( 'WPSEO_Bulk_List_Table' ) ) {
|
||||
?>
|
||||
<div class="tablenav <?php echo esc_attr( $which ); ?>">
|
||||
|
||||
<?php if ( 'top' === $which ) { ?>
|
||||
<?php if ('top' === $which) { ?>
|
||||
<form id="posts-filter" action="" method="get">
|
||||
<input type="hidden" name="page" value="wpseo_bulk-editor" />
|
||||
<input type="hidden" name="type" value="<?php echo $this->page_type; ?>" />
|
||||
<input type="hidden" name="orderby" value="<?php echo $_GET['orderby']; ?>" />
|
||||
<input type="hidden" name="order" value="<?php echo $_GET['order']; ?>" />
|
||||
<input type="hidden" name="post_type_filter" value="<?php echo $_GET['post_type_filter']; ?>" />
|
||||
<input type="hidden" name="type" value="<?php echo esc_attr( $this->page_type ); ?>" />
|
||||
<input type="hidden" name="orderby" value="<?php echo esc_attr( $_GET['orderby'] ); ?>" />
|
||||
<input type="hidden" name="order" value="<?php echo esc_attr( $_GET['order'] ); ?>" />
|
||||
<input type="hidden" name="post_type_filter" value="<?php echo esc_attr( $_GET['post_type_filter'] ); ?>" />
|
||||
<?php if ( ! empty( $post_status ) ) { ?>
|
||||
<input type="hidden" name="post_status" value="<?php echo esc_attr( $post_status ); ?>" />
|
||||
<?php } ?>
|
||||
@@ -166,7 +176,7 @@ if ( ! class_exists( 'WPSEO_Bulk_List_Table' ) ) {
|
||||
?>
|
||||
|
||||
<br class="clear" />
|
||||
<?php if ( 'top' === $which ) { ?>
|
||||
<?php if ('top' === $which) { ?>
|
||||
</form>
|
||||
<?php } ?>
|
||||
</div>
|
||||
@@ -384,10 +394,72 @@ if ( ! class_exists( 'WPSEO_Bulk_List_Table' ) ) {
|
||||
* Preparing the requested pagerows and setting the needed variables
|
||||
*/
|
||||
function prepare_items() {
|
||||
|
||||
$post_type_clause = $this->get_post_type_clause();
|
||||
$all_states = $this->get_all_states();
|
||||
$subquery = $this->get_base_subquery();
|
||||
|
||||
// Setting the column headers
|
||||
$this->set_column_headers();
|
||||
|
||||
// Count the total number of needed items and setting pagination given $total_items
|
||||
$total_items = $this->count_items( $subquery, $all_states, $post_type_clause );
|
||||
$this->set_pagination( $total_items );
|
||||
|
||||
// Getting items given $query
|
||||
$query = $this->parse_item_query( $subquery, $all_states, $post_type_clause );
|
||||
$this->get_items( $query );
|
||||
|
||||
// Get the metadata for the current items ($this->items)
|
||||
$this->get_meta_data();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting the columns for first row
|
||||
*
|
||||
* @param array $columns
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_columns( ) {
|
||||
return $this->merge_columns( );
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the column headers
|
||||
*/
|
||||
protected function set_column_headers() {
|
||||
$columns = $this->get_columns();
|
||||
$hidden = array();
|
||||
$sortable = $this->get_sortable_columns();
|
||||
$this->_column_headers = array( $columns, $hidden, $sortable );
|
||||
}
|
||||
|
||||
/**
|
||||
* Counting total items
|
||||
* @return mixed
|
||||
*/
|
||||
protected function count_items( $subquery, $all_states, $post_type_clause ) {
|
||||
global $wpdb;
|
||||
$total_items = $wpdb->get_var(
|
||||
"
|
||||
SELECT COUNT(ID)
|
||||
FROM {$subquery}
|
||||
WHERE post_status IN ({$all_states}) $post_type_clause
|
||||
"
|
||||
);
|
||||
|
||||
return $total_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting the post_type_clause filter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_post_type_clause() {
|
||||
// Filter Block
|
||||
|
||||
$post_types = null;
|
||||
$post_type_clause = '';
|
||||
|
||||
@@ -396,6 +468,56 @@ if ( ! class_exists( 'WPSEO_Bulk_List_Table' ) ) {
|
||||
$post_type_clause = "AND post_type IN ('{$post_types}')";
|
||||
}
|
||||
|
||||
return $post_type_clause;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the pagination
|
||||
*
|
||||
* Total items is the number of all visible items
|
||||
*
|
||||
* @param $total_items
|
||||
*/
|
||||
protected function set_pagination( $total_items ) {
|
||||
|
||||
// Calculate items per page
|
||||
$per_page = $this->get_items_per_page( 'wpseo_posts_per_page', 10 );
|
||||
|
||||
$paged = ! empty( $_GET['paged'] ) ? esc_sql( sanitize_text_field( $_GET['paged'] ) ) : '';
|
||||
|
||||
if ( empty( $paged ) || ! is_numeric( $paged ) || $paged <= 0 ) {
|
||||
$paged = 1;
|
||||
}
|
||||
|
||||
$this->set_pagination_args(
|
||||
array(
|
||||
'total_items' => $total_items,
|
||||
'total_pages' => ceil( $total_items / $per_page ),
|
||||
'per_page' => $per_page,
|
||||
)
|
||||
);
|
||||
|
||||
$this->pagination = array(
|
||||
'per_page' => $per_page,
|
||||
'offset' => ( $paged - 1 ) * $per_page,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the query to get items from database
|
||||
*
|
||||
* Based on given parameters there will be parse a query which will get all the pages/posts and other post_types
|
||||
* from the database
|
||||
*
|
||||
* @param $subquery
|
||||
* @param $all_states
|
||||
* @param $post_type_clause
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function parse_item_query( $subquery, $all_states, $post_type_clause ) {
|
||||
|
||||
// Order By block
|
||||
$orderby = ! empty( $_GET['orderby'] ) ? esc_sql( sanitize_text_field( $_GET['orderby'] ) ) : 'post_title';
|
||||
$order = 'ASC';
|
||||
@@ -404,6 +526,41 @@ if ( ! class_exists( 'WPSEO_Bulk_List_Table' ) ) {
|
||||
$order = esc_sql( strtoupper( sanitize_text_field( $_GET['order'] ) ) );
|
||||
}
|
||||
|
||||
// Get all needed results
|
||||
$query = "
|
||||
SELECT ID, post_title, post_type, post_status, post_modified, post_date
|
||||
FROM {$subquery}
|
||||
WHERE post_status IN ({$all_states}) $post_type_clause
|
||||
ORDER BY {$orderby} {$order}
|
||||
LIMIT %d,%d
|
||||
";
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting all the items
|
||||
*
|
||||
* @param string $query
|
||||
*/
|
||||
protected function get_items( $query ) {
|
||||
global $wpdb;
|
||||
|
||||
$this->items = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
$query,
|
||||
$this->pagination['offset'],
|
||||
$this->pagination['per_page']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting all the states
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_all_states() {
|
||||
$states = get_post_stati( array( 'show_in_admin_all_list' => true ) );
|
||||
$states['trash'] = 'trash';
|
||||
|
||||
@@ -417,64 +574,10 @@ if ( ! class_exists( 'WPSEO_Bulk_List_Table' ) ) {
|
||||
$states = esc_sql( $states );
|
||||
$all_states = "'" . implode( "', '", $states ) . "'";
|
||||
|
||||
$subquery = $this->get_base_subquery();
|
||||
|
||||
// Count the total number of needed items
|
||||
$total_items = $wpdb->get_var(
|
||||
"
|
||||
SELECT COUNT(ID)
|
||||
FROM {$subquery}
|
||||
WHERE post_status IN ({$all_states}) $post_type_clause
|
||||
"
|
||||
);
|
||||
|
||||
// Get all needed results
|
||||
$query = "
|
||||
SELECT ID, post_title, post_type, post_status, post_modified, post_date
|
||||
FROM {$subquery}
|
||||
WHERE post_status IN ({$all_states}) $post_type_clause
|
||||
ORDER BY {$orderby} {$order}
|
||||
LIMIT %d,%d
|
||||
";
|
||||
|
||||
$per_page = $this->get_items_per_page( 'wpseo_posts_per_page', 10 );
|
||||
|
||||
$paged = ! empty( $_GET['paged'] ) ? esc_sql( sanitize_text_field( $_GET['paged'] ) ) : '';
|
||||
|
||||
if ( empty( $paged ) || ! is_numeric( $paged ) || $paged <= 0 ) {
|
||||
$paged = 1;
|
||||
}
|
||||
|
||||
$total_pages = ceil( $total_items / $per_page );
|
||||
|
||||
$offset = ( $paged - 1 ) * $per_page;
|
||||
|
||||
$this->set_pagination_args(
|
||||
array(
|
||||
'total_items' => $total_items,
|
||||
'total_pages' => $total_pages,
|
||||
'per_page' => $per_page,
|
||||
)
|
||||
);
|
||||
|
||||
$columns = $this->get_columns();
|
||||
$hidden = array();
|
||||
$sortable = $this->get_sortable_columns();
|
||||
$this->_column_headers = array( $columns, $hidden, $sortable );
|
||||
|
||||
$this->items = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
$query,
|
||||
$offset,
|
||||
$per_page
|
||||
)
|
||||
);
|
||||
|
||||
// Get the metadata for the current items ($this->items)
|
||||
$this->get_meta_data();
|
||||
|
||||
return $all_states;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Based on $this->items and the defined columns, the table rows will be displayed.
|
||||
*
|
||||
@@ -485,101 +588,24 @@ if ( ! class_exists( 'WPSEO_Bulk_List_Table' ) ) {
|
||||
|
||||
list( $columns, $hidden ) = $this->get_column_info();
|
||||
|
||||
|
||||
$date_format = get_option( 'date_format' );
|
||||
|
||||
if ( ( is_array( $records ) && $records !== array() ) && ( is_array( $columns ) && $columns !== array() ) ) {
|
||||
foreach ( $records as $rec ) {
|
||||
|
||||
// Fill meta data if exists in $this->meta_data
|
||||
$meta_data = ( ! empty( $this->meta_data[$rec->ID] ) ) ? $this->meta_data[$rec->ID] : array();
|
||||
foreach ( $records as $rec ) {
|
||||
|
||||
echo '<tr id="record_' . $rec->ID . '">';
|
||||
|
||||
foreach ( $columns as $column_name => $column_display_name ) {
|
||||
|
||||
$class = sprintf( 'class="%1$s column-%1$s"', $column_name );
|
||||
$style = '';
|
||||
$attributes = $this->column_attributes( $column_name, $hidden );
|
||||
|
||||
if ( in_array( $column_name, $hidden ) ) {
|
||||
$style = ' style="display:none;"';
|
||||
$column_value = $this->parse_column( $column_name, $rec );
|
||||
|
||||
if ( method_exists( $this, 'parse_page_specific_column' ) && empty( $column_value ) ) {
|
||||
$column_value = $this->parse_page_specific_column( $column_name, $rec, $attributes );
|
||||
}
|
||||
|
||||
$attributes = $class . $style;
|
||||
|
||||
switch ( $column_name ) {
|
||||
case 'col_page_title':
|
||||
echo sprintf( '<td %2$s><strong>%1$s</strong>', stripslashes( $rec->post_title ), $attributes );
|
||||
|
||||
$post_type_object = get_post_type_object( $rec->post_type );
|
||||
$can_edit_post = current_user_can( $post_type_object->cap->edit_post, $rec->ID );
|
||||
|
||||
$actions = array();
|
||||
|
||||
if ( $can_edit_post && 'trash' != $rec->post_status ) {
|
||||
$actions['edit'] = '<a href="' . esc_url( get_edit_post_link( $rec->ID, true ) ) . '" title="' . esc_attr( __( 'Edit this item', 'wordpress-seo' ) ) . '">' . __( 'Edit', 'wordpress-seo' ) . '</a>';
|
||||
}
|
||||
|
||||
if ( $post_type_object->public ) {
|
||||
if ( in_array( $rec->post_status, array( 'pending', 'draft', 'future' ) ) ) {
|
||||
if ( $can_edit_post ) {
|
||||
$actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $rec->ID ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”', 'wordpress-seo' ), $rec->post_title ) ) . '">' . __( 'Preview', 'wordpress-seo' ) . '</a>';
|
||||
}
|
||||
} elseif ( 'trash' != $rec->post_status ) {
|
||||
$actions['view'] = '<a href="' . esc_url( get_permalink( $rec->ID ) ) . '" title="' . esc_attr( sprintf( __( 'View “%s”', 'wordpress-seo' ), $rec->post_title ) ) . '" rel="bookmark">' . __( 'View', 'wordpress-seo' ) . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
echo $this->row_actions( $actions );
|
||||
echo '</td>';
|
||||
break;
|
||||
|
||||
case 'col_page_slug':
|
||||
$permalink = get_permalink( $rec->ID );
|
||||
$display_slug = str_replace( get_bloginfo( 'url' ), '', $permalink );
|
||||
echo sprintf( '<td %2$s><a href="%3$s" target="_blank">%1$s</a></td>', stripslashes( $display_slug ), $attributes, esc_url( $permalink ) );
|
||||
break;
|
||||
|
||||
case 'col_post_type':
|
||||
$post_type = get_post_type_object( $rec->post_type );
|
||||
echo sprintf( '<td %2$s>%1$s</td>', $post_type->labels->singular_name, $attributes );
|
||||
break;
|
||||
|
||||
case 'col_post_status':
|
||||
$post_status = get_post_status_object( $rec->post_status );
|
||||
echo sprintf( '<td %2$s>%1$s</td>', $post_status->label, $attributes );
|
||||
break;
|
||||
|
||||
case 'col_post_date':
|
||||
$cell_value = date_i18n( $date_format, strtotime( $rec->post_date ) );
|
||||
echo sprintf( '<td %2$s>%1$s</td>', $cell_value, $attributes );
|
||||
break;
|
||||
|
||||
case 'col_existing_yoast_seo_title':
|
||||
$cell_value = ( ( ! empty( $meta_data[WPSEO_Meta::$meta_prefix . 'title'] ) ) ? $meta_data[WPSEO_Meta::$meta_prefix . 'title'] : '' );
|
||||
echo sprintf( '<td %2$s id="wpseo-existing-title-%3$s">%1$s</td>', $cell_value, $attributes, $rec->ID );
|
||||
break;
|
||||
|
||||
case 'col_new_yoast_seo_title':
|
||||
$input = sprintf( '<input type="text" id="%1$s" name="%1$s" class="wpseo-new-title" data-id="%2$s" />', 'wpseo-new-title-' . $rec->ID, $rec->ID );
|
||||
echo sprintf( '<td %2$s>%1$s</td>', $input, $attributes );
|
||||
break;
|
||||
|
||||
case 'col_new_yoast_seo_metadesc' :
|
||||
$input = sprintf( '<textarea id="%1$s" name="%1$s" class="wpseo-new-metadesc" data-id="%2$s"></textarea>', 'wpseo-new-metadesc-' . $rec->ID, $rec->ID );
|
||||
echo sprintf( '<td %2$s>%1$s</td>', $input, $attributes );
|
||||
break;
|
||||
|
||||
|
||||
case 'col_existing_yoast_seo_metadesc':
|
||||
$cell_value = ( ( ! empty( $meta_data[WPSEO_Meta::$meta_prefix . 'metadesc'] ) ) ? $meta_data[WPSEO_Meta::$meta_prefix . 'metadesc'] : '' );
|
||||
echo sprintf( '<td %2$s id="wpseo-existing-metadesc-%3$s">%1$s</td>', $cell_value, $attributes, $rec->ID );
|
||||
break;
|
||||
|
||||
case 'col_row_action':
|
||||
$actions = sprintf( '<a href="#" class="wpseo-save" data-id="%1$s">Save</a> | <a href="#" class="wpseo-save-all">Save All</a>', $rec->ID );
|
||||
echo sprintf( '<td %2$s>%1$s</td>', $actions, $attributes );
|
||||
break;
|
||||
if ( ! empty( $column_value ) ) {
|
||||
echo sprintf( '<td %2$s>%1$s</td>', $column_value, $attributes );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -587,5 +613,233 @@ if ( ! class_exists( 'WPSEO_Bulk_List_Table' ) ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting the attributes for each table cell
|
||||
*
|
||||
* @param string $column_name
|
||||
* @param string $hidden
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function column_attributes( $column_name, $hidden ) {
|
||||
|
||||
$class = sprintf( 'class="%1$s column-%1$s"', $column_name );
|
||||
$style = '';
|
||||
|
||||
if ( in_array( $column_name, $hidden ) ) {
|
||||
$style = ' style="display:none;"';
|
||||
}
|
||||
|
||||
$attributes = $class . $style;
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parsing the title
|
||||
* @param object $rec
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function parse_page_title_column( $rec ) {
|
||||
|
||||
$return = sprintf( '<strong>%1$s</strong>', stripslashes( wp_strip_all_tags( $rec->post_title ) ) );
|
||||
|
||||
$post_type_object = get_post_type_object( $rec->post_type );
|
||||
$can_edit_post = current_user_can( $post_type_object->cap->edit_post, $rec->ID );
|
||||
|
||||
$actions = array();
|
||||
|
||||
if ( $can_edit_post && 'trash' != $rec->post_status ) {
|
||||
$actions['edit'] = '<a href="' . esc_url( get_edit_post_link( $rec->ID, true ) ) . '" title="' . esc_attr( __( 'Edit this item', 'wordpress-seo' ) ) . '">' . __( 'Edit', 'wordpress-seo' ) . '</a>';
|
||||
}
|
||||
|
||||
if ( $post_type_object->public ) {
|
||||
if ( in_array( $rec->post_status, array( 'pending', 'draft', 'future' ) ) ) {
|
||||
if ( $can_edit_post ) {
|
||||
$actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $rec->ID ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”', 'wordpress-seo' ), $rec->post_title ) ) . '">' . __( 'Preview', 'wordpress-seo' ) . '</a>';
|
||||
}
|
||||
} elseif ( 'trash' != $rec->post_status ) {
|
||||
$actions['view'] = '<a href="' . esc_url( get_permalink( $rec->ID ) ) . '" title="' . esc_attr( sprintf( __( 'View “%s”', 'wordpress-seo' ), $rec->post_title ) ) . '" rel="bookmark">' . __( 'View', 'wordpress-seo' ) . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$return .= $this->row_actions( $actions );
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Parsing the column based on the $column_name
|
||||
*
|
||||
* @param string $column_name
|
||||
* @param stdobject $rec
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function parse_column( $column_name, $rec ) {
|
||||
|
||||
static $date_format;
|
||||
|
||||
if ( $date_format == null ) {
|
||||
$date_format = get_option( 'date_format' );
|
||||
}
|
||||
|
||||
switch ( $column_name ) {
|
||||
case 'col_page_title':
|
||||
$column_value = $this->parse_page_title_column( $rec );
|
||||
|
||||
break;
|
||||
|
||||
case 'col_page_slug':
|
||||
$permalink = get_permalink( $rec->ID );
|
||||
$display_slug = str_replace( get_bloginfo( 'url' ), '', $permalink );
|
||||
$column_value = sprintf( '<a href="%2$s" target="_blank">%1$s</a>', stripslashes( $display_slug ), esc_url( $permalink ) );
|
||||
break;
|
||||
|
||||
case 'col_post_type':
|
||||
$post_type = get_post_type_object( $rec->post_type );
|
||||
$column_value = $post_type->labels->singular_name;
|
||||
break;
|
||||
|
||||
case 'col_post_status':
|
||||
$post_status = get_post_status_object( $rec->post_status );
|
||||
$column_value = $post_status->label;
|
||||
break;
|
||||
|
||||
case 'col_post_date':
|
||||
$column_value = date_i18n( $date_format, strtotime( $rec->post_date ) );
|
||||
break;
|
||||
|
||||
case 'col_row_action':
|
||||
$column_value = sprintf( '<a href="#" class="wpseo-save" data-id="%1$s">Save</a> | <a href="#" class="wpseo-save-all">Save All</a>', $rec->ID );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( ! empty( $column_value ) ) {
|
||||
return $column_value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the field where the existing meta-data value is displayed
|
||||
*
|
||||
* @param integer $record_id
|
||||
* @param string $attributes
|
||||
* @param bool|array $values
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function parse_meta_data_field( $record_id, $attributes, $values = false ) {
|
||||
|
||||
// Fill meta data if exists in $this->meta_data
|
||||
$meta_data = ( ! empty( $this->meta_data[$record_id] ) ) ? $this->meta_data[$record_id] : array();
|
||||
$meta_key = WPSEO_Meta::$meta_prefix . $this->target_db_field;
|
||||
$meta_value = ( ! empty( $meta_data[$meta_key] ) ) ? $meta_data[$meta_key] : '';
|
||||
|
||||
if ( ! empty( $values ) ) {
|
||||
$meta_value = $values[$meta_value];
|
||||
}
|
||||
|
||||
return sprintf( '<td %2$s id="wpseo-existing-%4$s-%3$s">%1$s</td>', $meta_value, $attributes, $record_id, $this->target_db_field );
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for setting the meta data, which belongs to the records that will be shown on the current page
|
||||
*
|
||||
* This method will loop through the current items ($this->items) for getting the post_id. With this data
|
||||
* ($needed_ids) the method will query the meta-data table for getting the title.
|
||||
*
|
||||
*/
|
||||
protected function get_meta_data() {
|
||||
|
||||
$post_ids = $this->get_post_ids();
|
||||
$meta_data = $this->get_meta_data_result( $post_ids );
|
||||
|
||||
$this->parse_meta_data( $meta_data );
|
||||
|
||||
// Little housekeeping
|
||||
unset( $post_ids, $meta_data );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting all post_ids from to $this->items
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_post_ids() {
|
||||
$needed_ids = array();
|
||||
foreach ( $this->items AS $item ) {
|
||||
$needed_ids[] = $item->ID;
|
||||
}
|
||||
|
||||
$post_ids = "'" . implode( "', '", $needed_ids ) . "'";
|
||||
|
||||
return $post_ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting the meta_data from database
|
||||
*
|
||||
* @param string $post_ids
|
||||
* @param string $target_field
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function get_meta_data_result( $post_ids ) {
|
||||
global $wpdb;
|
||||
|
||||
$meta_data = $wpdb->get_results(
|
||||
"
|
||||
SELECT *
|
||||
FROM {$wpdb->postmeta}
|
||||
WHERE post_id IN({$post_ids}) && meta_key = '" . WPSEO_Meta::$meta_prefix . $this->target_db_field . "'
|
||||
"
|
||||
);
|
||||
|
||||
return $meta_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting $this->meta_data
|
||||
*
|
||||
* @param array $meta_data
|
||||
*/
|
||||
protected function parse_meta_data( $meta_data ) {
|
||||
|
||||
foreach ( $meta_data AS $row ) {
|
||||
$this->meta_data[$row->post_id][$row->meta_key] = $row->meta_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will merge general array with given parameter $columns
|
||||
*
|
||||
* @param array $columns
|
||||
*
|
||||
* return array
|
||||
*/
|
||||
protected function merge_columns( $columns = array() ) {
|
||||
$columns = array_merge(
|
||||
array(
|
||||
'col_page_title' => __( 'WP Page Title', 'wordpress-seo' ),
|
||||
'col_post_type' => __( 'Post Type', 'wordpress-seo' ),
|
||||
'col_post_status' => __( 'Post Status', 'wordpress-seo' ),
|
||||
'col_post_date' => __( 'Publication date', 'wordpress-seo' ),
|
||||
'col_page_slug' => __( 'Page URL/Slug', 'wordpress-seo' ),
|
||||
),
|
||||
$columns
|
||||
);
|
||||
|
||||
$columns['col_row_action'] = __( 'Action', 'wordpress-seo' );
|
||||
|
||||
return $columns;
|
||||
|
||||
}
|
||||
|
||||
} /* End of class */
|
||||
} /* End of class-exists wrapper */
|
||||
@@ -35,58 +35,54 @@ if ( ! class_exists( 'WPSEO_Bulk_Title_Editor_List_Table' ) ) {
|
||||
'ajax' => true,
|
||||
);
|
||||
|
||||
/**
|
||||
* The field in the database where meta field is saved.
|
||||
* @var string
|
||||
*/
|
||||
protected $target_db_field = 'title';
|
||||
|
||||
/**
|
||||
* The columns shown on the table
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_columns() {
|
||||
return $columns = array(
|
||||
'col_page_title' => __( 'WP Page Title', 'wordpress-seo' ),
|
||||
'col_post_type' => __( 'Post Type', 'wordpress-seo' ),
|
||||
'col_post_status' => __( 'Post Status', 'wordpress-seo' ),
|
||||
'col_post_date' => __( 'Publication date', 'wordpress-seo' ),
|
||||
'col_page_slug' => __( 'Page URL/Slug', 'wordpress-seo' ),
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
'col_existing_yoast_seo_title' => __( 'Existing Yoast SEO Title', 'wordpress-seo' ),
|
||||
'col_new_yoast_seo_title' => __( 'New Yoast SEO Title', 'wordpress-seo' ),
|
||||
'col_row_action' => __( 'Action', 'wordpress-seo' ),
|
||||
);
|
||||
|
||||
return $this->merge_columns($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for setting the meta data, which belongs to the records that will be shown on the current page
|
||||
* Parse the title columns
|
||||
*
|
||||
* This method will loop through the current items ($this->items) for getting the post_id. With this data
|
||||
* ($needed_ids) the method will query the meta-data table for getting the title.
|
||||
* @param string $column_name
|
||||
* @param object $record
|
||||
* @param string $attributes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_meta_data() {
|
||||
protected function parse_page_specific_column( $column_name, $record, $attributes ) {
|
||||
|
||||
global $wpdb;
|
||||
// Fill meta data if exists in $this->meta_data
|
||||
$meta_data = ( ! empty( $this->meta_data[$record->ID] ) ) ? $this->meta_data[$record->ID] : array();
|
||||
|
||||
$needed_ids = array();
|
||||
foreach ( $this->items AS $item ) {
|
||||
$needed_ids[] = $item->ID;
|
||||
switch ( $column_name ) {
|
||||
case 'col_existing_yoast_seo_title':
|
||||
echo $this->parse_meta_data_field( $record->ID, $attributes );
|
||||
break;
|
||||
|
||||
case 'col_new_yoast_seo_title':
|
||||
return sprintf( '<input type="text" id="%1$s" name="%1$s" class="wpseo-new-title" data-id="%2$s" />', 'wpseo-new-title-' . $record->ID, $record->ID );
|
||||
break;
|
||||
}
|
||||
|
||||
$post_ids = "'" . implode( "', '", $needed_ids ) . "'";
|
||||
$meta_data = $wpdb->get_results(
|
||||
"
|
||||
SELECT *
|
||||
FROM {$wpdb->postmeta}
|
||||
WHERE post_id IN({$post_ids}) && meta_key = '" . WPSEO_Meta::$meta_prefix . "title'
|
||||
"
|
||||
);
|
||||
|
||||
foreach ( $meta_data AS $row ) {
|
||||
$this->meta_data[$row->post_id][$row->meta_key] = $row->meta_value;
|
||||
}
|
||||
|
||||
|
||||
// Little housekeeping
|
||||
unset( $needed_ids, $post_ids, $meta_data );
|
||||
|
||||
unset( $meta_data );
|
||||
}
|
||||
|
||||
|
||||
} /* End of class */
|
||||
} /* End of class-exists wrapper */
|
||||
@@ -201,6 +201,8 @@ if ( ! class_exists( 'WPSEO_Admin_Pages' ) ) {
|
||||
</form>';
|
||||
}
|
||||
|
||||
do_action( 'wpseo_admin_footer' );
|
||||
|
||||
echo '
|
||||
</div><!-- end of div meta-box-sortables -->
|
||||
</div><!-- end of div metabox-holder -->
|
||||
|
||||
@@ -27,7 +27,7 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
/**
|
||||
* Class constructor
|
||||
*/
|
||||
function __construct() {
|
||||
public function __construct() {
|
||||
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
|
||||
add_action( 'wp_insert_post', array( $this, 'save_postdata' ) );
|
||||
@@ -53,13 +53,13 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
|
||||
self::$meta_fields['general']['title']['title'] = __( 'SEO Title', 'wordpress-seo' );
|
||||
self::$meta_fields['general']['title']['description'] = '<p id="yoast_wpseo_title-length-warning">' . '<span class="wrong">' . __( 'Warning:', 'wordpress-seo' ) . '</span> ' . __( 'Title display in Google is limited to a fixed width, yours is too long.', 'wordpress-seo' ) . '</p>';
|
||||
self::$meta_fields['general']['title']['help'] = __( 'The SEO Title defaults to what is generated based on this sites title template for this posttype.', 'wordpress-seo' );
|
||||
self::$meta_fields['general']['title']['help'] = __( 'The SEO title defaults to what is generated based on this sites title template for this posttype.', 'wordpress-seo' );
|
||||
|
||||
self::$meta_fields['general']['metadesc']['title'] = __( 'Meta Description', 'wordpress-seo' );
|
||||
self::$meta_fields['general']['metadesc']['title'] = __( 'Meta description', 'wordpress-seo' );
|
||||
self::$meta_fields['general']['metadesc']['description'] = sprintf( __( 'The <code>meta</code> description will be limited to %s chars%s, %s chars left.', 'wordpress-seo' ), self::$meta_length, self::$meta_length_reason, '<span id="yoast_wpseo_metadesc-length"></span>' ) . ' <div id="yoast_wpseo_metadesc_notice"></div>';
|
||||
self::$meta_fields['general']['metadesc']['help'] = sprintf( __( 'The meta description is often shown as the black text under the title in a search result. For this to work it has to contain the keyword that was searched for.<br/><br/>Read %sthis post%s for more info.', 'wordpress-seo' ), '<a href="https://yoast.com/snippet-preview/#utm_source=wordpress-seo-metabox&utm_medium=inline-help&utm_campaign=focus-keyword">', '</a>' );
|
||||
|
||||
self::$meta_fields['general']['metakeywords']['title'] = __( 'Meta Keywords', 'wordpress-seo' );
|
||||
self::$meta_fields['general']['metakeywords']['title'] = __( 'Meta keywords', 'wordpress-seo' );
|
||||
self::$meta_fields['general']['metakeywords']['description'] = __( 'If you type something above it will override your %smeta keywords template%s.', 'wordpress-seo' );
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
self::$meta_fields['advanced']['meta-robots-adv']['options']['noarchive'] = __( 'No Archive', 'wordpress-seo' );
|
||||
self::$meta_fields['advanced']['meta-robots-adv']['options']['nosnippet'] = __( 'No Snippet', 'wordpress-seo' );
|
||||
|
||||
self::$meta_fields['advanced']['bctitle']['title'] = __( 'Breadcrumbs title', 'wordpress-seo' );
|
||||
self::$meta_fields['advanced']['bctitle']['title'] = __( 'Breadcrumbs Title', 'wordpress-seo' );
|
||||
self::$meta_fields['advanced']['bctitle']['description'] = __( 'Title to use for this page in breadcrumb paths', 'wordpress-seo' );
|
||||
|
||||
self::$meta_fields['advanced']['sitemap-include']['title'] = __( 'Include in Sitemap', 'wordpress-seo' );
|
||||
@@ -103,18 +103,6 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
self::$meta_fields['advanced']['sitemap-prio']['options']['0.5'] .= __( 'Medium priority', 'wordpress-seo' );
|
||||
self::$meta_fields['advanced']['sitemap-prio']['options']['0.1'] .= __( 'Lowest priority', 'wordpress-seo' );
|
||||
|
||||
self::$meta_fields['advanced']['sitemap-html-include']['title'] = __( 'Include in HTML Sitemap', 'wordpress-seo' );
|
||||
self::$meta_fields['advanced']['sitemap-html-include']['description'] = __( 'Should this page be in the HTML Sitemap at all times, regardless of Robots Meta settings?', 'wordpress-seo' );
|
||||
self::$meta_fields['advanced']['sitemap-html-include']['options']['-'] = __( 'Auto detect', 'wordpress-seo' );
|
||||
self::$meta_fields['advanced']['sitemap-html-include']['options']['always'] = __( 'Always include', 'wordpress-seo' );
|
||||
self::$meta_fields['advanced']['sitemap-html-include']['options']['never'] = __( 'Never include', 'wordpress-seo' );
|
||||
|
||||
self::$meta_fields['advanced']['authorship']['title'] = __( 'Authorship', 'wordpress-seo' );
|
||||
self::$meta_fields['advanced']['authorship']['description'] = __( 'Show <code>rel="author"</code> on this page?', 'wordpress-seo' );
|
||||
self::$meta_fields['advanced']['authorship']['options']['-'] = __( 'Default for post type, currently: %s', 'wordpress-seo' );
|
||||
self::$meta_fields['advanced']['authorship']['options']['always'] = __( 'Always show', 'wordpress-seo' );
|
||||
self::$meta_fields['advanced']['authorship']['options']['never'] = __( 'Never show', 'wordpress-seo' );
|
||||
|
||||
self::$meta_fields['advanced']['canonical']['title'] = __( 'Canonical URL', 'wordpress-seo' );
|
||||
self::$meta_fields['advanced']['canonical']['description'] = sprintf( __( 'The canonical URL that this page should point to, leave empty to default to permalink. %sCross domain canonical%s supported too.', 'wordpress-seo' ), '<a target="_blank" href="http://googlewebmastercentral.blogspot.com/2009/12/handling-legitimate-cross-domain.html">', '</a>' );
|
||||
|
||||
@@ -198,6 +186,22 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
return $this->statistics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns post in metabox context
|
||||
*
|
||||
* @returns WP_Post
|
||||
*/
|
||||
private function get_metabox_post() {
|
||||
if ( isset( $_GET['post'] ) ) {
|
||||
$post_id = (int) WPSEO_Option::validate_int( $_GET['post'] );
|
||||
$post = get_post( $post_id );
|
||||
} else {
|
||||
global $post;
|
||||
}
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lowercase a sentence while preserving "weird" characters.
|
||||
*
|
||||
@@ -241,17 +245,13 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
|
||||
echo '<div class="misc-pub-section misc-yoast misc-pub-section-last">';
|
||||
|
||||
if ( self::get_value( 'meta-robots-noindex' ) === '1' ) {
|
||||
$post = $this->get_metabox_post();
|
||||
|
||||
if ( self::get_value( 'meta-robots-noindex', $post->ID ) === '1' ) {
|
||||
$score_label = 'noindex';
|
||||
$title = __( 'Post is set to noindex.', 'wordpress-seo' );
|
||||
$score_title = $title;
|
||||
} else {
|
||||
if ( isset( $_GET['post'] ) ) {
|
||||
$post_id = (int) WPSEO_Option::validate_int( $_GET['post'] );
|
||||
$post = get_post( $post_id );
|
||||
} else {
|
||||
global $post;
|
||||
}
|
||||
|
||||
$score = '';
|
||||
$results = $this->calculate_results( $post );
|
||||
@@ -306,12 +306,7 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
* @return array
|
||||
*/
|
||||
public function localize_script() {
|
||||
if ( isset( $_GET['post'] ) ) {
|
||||
$post_id = (int) WPSEO_Option::validate_int( $_GET['post'] );
|
||||
$post = get_post( $post_id );
|
||||
} else {
|
||||
global $post;
|
||||
}
|
||||
$post = $this->get_metabox_post();
|
||||
|
||||
if ( ( ! is_object( $post ) || ! isset( $post->post_type ) ) || $this->is_metabox_hidden( $post->post_type ) === true ) {
|
||||
return array();
|
||||
@@ -371,7 +366,7 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
|
||||
return array_merge( $cached_replacement_vars, array(
|
||||
'field_prefix' => self::$form_prefix,
|
||||
'keyword_header' => __( 'Your focus keyword was found in:', 'wordpress-seo' ),
|
||||
'keyword_header' => '<strong>' . __( 'Focus keyword usage', 'wordpress-seo' ) . '</strong><br>' . __( 'Your focus keyword was found in:', 'wordpress-seo' ),
|
||||
'article_header_text' => __( 'Article Heading: ', 'wordpress-seo' ),
|
||||
'page_title_text' => __( 'Page title: ', 'wordpress-seo' ),
|
||||
'page_url_text' => __( 'Page URL: ', 'wordpress-seo' ),
|
||||
@@ -384,7 +379,7 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
'wpseo_permalink_template' => $sample_permalink,
|
||||
'wpseo_keyword_suggest_nonce' => wp_create_nonce( 'wpseo-get-suggest' ),
|
||||
'wpseo_replace_vars_nonce' => wp_create_nonce( 'wpseo-replace-vars' ),
|
||||
'no_parent_text' => __( '(no parent)' ),
|
||||
'no_parent_text' => __( '(no parent)', 'wordpress-seo' ),
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -410,13 +405,7 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
* Output the meta box
|
||||
*/
|
||||
function meta_box() {
|
||||
if ( isset( $_GET['post'] ) ) {
|
||||
$post_id = (int) WPSEO_Option::validate_int( $_GET['post'] );
|
||||
$post = get_post( $post_id );
|
||||
} else {
|
||||
global $post;
|
||||
}
|
||||
|
||||
$post = $this->get_metabox_post();
|
||||
$options = WPSEO_Options::get_all();
|
||||
|
||||
?>
|
||||
@@ -471,7 +460,8 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
function do_meta_box( $meta_field_def, $key = '' ) {
|
||||
$content = '';
|
||||
$esc_form_key = esc_attr( self::$form_prefix . $key );
|
||||
$meta_value = self::get_value( $key );
|
||||
$post = $this->get_metabox_post();
|
||||
$meta_value = self::get_value( $key, $post->ID );
|
||||
|
||||
$class = '';
|
||||
if ( isset( $meta_field_def['class'] ) && $meta_field_def['class'] !== '' ) {
|
||||
@@ -634,45 +624,13 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
* @return string
|
||||
*/
|
||||
function snippet() {
|
||||
if ( isset( $_GET['post'] ) ) {
|
||||
$post_id = (int) WPSEO_Option::validate_int( $_GET['post'] );
|
||||
$post = get_post( $post_id );
|
||||
} else {
|
||||
global $post;
|
||||
}
|
||||
$post = $this->get_metabox_post();
|
||||
$title = self::get_value( 'title', $post->ID );
|
||||
$description = self::get_value( 'metadesc', $post->ID );
|
||||
|
||||
$options = WPSEO_Options::get_all();
|
||||
$snippet_preview = new WPSEO_Snippet_Preview( $post, $title, $description );
|
||||
|
||||
$date = '';
|
||||
if ( is_object( $post ) && isset( $options[ 'showdate-' . $post->post_type ] ) && $options[ 'showdate-' . $post->post_type ] === true ) {
|
||||
$date = $this->get_post_date( $post );
|
||||
}
|
||||
|
||||
$title = self::get_value( 'title' );
|
||||
$desc = self::get_value( 'metadesc' );
|
||||
|
||||
$slug = ( is_object( $post ) && isset( $post->post_name ) ) ? $post->post_name : '';
|
||||
if ( $slug !== '' ) {
|
||||
$slug = sanitize_title( $title );
|
||||
}
|
||||
|
||||
if ( is_string( $date ) && $date !== '' ) {
|
||||
$datestr = '<span class="date">' . $date . ' - </span>';
|
||||
} else {
|
||||
$datestr = '';
|
||||
}
|
||||
$content = '<div id="wpseosnippet">
|
||||
<a class="title" id="wpseosnippet_title" href="#">' . esc_html( $title ) . '</a>';
|
||||
|
||||
$content .= '<span class="url">' . str_replace( 'http://', '', get_bloginfo( 'url' ) ) . '/' . esc_html( $slug ) . '/</span>';
|
||||
|
||||
$content .= '<p class="desc">' . $datestr . '<span class="autogen"></span><span class="content">' . esc_html( $desc ) . '</span></p>';
|
||||
|
||||
$content .= '</div>';
|
||||
|
||||
$content = apply_filters( 'wpseo_snippet', $content, $post, compact( 'title', 'desc', 'date', 'slug' ) );
|
||||
|
||||
return $content;
|
||||
return $snippet_preview->get_content();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -701,6 +659,8 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
do_action( 'wpseo_save_compare_data', $post );
|
||||
|
||||
$meta_boxes = apply_filters( 'wpseo_save_metaboxes', array() );
|
||||
$meta_boxes = array_merge( $meta_boxes, $this->get_meta_field_defs( 'general', $post->post_type ), $this->get_meta_field_defs( 'advanced' ) );
|
||||
|
||||
@@ -727,11 +687,12 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
*/
|
||||
public function enqueue() {
|
||||
global $pagenow;
|
||||
if ( ! in_array( $pagenow, array(
|
||||
/* Filter 'wpseo_always_register_metaboxes_on_admin' documented in wpseo-main.php */
|
||||
if ( ( ! in_array( $pagenow, array(
|
||||
'post-new.php',
|
||||
'post.php',
|
||||
'edit.php',
|
||||
), true ) || $this->is_metabox_hidden() === true
|
||||
), true ) && apply_filters( 'wpseo_always_register_metaboxes_on_admin', false ) === false ) || $this->is_metabox_hidden() === true
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -751,17 +712,18 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
}
|
||||
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 );
|
||||
wp_enqueue_style( "jquery-qtip.js", plugins_url( 'css/jquery.qtip' . WPSEO_CSSJS_SUFFIX . '.css', WPSEO_FILE ), array(), '2.2.1' );
|
||||
|
||||
wp_enqueue_script( 'jquery-ui-autocomplete' );
|
||||
|
||||
wp_enqueue_script( 'jquery-qtip', plugins_url( 'js/jquery.qtip.min.js', WPSEO_FILE ), array( 'jquery' ), '1.0.0-RC3', true );
|
||||
wp_enqueue_script( 'jquery-qtip', plugins_url( 'js/jquery.qtip' . WPSEO_CSSJS_SUFFIX . '.js', WPSEO_FILE ), array( 'jquery' ), '2.2.1', true );
|
||||
wp_enqueue_script( 'wp-seo-metabox', plugins_url( 'js/wp-seo-metabox' . WPSEO_CSSJS_SUFFIX . '.js', WPSEO_FILE ), array(
|
||||
'jquery',
|
||||
'jquery-ui-core',
|
||||
'jquery-ui-autocomplete',
|
||||
), WPSEO_VERSION, true );
|
||||
|
||||
wp_enqueue_script( 'wpseo-admin-media', plugins_url( 'js/wp-seo-admin-media' . WPSEO_CSSJS_SUFFIX . '.js', WPSEO_FILE ), array( 'jquery', 'jquery-ui-core' ), WPSEO_VERSION, true );
|
||||
wp_enqueue_script( 'wpseo-admin-media', plugins_url( 'js/wp-seo-admin-media' . WPSEO_CSSJS_SUFFIX . '.js', WPSEO_FILE ), array( 'jquery', 'jquery-ui-core' ), WPSEO_VERSION, true );
|
||||
wp_localize_script( 'wpseo-admin-media', 'wpseoMediaL10n', $this->localize_media_script() );
|
||||
|
||||
// Text strings to pass to metabox for keyword analysis
|
||||
@@ -825,11 +787,11 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
}
|
||||
|
||||
return array_merge( $columns, array(
|
||||
'wpseo-score' => __( 'SEO', 'wordpress-seo' ),
|
||||
'wpseo-title' => __( 'SEO Title', 'wordpress-seo' ),
|
||||
'wpseo-metadesc' => __( 'Meta Desc.', 'wordpress-seo' ),
|
||||
'wpseo-focuskw' => __( 'Focus KW', 'wordpress-seo' )
|
||||
) );
|
||||
'wpseo-score' => __( 'SEO', 'wordpress-seo' ),
|
||||
'wpseo-title' => __( 'SEO Title', 'wordpress-seo' ),
|
||||
'wpseo-metadesc' => __( 'Meta Desc.', 'wordpress-seo' ),
|
||||
'wpseo-focuskw' => __( 'Focus KW', 'wordpress-seo' )
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -908,6 +870,7 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
*/
|
||||
function column_sort_orderby( $vars ) {
|
||||
if ( isset( $_GET['seo_filter'] ) ) {
|
||||
$na = false;
|
||||
$noindex = false;
|
||||
$high = false;
|
||||
switch ( $_GET['seo_filter'] ) {
|
||||
@@ -916,8 +879,8 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
$noindex = true;
|
||||
break;
|
||||
case 'na':
|
||||
$low = 0;
|
||||
$high = 0;
|
||||
$low = false;
|
||||
$na = true;
|
||||
break;
|
||||
case 'bad':
|
||||
$low = 1;
|
||||
@@ -971,6 +934,21 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
|
||||
add_filter( 'posts_where', array( $this, 'seo_score_posts_where' ) );
|
||||
|
||||
} elseif ( $na ) {
|
||||
$vars = array_merge(
|
||||
$vars,
|
||||
array(
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => self::$meta_prefix . 'linkdex',
|
||||
'value' => 'needs-a-value-anyway',
|
||||
'compare' => 'NOT EXISTS',
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
} elseif ( $noindex ) {
|
||||
$vars = array_merge(
|
||||
$vars,
|
||||
@@ -1062,8 +1040,8 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
} else {
|
||||
$post = get_post( $post_id );
|
||||
$options = WPSEO_Options::get_all();
|
||||
if ( is_object( $post ) && ( isset( $options[ 'title-' . $post->post_type ] ) && $options[ 'title-' . $post->post_type ] !== '' ) ) {
|
||||
$title_template = $options[ 'title-' . $post->post_type ];
|
||||
if ( is_object( $post ) && ( isset( $options['title-' . $post->post_type] ) && $options['title-' . $post->post_type] !== '' ) ) {
|
||||
$title_template = $options['title-' . $post->post_type];
|
||||
$title_template = str_replace( ' %%page%% ', ' ', $title_template );
|
||||
|
||||
return wpseo_replace_vars( $title_template, $post );
|
||||
@@ -1084,11 +1062,11 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
$ret = array();
|
||||
reset( $array );
|
||||
foreach ( $array as $ii => $va ) {
|
||||
$sorter[ $ii ] = $va[ $key ];
|
||||
$sorter[$ii] = $va[$key];
|
||||
}
|
||||
asort( $sorter );
|
||||
foreach ( $sorter as $ii => $va ) {
|
||||
$ret[ $ii ] = $array[ $ii ];
|
||||
$ret[$ii] = $array[$ii];
|
||||
}
|
||||
$array = $ret;
|
||||
}
|
||||
@@ -1180,7 +1158,7 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
$sampleurl = $this->get_sample_permalink( $post );
|
||||
$job['pageUrl'] = preg_replace( '`%(?:post|page)name%`', $sampleurl[1], $sampleurl[0] );
|
||||
$job['pageSlug'] = urldecode( $post->post_name );
|
||||
$job['keyword'] = self::get_value( 'focuskw' );
|
||||
$job['keyword'] = self::get_value( 'focuskw', $post->ID );
|
||||
$job['keyword_folded'] = $this->strip_separators_and_fold( $job['keyword'] );
|
||||
$job['post_id'] = $post->ID;
|
||||
$job['post_type'] = $post->post_type;
|
||||
@@ -1214,7 +1192,7 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
$this->score_keyword( $job['keyword'], $results );
|
||||
|
||||
// Title
|
||||
$title = self::get_value( 'title' );
|
||||
$title = self::get_value( 'title', $post->ID );
|
||||
if ( $title !== '' ) {
|
||||
$job['title'] = $title;
|
||||
} else {
|
||||
@@ -1230,11 +1208,11 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
|
||||
// Meta description
|
||||
$description = '';
|
||||
$desc_meta = self::get_value( 'metadesc' );
|
||||
$desc_meta = self::get_value( 'metadesc', $post->ID );
|
||||
if ( $desc_meta !== '' ) {
|
||||
$description = $desc_meta;
|
||||
} elseif ( isset( $options[ 'metadesc-' . $post->post_type ] ) && $options[ 'metadesc-' . $post->post_type ] !== '' ) {
|
||||
$description = wpseo_replace_vars( $options[ 'metadesc-' . $post->post_type ], $post );
|
||||
} elseif ( isset( $options['metadesc-' . $post->post_type] ) && $options['metadesc-' . $post->post_type] !== '' ) {
|
||||
$description = wpseo_replace_vars( $options['metadesc-' . $post->post_type], $post );
|
||||
}
|
||||
unset( $desc_meta );
|
||||
|
||||
@@ -1336,12 +1314,12 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
* @param string $rawScore The raw score, to be used by other filters.
|
||||
*/
|
||||
function save_score_result( &$results, $scoreValue, $scoreMessage, $scoreLabel, $rawScore = null ) {
|
||||
$score = array(
|
||||
$score = array(
|
||||
'val' => $scoreValue,
|
||||
'msg' => $scoreMessage,
|
||||
'raw' => $rawScore,
|
||||
);
|
||||
$results[ $scoreLabel ] = $score;
|
||||
$results[$scoreLabel] = $score;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1364,7 +1342,7 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
$inputString = str_replace( $keywordCharactersAlwaysReplacedBySpace, ' ', $inputString );
|
||||
|
||||
// standardise whitespace
|
||||
$inputString = preg_replace( '`\s+`u', ' ', $inputString );
|
||||
$inputString = wpseo_standardize_whitespace( $inputString );
|
||||
|
||||
// deal with the separators that can be either removed or replaced by space
|
||||
if ( $removeOptionalCharacters ) {
|
||||
@@ -1377,7 +1355,7 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
}
|
||||
|
||||
// standardise whitespace again
|
||||
$inputString = preg_replace( '`\s+`u', ' ', $inputString );
|
||||
$inputString = wpseo_standardize_whitespace( $inputString );
|
||||
|
||||
return trim( $inputString );
|
||||
}
|
||||
@@ -1485,6 +1463,8 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
if ( $job['title'] == '' ) {
|
||||
$this->save_score_result( $results, 1, $scoreTitleMissing, 'title' );
|
||||
} else {
|
||||
$job['title'] = wp_strip_all_tags( $job['title'] );
|
||||
|
||||
$length = $this->statistics()->text_length( $job['title'] );
|
||||
if ( $length < $scoreTitleMinLength ) {
|
||||
$this->save_score_result( $results, 6, sprintf( $scoreTitleTooShort, $length ), 'title_length' );
|
||||
@@ -1611,12 +1591,12 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
if ( $dom_object->attributes->getNamedItem( 'rel' ) ) {
|
||||
$link_rel = $dom_object->attributes->getNamedItem( 'rel' )->textContent;
|
||||
if ( stripos( $link_rel, 'nofollow' ) !== false ) {
|
||||
$count[ $type ]['nofollow'] ++;
|
||||
$count[$type]['nofollow'] ++;
|
||||
} else {
|
||||
$count[ $type ]['dofollow'] ++;
|
||||
$count[$type]['dofollow'] ++;
|
||||
}
|
||||
} else {
|
||||
$count[ $type ]['dofollow'] ++;
|
||||
$count[$type]['dofollow'] ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1866,7 +1846,7 @@ if ( ! class_exists( 'WPSEO_Metabox' ) ) {
|
||||
// Keyword Density check
|
||||
$keywordDensity = 0;
|
||||
if ( $wordCount > 100 ) {
|
||||
$keywordCount = preg_match_all( '`\b' . preg_quote( $job['keyword'], '`' ) . '\b`miu', utf8_encode( $body ), $res );
|
||||
$keywordCount = preg_match_all( '`\b' . preg_quote( $job['keyword'], '`' ) . '\b`miu', $body, $res );
|
||||
if ( ( $keywordCount > 0 && $keywordWordCount > 0 ) && $wordCount > $keywordCount ) {
|
||||
$keywordDensity = wpseo_calc( wpseo_calc( $keywordCount, '/', wpseo_calc( $wordCount, '-', ( wpseo_calc( wpseo_calc( $keywordWordCount, '-', 1 ), '*', $keywordCount ) ) ) ), '*', 100, true, 2 );
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ if ( ! class_exists( 'WPSEO_Social_Admin' ) ) {
|
||||
add_action( 'wpseo_tab_header', array( $this, 'tab_header' ), 60 );
|
||||
add_action( 'wpseo_tab_content', array( $this, 'tab_content' ) );
|
||||
add_filter( 'wpseo_save_metaboxes', array( $this, 'save_meta_boxes' ), 10, 1 );
|
||||
add_action( 'wpseo_save_compare_data', array( $this, 'og_data_compare' ), 10, 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,23 +33,35 @@ if ( ! class_exists( 'WPSEO_Social_Admin' ) ) {
|
||||
* the main meta box definition array in the class WPSEO_Meta() as well!!!!
|
||||
*/
|
||||
public static function translate_meta_boxes() {
|
||||
self::$meta_fields['social']['opengraph-title']['title'] = __( 'Facebook Title', 'wordpress-seo' );
|
||||
self::$meta_fields['social']['opengraph-title']['description'] = __( 'If you don\'t want to use the post title for sharing the post on Facebook but instead want another title there, write it here.', 'wordpress-seo' );
|
||||
$title_text = __( 'If you don\'t want to use the post title for sharing the post on %s but instead want another title there, write it here.', 'wordpress-seo' );
|
||||
$description_text = __( 'If you don\'t want to use the meta description for sharing the post on %s but want another description there, write it here.', 'wordpress-seo' );
|
||||
$image_text = __( 'If you want to override the image used on %s for this post, upload / choose an image or add the URL here.', 'wordpress-seo' );
|
||||
|
||||
self::$meta_fields['social']['opengraph-description']['title'] = __( 'Facebook Description', 'wordpress-seo' );
|
||||
self::$meta_fields['social']['opengraph-description']['description'] = __( 'If you don\'t want to use the meta description for sharing the post on Facebook but want another description there, write it here.', 'wordpress-seo' );
|
||||
$options = WPSEO_Options::get_all();
|
||||
|
||||
self::$meta_fields['social']['opengraph-image']['title'] = __( 'Facebook Image', 'wordpress-seo' );
|
||||
self::$meta_fields['social']['opengraph-image']['description'] = __( 'If you want to override the Facebook image for this post, upload / choose an image or add the URL here.', 'wordpress-seo' );
|
||||
foreach (
|
||||
array(
|
||||
'opengraph' => __( 'Facebook', 'wordpress-seo' ),
|
||||
'twitter' => __( 'Twitter', 'wordpress-seo' ),
|
||||
'googleplus' => __( 'Google+', 'wordpress-seo' ),
|
||||
) as $network => $label
|
||||
) {
|
||||
if ( true === $options[ $network ] ) {
|
||||
if ( 'googleplus' == $network ) {
|
||||
$network = 'google-plus'; // Yuck, I know.
|
||||
}
|
||||
|
||||
self::$meta_fields['social']['google-plus-title']['title'] = __( 'Google+ Title', 'wordpress-seo' );
|
||||
self::$meta_fields['social']['google-plus-title']['description'] = __( 'If you don\'t want to use the post title for sharing the post on Google+ but instead want another title there, write it here.', 'wordpress-seo' );
|
||||
self::$meta_fields['social'][ $network . '-title' ]['title'] = sprintf( __( '%s Title', 'wordpress-seo' ), $label );
|
||||
self::$meta_fields['social'][ $network . '-title' ]['description'] = sprintf( $title_text, $label );
|
||||
|
||||
self::$meta_fields['social']['google-plus-description']['title'] = __( 'Google+ Description', 'wordpress-seo' );
|
||||
self::$meta_fields['social']['google-plus-description']['description'] = __( 'If you don\'t want to use the meta description for sharing the post on Google+ but want another description there, write it here.', 'wordpress-seo' );
|
||||
self::$meta_fields['social'][ $network . '-description' ]['title'] = sprintf( __( '%s Description', 'wordpress-seo' ), $label );
|
||||
self::$meta_fields['social'][ $network . '-description' ]['description'] = sprintf( $description_text, $label );
|
||||
|
||||
self::$meta_fields['social'][ $network . '-image' ]['title'] = sprintf( __( '%s Image', 'wordpress-seo' ), $label );
|
||||
self::$meta_fields['social'][ $network . '-image' ]['description'] = sprintf( $image_text, $label );
|
||||
}
|
||||
}
|
||||
|
||||
self::$meta_fields['social']['google-plus-image']['title'] = __( 'Google+ Image', 'wordpress-seo' );
|
||||
self::$meta_fields['social']['google-plus-image']['description'] = __( 'If you want to override the image for this post that Google+ will use, upload / choose an image or add the URL here. Note that it will otherwise default to the Facebook one above.', 'wordpress-seo' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,12 +87,51 @@ if ( ! class_exists( 'WPSEO_Social_Admin' ) ) {
|
||||
* Filter over the meta boxes to save, this function adds the Social meta boxes.
|
||||
*
|
||||
* @param array $field_defs Array of metaboxes to save.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function save_meta_boxes( $field_defs ) {
|
||||
return array_merge( $field_defs, $this->get_meta_field_defs( 'social' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will compare opengraph fields with the posted values.
|
||||
*
|
||||
* When fields are changed, the facebook cache will be purge.
|
||||
*
|
||||
* @param object $post
|
||||
*/
|
||||
public function og_data_compare( $post ) {
|
||||
|
||||
// Check if post data is available, if post_id is set and if original post_status is publish
|
||||
if ( ! empty( $_POST ) && ! empty( $post->ID ) && $post->post_status == 'publish' && $_POST['original_post_status'] === 'publish' ) {
|
||||
|
||||
$fields_to_compare = array(
|
||||
'opengraph-title',
|
||||
'opengraph-description',
|
||||
'opengraph-image'
|
||||
);
|
||||
|
||||
$reset_facebook_cache = false;
|
||||
|
||||
foreach ( $fields_to_compare AS $field_to_compare ) {
|
||||
$old_value = self::get_value( $field_to_compare, $post->ID );
|
||||
$new_value = self::get_post_value( self::$form_prefix . $field_to_compare );
|
||||
|
||||
if ( $old_value !== $new_value ) {
|
||||
$reset_facebook_cache = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $reset_facebook_cache ) {
|
||||
wp_remote_get(
|
||||
'https://graph.facebook.com/?id=' . get_permalink( $post->ID ) . '&scrape=true&method=post'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/********************** DEPRECATED METHODS **********************/
|
||||
|
||||
@@ -88,16 +140,18 @@ if ( ! class_exists( 'WPSEO_Social_Admin' ) ) {
|
||||
*
|
||||
* @deprecated 1.5.0
|
||||
* @deprecated use WPSEO_Meta::get_meta_field_defs()
|
||||
* @see WPSEO_Meta::get_meta_field_defs()
|
||||
* @see WPSEO_Meta::get_meta_field_defs()
|
||||
*
|
||||
* @param string $post_type
|
||||
* @return array Array containing the meta boxes
|
||||
* @param string $post_type
|
||||
*
|
||||
* @return array Array containing the meta boxes
|
||||
*/
|
||||
public function get_meta_boxes( $post_type = 'post' ) {
|
||||
_deprecated_function( __METHOD__, 'WPSEO 1.5.0', 'WPSEO_Meta::get_meta_field_defs()' );
|
||||
|
||||
return $this->get_meta_field_defs( 'social' );
|
||||
}
|
||||
|
||||
} /* End of class */
|
||||
|
||||
} /* End of class-exists wrapper */
|
||||
} /* End of class-exists wrapper */
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( ! defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'Status: 403 Forbidden' );
|
||||
header( 'HTTP/1.1 403 Forbidden' );
|
||||
exit();
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'WPSEO_Plugin_Conflict' ) ) {
|
||||
|
||||
class WPSEO_Plugin_Conflict extends Yoast_Plugin_Conflict {
|
||||
|
||||
/**
|
||||
* The plugins must be grouped per section.
|
||||
*
|
||||
* It's possible to check for each section if there are conflicting plugin
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $plugins = array(
|
||||
// The plugin which are writing OG metadata
|
||||
'open_graph' => array(
|
||||
'2-click-socialmedia-buttons/2-click-socialmedia-buttons.php',
|
||||
|
||||
// 2 Click Social Media Buttons
|
||||
'add-link-to-facebook/add-link-to-facebook.php', // Add Link to Facebook
|
||||
'add-meta-tags/add-meta-tags.php', // Add Meta Tags
|
||||
'easy-facebook-share-thumbnails/esft.php', // Easy Facebook Share Thumbnail
|
||||
'facebook/facebook.php', // Facebook (official plugin)
|
||||
'facebook-awd/AWD_facebook.php', // Facebook AWD All in one
|
||||
'facebook-featured-image-and-open-graph-meta-tags/fb-featured-image.php',
|
||||
// Facebook Featured Image & OG Meta Tags
|
||||
'facebook-meta-tags/facebook-metatags.php', // Facebook Meta Tags
|
||||
'wonderm00ns-simple-facebook-open-graph-tags/wonderm00n-open-graph.php',
|
||||
// Facebook Open Graph Meta Tags for WordPress
|
||||
'facebook-revised-open-graph-meta-tag/index.php', // Facebook Revised Open Graph Meta Tag
|
||||
'facebook-thumb-fixer/_facebook-thumb-fixer.php', // Facebook Thumb Fixer
|
||||
'facebook-and-digg-thumbnail-generator/facebook-and-digg-thumbnail-generator.php',
|
||||
// Fedmich's Facebook Open Graph Meta
|
||||
'header-footer/plugin.php', // Header and Footer
|
||||
'network-publisher/networkpub.php', // Network Publisher
|
||||
'nextgen-facebook/nextgen-facebook.php', // NextGEN Facebook OG
|
||||
'social-networks-auto-poster-facebook-twitter-g/NextScripts_SNAP.php',
|
||||
// NextScripts SNAP
|
||||
'opengraph/opengraph.php', // Open Graph
|
||||
'open-graph-protocol-framework/open-graph-protocol-framework.php',
|
||||
// Open Graph Protocol Framework
|
||||
'seo-facebook-comments/seofacebook.php', // SEO Facebook Comments
|
||||
'seo-ultimate/seo-ultimate.php', // SEO Ultimate
|
||||
'sexybookmarks/sexy-bookmarks.php', // Shareaholic
|
||||
'shareaholic/sexy-bookmarks.php', // Shareaholic
|
||||
'sharepress/sharepress.php', // SharePress
|
||||
'simple-facebook-connect/sfc.php', // Simple Facebook Connect
|
||||
'social-discussions/social-discussions.php', // Social Discussions
|
||||
'social-sharing-toolkit/social_sharing_toolkit.php', // Social Sharing Toolkit
|
||||
'socialize/socialize.php', // Socialize
|
||||
'only-tweet-like-share-and-google-1/tweet-like-plusone.php',
|
||||
// Tweet, Like, Google +1 and Share
|
||||
'wordbooker/wordbooker.php', // Wordbooker
|
||||
'wpsso/wpsso.php', // WordPress Social Sharing Optimization
|
||||
'wp-caregiver/wp-caregiver.php', // WP Caregiver
|
||||
'wp-facebook-like-send-open-graph-meta/wp-facebook-like-send-open-graph-meta.php',
|
||||
// WP Facebook Like Send & Open Graph Meta
|
||||
'wp-facebook-open-graph-protocol/wp-facebook-ogp.php', // WP Facebook Open Graph protocol
|
||||
'wp-ogp/wp-ogp.php', // WP-OGP
|
||||
'zoltonorg-social-plugin/zosp.php', // Zolton.org Social Plugin
|
||||
),
|
||||
|
||||
'xml_sitemaps' => array(
|
||||
'google-sitemap-plugin/google-sitemap-plugin.php', // Google Sitemap (BestWebSoft)
|
||||
'xml-sitemaps/xml-sitemaps.php', // XML Sitemaps (Denis de Bernardy and Mike Koepke)
|
||||
'bwp-google-xml-sitemaps/bwp-simple-gxs.php', // Better WordPress Google XML Sitemaps (Khang Minh)
|
||||
'google-sitemap-generator/sitemap.php', // Google XML Sitemaps (Arne Brachhold)
|
||||
'xml-sitemap-feed/xml-sitemap.php', // XML Sitemap & Google News feeds (RavanH)
|
||||
'google-monthly-xml-sitemap/monthly-xml-sitemap.php', // Google Monthly XML Sitemap (Andrea Pernici)
|
||||
'simple-google-sitemap-xml/simple-google-sitemap-xml.php', // Simple Google Sitemap XML (iTx Technologies)
|
||||
'another-simple-xml-sitemap/another-simple-xml-sitemap.php', // Another Simple XML Sitemap
|
||||
'xml-maps/google-sitemap.php', // Xml Sitemap (Jason Martens)
|
||||
'google-xml-sitemap-generator-by-anton-dachauer/adachauer-google-xml-sitemap.php', // Google XML Sitemap Generator by Anton Dachauer (Anton Dachauer)
|
||||
'wp-xml-sitemap/wp-xml-sitemap.php', // WP XML Sitemap (Team Vivacity)
|
||||
'sitemap-generator-for-webmasters/sitemap.php', // Sitemap Generator for Webmasters (iwebslogtech)
|
||||
'xml-sitemap-xml-sitemapcouk/xmls.php', // XML Sitemap - XML-Sitemap.co.uk (Simon Hancox)
|
||||
'sewn-in-xml-sitemap/sewn-xml-sitemap.php', // Sewn In XML Sitemap (jcow)
|
||||
'rps-sitemap-generator/rps-sitemap-generator.php', // RPS Sitemap Generator (redpixelstudios)
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Overrides instance to set with this class as class
|
||||
*
|
||||
* @return Yoast_Plugin_Conflict
|
||||
*/
|
||||
public static function get_instance( $classname = __CLASS__ ) {
|
||||
return parent::get_instance( $classname );
|
||||
}
|
||||
|
||||
/**
|
||||
* After activating any plugin, this method will be executed by a hook.
|
||||
*
|
||||
* If the activated plugin is conflicting with ours a notice will be shown.
|
||||
*
|
||||
* @param string|bool $plugin
|
||||
*
|
||||
*/
|
||||
public static function hook_check_for_plugin_conflicts( $plugin = false ) {
|
||||
// The instance of itself
|
||||
$instance = self::get_instance();
|
||||
|
||||
// Only add plugin as active plugin if $plugin isn't false
|
||||
if ( $plugin ) {
|
||||
// Because it's just activated
|
||||
$instance->add_active_plugin( $instance->find_plugin_category( $plugin ), $plugin );
|
||||
}
|
||||
|
||||
$plugin_sections = array(
|
||||
'open_graph' => 'open graph',
|
||||
'xml_sitemaps' => 'xml sitemaps'
|
||||
);
|
||||
|
||||
$instance->check_plugin_conflicts( $plugin_sections );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,7 +19,7 @@ if ( ! class_exists( 'WPSEO_Pointers' ) ) {
|
||||
class WPSEO_Pointers {
|
||||
|
||||
/**
|
||||
* @var object Instance of this class
|
||||
* @var object Instance of this class
|
||||
*/
|
||||
public static $instance;
|
||||
|
||||
@@ -37,8 +37,7 @@ if ( ! class_exists( 'WPSEO_Pointers' ) ) {
|
||||
}
|
||||
if ( $options['tracking_popup_done'] === false && ! isset( $_GET['allow_tracking'] ) ) {
|
||||
add_action( 'admin_print_footer_scripts', array( $this, 'tracking_request' ) );
|
||||
}
|
||||
elseif ( $options['ignore_tour'] === false ) {
|
||||
} elseif ( $options['ignore_tour'] === false ) {
|
||||
add_action( 'admin_print_footer_scripts', array( $this, 'intro_tour' ) );
|
||||
}
|
||||
}
|
||||
@@ -53,6 +52,7 @@ if ( ! class_exists( 'WPSEO_Pointers' ) ) {
|
||||
if ( ! ( self::$instance instanceof self ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
@@ -64,18 +64,24 @@ if ( ! class_exists( 'WPSEO_Pointers' ) ) {
|
||||
$id = '#wpadminbar';
|
||||
$nonce = wp_create_nonce( 'wpseo_activate_tracking' );
|
||||
|
||||
$content = '<h3>' . __( 'Help improve WordPress SEO', 'wordpress-seo' ) . '</h3>';
|
||||
$content .= '<p>' . __( 'You\'ve just installed WordPress SEO by Yoast. Please helps us improve it by allowing us to gather anonymous usage stats so we know which configurations, plugins and themes to test with.', 'wordpress-seo' ) . '</p>';
|
||||
$opt_arr = array(
|
||||
$content = '<h3>' . __( 'Help improve WordPress SEO', 'wordpress-seo' ) . '</h3>';
|
||||
$content .= '<p>' . __( 'You’ve just installed WordPress SEO by Yoast. Please helps us improve it by allowing us to gather anonymous usage stats so we know which configurations, plugins and themes to test with.', 'wordpress-seo' ) . '</p>';
|
||||
$opt_arr = array(
|
||||
'content' => $content,
|
||||
'position' => array( 'edge' => 'top', 'align' => 'center' )
|
||||
);
|
||||
$button2 = __( 'Allow tracking', 'wordpress-seo' );
|
||||
$button_array = array(
|
||||
'button1' => array(
|
||||
'text' => __( 'Do not allow tracking', 'wordpress-seo' ),
|
||||
'function' => 'wpseo_store_answer("no","' . $nonce . '")',
|
||||
),
|
||||
'button2' => array(
|
||||
'text' => __( 'Allow tracking', 'wordpress-seo' ),
|
||||
'function' => 'wpseo_store_answer("yes","' . $nonce . '")',
|
||||
),
|
||||
);
|
||||
|
||||
$function2 = 'wpseo_store_answer("yes","' . $nonce . '")';
|
||||
$function1 = 'wpseo_store_answer("no","' . $nonce . '")';
|
||||
|
||||
$this->print_scripts( $id, $opt_arr, __( 'Do not allow tracking', 'wordpress-seo' ), $button2, $function2, $function1 );
|
||||
$this->print_scripts( $id, $opt_arr, $button_array );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,91 +90,114 @@ if ( ! class_exists( 'WPSEO_Pointers' ) ) {
|
||||
function intro_tour() {
|
||||
global $pagenow, $current_user;
|
||||
|
||||
// @FIXME: Links to tabs only work with target="_blank" and thus open in a new window
|
||||
$adminpages = array(
|
||||
'wpseo_dashboard' => array(
|
||||
'content' => '<h3>' . __( 'Dashboard', 'wordpress-seo' ) . '</h3><p>' . __( 'This is the WordPress SEO Dashboard, here you can restart this tour or revert the WP SEO settings to default.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'More WordPress SEO', 'wordpress-seo' ) . '</strong><br/>' . sprintf( __( 'There\'s more to learn about WordPress & SEO than just using this plugin. Read our article %1$sthe definitive guide to WordPress SEO%2$s.', 'wordpress-seo' ), '<a target="_blank" href="' . esc_url( 'https://yoast.com/articles/wordpress-seo/#utm_source=wpadmin&utm_medium=wpseo_tour&utm_term=link&utm_campaign=wpseoplugin' ) . '">', '</a>' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Webmaster Tools', 'wordpress-seo' ) . '</strong><br/>' . __( 'Underneath the General Settings, you can add the verification codes for the different Webmaster Tools programs, I highly encourage you to check out both Google and Bing\'s Webmaster Tools.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'About This Tour', 'wordpress-seo' ) . '</strong><br/>' . __( 'Clicking Next below takes you to the next page of the tour. If you want to stop this tour, click "Close".', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Like this plugin?', 'wordpress-seo' ) . '</strong><br/>' . sprintf( __( 'If you like this plugin, please %srate it 5 stars on WordPress.org%s and consider making a donation by clicking the button on the right!', 'wordpress-seo' ), '<a target="_blank" href="https://wordpress.org/plugins/wordpress-seo/">', '</a>' ) . '</p>' .
|
||||
'<p><strong>' . __( 'Newsletter', 'wordpress-seo' ) . '</strong><br/>' .
|
||||
__( 'If you would like to keep up to date regarding the WordPress SEO plugin and other plugins by Yoast, subscribe to the newsletter:', 'wordpress-seo' ) . '</p>' .
|
||||
'<form action="http://yoast.us1.list-manage1.com/subscribe/post?u=ffa93edfe21752c921f860358&id=972f1c9122" method="post" id="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">' .
|
||||
'<p>' .
|
||||
'<label for="newsletter-email">' . __( 'Email', 'wordpress-seo' ) . ':</label><input style="color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" id="newsletter-email" placeholder="' . __( 'Email', 'wordpress-seo' ) . '"/><br/>' .
|
||||
'<input type="hidden" name="group" value="2"/>' .
|
||||
'<button type="submit" class="button-primary">' . __( 'Subscribe', 'wordpress-seo' ) . '</button>' .
|
||||
'</p></form>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_titles' ) . '";',
|
||||
'content' => '<h3>' . __( 'Dashboard', 'wordpress-seo' ) . '</h3><p>' . __( 'This is the WordPress SEO Dashboard, here you can restart this tour or revert the WP SEO settings to default.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'More WordPress SEO', 'wordpress-seo' ) . '</strong><br/>' . sprintf( __( 'There’s more to learn about WordPress & SEO than just using this plugin. A great start is our article %1$sthe definitive guide to WordPress SEO%2$s.', 'wordpress-seo' ), '<a target="_blank" href="' . esc_url( 'https://yoast.com/articles/wordpress-seo/#utm_source=wpseo_dashboard&utm_medium=wpseo_tour&utm_campaign=tour' ) . '">', '</a>' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Tracking', 'wordpress-seo' ) . '</strong><br/>' . __( 'To provide you with the best experience possible, we need your help. Please enable tracking to help us gather anonymous usage data.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Webmaster Tools', 'wordpress-seo' ) . '</strong><br/>' . __( 'You can also add the verification codes for the different Webmaster Tools programs here, we highly encourage you to check out both Google and Bing’s Webmaster Tools.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'WordPress SEO Tour', 'wordpress-seo' ) . '</strong><br/>' . __( 'This tour will show you around in the plugin, to give you a general overview of the plugin.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Newsletter', 'wordpress-seo' ) . '</strong><br/>' .
|
||||
__( 'If you would like to us to keep you up-to-date regarding WordPress SEO and other plugins by Yoast, subscribe to our newsletter:', 'wordpress-seo' ) . '</p>' .
|
||||
'<form action="http://yoast.us1.list-manage1.com/subscribe/post?u=ffa93edfe21752c921f860358&id=972f1c9122" method="post" id="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">' .
|
||||
'<p>' .
|
||||
'<label for="newsletter-email">' . __( 'Email', 'wordpress-seo' ) . ':</label> <input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" id="newsletter-email" placeholder="' . __( 'Email', 'wordpress-seo' ) . '"/><br/>' .
|
||||
'<input type="hidden" name="group" value="2"/>' .
|
||||
'<button type="submit" class="button-primary">' . __( 'Subscribe', 'wordpress-seo' ) . '</button>' .
|
||||
'</p></form>',
|
||||
'next' => __( 'Next', 'wordpress-seo' ),
|
||||
'next_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_titles' ) . '";',
|
||||
'position' => array( 'edge' => 'top', 'align' => 'center' ),
|
||||
),
|
||||
'wpseo_titles' => array(
|
||||
'content' => '<h3>' . __( 'Title & Description settings', 'wordpress-seo' ) . '</h3>'
|
||||
. '<p>' . __( 'This is where you set the templates for your titles and descriptions of all the different types of pages on your blog, be it your homepage, posts & pages (under post types), category or tag archives (under taxonomy archives), or even custom post type archives and custom posts: all of that is done from here.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Templates', 'wordpress-seo' ) . '</strong><br/>'
|
||||
. __( 'The templates are built using variables, the help tab for all the different variables available to you to use in these.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Sitewide settings', 'wordpress-seo' ) . '</strong><br/>'
|
||||
. __( 'You can also set some settings for the entire site here to add specific meta tags or to remove some unneeded cruft.', 'wordpress-seo' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_social' ) . '";',
|
||||
'content' => '<h3>' . __( 'Title & Metas settings', 'wordpress-seo' ) . '</h3>' . '<p>' . __( 'This is where you set the titles and meta-information for all your post types, taxonomies, archives, special pages and for your homepage. The page is divided into different tabs. Make sure you check ’em all out!', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Sitewide settings', 'wordpress-seo' ) . '</strong><br/>' . __( 'The first tab will show you site-wide settings. You can also set some settings for the entire site here to add specific meta tags or to remove some unneeded cruft.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Templates and settings', 'wordpress-seo' ) . '</strong><br/>' . sprintf( __( 'Now click on the ‘%1$sPost Types%2$s’-tab, as this will be our example.', 'wordpress-seo' ), '<a target="_blank" href="' . esc_url( admin_url( 'admin.php?page=wpseo_titles#top#post_types' ) ) . '">', '</a>' ) . '<br />' . __( 'The templates are built using variables. You can find all these variables in the help tab (in the top-right corner of the page). The settings allow you to set specific behavior for the post types.', 'wordpress-seo' ) . '</p>',
|
||||
'next' => __( 'Next', 'wordpress-seo' ),
|
||||
'next_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_social' ) . '";',
|
||||
'prev' => __( 'Previous', 'wordpress-seo' ),
|
||||
'prev_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_dashboard' ) . '";',
|
||||
),
|
||||
'wpseo_social' => array(
|
||||
'content' => '<h3>' . __( 'Social settings', 'wordpress-seo' ) . '</h3>'
|
||||
. '<p><strong>' . __( 'Facebook Open Graph', 'wordpress-seo' ) . '</strong><br/>'
|
||||
. __( 'On this page you can enable the Open Graph functionality from this plugin, as well as assign a Facebook user or Application to be the admin of your site, so you can view the Facebook insights.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p>' . sprintf( __( 'Read more about %1$sFacebook Open Graph%2$s.', 'wordpress-seo' ), '<a target="_blank" href="'. esc_url( 'https://yoast.com/facebook-open-graph-protocol/#utm_source=wpadmin&utm_medium=wpseo_tour&utm_term=link&utm_campaign=wpseoplugin' ) . '">', '</a>' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Twitter Cards', 'wordpress-seo' ) . '</strong><br/>'
|
||||
. sprintf( __( 'This functionality is currently in beta, but it allows for %1$sTwitter Cards%2$s.', 'wordpress-seo' ), '<a target="_blank" href="' . esc_url( 'https://yoast.com/twitter-cards/#utm_source=wpadmin&utm_medium=wpseo_tour&utm_term=link&utm_campaign=wpseoplugin' ) . '">', '</a>' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_xml' ) . '";',
|
||||
'content' => '<h3>' . __( 'Social settings', 'wordpress-seo' ) . '</h3>'
|
||||
. '<p><strong>' . __( 'Facebook', 'wordpress-seo' ) . '</strong><br/>' . sprintf( __( 'On this tab you can enable the %1$sFacebook Open Graph%2$s functionality from this plugin, as well as assign a Facebook user or Application to be the admin of your site, so you can view the Facebook insights.', 'wordpress-seo' ), '<a target="_blank" href="' . esc_url( 'https://yoast.com/facebook-open-graph-protocol/#utm_source=wpseo_social&utm_medium=wpseo_tour&utm_campaign=tour' ) . '">', '</a>' ) . '</p><p>' . __( 'The frontpage settings allow you to set meta-data for your homepage, whereas the default settings allow you to set a fallback for all posts/pages without images. ', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Twitter', 'wordpress-seo' ) . '</strong><br/>' . sprintf( __( 'With %1$sTwitter Cards%2$s, you can attach rich photos, videos and media experience to tweets that drive traffic to your website. Simply check the box, sign up for the service, and users who Tweet links to your content will have a “Card” added to the tweet that’s visible to all of their followers.', 'wordpress-seo' ), '<a target="_blank" href="' . esc_url( 'https://yoast.com/twitter-cards/#utm_source=wpseo_social&utm_medium=wpseo_tour&utm_campaign=tour' ) . '">', '</a>' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Google+', 'wordpress-seo' ) . '</strong><br/>' . sprintf( __( 'This tab allows you to add specific post meta data for Google+. And if you have a Google+ page for your business, add that URL here and link it on your %1$sGoogle+%2$s page’s about page.', 'wordpress-seo' ), '<a target="_blank" href="' . esc_url( 'https://plus.google.com/' ) . '">', '</a>' ) . '</p>',
|
||||
'next' => __( 'Next', 'wordpress-seo' ),
|
||||
'next_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_xml' ) . '";',
|
||||
'prev' => __( 'Previous', 'wordpress-seo' ),
|
||||
'prev_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_titles' ) . '";',
|
||||
),
|
||||
'wpseo_xml' => array(
|
||||
'content' => '<h3>' . __( 'XML Sitemaps', 'wordpress-seo' ) . '</h3><p>' . __( 'This plugin adds an XML sitemap to your site. It\'s automatically updated when you publish a new post, page or custom post and Google and Bing will be automatically notified.', 'wordpress-seo' ) . '</p><p>' . __( 'Be sure to check whether post types or taxonomies are showing that search engines shouldn\'t be indexing, if so, check the box before them to hide them from the XML sitemaps.', 'wordpress-seo' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_permalinks' ) . '";',
|
||||
'content' => '<h3>' . __( 'XML Sitemaps', 'wordpress-seo' ) . '</h3>'
|
||||
. '<p><strong>' . __( 'What are XML sitemaps?', 'wordpress-seo' ) . '</strong><br/>' . __( 'A Sitemap is an XML file that lists the URLs for a site. It allows webmasters to include additional information about each URL: when it was last updated, how often it changes, and how important it is in relation to other URLs in the site. This allows search engines to crawl the site more intelligently.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'What does the plugin do with XML Sitemaps?', 'wordpress-seo' ) . '</strong><br/>' . __( 'This plugin adds XML sitemaps to your site. The sitemaps are automatically updated when you publish a new post, page or custom post and Google and Bing will be automatically notified. You can also have the plugin automatically notify Yahoo! and Ask.com.', 'wordpress-seo' ) . '</p><p>' . __( 'If you want to exclude certain post types and/or taxonomies, you can also set that on this page.', 'wordpress-seo' ) . '</p><p>' . __( 'Is your webserver low on memory? Decrease the entries per sitemap (default: 1000) to reduce load.', 'wordpress-seo' ) . '</p>',
|
||||
'next' => __( 'Next', 'wordpress-seo' ),
|
||||
'next_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_permalinks' ) . '";',
|
||||
'prev' => __( 'Previous', 'wordpress-seo' ),
|
||||
'prev_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_social' ) . '";',
|
||||
),
|
||||
'wpseo_permalinks' => array(
|
||||
'content' => '<h3>' . __( 'Permalink Settings', 'wordpress-seo' ) . '</h3><p>' . __( 'All of the options here are for advanced users only, if you don\'t know whether you should check any, don\'t touch them.', 'wordpress-seo' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_internal-links' ) . '";',
|
||||
'content' => '<h3>' . __( 'Permalink Settings', 'wordpress-seo' ) . '</h3><p>' . __( 'All of the options here are for advanced users only, if you don’t know whether you should check any, don’t touch them.', 'wordpress-seo' ) . '</p>',
|
||||
'next' => __( 'Next', 'wordpress-seo' ),
|
||||
'next_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_internal-links' ) . '";',
|
||||
'prev' => __( 'Previous', 'wordpress-seo' ),
|
||||
'prev_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_xml' ) . '";',
|
||||
),
|
||||
'wpseo_internal-links' => array(
|
||||
'content' => '<h3>' . __( 'Breadcrumbs Settings', 'wordpress-seo' ) . '</h3><p>' . sprintf( __( 'If your theme supports my breadcrumbs, as all Genesis and WooThemes themes as well as a couple of other ones do, you can change the settings for those here. If you want to modify your theme to support them, %sfollow these instructions%s.', 'wordpress-seo' ), '<a target="_blank" href="' . esc_url( 'https://yoast.com/wordpress/plugins/breadcrumbs/#utm_source=wpadmin&utm_medium=wpseo_tour&utm_term=link&utm_campaign=wpseoplugin' ) . '">', '</a>' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_rss' ) . '";',
|
||||
'content' => '<h3>' . __( 'Breadcrumbs Settings', 'wordpress-seo' ) . '</h3><p>' . sprintf( __( 'If your theme supports my breadcrumbs, as all Genesis and WooThemes themes as well as a couple of other ones do, you can change the settings for those here. If you want to modify your theme to support them, %sfollow these instructions%s.', 'wordpress-seo' ), '<a target="_blank" href="' . esc_url( 'https://yoast.com/wordpress/plugins/breadcrumbs/#utm_source=wpseo_permalinks&utm_medium=wpseo_tour&utm_campaign=tour' ) . '">', '</a>' ) . '</p>',
|
||||
'next' => __( 'Next', 'wordpress-seo' ),
|
||||
'next_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_rss' ) . '";',
|
||||
'prev' => __( 'Previous', 'wordpress-seo' ),
|
||||
'prev_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_permalinks' ) . '";',
|
||||
),
|
||||
'wpseo_rss' => array(
|
||||
'content' => '<h3>' . __( 'RSS Settings', 'wordpress-seo' ) . '</h3><p>' . __( 'This incredibly powerful function allows you to add content to the beginning and end of your posts in your RSS feed. This helps you gain links from people who steal your content!', 'wordpress-seo' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_import' ) . '";',
|
||||
'content' => '<h3>' . __( 'RSS Settings', 'wordpress-seo' ) . '</h3><p>' . __( 'This incredibly powerful function allows you to add content to the beginning and end of your posts in your RSS feed. This helps you gain links from people who steal your content!', 'wordpress-seo' ) . '</p>',
|
||||
'next' => __( 'Next', 'wordpress-seo' ),
|
||||
'next_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_import' ) . '";',
|
||||
'prev' => __( 'Previous', 'wordpress-seo' ),
|
||||
'prev_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_internal-links' ) . '";',
|
||||
),
|
||||
'wpseo_import' => array(
|
||||
'content' => '<h3>' . __( 'Import & Export', 'wordpress-seo' ) . '</h3><p>' . __( 'Just switched over from another SEO plugin? Use the options here to switch your data over. If you were using some of my older plugins like Robots Meta & RSS Footer, you can import the settings here too.', 'wordpress-seo' ) . '</p><p>' . __( 'If you have multiple blogs and you\'re happy with how you\'ve configured this blog, you can export the settings and import them on another blog so you don\'t have to go through this process twice!', 'wordpress-seo' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . network_admin_url( 'admin.php?page=wpseo_files' ) . '";', // will auto-use admin_url if not on multi-site
|
||||
'content' => '<h3>' . esc_html__( 'Import & Export', 'wordpress-seo' ) . '</h3>'
|
||||
. '<p><strong>' . __( 'Import from other (SEO) plugins', 'wordpress-seo' ) . '</strong><br/>' . __( 'We can imagine that you switch from another SEO plugin to WordPress SEO. If you just did, you can use these options to transfer your SEO-data. If you were using one of my older plugins like Robots Meta & RSS Footer, you can import the settings here too.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Other imports', 'wordpress-seo' ) . '</strong><br/>' . sprintf( __( 'If you’re using one of our premium plugins, such as %1$sLocal SEO%2$s, you can also find specific import-options for that plugin here.', 'wordpress-seo' ), '<a target="_blank" href="' . esc_url( 'https://yoast.com/wordpress/plugins/local-seo/#utm_source=wpseo_import&utm_medium=wpseo_tour&utm_campaign=tour' ) . '">', '</a>' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Export', 'wordpress-seo' ) . '</strong><br/>' . __( 'If you have multiple blogs and you’re happy with how you’ve configured this blog, you can export the settings and import them on another blog so you don’t have to go through this process twice!', 'wordpress-seo' ) . '</p>',
|
||||
'next' => __( 'Next', 'wordpress-seo' ),
|
||||
'next_function' => 'window.location="' . network_admin_url( 'admin.php?page=wpseo_bulk-editor' ) . '";', // will auto-use admin_url if not on multi-site
|
||||
'prev' => __( 'Previous', 'wordpress-seo' ),
|
||||
'prev_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_rss' ) . '";',
|
||||
),
|
||||
'wpseo_bulk-editor' => array(
|
||||
'content' => '<h3>' . __( 'Bulk Editor', 'wordpress-seo' ) . '</h3><p>' . __( 'This page lets you view and edit the titles and meta descriptions of all posts and pages on your site. This allows you to edit the title or meta description of all your pages in one place, rather than having to edit each individual page.', 'wordpress-seo' ) . '</p>',
|
||||
'next' => __( 'Next', 'wordpress-seo' ),
|
||||
'next_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_files' ) . '";',
|
||||
'prev' => __( 'Previous', 'wordpress-seo' ),
|
||||
'prev_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_import' ) . '";',
|
||||
),
|
||||
'wpseo_files' => array(
|
||||
'content' => '<h3>' . __( 'File Editor', 'wordpress-seo' ) . '</h3><p>' . __( 'Here you can edit the .htaccess and robots.txt files, two of the most powerful files in your WordPress install. Only touch these files if you know what you\'re doing!', 'wordpress-seo' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_bulk-title-editor' ) . '";',
|
||||
'content' => '<h3>' . __( 'File Editor', 'wordpress-seo' ) . '</h3><p>' . __( 'Here you can edit the .htaccess and robots.txt files, two of the most powerful files in your WordPress install, if your WordPress installation has write-access to the files. But please, only touch these files if you know what you’re doing!', 'wordpress-seo' ) . '</p>',
|
||||
'next' => __( 'Next', 'wordpress-seo' ),
|
||||
'next_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_licenses' ) . '";',
|
||||
'prev' => __( 'Previous', 'wordpress-seo' ),
|
||||
'prev_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_bulk-editor' ) . '";',
|
||||
),
|
||||
'wpseo_bulk-title-editor' => array(
|
||||
'content' => '<h3>' . __( 'Bulk Title Editor', 'wordpress-seo' ) . '</h3><p>' . __( 'This is where you can view and edit the SEO titles of every post and page on your site. If you have a lot of pages that need SEO titles, use this page to save yourself the hassle of editing every page one at a time!', 'wordpress-seo' ) . '</p>',
|
||||
'button2' => __( 'Next', 'wordpress-seo' ),
|
||||
'function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_bulk-description-editor' ) . '";',
|
||||
),
|
||||
'wpseo_bulk-description-editor' => array(
|
||||
'content' => '<h3>' . __( 'Bulk Description Editor', 'wordpress-seo' ) . '</h3><p>' . __( 'This page lets you view and edit the meta descriptions of all posts and pages on your site. Just like the Bulk Title Editor, this allows you to edit the meta description of all your pages in one place, rather than having to edit each individual page.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p>' . sprintf( __( 'The tour ends here, thank you for using my plugin and good luck with your SEO!<br/><br/>Best,<br/>Joost de Valk - %1$sYoast.com%2$s', 'wordpress-seo' ), '<a target="_blank" href="' . esc_url( 'https://yoast.com/#utm_source=wpadmin&utm_medium=wpseo_tour&utm_term=link&utm_campaign=wpseoplugin' ) . '">', '</a>' ) . '</p>'
|
||||
'wpseo_licenses' => array(
|
||||
'content' => '<h3>' . __( 'Extensions and Licenses', 'wordpress-seo' ) . '</h3>'
|
||||
. '<p><strong>' . __( 'Extensions', 'wordpress-seo' ) . '</strong><br/>' . sprintf( __( 'The powerful functions of WordPress SEO can be extended with %1$sYoast premium plugins%2$s. These premium plugins require the installation of WordPress SEO or WordPress SEO Premium and add specific functionality. You can read all about the Yoast Premium Plugins on %1$shttp://yoast.com/wordpress/plugins/%2$s.', 'wordpress-seo' ), '<a target="_blank" href="' . esc_url( 'https://yoast.com/wordpress/plugins/#utm_source=wpseo_licenses&utm_medium=wpseo_tour&utm_campaign=tour' ) . '">', '</a>' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Licenses', 'wordpress-seo' ) . '</strong><br/>' . __( 'Once you’ve purchased WordPress SEO Premium or any other premium Yoast plugin, you’ll have to enter a license key. You can do so on the Licenses-tab. Once you’ve activated your premium plugin, you can use all its powerful features.', 'wordpress-seo' ) . '</p>'
|
||||
. '<p><strong>' . __( 'Like this plugin?', 'wordpress-seo' ) . '</strong><br/>' . sprintf( __( 'So, we’ve come to the end of the tour. If you like the plugin, please %srate it 5 stars on WordPress.org%s!', 'wordpress-seo' ), '<a target="_blank" href="https://wordpress.org/plugins/wordpress-seo/">', '</a>' ) . '</p>'
|
||||
. '<p>' . sprintf( __( 'Thank you for using my plugin and good luck with your SEO!<br/><br/>Best,<br/>Team Yoast - %1$sYoast.com%2$s', 'wordpress-seo' ), '<a target="_blank" href="' . esc_url( 'https://yoast.com/#utm_source=wpseo_licenses&utm_medium=wpseo_tour&utm_campaign=tour' ) . '">', '</a>' ) . '</p>',
|
||||
'prev' => __( 'Previous', 'wordpress-seo' ),
|
||||
'prev_function' => 'window.location="' . admin_url( 'admin.php?page=wpseo_files' ) . '";',
|
||||
),
|
||||
);
|
||||
|
||||
// Remove the last step and add tour end to import page if file editing is disallowed or if the site is a multisite and the current user isn't a superadmin
|
||||
if ( wpseo_allow_system_file_edit() === false ) {
|
||||
// Skip tour about wpseo_files page if file editing is disallowed or if the site is a multisite and the current user isn't a superadmin
|
||||
if ( false === wpseo_allow_system_file_edit() ) {
|
||||
unset( $adminpages['wpseo_files'] );
|
||||
$adminpages['wpseo_import']['function'] = '';
|
||||
unset( $adminpages['wpseo_import']['button2'] );
|
||||
$adminpages['wpseo_import']['content'] .= '<p>' . sprintf( __( 'The tour ends here,thank you for using my plugin and good luck with your SEO!<br/><br/>Best,<br/>Joost de Valk - %1$sYoast.com%2$s', 'wordpress-seo' ), '<a href="https://yoast.com/">', '</a>' ) . '</p>';
|
||||
$adminpages['wpseo_bulk-editor']['function'] = 'window.location="' . admin_url( 'admin.php?page=wpseo_licenses' ) . '";';
|
||||
}
|
||||
|
||||
$page = '';
|
||||
@@ -176,57 +205,83 @@ if ( ! class_exists( 'WPSEO_Pointers' ) ) {
|
||||
$page = $_GET['page'];
|
||||
}
|
||||
|
||||
$function = '';
|
||||
$button2 = '';
|
||||
$opt_arr = array();
|
||||
$id = '#wpseo-title';
|
||||
$button_array = array(
|
||||
'button1' => array(
|
||||
'text' => __( 'Close', 'wordpress-seo' ),
|
||||
'function' => '',
|
||||
)
|
||||
);
|
||||
$opt_arr = array();
|
||||
$id = '#wpseo-title';
|
||||
if ( 'admin.php' != $pagenow || ! array_key_exists( $page, $adminpages ) ) {
|
||||
$id = 'li.toplevel_page_wpseo_dashboard';
|
||||
$content = '<h3>' . __( 'Congratulations!', 'wordpress-seo' ) . '</h3>';
|
||||
$content .= '<p>' . __( 'You\'ve just installed WordPress SEO by Yoast! Click "Start Tour" to view a quick introduction of this plugins core functionality.', 'wordpress-seo' ) . '</p>';
|
||||
$opt_arr = array(
|
||||
$id = 'li.toplevel_page_wpseo_dashboard';
|
||||
$content = '<h3>' . __( 'Congratulations!', 'wordpress-seo' ) . '</h3>';
|
||||
$content .= '<p>' . __( 'You’ve just installed WordPress SEO by Yoast! Click “Start Tour” to view a quick introduction of this plugin’s core functionality.', 'wordpress-seo' ) . '</p>';
|
||||
$opt_arr = array(
|
||||
'content' => $content,
|
||||
'position' => array( 'edge' => 'top', 'align' => 'center' )
|
||||
'position' => array( 'edge' => 'bottom', 'align' => 'center' )
|
||||
);
|
||||
$button2 = __( 'Start Tour', 'wordpress-seo' );
|
||||
$function = 'document.location="' . admin_url( 'admin.php?page=wpseo_dashboard' ) . '";';
|
||||
}
|
||||
else {
|
||||
$button_array['button2']['text'] = __( 'Start Tour', 'wordpress-seo' );
|
||||
$button_array['button2']['function'] = 'document.location="' . admin_url( 'admin.php?page=wpseo_dashboard' ) . '";';
|
||||
} else {
|
||||
if ( '' != $page && in_array( $page, array_keys( $adminpages ) ) ) {
|
||||
$align = ( is_rtl() ) ? 'right' : 'left';
|
||||
$align = ( is_rtl() ) ? 'left' : 'right';
|
||||
$opt_arr = array(
|
||||
'content' => $adminpages[ $page ]['content'],
|
||||
'position' => array( 'edge' => 'top', 'align' => $align ),
|
||||
'pointerWidth' => 400,
|
||||
'content' => $adminpages[$page]['content'],
|
||||
'position' => ( isset ( $adminpages[$page]['position'] ) ) ? ( $adminpages[$page]['position'] ) : array( 'edge' => 'top', 'align' => $align ),
|
||||
'pointerWidth' => 450,
|
||||
);
|
||||
if ( isset( $adminpages[ $page ]['button2'] ) ) {
|
||||
$button2 = $adminpages[ $page ]['button2'];
|
||||
if ( isset( $adminpages[$page]['next'] ) && isset( $adminpages[$page]['next_function'] ) ) {
|
||||
$button_array['button2'] = array(
|
||||
'text' => $adminpages[$page]['next'],
|
||||
'function' => $adminpages[$page]['next_function'],
|
||||
);
|
||||
}
|
||||
if ( isset( $adminpages[ $page ]['function'] ) ) {
|
||||
$function = $adminpages[ $page ]['function'];
|
||||
if ( isset( $adminpages[$page]['prev'] ) && isset( $adminpages[$page]['prev_function'] ) ) {
|
||||
$button_array['button3'] = array(
|
||||
'text' => $adminpages[$page]['prev'],
|
||||
'function' => $adminpages[$page]['prev_function'],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->print_scripts( $id, $opt_arr, __( 'Close', 'wordpress-seo' ), $button2, $function );
|
||||
$this->print_scripts( $id, $opt_arr, $button_array );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prints the pointer script
|
||||
*
|
||||
* @param string $selector The CSS selector the pointer is attached to.
|
||||
* @param array $options The options for the pointer.
|
||||
* @param string $button1 Text for button 1
|
||||
* @param string|bool $button2 Text for button 2 (or false to not show it, defaults to false)
|
||||
* @param string $button2_function The JavaScript function to attach to button 2
|
||||
* @param string $button1_function The JavaScript function to attach to button 1
|
||||
* @param string $selector The CSS selector the pointer is attached to.
|
||||
* @param array $options The options for the pointer.
|
||||
* @param array $button_array The options for the buttons.
|
||||
*/
|
||||
function print_scripts( $selector, $options, $button1, $button2 = false, $button2_function = '', $button1_function = '' ) {
|
||||
function print_scripts( $selector, $options, $button_array ) {
|
||||
$button_array_defaults = array(
|
||||
'button1' => array(
|
||||
'text' => false,
|
||||
'function' => '',
|
||||
),
|
||||
'button2' => array(
|
||||
'text' => false,
|
||||
'function' => '',
|
||||
),
|
||||
'button3' => array(
|
||||
'text' => false,
|
||||
'function' => '',
|
||||
),
|
||||
);
|
||||
$button_array = wp_parse_args( $button_array, $button_array_defaults );
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
(function ($) {
|
||||
// Don't show the tour on screens with an effective width smaller than 1024px or an effective height smaller than 768px.
|
||||
if (jQuery(window).width() < 1024 || jQuery(window).availWidth < 1024 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var wpseo_pointer_options = <?php echo json_encode( $options ); ?>, setup;
|
||||
|
||||
function wpseo_store_answer(input, nonce) {
|
||||
@@ -242,7 +297,7 @@ if ( ! class_exists( 'WPSEO_Pointers' ) ) {
|
||||
|
||||
wpseo_pointer_options = $.extend(wpseo_pointer_options, {
|
||||
buttons: function (event, t) {
|
||||
var button = jQuery('<a id="pointer-close" style="margin-left:5px;" class="button-secondary">' + '<?php echo $button1; ?>' + '</a>');
|
||||
var button = jQuery('<a id="pointer-close" style="margin:0 5px;" class="button-secondary">' + '<?php echo $button_array['button1']['text']; ?>' + '</a>');
|
||||
button.bind('click.pointer', function () {
|
||||
t.element.pointer('close');
|
||||
});
|
||||
@@ -254,18 +309,29 @@ if ( ! class_exists( 'WPSEO_Pointers' ) ) {
|
||||
|
||||
setup = function () {
|
||||
$('<?php echo $selector; ?>').pointer(wpseo_pointer_options).pointer('open');
|
||||
<?php if ( $button2 ) { ?>
|
||||
jQuery('#pointer-close').after('<a id="pointer-primary" class="button-primary">' + '<?php echo $button2; ?>' + '</a>');
|
||||
<?php if ( $button_array['button2']['text'] ) { ?>
|
||||
jQuery('#pointer-close').after('<a id="pointer-primary" class="button-primary">' + '<?php echo $button_array['button2']['text']; ?>' + '</a>');
|
||||
jQuery('#pointer-primary').click(function () {
|
||||
<?php echo $button2_function; ?>
|
||||
<?php echo $button_array['button2']['function']; ?>
|
||||
});
|
||||
<?php if ( $button_array['button3']['text'] ) { ?>
|
||||
jQuery('#pointer-primary').after('<a id="pointer-ternary" style="float: left;" class="button-secondary">' + '<?php echo $button_array['button3']['text']; ?>' + '</a>');
|
||||
jQuery('#pointer-ternary').click(function () {
|
||||
<?php echo $button_array['button3']['function']; ?>
|
||||
});
|
||||
<?php } ?>
|
||||
jQuery('#pointer-close').click(function () {
|
||||
<?php if ( $button1_function == '' ) { ?>
|
||||
<?php if ( $button_array['button1']['function'] == '' ) { ?>
|
||||
wpseo_setIgnore("tour", "wp-pointer-0", "<?php echo esc_js( wp_create_nonce( 'wpseo-ignore' ) ); ?>");
|
||||
<?php } else { ?>
|
||||
<?php echo $button1_function; ?>
|
||||
<?php echo $button_array['button1']['function']; ?>
|
||||
<?php } ?>
|
||||
});
|
||||
<?php } else if ( $button_array['button3']['text'] ) { ?>
|
||||
jQuery('#pointer-close').after('<a id="pointer-ternary" style="float: left;" class="button-secondary">' + '<?php echo $button_array['button3']['text']; ?>' + '</a>');
|
||||
jQuery('#pointer-ternary').click(function () {
|
||||
<?php echo $button_array['button3']['function']; ?>
|
||||
});
|
||||
<?php } ?>
|
||||
};
|
||||
|
||||
@@ -280,7 +346,6 @@ if ( ! class_exists( 'WPSEO_Pointers' ) ) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load a tiny bit of CSS in the head
|
||||
*
|
||||
@@ -288,9 +353,10 @@ if ( ! class_exists( 'WPSEO_Pointers' ) ) {
|
||||
*/
|
||||
function admin_head() {
|
||||
_deprecated_function( __METHOD__, 'WPSEO 1.5.0' );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} /* End of class */
|
||||
|
||||
} /* End of class-exists wrapper */
|
||||
} /* End of class-exists wrapper */
|
||||
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
if ( ! class_exists( 'WPSEO_Snippet_Preview' ) ) {
|
||||
/**
|
||||
* class WPSEO_Snippet_Preview
|
||||
*
|
||||
* Generates a Google Search snippet preview.
|
||||
*
|
||||
* Takes a $post, $title and $description
|
||||
*
|
||||
*/
|
||||
class WPSEO_Snippet_Preview {
|
||||
/**
|
||||
* @var string The dynamically generated html for the snippet preview.
|
||||
*/
|
||||
protected $content;
|
||||
|
||||
/**
|
||||
* @var array The WPSEO options.
|
||||
*/
|
||||
protected $options;
|
||||
|
||||
/**
|
||||
* @var object The post for which we want to generate the snippet preview.
|
||||
*/
|
||||
protected $post;
|
||||
|
||||
/**
|
||||
* @var string The title that is shown in the snippet.
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* @var string The description that is shown in the snippet.
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @var string The date that is shown at the beginning of the description in the snippet.
|
||||
*/
|
||||
protected $date = '';
|
||||
|
||||
/**
|
||||
* @var string The url that is shown in the snippet.
|
||||
*/
|
||||
protected $url;
|
||||
|
||||
/**
|
||||
* @var string The slug of the url that is shown in the snippet.
|
||||
*/
|
||||
protected $slug = '';
|
||||
|
||||
/**
|
||||
* Generates the html for the snippet preview containing dynamically generated text components.
|
||||
* Those components are included as properties which are set in the constructor.
|
||||
*
|
||||
* @param object $post
|
||||
* @param string $title
|
||||
* @param string $description
|
||||
*/
|
||||
public function __construct( $post, $title, $description ) {
|
||||
$this->options = WPSEO_Options::get_all();
|
||||
$this->post = $post;
|
||||
$this->title = esc_html( $title );
|
||||
$this->description = esc_html( $description );
|
||||
|
||||
$this->set_date();
|
||||
$this->set_url();
|
||||
$this->set_content();
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for $this->content
|
||||
* @return string html for snippet preview
|
||||
*/
|
||||
public function get_content() {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets date if available
|
||||
*/
|
||||
protected function set_date() {
|
||||
if ( is_object( $this->post ) && isset( $this->options['showdate-' . $this->post->post_type] ) && $this->options['showdate-' . $this->post->post_type] === true ) {
|
||||
$date = $this->get_post_date();
|
||||
$this->date = '<span class="date">' . $date . ' - </span>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a post date when post is published, or return current date when it's not.
|
||||
*
|
||||
* @param object $post Post to retrieve the date for.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_post_date() {
|
||||
if ( isset( $this->post->post_date ) && $this->post->post_status == 'publish' ) {
|
||||
$date = date_i18n( 'j M Y', strtotime( $this->post->post_date ) );
|
||||
} else {
|
||||
$date = date_i18n( 'j M Y' );
|
||||
}
|
||||
|
||||
return (string) $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the url that is displayed in the snippet preview.
|
||||
*/
|
||||
protected function set_url() {
|
||||
$this->url = str_replace( array( 'http://', 'https://' ), '', get_bloginfo( 'url' ) ) . '/';
|
||||
$this->set_slug();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the slug and adds it to the url if the post has been published and the post name exists.
|
||||
*
|
||||
* If the post is set to be the homepage the slug is also not included.
|
||||
*/
|
||||
protected function set_slug() {
|
||||
$frontpage_post_id = (int) ( get_option( 'page_on_front' ) );
|
||||
|
||||
if ( is_object( $this->post ) && isset( $this->post->post_name ) && $this->post->post_name !== '' && $this->post->ID !== $frontpage_post_id ) {
|
||||
$this->slug = sanitize_title( $this->title );
|
||||
$this->url .= esc_html( $this->slug );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the html for the snippet preview and assign it to $this->content.
|
||||
*/
|
||||
protected function set_content() {
|
||||
$content = <<<HTML
|
||||
<div id="wpseosnippet">
|
||||
<a class="title" id="wpseosnippet_title" href="#">$this->title</a>
|
||||
<span class="url">$this->url</span>
|
||||
<p class="desc">$this->date<span class="autogen"></span><span class="content">$this->description</span></p>
|
||||
</div>
|
||||
HTML;
|
||||
$this->set_content_through_filter( $content );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the html for the snippet preview through a filter
|
||||
*/
|
||||
protected function set_content_through_filter( $content ) {
|
||||
$properties = get_object_vars( $this );
|
||||
|
||||
/**
|
||||
* Filter: 'wpseo_snippet' - Allow changing the html for the snippet preview.
|
||||
*
|
||||
* Passing in the post twice because of backwards compatibility.
|
||||
*/
|
||||
$this->content = apply_filters( 'wpseo_snippet', $content, $this->post, $properties );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,13 +178,13 @@ if ( ! class_exists( 'WPSEO_Taxonomy' ) ) {
|
||||
$this->form_row( 'wpseo_desc', __( 'SEO Description', 'wordpress-seo' ), esc_html__( 'The SEO description is used for the meta description on the archive page for this term.', 'wordpress-seo' ), $tax_meta );
|
||||
|
||||
if ( $options['usemetakeywords'] === true ) {
|
||||
$this->form_row( 'wpseo_metakey', __( 'Meta Keywords', 'wordpress-seo' ), esc_html__( 'Meta keywords used on the archive page for this term.', 'wordpress-seo' ), $tax_meta );
|
||||
$this->form_row( 'wpseo_metakey', __( 'Meta keywords', 'wordpress-seo' ), esc_html__( 'Meta keywords used on the archive page for this term.', 'wordpress-seo' ), $tax_meta );
|
||||
}
|
||||
|
||||
$this->form_row( 'wpseo_canonical', __( 'Canonical', 'wordpress-seo' ), esc_html__( 'The canonical link is shown on the archive page for this term.', 'wordpress-seo' ), $tax_meta );
|
||||
|
||||
if ( $options['breadcrumbs-enable'] === true ) {
|
||||
$this->form_row( 'wpseo_bctitle', __( 'Breadcrumbs Title', 'wordpress-seo' ), sprintf( esc_html__( 'The Breadcrumbs title is used in the breadcrumbs where this %s appears.', 'wordpress-seo' ), $term->taxonomy ), $tax_meta );
|
||||
$this->form_row( 'wpseo_bctitle', __( 'Breadcrumbs title', 'wordpress-seo' ), sprintf( esc_html__( 'The Breadcrumbs title is used in the breadcrumbs where this %s appears.', 'wordpress-seo' ), $term->taxonomy ), $tax_meta );
|
||||
}
|
||||
|
||||
$current = 'index';
|
||||
|
||||
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Admin
|
||||
*/
|
||||
|
||||
if ( ! defined( 'WPSEO_VERSION' ) ) {
|
||||
header( 'Status: 403 Forbidden' );
|
||||
header( 'HTTP/1.1 403 Forbidden' );
|
||||
exit();
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Yoast_Plugin_Conflict' ) ) {
|
||||
|
||||
class Yoast_Plugin_Conflict {
|
||||
|
||||
/**
|
||||
* The plugins must be grouped per section.
|
||||
*
|
||||
* It's possible to check for each section if there are conflicting plugin
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $plugins = array();
|
||||
|
||||
/**
|
||||
* All the current active plugins will be stored in this private var
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $all_active_plugins = array();
|
||||
|
||||
/**
|
||||
* After searching for active plugins that are in $this->plugins the active plugins will be stored in this
|
||||
* property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $active_plugins = array();
|
||||
|
||||
/**
|
||||
* Property for holding instance of itself
|
||||
*
|
||||
* @var Yoast_Plugin_Conflict
|
||||
*/
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
* For the use of singleton pattern. Create instance of itself and return his instance
|
||||
*
|
||||
* @param bool|string $classname Give the classname to initialize. If classname is false (empty) it will use it's own __CLASS__
|
||||
*
|
||||
* @return Yoast_Plugin_Conflict
|
||||
*/
|
||||
public static function get_instance( $class_name = false ) {
|
||||
|
||||
if ( is_null( self::$instance ) ) {
|
||||
if ( empty( $class_name ) ) {
|
||||
$class_name = __CLASS__;
|
||||
}
|
||||
|
||||
self::$instance = new $class_name();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting instance, all active plugins and search for active plugins
|
||||
*
|
||||
* Protected constructor to prevent creating a new instance of the
|
||||
* *Singleton* via the `new` operator from outside of this class.
|
||||
*
|
||||
*/
|
||||
protected function __construct() {
|
||||
// Set active plugins
|
||||
$this->all_active_plugins = get_option( 'active_plugins' );
|
||||
|
||||
// Search for active plugins
|
||||
$this->search_active_plugins();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there are conflicting plugins for given $plugin_section
|
||||
*
|
||||
* @param string $plugin_section
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function check_for_conflicts( $plugin_section ) {
|
||||
|
||||
static $sections_checked;
|
||||
|
||||
if ( $sections_checked == null ) {
|
||||
$sections_checked = array();
|
||||
}
|
||||
|
||||
if ( ! in_array($plugin_section, $sections_checked ) ) {
|
||||
$sections_checked[] = $plugin_section;
|
||||
$has_conflicts = ( ! empty( $this->active_plugins[$plugin_section] ) );
|
||||
|
||||
return $has_conflicts;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting all the conflicting plugins and return them as a string.
|
||||
*
|
||||
* This method will loop through all conflicting plugins to get the details of each plugin. The plugin name
|
||||
* will be taken from the details to parse a comma separated string, which can be use for by example a notice
|
||||
*
|
||||
* @param string $plugin_section
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_conflicting_plugins_as_string( $plugin_section ) {
|
||||
if ( ! function_exists( 'get_plugin_data' ) ) {
|
||||
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
||||
}
|
||||
|
||||
// Getting the active plugins by given section
|
||||
$plugins = $this->active_plugins[$plugin_section];
|
||||
|
||||
$plugin_names = array();
|
||||
foreach ( $plugins AS $plugin ) {
|
||||
$plugin_details = get_plugin_data( ABSPATH . '/wp-content/plugins/' . $plugin );
|
||||
|
||||
if ( $plugin_details['Name'] != '' ) {
|
||||
$plugin_names[] = $plugin_details['Name'];
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $plugin_names ) ) {
|
||||
return implode( ', ', $plugin_names );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for given $plugin_sections for conflicts
|
||||
*
|
||||
* @param array $plugin_sections
|
||||
*/
|
||||
public function check_plugin_conflicts( $plugin_sections ) {
|
||||
foreach ( $plugin_sections AS $plugin_section => $readable_plugin_section ) {
|
||||
// Check for conflicting plugins and show error if there are conflicts
|
||||
if ( $this->check_for_conflicts( $plugin_section ) ) {
|
||||
$this->set_error( $plugin_section, $readable_plugin_section );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting an error on the screen
|
||||
*
|
||||
* @param string $plugin_section
|
||||
* @param string $readable_plugin_section This is the value for the translation
|
||||
*/
|
||||
protected function set_error( $plugin_section, $readable_plugin_section ) {
|
||||
|
||||
$plugins_as_string = $this->get_conflicting_plugins_as_string( $plugin_section );
|
||||
$error_message = sprintf( __( 'The following plugins might cause (%1s) issues with Yoast WordPress SEO: %2s', 'wordpress-seo' ), $readable_plugin_section, $plugins_as_string );
|
||||
|
||||
// Add the message to the notifications center
|
||||
Yoast_Notification_Center::get()->add_notification( new Yoast_Notification( $error_message, 'error' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loop through the $this->plugins to check if one of the plugins is active.
|
||||
*
|
||||
* This method will store the active plugins in $this->active_plugins.
|
||||
*/
|
||||
protected function search_active_plugins() {
|
||||
foreach ( $this->plugins AS $plugin_section => $plugins ) {
|
||||
$this->check_plugins_active( $plugins, $plugin_section );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loop through plugins and check if each plugin is active
|
||||
*
|
||||
* @param array $plugins
|
||||
* @param string $plugin_section
|
||||
*/
|
||||
protected function check_plugins_active( $plugins, $plugin_section ) {
|
||||
foreach ( $plugins AS $plugin ) {
|
||||
if ( $this->check_plugin_is_active( $plugin ) ) {
|
||||
$this->add_active_plugin( $plugin_section, $plugin );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if given plugin exists in array with all_active_plugins
|
||||
*
|
||||
* @param string $plugin
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function check_plugin_is_active( $plugin ) {
|
||||
|
||||
$is_plugin_active = in_array( $plugin, $this->all_active_plugins );
|
||||
|
||||
return $is_plugin_active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add plugin to the list of active plugins.
|
||||
*
|
||||
* This method will check first if key $plugin_section exists, if not it will create an empty array
|
||||
* If $plugin itself doesn't exist it will be added.
|
||||
*
|
||||
* @param string $plugin_section
|
||||
* @param string $plugin
|
||||
*/
|
||||
protected function add_active_plugin( $plugin_section, $plugin ) {
|
||||
|
||||
if ( ! array_key_exists( $plugin_section, $this->active_plugins ) ) {
|
||||
$this->active_plugins[$plugin_section] = array();
|
||||
}
|
||||
|
||||
if ( ! in_array( $plugin, $this->active_plugins[$plugin_section] ) ) {
|
||||
$this->active_plugins[$plugin_section][] = $plugin;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Search in $this->plugins for the given $plugin
|
||||
*
|
||||
* If there is a result it will return the plugin category
|
||||
*
|
||||
* @param string $plugin
|
||||
*
|
||||
* @return int|string
|
||||
*/
|
||||
protected function find_plugin_category( $plugin ) {
|
||||
|
||||
foreach ( $this->plugins AS $plugin_section => $plugins ) {
|
||||
if ( in_array( $plugin, $plugins ) ) {
|
||||
return $plugin_section;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,675 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{one line to give the program's name and a brief idea of what it does.}
|
||||
Copyright (C) {year} {name of author}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
{project} Copyright (C) {year} {fullname}
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
[](https://codeclimate.com/github/Yoast/i18n-module)
|
||||
|
||||
# Yoast i18n module
|
||||
Promote your own translation site for people who are using your plugin in another language than `en_US`.
|
||||
|
||||
## Example of the rendered promo box
|
||||
|
||||

|
||||
|
||||
The image, the name of your plugin and the name of your translation project are all configurable (see example below). The name of the language is retrieved from your GlotPress install, as is the percentage translated. The box doesn't display when a language has been translated for 90% or more.
|
||||
|
||||
## How to use this module
|
||||
Just include the library as a submodule, make sure the class is loaded and instantiate it like this:
|
||||
|
||||
```php
|
||||
$wpseo_i18n = new yoast_i18n(
|
||||
array(
|
||||
'textdomain' => 'wordpress-seo',
|
||||
'project_slug' => 'wordpress-seo',
|
||||
'plugin_name' => 'WordPress SEO by Yoast',
|
||||
'hook' => 'wpseo_admin_footer',
|
||||
'glotpress_url' => 'http://translate.yoast.com',
|
||||
'glotpress_name' => 'Yoast Translate',
|
||||
'glotpress_logo' => 'https://cdn.yoast.com/wp-content/uploads/i18n-images/Yoast_Translate.svg',
|
||||
'register_url ' => 'http://translate.yoast.com/projects#utm_source=plugin&utm_medium=promo-box&utm_campaign=i18n-promo',
|
||||
)
|
||||
);
|
||||
```
|
||||
@@ -0,0 +1,278 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This class defines a promo box and checks your translation site's API for stats about it, then shows them to the user.
|
||||
*/
|
||||
class yoast_i18n {
|
||||
|
||||
/**
|
||||
* Your translation site's logo
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $glotpress_logo;
|
||||
|
||||
/**
|
||||
* Your translation site's name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $glotpress_name;
|
||||
|
||||
/**
|
||||
* Your translation site's URL
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $glotpress_url;
|
||||
|
||||
/**
|
||||
* Hook where you want to show the promo box
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $hook;
|
||||
|
||||
/**
|
||||
* Will contain the site's locale
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $locale;
|
||||
|
||||
/**
|
||||
* Will contain the locale's name, obtained from yoru translation site
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $locale_name;
|
||||
|
||||
/**
|
||||
* Will contain the percentage translated for the plugin translation project in the locale
|
||||
*
|
||||
* @access private
|
||||
* @var int
|
||||
*/
|
||||
private $percent_translated;
|
||||
|
||||
/**
|
||||
* Name of your plugin
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $plugin_name;
|
||||
|
||||
/**
|
||||
* Project slug for the project on your translation site
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $project_slug;
|
||||
|
||||
/**
|
||||
* URL to point to for registration links
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $register_url;
|
||||
|
||||
/**
|
||||
* Your plugins textdomain
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $textdomain;
|
||||
|
||||
/**
|
||||
* Indicates whether there's a translation available at all.
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $translation_exists;
|
||||
|
||||
/**
|
||||
* Indicates whether the translation's loaded.
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $translation_loaded;
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param array $args Contains the settings for the class.
|
||||
*/
|
||||
public function __construct( $args ) {
|
||||
if ( ! is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->locale = get_locale();
|
||||
if ( 'en_US' === $this->locale ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->init( $args );
|
||||
|
||||
if ( ! $this->hide_promo() ) {
|
||||
add_action( $this->hook, array( $this, 'promo' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is where you decide where to display the messages and where you set the plugin specific variables.
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @param array $args
|
||||
*/
|
||||
private function init( $args ) {
|
||||
foreach ( $args as $key => $arg ) {
|
||||
$this->$key = $arg;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the promo should be hidden or not
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function hide_promo() {
|
||||
$hide_promo = get_transient( 'yoast_i18n_' . $this->project_slug . '_promo_hide' );
|
||||
if ( ! $hide_promo ) {
|
||||
if ( filter_input( INPUT_GET, 'remove_i18n_promo', FILTER_NULL_ON_FAILURE ) ) {
|
||||
// No expiration time, so this would normally not expire, but it wouldn't be copied to other sites etc.
|
||||
set_transient( 'yoast_i18n_' . $this->project_slug . '_promo_hide', true );
|
||||
$hide_promo = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $hide_promo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a promo message
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return bool|string $message
|
||||
*/
|
||||
private function promo_message() {
|
||||
$message = false;
|
||||
|
||||
if ( $this->translation_loaded && $this->percent_translated < 90 ) {
|
||||
$message = __( 'As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help complete the translation to %1$s!', $this->textdomain );
|
||||
} else if ( ! $this->translation_loaded && $this->translation_exists ) {
|
||||
$message = __( 'You\'re using WordPress in %1$s. While %2$s has been translated to %1$s for %3$d%%, it\'s not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', $this->textdomain );
|
||||
} else if ( ! $this->translation_loaded && ! $this->translation_exists ) {
|
||||
$message = __( 'You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', $this->textdomain );
|
||||
}
|
||||
|
||||
$registration_link = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $this->register_url ), esc_html( $this->glotpress_name ) );
|
||||
$message = sprintf( $message, esc_html( $this->locale_name ), esc_html( $this->plugin_name ), $this->percent_translated, $registration_link );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs a promo box
|
||||
*/
|
||||
public function promo() {
|
||||
$this->translation_details();
|
||||
|
||||
$message = $this->promo_message();
|
||||
|
||||
if ( $message ) {
|
||||
echo '<div id="i18n_promo_box" style="border:1px solid #ccc;background-color:#fff;padding:10px;max-width:650px;">';
|
||||
echo '<a href="' . add_query_arg( array( 'remove_i18n_promo' => '1' ) ) . '" style="color:#333;text-decoration:none;font-weight:bold;font-size:16px;border:1px solid #ccc;padding:1px 4px;" class="alignright">X</a>';
|
||||
echo '<h2>' . sprintf( __( 'Translation of %s', $this->textdomain ), $this->plugin_name ) . '</h2>';
|
||||
if ( isset( $this->glotpress_logo ) && '' != $this->glotpress_logo ) {
|
||||
echo '<a href="' . $this->register_url . '"><img class="alignright" style="margin:15px 5px 5px 5px;width:200px;" src="' . $this->glotpress_logo . '" alt="' . $this->glotpress_name . '"/></a>';
|
||||
}
|
||||
echo '<p>' . $message . '</p>';
|
||||
echo '<p><a href="' . $this->register_url . '">' . __( 'Register now »', $this->textdomain ) . '</a></p>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to find the transient for the translation set or retrieve them.
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return object|null
|
||||
*/
|
||||
private function find_or_initialize_translation_details() {
|
||||
$set = get_transient( 'yoast_i18n_' . $this->project_slug );
|
||||
|
||||
if ( ! $set ) {
|
||||
$set = $this->retrieve_translation_details();
|
||||
set_transient( 'yoast_i18n_' . $this->project_slug, $set, DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to get translation details from cache, otherwise retrieve them, then parse them.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function translation_details() {
|
||||
$set = $this->find_or_initialize_translation_details();
|
||||
|
||||
$this->translation_exists = ! is_null( $set );
|
||||
$this->translation_loaded = is_textdomain_loaded( $this->textdomain );
|
||||
|
||||
$this->parse_translation_set( $set );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the translation details from Yoast Translate
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return object|null
|
||||
*/
|
||||
private function retrieve_translation_details() {
|
||||
$api_url = trailingslashit( $this->glotpress_url ) . 'api/projects/' . $this->project_slug;
|
||||
|
||||
$resp = wp_remote_get( $api_url );
|
||||
$body = wp_remote_retrieve_body( $resp );
|
||||
unset( $resp );
|
||||
|
||||
if ( $body ) {
|
||||
$body = json_decode( $body );
|
||||
foreach ( $body->translation_sets as $set ) {
|
||||
if ( $this->locale == $set->wp_locale ) {
|
||||
return $set;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the needed private variables based on the results from Yoast Translate
|
||||
*
|
||||
* @param object $set The translation set
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function parse_translation_set( $set ) {
|
||||
if ( $this->translation_exists ) {
|
||||
$this->locale_name = $set->name;
|
||||
$this->percent_translated = $set->percent_translated;
|
||||
} else {
|
||||
$this->locale_name = '';
|
||||
$this->percent_translated = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,11 +175,13 @@ if( ! class_exists( 'Yoast_License_Manager', false ) ) {
|
||||
// show success notice if license is valid
|
||||
if($result->license === 'valid') {
|
||||
|
||||
$message = sprintf( __( "Your %s license has been activated. ", $this->product->get_text_domain() ), $this->product->get_item_name() );
|
||||
|
||||
// show a custom notice if users have an unlimited license
|
||||
if( $result->license_limit == 0 ) {
|
||||
$message = sprintf( __( "Your %s license has been activated. You have an unlimited license. ", $this->product->get_text_domain() ), $this->product->get_item_name() );
|
||||
$message .= __( "You have an unlimited license. ", $this->product->get_text_domain() );
|
||||
} else {
|
||||
$message = sprintf( __( "Your %s license has been activated. You have used %d/%d activations. ", $this->product->get_text_domain() ), $this->product->get_item_name(), $result->site_count, $result->license_limit );
|
||||
$message .= sprintf( __( "You have used %d/%d activations. ", $this->product->get_text_domain() ), $result->site_count, $result->license_limit );
|
||||
}
|
||||
|
||||
// add upgrade notice if user has less than 3 activations left
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
if( class_exists( 'Yoast_License_Manager' ) && ! class_exists( "Yoast_Theme_License_Manager", false ) ) {
|
||||
|
||||
class Yoast_Theme_License_Manager extends Yoast_License_Manager {
|
||||
|
||||
/**
|
||||
* Setup auto updater for themes
|
||||
*/
|
||||
public function setup_auto_updater() {
|
||||
if ( $this->license_is_valid() ) {
|
||||
// setup auto updater
|
||||
require_once dirname( __FILE__ ) . '/class-update-manager.php';
|
||||
require_once dirname( __FILE__ ) . '/class-theme-update-manager.php'; // @TODO: Autoload?
|
||||
new Yoast_Theme_Update_Manager( $this->product, $this );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup hooks
|
||||
*/
|
||||
public function specific_hooks() {
|
||||
// remotely deactivate license upon switching away from this theme
|
||||
add_action( 'switch_theme', array( $this, 'deactivate_license' ) );
|
||||
|
||||
// Add the license menu
|
||||
add_action( 'admin_menu', array( $this, 'add_license_menu' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add license page and add it to Themes menu
|
||||
*/
|
||||
public function add_license_menu() {
|
||||
$theme_page = add_theme_page( sprintf( __( '%s License', $this->product->get_text_domain() ), $this->product->get_item_name() ), __( 'Theme License', $this->product->get_text_domain() ), 'manage_options', 'theme-license', array( $this, 'show_license_page' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows license page
|
||||
*/
|
||||
public function show_license_page() {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<?php settings_errors(); ?>
|
||||
|
||||
<?php $this->show_license_form( false ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
|
||||
if( class_exists( 'Yoast_Update_Manager' ) && ! class_exists( "Yoast_Theme_Update_Manager", false ) ) {
|
||||
|
||||
class Yoast_Theme_Update_Manager extends Yoast_Update_Manager {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $api_url
|
||||
* @param string $item_name
|
||||
* @param string $license_key
|
||||
* @param string $slug
|
||||
* @param string $theme_version
|
||||
* @param string $author (optional)
|
||||
*/
|
||||
public function __construct( Yoast_Product $product, $license_key ) {
|
||||
|
||||
parent::__construct( $product, $license_key );
|
||||
|
||||
// setup hooks
|
||||
$this->setup_hooks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current theme version
|
||||
*
|
||||
* @return string The version number
|
||||
*/
|
||||
private function get_theme_version() {
|
||||
|
||||
// if version was not set, get it from the Theme stylesheet
|
||||
if( $this->product->get_version() === '' ) {
|
||||
$theme = wp_get_theme( $this->product->get_slug() );
|
||||
return $theme->get( 'Version' );
|
||||
}
|
||||
|
||||
return $this->product->get_version();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup hooks
|
||||
*/
|
||||
private function setup_hooks() {
|
||||
add_filter( 'site_transient_update_themes', array( $this, 'set_theme_update_transient' ) );
|
||||
add_action( 'load-themes.php', array( $this, 'load_themes_screen' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set "updates available" transient
|
||||
*/
|
||||
public function set_theme_update_transient( $value ) {
|
||||
|
||||
$update_data = $this->get_update_data();
|
||||
|
||||
if( $update_data === false ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
// add update data to "updates available" array. convert object to array.
|
||||
$value->response[ $this->product->get_slug() ] = (array) $update_data;
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add hooks and scripts to the Appearance > Themes screen
|
||||
*/
|
||||
public function load_themes_screen() {
|
||||
|
||||
$update_data = $this->get_update_data();
|
||||
|
||||
// only do if an update is available
|
||||
if( $update_data === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_thickbox();
|
||||
add_action( 'admin_notices', array( $this, 'show_update_details' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show update link.
|
||||
* Opens Thickbox with Changelog.
|
||||
*/
|
||||
public function show_update_details() {
|
||||
|
||||
$update_data = $this->get_update_data();
|
||||
|
||||
// only show if an update is available
|
||||
if( $update_data === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$update_url = wp_nonce_url( 'update.php?action=upgrade-theme&theme=' . urlencode( $this->product->get_slug() ), 'upgrade-theme_' . $this->product->get_slug() );
|
||||
$update_onclick = ' onclick="if ( confirm(\'' . esc_js( __( "Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update." ) ) . '\') ) {return true;}return false;"';
|
||||
?>
|
||||
<div id="update-nag">
|
||||
<?php
|
||||
printf(
|
||||
__( '<strong>%s version %s</strong> is available. <a href="%s" class="thickbox" title="%s">Check out what\'s new</a> or <a href="%s" %s>update now</a>.' ),
|
||||
$this->product->get_item_name(),
|
||||
$update_data->new_version,
|
||||
'#TB_inline?width=640&inlineId=' . $this->product->get_slug() . '_changelog',
|
||||
$this->get_item_name(),
|
||||
$update_url,
|
||||
$update_onclick
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<div id="<?php echo $this->product->get_slug(); ?>_changelog" style="display: none;">
|
||||
<?php echo wpautop( $update_data->sections['changelog'] ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get update data
|
||||
*
|
||||
* This gets the update data from a transient (12 hours), if set.
|
||||
* If not, it will make a remote request and get the update data.
|
||||
*
|
||||
* @return object $update_data Object containing the update data
|
||||
*/
|
||||
public function get_update_data() {
|
||||
|
||||
$api_response = $this->get_remote_data();
|
||||
|
||||
if( false === $api_response ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$update_data = $api_response;
|
||||
|
||||
// check if a new version is available.
|
||||
if ( version_compare( $this->get_theme_version(), $update_data->new_version, '>=' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// an update is available
|
||||
return $update_data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
//Nothing to see here
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Plugin Name: Sample Plugin
|
||||
Version: 1.0
|
||||
Plugin URI: https://yoast.com/
|
||||
Description: A sample plugin to test the License Manager
|
||||
Author: Yoast, DvanKooten
|
||||
Author URI: http://yoast.com/
|
||||
Text Domain: sample-plugin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class Sample_Plugin
|
||||
*
|
||||
*/
|
||||
class Sample_Plugin {
|
||||
|
||||
public function __construct() {
|
||||
|
||||
// we only need license stuff inside the admin area
|
||||
if ( is_admin() ) {
|
||||
|
||||
// add menu item
|
||||
add_action( 'admin_menu', array( $this, 'add_license_menu' ) );
|
||||
|
||||
// load license class
|
||||
$this->load_license_manager();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the License_Plugin_Manager class
|
||||
*
|
||||
* The class will take care of the rest: notices, license (de)activations, updates, etc..
|
||||
*/
|
||||
public function load_license_manager() {
|
||||
|
||||
// Instantiate license class
|
||||
$license_manager = new Yoast_Plugin_License_Manager( new Sample_Product() );
|
||||
|
||||
// Setup the required hooks
|
||||
$license_manager->setup_hooks();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add license page and add it to Themes menu
|
||||
*/
|
||||
public function add_license_menu() {
|
||||
$theme_page = add_options_page( sprintf( __( '%s License', $this->text_domain ), $this->item_name ), sprintf( __( '%s License', $this->text_domain ), $this->item_name ), 'manage_options', $this->text_domain . '-license', array( $this, 'show_license_page' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows license page
|
||||
*/
|
||||
public function show_license_page() {
|
||||
|
||||
// Instantiate license class
|
||||
$license_manager = new Yoast_Plugin_License_Manager( new Sample_Product() );
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<?php //settings_errors(); ?>
|
||||
|
||||
<?php $license_manager->show_license_form( false ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
new Sample_Plugin();
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class Sample_Product
|
||||
*
|
||||
* Our sample product class
|
||||
*/
|
||||
class Sample_Product extends Yoast_Product {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'https://yoast.com',
|
||||
'Sample Product',
|
||||
'sample-product',
|
||||
'1.0',
|
||||
'https://yoast.com/wordpress/plugins/sample-product/',
|
||||
'admin.php?page=sample-product',
|
||||
'sample-product',
|
||||
'Yoast'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
if( is_admin() ) {
|
||||
|
||||
// Instantiate license class
|
||||
$license_manager = new Yoast_Theme_License_Manager( new Sample_Product() );
|
||||
|
||||
// Setup the required hooks
|
||||
$license_manager->setup_hooks();
|
||||
|
||||
}
|
||||
@@ -39,23 +39,10 @@ if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
|
||||
|
||||
<div class="tabwrapper">
|
||||
<div id="title" class="wpseotab">
|
||||
<?php
|
||||
$wpseo_bulk_titles_table->prepare_page_navigation();
|
||||
$wpseo_bulk_titles_table->prepare_items();
|
||||
?>
|
||||
|
||||
<?php $wpseo_bulk_titles_table->views(); ?>
|
||||
<?php $wpseo_bulk_titles_table->display(); ?>
|
||||
|
||||
<?php $wpseo_bulk_titles_table->show_page(); ?>
|
||||
</div>
|
||||
<div id="description" class="wpseotab">
|
||||
<?php
|
||||
$wpseo_bulk_description_table->prepare_page_navigation();
|
||||
$wpseo_bulk_description_table->prepare_items();
|
||||
?>
|
||||
|
||||
<?php $wpseo_bulk_description_table->views(); ?>
|
||||
<?php $wpseo_bulk_description_table->display(); ?>
|
||||
<?php $wpseo_bulk_description_table->show_page(); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -15,7 +15,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
|
||||
*
|
||||
* @todo [Yoast] The import for the RSS Footer plugin checks for data already entered via WP SEO,
|
||||
* the other import routines should do that too.
|
||||
*/
|
||||
*/
|
||||
|
||||
global $wpseo_admin_pages;
|
||||
|
||||
@@ -116,7 +116,7 @@ if ( isset( $_POST['import'] ) || isset( $_GET['import'] ) ) {
|
||||
$taxonomies = get_taxonomies( array( 'public' => true ), 'names' );
|
||||
if ( is_array( $taxonomies ) && $taxonomies !== array() ) {
|
||||
foreach ( $taxonomies as $tax ) {
|
||||
$options[ 'title-tax-'.$tax ] = $template;
|
||||
$options['title-tax-' . $tax] = $template;
|
||||
}
|
||||
}
|
||||
unset( $taxonomies, $tax, $template );
|
||||
@@ -156,7 +156,7 @@ if ( isset( $_POST['import'] ) || isset( $_GET['import'] ) ) {
|
||||
}
|
||||
|
||||
/* @todo [JRF => whomever] verify how WooSEO sets these metas ( 'noindex', 'follow' )
|
||||
and if the values saved are concurrent with the ones we use (i.e. 0/1/2) */
|
||||
* and if the values saved are concurrent with the ones we use (i.e. 0/1/2) */
|
||||
WPSEO_Meta::replace_meta( 'seo_follow', WPSEO_Meta::$meta_prefix . 'meta-robots-nofollow', $replace );
|
||||
WPSEO_Meta::replace_meta( 'seo_noindex', WPSEO_Meta::$meta_prefix . 'meta-robots-noindex', $replace );
|
||||
|
||||
@@ -170,13 +170,13 @@ if ( isset( $_POST['import'] ) || isset( $_GET['import'] ) ) {
|
||||
WPSEO_Meta::replace_meta( '_headspace_keywords', WPSEO_Meta::$meta_prefix . 'metakeywords', $replace );
|
||||
WPSEO_Meta::replace_meta( '_headspace_page_title', WPSEO_Meta::$meta_prefix . 'title', $replace );
|
||||
/* @todo [JRF => whomever] verify how headspace sets these metas ( 'noindex', 'nofollow', 'noarchive', 'noodp', 'noydir' )
|
||||
and if the values saved are concurrent with the ones we use (i.e. 0/1/2) */
|
||||
* and if the values saved are concurrent with the ones we use (i.e. 0/1/2) */
|
||||
WPSEO_Meta::replace_meta( '_headspace_noindex', WPSEO_Meta::$meta_prefix . 'meta-robots-noindex', $replace );
|
||||
WPSEO_Meta::replace_meta( '_headspace_nofollow', WPSEO_Meta::$meta_prefix . 'meta-robots-nofollow', $replace );
|
||||
|
||||
/* @todo - [JRF => whomever] check if this can be done more efficiently by querying only the meta table
|
||||
possibly directly changing it using concat on the existing values
|
||||
*/
|
||||
* possibly directly changing it using concat on the existing values
|
||||
*/
|
||||
$posts = $wpdb->get_results( "SELECT ID FROM $wpdb->posts" );
|
||||
if ( is_array( $posts ) && $posts !== array() ) {
|
||||
foreach ( $posts as $post ) {
|
||||
@@ -211,7 +211,52 @@ if ( isset( $_POST['import'] ) || isset( $_GET['import'] ) ) {
|
||||
WPSEO_Meta::replace_meta( '_aioseop_description', WPSEO_Meta::$meta_prefix . 'metadesc', $replace );
|
||||
WPSEO_Meta::replace_meta( '_aioseop_keywords', WPSEO_Meta::$meta_prefix . 'metakeywords', $replace );
|
||||
WPSEO_Meta::replace_meta( '_aioseop_title', WPSEO_Meta::$meta_prefix . 'title', $replace );
|
||||
$msg .= __( sprintf( 'All in One SEO data successfully imported. Would you like to %sdisable the All in One SEO plugin%s.', '<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_import&deactivate_aioseo=1' ) ) . '">', '</a>' ), 'wordpress-seo' );
|
||||
$options_aiosep = get_option( 'aioseop_options' );
|
||||
|
||||
if ( isset( $options_aiosep['aiosp_google_analytics_id'] ) ) {
|
||||
/**
|
||||
* The Google Analytics settings are used
|
||||
*/
|
||||
$ga_universal = 0;
|
||||
$ga_trackoutbound = 0;
|
||||
$ga_anomip = 0;
|
||||
|
||||
if ( $options_aiosep['aiosp_ga_use_universal_analytics'] == 'on' ) {
|
||||
$ga_universal = 1;
|
||||
}
|
||||
if ( $options_aiosep['aiosp_ga_track_outbound_links'] == 'on' ) {
|
||||
$ga_trackoutbound = 1;
|
||||
}
|
||||
if( $options_aiosep['aiosp_ga_anonymize_ip'] == 'on' ){
|
||||
|
||||
}
|
||||
|
||||
$ga_settings = array(
|
||||
'manual_ua_code' => (int) 1,
|
||||
'manual_ua_code_field' => $options_aiosep['aiosp_google_analytics_id'],
|
||||
'enable_universal' => (int) $ga_universal,
|
||||
'track_outbound' => (int) $ga_trackoutbound,
|
||||
'ignore_users' => (array) $options_aiosep['aiosp_ga_exclude_users'],
|
||||
'anonymize_ips' => (int) $ga_anomip,
|
||||
);
|
||||
|
||||
if( get_option('yst_ga') == false ){
|
||||
$options['ga_general'] = $ga_settings;
|
||||
update_option( 'yst_ga', $options );
|
||||
}
|
||||
|
||||
$plugin_install_nonce = wp_create_nonce('install-plugin_google-analytics-for-wordpress'); // Use the old name because that's the WordPress.org repo
|
||||
|
||||
$msg .= __( sprintf(
|
||||
'All in One SEO data successfully imported. Would you like to %sdisable the All in One SEO plugin%s. You\'ve had Google Analytics enabled in All in One SEO, would you like to install our %sGoogle Analytics plugin%s?',
|
||||
'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_import&deactivate_aioseo=1' ) ) . '">',
|
||||
'</a>',
|
||||
'<a href="' . esc_url( admin_url( 'update.php?action=install-plugin&plugin=google-analytics-for-wordpress&_wpnonce=' . $plugin_install_nonce ) ) . '">',
|
||||
'</a>'
|
||||
), 'wordpress-seo' );
|
||||
} else {
|
||||
$msg .= __( sprintf( 'All in One SEO data successfully imported. Would you like to %sdisable the All in One SEO plugin%s.', '<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_import&deactivate_aioseo=1' ) ) . '">', '</a>' ), 'wordpress-seo' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $_POST['wpseo']['importaioseoold'] ) ) {
|
||||
@@ -257,8 +302,7 @@ if ( isset( $_POST['import'] ) || isset( $_GET['import'] ) ) {
|
||||
if ( $optnew['rssafter'] === '' || $optnew['rssafter'] === WPSEO_Options::get_default( 'wpseo_rss', 'rssafter' ) ) {
|
||||
$optnew['rssafter'] = $optold['footerstring'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* @internal Uncomment the second part if a default would be given to the rssbefore value */
|
||||
if ( $optnew['rssbefore'] === '' /*|| $optnew['rssbefore'] === WPSEO_Options::get_default( 'wpseo_rss', 'rssbefore' )*/ ) {
|
||||
$optnew['rssbefore'] = $optold['footerstring'];
|
||||
@@ -276,17 +320,15 @@ if ( isset( $_POST['import'] ) || isset( $_GET['import'] ) ) {
|
||||
if ( is_array( $optold ) && $optold !== array() ) {
|
||||
foreach ( $optold as $opt => $val ) {
|
||||
if ( is_bool( $val ) && $val == true ) {
|
||||
$optnew[ 'breadcrumbs-' . $opt ] = true;
|
||||
}
|
||||
else {
|
||||
$optnew[ 'breadcrumbs-' . $opt ] = $val;
|
||||
$optnew['breadcrumbs-' . $opt] = true;
|
||||
} else {
|
||||
$optnew['breadcrumbs-' . $opt] = $val;
|
||||
}
|
||||
}
|
||||
unset( $opt, $val );
|
||||
update_option( 'wpseo_internallinks', $optnew );
|
||||
$msg .= __( 'Yoast Breadcrumbs options imported successfully.', 'wordpress-seo' );
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$msg .= __( 'Yoast Breadcrumbs options could not be found', 'wordpress-seo' );
|
||||
}
|
||||
unset( $optold, $optnew );
|
||||
@@ -316,7 +358,7 @@ if ( $msg != '' ) {
|
||||
echo '<div id="message" class="message updated" style="width:94%;"><p>' . $msg . '</p></div>';
|
||||
}
|
||||
|
||||
$content = '<p>' . __( 'No doubt you\'ve used an SEO plugin before if this site isn\'t new. Let\'s make it easy on you, you can import the data below. If you want, you can import first, check if it was imported correctly, and then import & delete. No duplicate data will be imported.', 'wordpress-seo' ) . '</p>';
|
||||
$content = '<p>' . __( 'No doubt you\'ve used an SEO plugin before if this site isn\'t new. Let\'s make it easy on you, you can import the data below. If you want, you can import first, check if it was imported correctly, and then import & delete. No duplicate data will be imported.', 'wordpress-seo' ) . '</p>';
|
||||
$content .= '<p>' . sprintf( __( 'If you\'ve used another SEO plugin, try the %sSEO Data Transporter%s plugin to move your data into this plugin, it rocks!', 'wordpress-seo' ), '<a href="https://wordpress.org/plugins/seo-data-transporter/">', '</a>' ) . '</p>';
|
||||
// @todo [JRF => whomever] add action for form tag
|
||||
$content .= '<form action="" method="post" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">';
|
||||
@@ -355,7 +397,7 @@ $wpseo_admin_pages->postbox( 'import', __( 'Import', 'wordpress-seo' ), $content
|
||||
do_action( 'wpseo_import', $this );
|
||||
|
||||
// @todo [JRF => whomever] add action for form tag
|
||||
$content = '<h4>' . __( 'Export', 'wordpress-seo' ) . '</h4>';
|
||||
$content = '<h4>' . __( 'Export', 'wordpress-seo' ) . '</h4>';
|
||||
$content .= '<form action="" method="post" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">';
|
||||
$content .= wp_nonce_field( 'wpseo-export', '_wpnonce', true, false );
|
||||
$content .= '<p>' . __( 'Export your WordPress SEO settings here, to import them again later or to import them on another site.', 'wordpress-seo' ) . '</p>';
|
||||
@@ -375,8 +417,7 @@ if ( isset( $_POST['wpseo_export'] ) ) {
|
||||
document.location = \'' . $url . '\';
|
||||
</script>';
|
||||
add_action( 'admin_footer-' . $GLOBALS['hook_suffix'], 'wpseo_deliver_export_zip' );
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$content .= 'Error: ' . $url;
|
||||
}
|
||||
}
|
||||
@@ -391,8 +432,7 @@ if ( ! isset( $_FILES['settings_import_file'] ) || empty( $_FILES['settings_impo
|
||||
$content .= '<input type="hidden" name="action" value="wp_handle_upload"/>';
|
||||
$content .= '<input type="submit" class="button" value="' . __( 'Import settings', 'wordpress-seo' ) . '"/>';
|
||||
$content .= '</form><br/>';
|
||||
}
|
||||
elseif ( isset( $_FILES['settings_import_file'] ) ) {
|
||||
} elseif ( isset( $_FILES['settings_import_file'] ) ) {
|
||||
check_admin_referer( 'wpseo-import-file' );
|
||||
$file = wp_handle_upload( $_FILES['settings_import_file'] );
|
||||
|
||||
@@ -428,36 +468,30 @@ elseif ( isset( $_FILES['settings_import_file'] ) ) {
|
||||
$option_instance = WPSEO_Options::get_option_instance( $name );
|
||||
if ( is_object( $option_instance ) && method_exists( $option_instance, 'import' ) ) {
|
||||
$optgroup = $option_instance->import( $optgroup, $old_wpseo_version, $options );
|
||||
}
|
||||
elseif ( WP_DEBUG === true || ( defined( 'WPSEO_DEBUG' ) && WPSEO_DEBUG === true ) ) {
|
||||
} elseif ( WP_DEBUG === true || ( defined( 'WPSEO_DEBUG' ) && WPSEO_DEBUG === true ) ) {
|
||||
$content .= '<p><strong>' . sprintf( __( 'Setting "%s" is no longer used and has been discarded.', 'wordpress-seo' ), $name ) . '</strong></p>';
|
||||
|
||||
}
|
||||
}
|
||||
$content .= '<p><strong>' . __( 'Settings successfully imported.', 'wordpress-seo' ) . '</strong></p>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$content .= '<p><strong>' . __( 'Settings could not be imported:', 'wordpress-seo' ) . ' ' . __( 'No settings found in file.', 'wordpress-seo' ) . '</strong></p>';
|
||||
}
|
||||
unset( $options, $name, $optgroup );
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$content .= '<p><strong>' . __( 'Settings could not be imported:', 'wordpress-seo' ) . ' ' . __( 'Unzipping failed - file settings.ini not found.', 'wordpress-seo' ) . '</strong></p>';
|
||||
}
|
||||
@unlink( $filename );
|
||||
@unlink( $p_path );
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$content .= '<p><strong>' . __( 'Settings could not be imported:', 'wordpress-seo' ) . ' ' . sprintf( __( 'Unzipping failed with error "%s".', 'wordpress-seo' ), $unzipped->get_error_message() ) . '</strong></p>';
|
||||
}
|
||||
unset( $zip, $unzipped );
|
||||
@unlink( $file['file'] );
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ( is_wp_error( $file ) ) {
|
||||
$content .= '<p><strong>' . __( 'Settings could not be imported:', 'wordpress-seo' ) . ' ' . $file->get_error_message() . '</strong></p>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$content .= '<p><strong>' . __( 'Settings could not be imported:', 'wordpress-seo' ) . ' ' . __( 'Upload failed.', 'wordpress-seo' ) . '</strong></p>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Admin
|
||||
* @todo Add default content (when no premium plugins are activated)
|
||||
* @todo Add default content (when no premium plugins are activated)
|
||||
*/
|
||||
|
||||
if ( ! defined( 'WPSEO_VERSION' ) ) {
|
||||
@@ -18,63 +18,86 @@ global $wpseo_admin_pages;
|
||||
<h2 id="wpseo-title"><?php echo esc_html( get_admin_page_title() ); ?></h2>
|
||||
|
||||
<h2 class="nav-tab-wrapper" id="wpseo-tabs">
|
||||
<a class="nav-tab" id="extensions-tab" href="#top#extensions"><?php _e( 'Extensions', 'wordpress-seo' );?></a>
|
||||
<a class="nav-tab" id="licenses-tab" href="#top#licenses"><?php _e( 'Licenses', 'wordpress-seo' );?></a>
|
||||
<a class="nav-tab" id="extensions-tab" href="#top#extensions"><?php _e( 'Extensions', 'wordpress-seo' ); ?></a>
|
||||
<a class="nav-tab" id="licenses-tab" href="#top#licenses"><?php _e( 'Licenses', 'wordpress-seo' ); ?></a>
|
||||
</h2>
|
||||
|
||||
<div class="tabwrapper">
|
||||
<div id="extensions" class="wpseotab">
|
||||
<?php
|
||||
$extensions = array();
|
||||
$extensions = array(
|
||||
'seo-premium' => (object) array(
|
||||
'url' => 'https://yoast.com/wordpress/plugins/seo-premium/',
|
||||
'title' => __( 'WordPress SEO Premium', 'wordpress-seo' ),
|
||||
'desc' => __( 'The premium version of WordPress SEO with more features & support.', 'wordpress-seo' ),
|
||||
'installed' => false,
|
||||
),
|
||||
'video-seo' => (object) array(
|
||||
'url' => 'https://yoast.com/wordpress/plugins/video-seo/',
|
||||
'title' => __( 'Video SEO', 'wordpress-seo' ),
|
||||
'desc' => __( 'Optimize your videos to show them off in search results and get more clicks!', 'wordpress-seo' ),
|
||||
'installed' => false,
|
||||
),
|
||||
'news-seo' => (object) array(
|
||||
'url' => 'https://yoast.com/wordpress/plugins/news-seo/',
|
||||
'title' => __( 'News SEO', 'wordpress-seo' ),
|
||||
'desc' => __( 'Are you in Google News? Increase your traffic from Google News by optimizing for it!', 'wordpress-seo' ),
|
||||
'installed' => false,
|
||||
),
|
||||
'local-seo' => (object) array(
|
||||
'url' => 'https://yoast.com/wordpress/plugins/local-seo/',
|
||||
'title' => __( 'Local SEO', 'wordpress-seo' ),
|
||||
'desc' => __( 'Rank better locally and in Google Maps, without breaking a sweat!', 'wordpress-seo' ),
|
||||
'installed' => false,
|
||||
),
|
||||
'woocommerce-seo' => (object) array(
|
||||
'url' => 'https://yoast.com/wordpress/plugins/yoast-woocommerce-seo/',
|
||||
'title' => __( 'Yoast WooCommerce SEO', 'wordpress-seo' ),
|
||||
'desc' => __( 'Seamlessly integrate WooCommerce with WordPress SEO and get extra features!', 'wordpress-seo' ),
|
||||
'installed' => false,
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! class_exists( 'WPSEO_Premium' ) ) {
|
||||
$extensions['seo-premium'] = (object) array(
|
||||
'url' => 'https://yoast.com/wordpress/plugins/seo-premium/',
|
||||
'title' => __( 'WordPress SEO Premium', 'wordpress-seo' ),
|
||||
'desc' => __( 'The premium version of WordPress SEO with more features & support.', 'wordpress-seo' ),
|
||||
);
|
||||
if ( class_exists( 'WPSEO_Premium' ) ) {
|
||||
$extensions['seo-premium']->installed = true;
|
||||
}
|
||||
if ( ! class_exists( 'wpseo_Video_Sitemap' ) ) {
|
||||
$extensions['video-seo'] = (object) array(
|
||||
'url' => 'https://yoast.com/wordpress/plugins/video-seo/',
|
||||
'title' => __( 'Video SEO', 'wordpress-seo' ),
|
||||
'desc' => __( 'Optimize your videos to show them off in search results and get more clicks!', 'wordpress-seo' ),
|
||||
);
|
||||
if ( class_exists( 'wpseo_Video_Sitemap' ) ) {
|
||||
$extensions['video-seo']->installed = true;
|
||||
}
|
||||
if ( ! class_exists( 'WPSEO_News' ) ) {
|
||||
$extensions['news-seo'] = (object) array(
|
||||
'url' => 'https://yoast.com/wordpress/plugins/news-seo/',
|
||||
'title' => __( 'News SEO', 'wordpress-seo' ),
|
||||
'desc' => __( 'Are you in Google News? Increase your traffic from Google News by optimizing for it!', 'wordpress-seo' ),
|
||||
);
|
||||
if ( class_exists( 'WPSEO_News' ) ) {
|
||||
$extensions['news-seo']->installed = true;
|
||||
}
|
||||
if ( ! defined( 'WPSEO_LOCAL_VERSION' ) ) {
|
||||
$extensions['local-seo'] = (object) array(
|
||||
'url' => 'https://yoast.com/wordpress/plugins/local-seo/',
|
||||
'title' => __( 'Local SEO', 'wordpress-seo' ),
|
||||
'desc' => __( 'Rank better locally and in Google Maps, without breaking a sweat!', 'wordpress-seo' ),
|
||||
);
|
||||
if ( defined( 'WPSEO_LOCAL_VERSION' ) ) {
|
||||
$extensions['local-seo']->installed = true;
|
||||
}
|
||||
if ( class_exists( 'Woocommerce' ) && ! class_exists( 'Yoast_WooCommerce_SEO' ) ) {
|
||||
$extensions['woocommerce-seo'] = (object) array(
|
||||
'url' => 'https://yoast.com/wordpress/plugins/yoast-woocommerce-seo/',
|
||||
'title' => __( 'Yoast WooCommerce SEO', 'wordpress-seo' ),
|
||||
'desc' => __( 'Seamlessly integrate WooCommerce with WordPress SEO and get extra features!', 'wordpress-seo' )
|
||||
);
|
||||
if ( ! class_exists( 'Woocommerce' ) ) {
|
||||
unset( $extensions['woocommerce-seo'] );
|
||||
} else {
|
||||
if ( class_exists( 'Yoast_WooCommerce_SEO' ) ) {
|
||||
$extensions['woocommerce-seo']->installed = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $extensions as $id => $extension ) {
|
||||
$utm = '#utm_source=wordpress-seo-config&utm_medium=banner&utm_campaign=extension-page-banners';
|
||||
?>
|
||||
<div class="extension <?php echo esc_attr( $id ); ?>">
|
||||
<a target="_blank" href="<?php echo esc_url( $extension->url . $utm ); ?>">
|
||||
<h3><?php echo esc_html( $extension->title ); ?></h3>
|
||||
</a>
|
||||
<p><?php echo esc_html( $extension->desc ); ?></p>
|
||||
<p><a target="_blank" href="<?php echo esc_url( $extension->url . $utm ); ?>" class="button-primary">
|
||||
<?php esc_html_e( 'Get this extension', 'wordpress-seo' ); ?>
|
||||
</a></p>
|
||||
</div>
|
||||
?>
|
||||
<div class="extension <?php echo esc_attr( $id ); ?>">
|
||||
<a target="_blank" href="<?php echo esc_url( $extension->url . $utm ); ?>">
|
||||
<h3><?php echo esc_html( $extension->title ); ?></h3>
|
||||
</a>
|
||||
|
||||
<p><?php echo esc_html( $extension->desc ); ?></p>
|
||||
|
||||
<p>
|
||||
<?php if ( $extension->installed ) { ?>
|
||||
<button class="button-primary installed">Installed</button>
|
||||
<?php } else { ?>
|
||||
<a target="_blank" href="<?php echo esc_url( $extension->url . $utm ); ?>" class="button-primary">
|
||||
<?php esc_html_e( 'Get this extension', 'wordpress-seo' ); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@@ -82,11 +105,11 @@ global $wpseo_admin_pages;
|
||||
<div id="licenses" class="wpseotab">
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Display license page
|
||||
*/
|
||||
settings_errors();
|
||||
do_action( 'wpseo_licenses_forms' );
|
||||
/**
|
||||
* Display license page
|
||||
*/
|
||||
settings_errors();
|
||||
do_action( 'wpseo_licenses_forms' );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -100,7 +100,6 @@ $wpseo_admin_pages->admin_header( true, WPSEO_Options::get_group_name( 'wpseo_ti
|
||||
echo $wpseo_admin_pages->textinput( 'metakey-' . $name, __( 'Meta keywords template', 'wordpress-seo' ) );
|
||||
}
|
||||
echo $wpseo_admin_pages->checkbox( 'noindex-' . $name, '<code>noindex, follow</code>', __( 'Meta Robots', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'noauthorship-' . $name, __( 'Don\'t show <code>rel="author"</code>', 'wordpress-seo' ), __( 'Authorship', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'showdate-' . $name, __( 'Show date in snippet preview?', 'wordpress-seo' ), __( 'Date in Snippet Preview', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'hideeditbox-' . $name, __( 'Hide', 'wordpress-seo' ), __( 'WordPress SEO Meta Box', 'wordpress-seo' ) );
|
||||
|
||||
@@ -141,7 +140,7 @@ $wpseo_admin_pages->admin_header( true, WPSEO_Options::get_group_name( 'wpseo_ti
|
||||
echo $wpseo_admin_pages->textinput( 'metakey-ptarchive-' . $name, __( 'Meta keywords', 'wordpress-seo' ) );
|
||||
}
|
||||
if ( $options['breadcrumbs-enable'] === true ) {
|
||||
echo $wpseo_admin_pages->textinput( 'bctitle-ptarchive-' . $name, __( 'Breadcrumbs Title', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->textinput( 'bctitle-ptarchive-' . $name, __( 'Breadcrumbs title', 'wordpress-seo' ) );
|
||||
}
|
||||
echo $wpseo_admin_pages->checkbox( 'noindex-ptarchive-' . $name, '<code>noindex, follow</code>', __( 'Meta Robots', 'wordpress-seo' ) );
|
||||
}
|
||||
@@ -207,4 +206,4 @@ $wpseo_admin_pages->admin_header( true, WPSEO_Options::get_group_name( 'wpseo_ti
|
||||
echo '<h2>' . __( 'Variables', 'wordpress-seo' ) . '</h2>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
$wpseo_admin_pages->admin_footer();
|
||||
$wpseo_admin_pages->admin_footer();
|
||||
@@ -108,10 +108,10 @@ if ( $use_dropdown === true ) {
|
||||
$content .= '<p>' . __( 'Choose the site whose settings you want to use as default for all sites that are added to your network. If you choose \'None\', the normal plugin defaults will be used.', 'wordpress-seo' ) . '</p>';
|
||||
}
|
||||
else {
|
||||
$content .= $wpseo_admin_pages->textinput( 'defaultblog', __( 'New sites in the network get the SEO settings from this site', 'wordpress-seo' ), 'wpseo_ms' );
|
||||
$content .= $wpseo_admin_pages->textinput( 'defaultblog', __( 'New sites in the network inherit their SEO settings from this site', 'wordpress-seo' ), 'wpseo_ms' );
|
||||
$content .= '<p>' . sprintf( __( 'Enter the %sSite ID%s for the site whose settings you want to use as default for all sites that are added to your network. Leave empty for none (i.e. the normal plugin defaults will be used).', 'wordpress-seo' ), '<a href="' . esc_url( network_admin_url( 'sites.php' ) ) . '">', '</a>' ) . '</p>';
|
||||
}
|
||||
$content .= '<p><strong>' . __( 'Take note :', 'wordpress-seo' ) . '</strong> ' . __( 'Privacy sensitive (FB admins and such), theme specific (title rewrite) and a few very site specific settings will not be imported to new blogs.', 'wordpress-seo' ) . '</p>';
|
||||
$content .= '<p><strong>' . __( 'Take note:', 'wordpress-seo' ) . '</strong> ' . __( 'Privacy sensitive (FB admins and such), theme specific (title rewrite) and a few very site specific settings will not be imported to new blogs.', 'wordpress-seo' ) . '</p>';
|
||||
|
||||
|
||||
$content .= '<input type="submit" name="wpseo_submit" class="button-primary" value="' . __( 'Save MultiSite Settings', 'wordpress-seo' ) . '"/>';
|
||||
|
||||
@@ -25,7 +25,7 @@ $rows[] = array(
|
||||
);
|
||||
$rows[] = array(
|
||||
'id' => 'rssafter',
|
||||
'label' => __( 'Content to put after each post', 'wordpress-seo' ),
|
||||
'label' => __( 'Content to put after each post in the feed', 'wordpress-seo' ),
|
||||
'desc' => __( '(HTML allowed)', 'wordpress-seo' ),
|
||||
'content' => '<textarea cols="50" rows="5" id="rssafter" name="wpseo_rss[rssafter]">' . esc_textarea( $options['rssafter'] ) . '</textarea>',
|
||||
);
|
||||
@@ -41,4 +41,4 @@ $rows[] = array(
|
||||
);
|
||||
$wpseo_admin_pages->postbox( 'rssfootercontent', __( 'Content of your RSS Feed', 'wordpress-seo' ), $content . $wpseo_admin_pages->form_table( $rows ) );
|
||||
|
||||
$wpseo_admin_pages->admin_footer();
|
||||
$wpseo_admin_pages->admin_footer();
|
||||
@@ -220,7 +220,7 @@ $wpseo_admin_pages->admin_header( true, WPSEO_Options::get_group_name( 'wpseo_so
|
||||
<div id="google" class="wpseotab">
|
||||
<?php
|
||||
echo '<p>';
|
||||
echo $wpseo_admin_pages->checkbox( 'googleplus', __( 'Add Google+ specific post meta data (excluding author metadata)', 'wordpress-seo' ) );
|
||||
echo $wpseo_admin_pages->checkbox( 'googleplus', __( 'Add Google+ specific post meta data', 'wordpress-seo' ) );
|
||||
echo '</p>';
|
||||
|
||||
echo $wpseo_admin_pages->textinput( 'plus-publisher', __( 'Google Publisher Page', 'wordpress-seo' ) );
|
||||
|
||||
@@ -24,8 +24,6 @@ $wpseo_admin_pages->admin_header( true, WPSEO_Options::get_group_name( 'wpseo_xm
|
||||
|
||||
$options = get_option( 'wpseo_xml' );
|
||||
|
||||
$base = $GLOBALS['wp_rewrite']->using_index_permalinks() ? 'index.php/' : '';
|
||||
|
||||
$content = $wpseo_admin_pages->checkbox( 'enablexmlsitemap', __( 'Check this box to enable XML sitemap functionality.', 'wordpress-seo' ), false );
|
||||
$content .= '<div id="sitemapinfo">';
|
||||
if ( wpseo_is_nginx() ) {
|
||||
@@ -37,7 +35,7 @@ rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 las
|
||||
}
|
||||
|
||||
if ( $options['enablexmlsitemap'] === true ) {
|
||||
$content .= '<p>' . sprintf( esc_html__( 'You can find your XML Sitemap here: %sXML Sitemap%s', 'wordpress-seo' ), '<a target="_blank" class="button-secondary" href="' . esc_url( home_url( $base . 'sitemap_index.xml' ) ) . '">', '</a>' ) . '<br/><br/>' . __( 'You do <strong>not</strong> need to generate the XML sitemap, nor will it take up time to generate after publishing a post.', 'wordpress-seo' ) . '</p>';
|
||||
$content .= '<p>' . sprintf( esc_html__( 'You can find your XML Sitemap here: %sXML Sitemap%s', 'wordpress-seo' ), '<a target="_blank" class="button-secondary" href="' . esc_url( wpseo_xml_sitemaps_base_url( 'sitemap_index.xml' ) ) . '">', '</a>' ) . '<br/><br/>' . __( 'You do <strong>not</strong> need to generate the XML sitemap, nor will it take up time to generate after publishing a post.', 'wordpress-seo' ) . '</p>';
|
||||
} else {
|
||||
$content .= '<p>' . __( 'Save your settings to activate XML Sitemaps.', 'wordpress-seo' ) . '</p>';
|
||||
}
|
||||
@@ -52,7 +50,7 @@ $content .= $wpseo_admin_pages->checkbox( 'disable_author_noposts', __( 'Disable
|
||||
|
||||
$roles = wpseo_get_roles();
|
||||
if ( is_array( $roles ) && $roles !== array() ) {
|
||||
$content .= '<p><strong>' . __( 'Exclude userroles', 'wordpress-seo' ) . '</strong><br/>';
|
||||
$content .= '<p><strong>' . __( 'Exclude user roles', 'wordpress-seo' ) . '</strong><br/>';
|
||||
$content .= __( 'Please check the appropriate box below if there\'s a user role that you do <strong>NOT</strong> want to include in your sitemap:', 'wordpress-seo' ) . '</p>';
|
||||
foreach ( $roles as $role_key => $role_name ) {
|
||||
$content .= $wpseo_admin_pages->checkbox( 'user_role-' . $role_key . '-not_in_sitemap', $role_name );
|
||||
@@ -101,4 +99,4 @@ $wpseo_admin_pages->postbox( 'xmlsitemaps', __( 'XML Sitemap', 'wordpress-seo' )
|
||||
|
||||
do_action( 'wpseo_xmlsitemaps_config' );
|
||||
|
||||
$wpseo_admin_pages->admin_footer();
|
||||
$wpseo_admin_pages->admin_footer();
|
||||
Reference in new issue
Block a user