Version Description
Download this release
Release Info
Developer | hallsofmontezuma |
Plugin | All in One SEO Pack |
Version | 2.3.15 |
Comparing to | |
See all releases |
Code changes from version 2.3.14.2 to 2.3.15
- admin/aioseop_module_class.php +42 -10
- admin/meta_import.php +2 -6
- aioseop_class.php +59 -74
- all_in_one_seo_pack.php +3 -3
- inc/sitemap-xsl.php +11 -9
- js/modules/aioseop_module.js +20 -5
- modules/aioseop_opengraph.php +627 -415
- public/google-analytics.php +130 -182
- readme.txt +1 -1
admin/aioseop_module_class.php
CHANGED
@@ -929,6 +929,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
929 |
/**
|
930 |
* Handles exporting settings data for a module.
|
931 |
*
|
|
|
|
|
932 |
* @param $buf
|
933 |
*
|
934 |
* @return string
|
@@ -1544,6 +1546,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
1544 |
}
|
1545 |
|
1546 |
/**
|
|
|
|
|
1547 |
* @param null $p
|
1548 |
*
|
1549 |
* @return bool
|
@@ -1556,6 +1560,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
1556 |
$post = $p;
|
1557 |
}
|
1558 |
|
|
|
|
|
|
|
1559 |
$post_thumbnail_id = null;
|
1560 |
if ( function_exists( 'get_post_thumbnail_id' ) ) {
|
1561 |
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
|
@@ -1702,9 +1709,10 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
1702 |
|
1703 |
/**
|
1704 |
* Load scripts and styles for metaboxes.
|
1705 |
-
*
|
1706 |
* edit-tags exists only for pre 4.5 support... remove when we drop 4.5 support.
|
1707 |
-
* Also, that check and others should be pulled out into their own functions
|
|
|
|
|
1708 |
*/
|
1709 |
function enqueue_metabox_scripts() {
|
1710 |
$screen = '';
|
@@ -1736,7 +1744,11 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
1736 |
foreach ( $this->locations as $k => $v ) {
|
1737 |
if ( $v['type'] === 'metabox' && isset( $v['display'] ) && ! empty( $v['display'] ) ) {
|
1738 |
$enqueue_scripts = false;
|
1739 |
-
$enqueue_scripts = ( ( ( $screen->base == 'toplevel_page_shopp-products' ) && in_array( 'shopp_product', $v['display'] ) ) )
|
|
|
|
|
|
|
|
|
1740 |
$enqueue_scripts = apply_filters( $prefix . 'enqueue_metabox_scripts', $enqueue_scripts, $screen, $v );
|
1741 |
if ( $enqueue_scripts ) {
|
1742 |
add_filter( 'aioseop_localize_script_data', array( $this, 'localize_script_data' ) );
|
@@ -2105,6 +2117,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
2105 |
$setsel = $strings['selected'];
|
2106 |
if ( isset( $options['initial_options'] ) && is_array( $options['initial_options'] ) ) {
|
2107 |
foreach ( $options['initial_options'] as $l => $option ) {
|
|
|
|
|
|
|
2108 |
$is_group = is_array( $option );
|
2109 |
if ( ! $is_group ) {
|
2110 |
$option = array( $l => $option );
|
@@ -2205,7 +2220,10 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
2205 |
$buf .= "<textarea name='$name' $attr>$value</textarea>";
|
2206 |
break;
|
2207 |
case 'image':
|
2208 |
-
$buf .=
|
|
|
|
|
|
|
2209 |
"<input class='aioseop_upload_image_label' name='$name' type='text' $attr value='$value' size=57 style='float:left;clear:left;'>\n";
|
2210 |
break;
|
2211 |
case 'html':
|
@@ -2772,7 +2790,10 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
2772 |
return $opts;
|
2773 |
}
|
2774 |
|
2775 |
-
/**
|
|
|
|
|
|
|
2776 |
*
|
2777 |
* @param null $location
|
2778 |
* @param null $defaults
|
@@ -2780,6 +2801,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
2780 |
* @return array
|
2781 |
*/
|
2782 |
function default_options( $location = null, $defaults = null ) {
|
|
|
2783 |
$options = $this->setting_options( $location, $defaults );
|
2784 |
$opts = array();
|
2785 |
foreach ( $options as $k => $v ) {
|
@@ -2787,11 +2809,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
2787 |
$opts[ $k ] = $v['default'];
|
2788 |
}
|
2789 |
}
|
2790 |
-
|
2791 |
-
return $opts;
|
2792 |
}
|
2793 |
|
2794 |
-
/**
|
|
|
|
|
|
|
2795 |
*
|
2796 |
* @param array $opts
|
2797 |
* @param null $location
|
@@ -2816,17 +2840,25 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
|
|
2816 |
}
|
2817 |
|
2818 |
if ( ( isset( $_GET['taxonomy'] ) && isset( $_GET['tag_ID'] ) ) || is_category() || is_tag() || is_tax() ) {
|
2819 |
-
|
|
|
2820 |
if ( AIOSEOPPRO ) {
|
2821 |
$get_opts = AIO_ProGeneral::getprotax( $get_opts );
|
|
|
2822 |
}
|
2823 |
|
2824 |
} elseif ( isset( $post ) ) {
|
2825 |
$get_opts = get_post_meta( $post->ID, '_' . $prefix . $location, true );
|
2826 |
}
|
2827 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2828 |
$defs = $this->default_options( $location, $defaults );
|
2829 |
-
if ( $get_opts
|
2830 |
$get_opts = $defs;
|
2831 |
} else {
|
2832 |
$get_opts = wp_parse_args( $get_opts, $defs );
|
929 |
/**
|
930 |
* Handles exporting settings data for a module.
|
931 |
*
|
932 |
+
* @since 2.4.13 Fixed bug on empty options.
|
933 |
+
*
|
934 |
* @param $buf
|
935 |
*
|
936 |
* @return string
|
1546 |
}
|
1547 |
|
1548 |
/**
|
1549 |
+
* @since 2.4.13 Fixes when content is taxonomy.
|
1550 |
+
*
|
1551 |
* @param null $p
|
1552 |
*
|
1553 |
* @return bool
|
1560 |
$post = $p;
|
1561 |
}
|
1562 |
|
1563 |
+
if ( is_category() || is_tag() || is_tax() )
|
1564 |
+
return false;
|
1565 |
+
|
1566 |
$post_thumbnail_id = null;
|
1567 |
if ( function_exists( 'get_post_thumbnail_id' ) ) {
|
1568 |
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
|
1709 |
|
1710 |
/**
|
1711 |
* Load scripts and styles for metaboxes.
|
|
|
1712 |
* edit-tags exists only for pre 4.5 support... remove when we drop 4.5 support.
|
1713 |
+
* Also, that check and others should be pulled out into their own functions.
|
1714 |
+
*
|
1715 |
+
* @since 2.4.14 Added term as screen base.
|
1716 |
*/
|
1717 |
function enqueue_metabox_scripts() {
|
1718 |
$screen = '';
|
1744 |
foreach ( $this->locations as $k => $v ) {
|
1745 |
if ( $v['type'] === 'metabox' && isset( $v['display'] ) && ! empty( $v['display'] ) ) {
|
1746 |
$enqueue_scripts = false;
|
1747 |
+
$enqueue_scripts = ( ( ( $screen->base == 'toplevel_page_shopp-products' ) && in_array( 'shopp_product', $v['display'] ) ) )
|
1748 |
+
|| in_array( $screen->post_type, $v['display'] )
|
1749 |
+
|| $screen->base == 'edit-category'
|
1750 |
+
|| $screen->base == 'edit-post_tag'
|
1751 |
+
|| $screen->base == 'term';
|
1752 |
$enqueue_scripts = apply_filters( $prefix . 'enqueue_metabox_scripts', $enqueue_scripts, $screen, $v );
|
1753 |
if ( $enqueue_scripts ) {
|
1754 |
add_filter( 'aioseop_localize_script_data', array( $this, 'localize_script_data' ) );
|
2117 |
$setsel = $strings['selected'];
|
2118 |
if ( isset( $options['initial_options'] ) && is_array( $options['initial_options'] ) ) {
|
2119 |
foreach ( $options['initial_options'] as $l => $option ) {
|
2120 |
+
$option_check = strip_tags( is_array( $option ) ? implode( ' ', $option ) : $option );
|
2121 |
+
if ( empty( $l ) && empty( $option_check ) )
|
2122 |
+
continue;
|
2123 |
$is_group = is_array( $option );
|
2124 |
if ( ! $is_group ) {
|
2125 |
$option = array( $l => $option );
|
2220 |
$buf .= "<textarea name='$name' $attr>$value</textarea>";
|
2221 |
break;
|
2222 |
case 'image':
|
2223 |
+
$buf .= '<input class="aioseop_upload_image_checker" type="hidden" name="' . $name . '_checker" value="0">' .
|
2224 |
+
"<input class='aioseop_upload_image_button button-primary' type='button' value='";
|
2225 |
+
$buf .= __( 'Upload Image', 'all-in-one-seo-pack' );
|
2226 |
+
$buf .= "' style='float:left;' />" .
|
2227 |
"<input class='aioseop_upload_image_label' name='$name' type='text' $attr value='$value' size=57 style='float:left;clear:left;'>\n";
|
2228 |
break;
|
2229 |
case 'html':
|
2790 |
return $opts;
|
2791 |
}
|
2792 |
|
2793 |
+
/**
|
2794 |
+
* Generates just the default option names and values
|
2795 |
+
*
|
2796 |
+
* @since 2.4.13 Applies filter before final return.
|
2797 |
*
|
2798 |
* @param null $location
|
2799 |
* @param null $defaults
|
2801 |
* @return array
|
2802 |
*/
|
2803 |
function default_options( $location = null, $defaults = null ) {
|
2804 |
+
$prefix = $this->get_prefix( $location );
|
2805 |
$options = $this->setting_options( $location, $defaults );
|
2806 |
$opts = array();
|
2807 |
foreach ( $options as $k => $v ) {
|
2809 |
$opts[ $k ] = $v['default'];
|
2810 |
}
|
2811 |
}
|
2812 |
+
return apply_filters( $prefix . 'default_options', $opts, $location );
|
|
|
2813 |
}
|
2814 |
|
2815 |
+
/**
|
2816 |
+
* Gets the current options stored for a given location.
|
2817 |
+
*
|
2818 |
+
* @since 2.4.14 Added taxonomy options.
|
2819 |
*
|
2820 |
* @param array $opts
|
2821 |
* @param null $location
|
2840 |
}
|
2841 |
|
2842 |
if ( ( isset( $_GET['taxonomy'] ) && isset( $_GET['tag_ID'] ) ) || is_category() || is_tag() || is_tax() ) {
|
2843 |
+
$term_id = isset( $_GET['tag_ID'] ) ? (int) $_GET['tag_ID'] : 0;
|
2844 |
+
$term_id = $term_id ? $term_id : get_queried_object()->term_id;
|
2845 |
if ( AIOSEOPPRO ) {
|
2846 |
$get_opts = AIO_ProGeneral::getprotax( $get_opts );
|
2847 |
+
$get_opts = get_term_meta( $term_id, '_' . $prefix . $location, true );
|
2848 |
}
|
2849 |
|
2850 |
} elseif ( isset( $post ) ) {
|
2851 |
$get_opts = get_post_meta( $post->ID, '_' . $prefix . $location, true );
|
2852 |
}
|
2853 |
}
|
2854 |
+
|
2855 |
+
if ( is_home() && ! is_front_page() ) {
|
2856 |
+
// If we're on the non-front page blog page, WP doesn't really know its post meta data so we need to get that manually for social meta.
|
2857 |
+
$get_opts = get_post_meta( get_option( 'page_for_posts' ), '_' . $prefix . $location, true );
|
2858 |
+
}
|
2859 |
+
|
2860 |
$defs = $this->default_options( $location, $defaults );
|
2861 |
+
if ( empty( $get_opts ) ) {
|
2862 |
$get_opts = $defs;
|
2863 |
} else {
|
2864 |
$get_opts = wp_parse_args( $get_opts, $defs );
|
admin/meta_import.php
CHANGED
@@ -69,7 +69,8 @@ add_action( 'admin_menu', 'aiosp_seometa_settings_init' );
|
|
69 |
/**
|
70 |
* Intercept POST data from the form submission.
|
71 |
*
|
72 |
-
* Use the intercepted data to convert values in the postmeta table from one platform to another
|
|
|
73 |
*/
|
74 |
function aiosp_seometa_action() {
|
75 |
|
@@ -130,11 +131,6 @@ function aiosp_seometa_action() {
|
|
130 |
|
131 |
}
|
132 |
|
133 |
-
/**
|
134 |
-
* This function displays feedback to the user about compatible conversion
|
135 |
-
* elements and the conversion process via the admin_alert hook.
|
136 |
-
*/
|
137 |
-
|
138 |
/**
|
139 |
* The admin page output
|
140 |
*/
|
69 |
/**
|
70 |
* Intercept POST data from the form submission.
|
71 |
*
|
72 |
+
* Use the intercepted data to convert values in the postmeta table from one platform to another and display feedback to the user about compatible conversion
|
73 |
+
* elements and the conversion process.
|
74 |
*/
|
75 |
function aiosp_seometa_action() {
|
76 |
|
131 |
|
132 |
}
|
133 |
|
|
|
|
|
|
|
|
|
|
|
134 |
/**
|
135 |
* The admin page output
|
136 |
*/
|
aioseop_class.php
CHANGED
@@ -91,7 +91,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
91 |
'use_tags_as_keywords' => __( 'Check this if you want your tags for a given post used as the Meta Keywords for this post (in addition to any keywords you specify on the Edit Post screen).', 'all-in-one-seo-pack' ),
|
92 |
'dynamic_postspage_keywords' => __( 'Check this if you want your keywords on your Posts page (set in WordPress under Settings, Reading, Front Page Displays) and your archive pages to be dynamically generated from the keywords of the posts showing on that page. If unchecked, it will use the keywords set in the edit page screen for the posts page.', 'all-in-one-seo-pack' ),
|
93 |
'rewrite_titles' => __( "Note that this is all about the title tag. This is what you see in your browser's window title bar. This is NOT visible on a page, only in the title bar and in the source code. If enabled, all page, post, category, search and archive page titles get rewritten. You can specify the format for most of them. For example: Using the default post title format below, Rewrite Titles will write all post titles as 'Post Title | Blog Name'. If you have manually defined a title using All in One SEO Pack, this will become the title of your post in the format string.", 'all-in-one-seo-pack' ),
|
94 |
-
'cap_titles' => __( 'Check this and Search Page Titles and Tag Page Titles will have the first letter of each word capitalized.', 'all-in-one-seo-pack' ),
|
95 |
'home_page_title_format' =>
|
96 |
__( 'This controls the format of the title tag for your Home Page.<br />The following macros are supported:', 'all-in-one-seo-pack' )
|
97 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
@@ -111,10 +110,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
111 |
__( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
112 |
__( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
113 |
__( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
114 |
-
__( "%current_date% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li
|
|
|
|
|
|
|
115 |
'post_title_format' =>
|
116 |
__( 'This controls the format of the title tag for Posts.<br />The following macros are supported:', 'all-in-one-seo-pack' )
|
117 |
-
. '<
|
118 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
119 |
__( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
|
120 |
__( '%category_title% - The (main) category of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
|
@@ -123,7 +125,10 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
123 |
__( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
124 |
__( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
125 |
__( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
126 |
-
__( "%current_date% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li
|
|
|
|
|
|
|
127 |
'category_title_format' =>
|
128 |
__( 'This controls the format of the title tag for Category Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
|
129 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
@@ -164,7 +169,10 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
164 |
__( '%description% - This outputs the description you write for each page/post or the autogenerated description, if you have that option enabled. Auto-generated descriptions are generated from the Post Excerpt, or the first 160 characters of the post content if there is no Post Excerpt.', 'all-in-one-seo-pack' ) . '</li><li>' .
|
165 |
__( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
|
166 |
__( '%wp_title% - The original WordPress title, e.g. post_title for posts', 'all-in-one-seo-pack' ) . '</li><li>' .
|
167 |
-
__( '%current_date% - The current date (localized)', 'all-in-one-seo-pack' ) . '</li
|
|
|
|
|
|
|
168 |
'404_title_format' => __( 'This controls the format of the title tag for the 404 page.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
|
169 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
170 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
@@ -247,7 +255,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
247 |
'use_tags_as_keywords' => '#use-tags-for-meta-keywords',
|
248 |
'dynamic_postspage_keywords' => '#dynamically-generate-keywords-for-posts-page',
|
249 |
'rewrite_titles' => '#rewrite-titles',
|
250 |
-
'cap_titles' => '#capitalize-titles',
|
251 |
'home_page_title_format' => '#title-format-fields',
|
252 |
'page_title_format' => '#title-format-fields',
|
253 |
'post_title_format' => '#title-format-fields',
|
@@ -417,10 +424,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
417 |
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
418 |
),
|
419 |
),
|
420 |
-
'cap_titles' => array(
|
421 |
-
'name' => __( 'Capitalize Tag and Search Titles:', 'all-in-one-seo-pack' ),
|
422 |
-
'default' => 1,
|
423 |
-
),
|
424 |
'home_page_title_format' => array(
|
425 |
'name' => __( 'Home Page Title Format:', 'all-in-one-seo-pack' ),
|
426 |
'type' => 'text',
|
@@ -1006,7 +1009,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1006 |
'options' => array(
|
1007 |
'rewrite_titles',
|
1008 |
'force_rewrites',
|
1009 |
-
'cap_titles',
|
1010 |
'home_page_title_format',
|
1011 |
'page_title_format',
|
1012 |
'post_title_format',
|
@@ -1189,6 +1191,15 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1189 |
if ( strpos( $title_format, '%current_date%' ) !== false ) {
|
1190 |
$title_format = str_replace( '%current_date%', date_i18n( get_option( 'date_format' ) ), $title_format );
|
1191 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1192 |
if ( $w->is_category || $w->is_tag || $w->is_tax ) {
|
1193 |
if ( AIOSEOPPRO && ! empty( $_GET ) && ! empty( $_GET['taxonomy'] ) && ! empty( $_GET['tag_ID'] ) && function_exists( 'wp_get_split_terms' ) ) {
|
1194 |
$term_id = intval( $_GET['tag_ID'] );
|
@@ -1537,11 +1548,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1537 |
$title = $this->get_original_title();
|
1538 |
}
|
1539 |
|
1540 |
-
// If we're going to have this here, which seems logical, we should probably take it out of other places... do all titles pass through here?
|
1541 |
-
// The following lines have been commented out to fix an error with Capitalize Titles as reported in the WP forums
|
1542 |
-
// if ( !empty( $aioseop_options['aiosp_cap_titles'] ) )
|
1543 |
-
// $title = $this->capitalize( $title );
|
1544 |
-
|
1545 |
return apply_filters( 'aioseop_title', $title );
|
1546 |
}
|
1547 |
|
@@ -1713,9 +1719,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1713 |
return apply_filters( 'aioseop_title_single', $title );
|
1714 |
} else if ( is_search() && isset( $s ) && ! empty( $s ) ) {
|
1715 |
$search = esc_attr( stripslashes( $s ) );
|
1716 |
-
if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
|
1717 |
-
$search = $this->capitalize( $search );
|
1718 |
-
}
|
1719 |
$title_format = $aioseop_options['aiosp_search_title_format'];
|
1720 |
$title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
|
1721 |
if ( strpos( $title, '%blog_description%' ) !== false ) {
|
@@ -1758,9 +1761,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1758 |
$tag_description = $this->internationalize( $tag_description );
|
1759 |
}
|
1760 |
if ( $tag ) {
|
1761 |
-
if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
|
1762 |
-
$tag = $this->capitalize( $tag );
|
1763 |
-
}
|
1764 |
$title_format = $aioseop_options['aiosp_tag_title_format'];
|
1765 |
$title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
|
1766 |
if ( strpos( $title, '%blog_description%' ) !== false ) {
|
@@ -1786,9 +1786,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1786 |
} else if ( isset( $STagging ) && $STagging->is_tag_view() ) { // Simple tagging support.
|
1787 |
$tag = $STagging->search_tag;
|
1788 |
if ( $tag ) {
|
1789 |
-
if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
|
1790 |
-
$tag = $this->capitalize( $tag );
|
1791 |
-
}
|
1792 |
$title_format = $aioseop_options['aiosp_tag_title_format'];
|
1793 |
$title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
|
1794 |
if ( strpos( $title, '%blog_description%' ) !== false ) {
|
@@ -1907,9 +1904,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1907 |
$title = $this->internationalize( single_post_title( '', false ) );
|
1908 |
} else if ( is_search() && isset( $s ) && ! empty( $s ) ) {
|
1909 |
$search = esc_attr( stripslashes( $s ) );
|
1910 |
-
if ( ! empty( $aioseop_options['aiosp_cap_titles'] ) ) {
|
1911 |
-
$search = $this->capitalize( $search );
|
1912 |
-
}
|
1913 |
$title = $search;
|
1914 |
} else if ( ( is_tax() || is_category() ) && ! is_feed() ) {
|
1915 |
$category_name = $this->ucwords( $this->internationalize( single_cat_title( '', false ) ) );
|
@@ -1964,23 +1958,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
1964 |
return trim( $title );
|
1965 |
}
|
1966 |
|
1967 |
-
/**
|
1968 |
-
* @param $s
|
1969 |
-
*
|
1970 |
-
* @return string
|
1971 |
-
*/
|
1972 |
-
function capitalize( $s ) {
|
1973 |
-
$s = trim( $s );
|
1974 |
-
$tokens = explode( ' ', $s );
|
1975 |
-
while ( list( $key, $val ) = each( $tokens ) ) {
|
1976 |
-
$tokens[ $key ] = trim( $tokens[ $key ] );
|
1977 |
-
$tokens[ $key ] = $this->strtoupper( $this->substr( $tokens[ $key ], 0, 1 ) ) . $this->substr( $tokens[ $key ], 1 );
|
1978 |
-
}
|
1979 |
-
$s = implode( ' ', $tokens );
|
1980 |
-
|
1981 |
-
return $s;
|
1982 |
-
}
|
1983 |
-
|
1984 |
/**
|
1985 |
* @param $request
|
1986 |
*
|
@@ -2025,6 +2002,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2025 |
}
|
2026 |
|
2027 |
/**
|
|
|
|
|
2028 |
* @param $title
|
2029 |
* @param $post
|
2030 |
* @param string $type
|
@@ -2084,6 +2063,16 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2084 |
if ( strpos( $new_title, "%current_date%" ) !== false ){
|
2085 |
$new_title = str_replace( '%current_date%', date_i18n( get_option( 'date_format' ) ), $new_title );
|
2086 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2087 |
$title = trim( $new_title );
|
2088 |
|
2089 |
return $title;
|
@@ -2284,8 +2273,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2284 |
*
|
2285 |
* @param $tax
|
2286 |
*
|
2287 |
-
*
|
2288 |
* and the default (true) or a legacy option in the db can be overridden with the new filter hook aioseop_capitalize_categories
|
|
|
2289 |
*
|
2290 |
* @return mixed|void
|
2291 |
*/
|
@@ -2303,25 +2293,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2303 |
$name = single_term_title( '', false );
|
2304 |
}
|
2305 |
|
2306 |
-
$cap_cats = true; // Default to uppercase category/taxonomy titles.
|
2307 |
-
if ( isset( $aioseop_options['aiosp_cap_cats'] ) && ! empty( $aioseop_options['aiosp_cap_cats'] ) ) {
|
2308 |
-
// Legacy option is checked.
|
2309 |
-
$cap_cats = true;
|
2310 |
-
|
2311 |
-
}
|
2312 |
-
|
2313 |
-
if ( isset( $aioseop_options['aiosp_cap_cats'] ) && empty( $aioseop_options['aiosp_cap_cats'] ) ) {
|
2314 |
-
// Legacy option is unchecked.
|
2315 |
-
$cap_cats = false;
|
2316 |
-
}
|
2317 |
-
|
2318 |
-
$cap_cats = apply_filters( 'aioseop_capitalize_categories', $cap_cats ); // This will override any legacy settings.
|
2319 |
-
|
2320 |
-
// Apparently we're already ucwordsing this elsewhere, and doing it a second time messes it up... why aren't we just doing this at the end?
|
2321 |
-
if ( ( $tax == 'category' ) && $cap_cats == true ) {
|
2322 |
-
$name = $this->ucwords( $name );
|
2323 |
-
}
|
2324 |
-
|
2325 |
return $this->internationalize( $name );
|
2326 |
}
|
2327 |
|
@@ -2542,6 +2513,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2542 |
*
|
2543 |
* @since 2.3.13 #899 Fixes non breacking space, applies filter "aioseop_description".
|
2544 |
* @since 2.3.14 #932 Removes filter "aioseop_description".
|
|
|
2545 |
*
|
2546 |
* @param object $post Post object.
|
2547 |
*
|
@@ -2562,11 +2534,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2562 |
$description = $this->trim_excerpt_without_filters_full_length( $this->internationalize( $post->post_excerpt ) );
|
2563 |
}
|
2564 |
if ( ! $description && isset( $aioseop_options['aiosp_generate_descriptions'] ) && $aioseop_options['aiosp_generate_descriptions'] ) {
|
2565 |
-
$content = $post->post_content;
|
2566 |
-
if ( ! empty( $aioseop_options['aiosp_run_shortcodes'] ) ) {
|
2567 |
-
$content = do_shortcode( $content );
|
2568 |
-
}
|
2569 |
-
$content = wp_strip_all_tags( $content );
|
2570 |
$description = $this->trim_excerpt_without_filters( $this->internationalize( $content ) );
|
2571 |
}
|
2572 |
}
|
@@ -2575,19 +2543,23 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2575 |
}
|
2576 |
|
2577 |
/**
|
|
|
|
|
2578 |
* @param $text
|
2579 |
*
|
2580 |
* @return string
|
2581 |
*/
|
2582 |
function trim_excerpt_without_filters_full_length( $text ) {
|
2583 |
$text = str_replace( ']]>', ']]>', $text );
|
2584 |
-
$text = preg_replace( '
|
2585 |
$text = wp_strip_all_tags( $text );
|
2586 |
|
2587 |
return trim( $text );
|
2588 |
}
|
2589 |
|
2590 |
/**
|
|
|
|
|
2591 |
* @param $text
|
2592 |
* @param int $max
|
2593 |
*
|
@@ -2595,7 +2567,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
2595 |
*/
|
2596 |
function trim_excerpt_without_filters( $text, $max = 0 ) {
|
2597 |
$text = str_replace( ']]>', ']]>', $text );
|
2598 |
-
$text = preg_replace( '
|
2599 |
$text = wp_strip_all_tags( $text );
|
2600 |
// Treat other common word-break characters like a space.
|
2601 |
$text2 = preg_replace( '/[,._\-=+&!\?;:*]/s', ' ', $text );
|
@@ -3152,12 +3124,16 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
3152 |
$this->help_text[ $field ] .= sprintf( __( "%%tax_%s%% - This post's associated %s taxonomy title", 'all-in-one-seo-pack' ), $n, $t->label ) . '</li><li>';
|
3153 |
}
|
3154 |
}
|
3155 |
-
$this->help_text[ $field ]
|
3156 |
__( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
3157 |
__( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
3158 |
__( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
3159 |
__( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>' .
|
3160 |
-
__( "%current_date% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li
|
|
|
|
|
|
|
|
|
3161 |
'</ul>';
|
3162 |
$this->help_anchors[ $field ] = '#custom-titles';
|
3163 |
$this->layout['cpt']['options'][] = $field;
|
@@ -4036,6 +4012,15 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
|
|
4036 |
if ( strpos( $description, '%current_date%' ) !== false ) {
|
4037 |
$description = str_replace( '%current_date%', date_i18n( get_option( 'date_format' ) ), $description );
|
4038 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4039 |
|
4040 |
/*this was intended to make attachment descriptions unique if pulling from the parent... let's remove it and see if there are any problems
|
4041 |
*on the roadmap is to have a better hierarchy for attachment description pulling
|
91 |
'use_tags_as_keywords' => __( 'Check this if you want your tags for a given post used as the Meta Keywords for this post (in addition to any keywords you specify on the Edit Post screen).', 'all-in-one-seo-pack' ),
|
92 |
'dynamic_postspage_keywords' => __( 'Check this if you want your keywords on your Posts page (set in WordPress under Settings, Reading, Front Page Displays) and your archive pages to be dynamically generated from the keywords of the posts showing on that page. If unchecked, it will use the keywords set in the edit page screen for the posts page.', 'all-in-one-seo-pack' ),
|
93 |
'rewrite_titles' => __( "Note that this is all about the title tag. This is what you see in your browser's window title bar. This is NOT visible on a page, only in the title bar and in the source code. If enabled, all page, post, category, search and archive page titles get rewritten. You can specify the format for most of them. For example: Using the default post title format below, Rewrite Titles will write all post titles as 'Post Title | Blog Name'. If you have manually defined a title using All in One SEO Pack, this will become the title of your post in the format string.", 'all-in-one-seo-pack' ),
|
|
|
94 |
'home_page_title_format' =>
|
95 |
__( 'This controls the format of the title tag for your Home Page.<br />The following macros are supported:', 'all-in-one-seo-pack' )
|
96 |
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
110 |
__( "%page_author_nicename% - This page's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
111 |
__( "%page_author_firstname% - This page's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
112 |
__( "%page_author_lastname% - This page's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
113 |
+
__( "%current_date% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li><li>'.
|
114 |
+
__( "%post_date% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
115 |
+
__( "%post_year% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
116 |
+
__( "%post_month% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li>' ,
|
117 |
'post_title_format' =>
|
118 |
__( 'This controls the format of the title tag for Posts.<br />The following macros are supported:', 'all-in-one-seo-pack' )
|
119 |
+
. '<li><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
120 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
121 |
__( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
|
122 |
__( '%category_title% - The (main) category of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
|
125 |
__( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
126 |
__( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
127 |
__( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
128 |
+
__( "%current_date% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
129 |
+
__( "%post_date% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
130 |
+
__( "%post_year% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
131 |
+
__( "%post_month% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li>' ,
|
132 |
'category_title_format' =>
|
133 |
__( 'This controls the format of the title tag for Category Archives.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
|
134 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
169 |
__( '%description% - This outputs the description you write for each page/post or the autogenerated description, if you have that option enabled. Auto-generated descriptions are generated from the Post Excerpt, or the first 160 characters of the post content if there is no Post Excerpt.', 'all-in-one-seo-pack' ) . '</li><li>' .
|
170 |
__( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '</li><li>' .
|
171 |
__( '%wp_title% - The original WordPress title, e.g. post_title for posts', 'all-in-one-seo-pack' ) . '</li><li>' .
|
172 |
+
__( '%current_date% - The current date (localized)', 'all-in-one-seo-pack' ) . '</li><li>' .
|
173 |
+
__( "%post_date% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
174 |
+
__( "%post_year% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
175 |
+
__( "%post_month% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li>' ,
|
176 |
'404_title_format' => __( 'This controls the format of the title tag for the 404 page.<br />The following macros are supported:', 'all-in-one-seo-pack' ) .
|
177 |
'<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
|
178 |
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
|
255 |
'use_tags_as_keywords' => '#use-tags-for-meta-keywords',
|
256 |
'dynamic_postspage_keywords' => '#dynamically-generate-keywords-for-posts-page',
|
257 |
'rewrite_titles' => '#rewrite-titles',
|
|
|
258 |
'home_page_title_format' => '#title-format-fields',
|
259 |
'page_title_format' => '#title-format-fields',
|
260 |
'post_title_format' => '#title-format-fields',
|
424 |
0 => __( 'Disabled', 'all-in-one-seo-pack' ),
|
425 |
),
|
426 |
),
|
|
|
|
|
|
|
|
|
427 |
'home_page_title_format' => array(
|
428 |
'name' => __( 'Home Page Title Format:', 'all-in-one-seo-pack' ),
|
429 |
'type' => 'text',
|
1009 |
'options' => array(
|
1010 |
'rewrite_titles',
|
1011 |
'force_rewrites',
|
|
|
1012 |
'home_page_title_format',
|
1013 |
'page_title_format',
|
1014 |
'post_title_format',
|
1191 |
if ( strpos( $title_format, '%current_date%' ) !== false ) {
|
1192 |
$title_format = str_replace( '%current_date%', date_i18n( get_option( 'date_format' ) ), $title_format );
|
1193 |
}
|
1194 |
+
if ( strpos( $title_format, "%post_date%" ) !== false ){
|
1195 |
+
$title_format = str_replace( '%post_date%', get_the_date(), $title_format );
|
1196 |
+
}
|
1197 |
+
if ( strpos( $title_format, "%post_year%" ) !== false ){
|
1198 |
+
$title_format = str_replace( '%post_year%', get_the_date( 'Y' ), $title_format );
|
1199 |
+
}
|
1200 |
+
if ( strpos( $title_format, "%post_month%" ) !== false ){
|
1201 |
+
$title_format = str_replace( '%post_month%', get_the_date( 'F' ), $title_format );
|
1202 |
+
}
|
1203 |
if ( $w->is_category || $w->is_tag || $w->is_tax ) {
|
1204 |
if ( AIOSEOPPRO && ! empty( $_GET ) && ! empty( $_GET['taxonomy'] ) && ! empty( $_GET['tag_ID'] ) && function_exists( 'wp_get_split_terms' ) ) {
|
1205 |
$term_id = intval( $_GET['tag_ID'] );
|
1548 |
$title = $this->get_original_title();
|
1549 |
}
|
1550 |
|
|
|
|
|
|
|
|
|
|
|
1551 |
return apply_filters( 'aioseop_title', $title );
|
1552 |
}
|
1553 |
|
1719 |
return apply_filters( 'aioseop_title_single', $title );
|
1720 |
} else if ( is_search() && isset( $s ) && ! empty( $s ) ) {
|
1721 |
$search = esc_attr( stripslashes( $s ) );
|
|
|
|
|
|
|
1722 |
$title_format = $aioseop_options['aiosp_search_title_format'];
|
1723 |
$title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
|
1724 |
if ( strpos( $title, '%blog_description%' ) !== false ) {
|
1761 |
$tag_description = $this->internationalize( $tag_description );
|
1762 |
}
|
1763 |
if ( $tag ) {
|
|
|
|
|
|
|
1764 |
$title_format = $aioseop_options['aiosp_tag_title_format'];
|
1765 |
$title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
|
1766 |
if ( strpos( $title, '%blog_description%' ) !== false ) {
|
1786 |
} else if ( isset( $STagging ) && $STagging->is_tag_view() ) { // Simple tagging support.
|
1787 |
$tag = $STagging->search_tag;
|
1788 |
if ( $tag ) {
|
|
|
|
|
|
|
1789 |
$title_format = $aioseop_options['aiosp_tag_title_format'];
|
1790 |
$title = str_replace( '%blog_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
|
1791 |
if ( strpos( $title, '%blog_description%' ) !== false ) {
|
1904 |
$title = $this->internationalize( single_post_title( '', false ) );
|
1905 |
} else if ( is_search() && isset( $s ) && ! empty( $s ) ) {
|
1906 |
$search = esc_attr( stripslashes( $s ) );
|
|
|
|
|
|
|
1907 |
$title = $search;
|
1908 |
} else if ( ( is_tax() || is_category() ) && ! is_feed() ) {
|
1909 |
$category_name = $this->ucwords( $this->internationalize( single_cat_title( '', false ) ) );
|
1958 |
return trim( $title );
|
1959 |
}
|
1960 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1961 |
/**
|
1962 |
* @param $request
|
1963 |
*
|
2002 |
}
|
2003 |
|
2004 |
/**
|
2005 |
+
* Replace title templates inside % symbol.
|
2006 |
+
*
|
2007 |
* @param $title
|
2008 |
* @param $post
|
2009 |
* @param string $type
|
2063 |
if ( strpos( $new_title, "%current_date%" ) !== false ){
|
2064 |
$new_title = str_replace( '%current_date%', date_i18n( get_option( 'date_format' ) ), $new_title );
|
2065 |
}
|
2066 |
+
if ( strpos( $new_title, "%post_date%" ) !== false ){
|
2067 |
+
$new_title = str_replace( '%post_date%', get_the_date(), $new_title );
|
2068 |
+
}
|
2069 |
+
if ( strpos( $new_title, "%post_year%" ) !== false ){
|
2070 |
+
$new_title = str_replace( '%post_year%', get_the_date( 'Y' ), $new_title );
|
2071 |
+
}
|
2072 |
+
if ( strpos( $new_title, "%post_month%" ) !== false ){
|
2073 |
+
$new_title = str_replace( '%post_month%', get_the_date( 'F' ), $new_title );
|
2074 |
+
}
|
2075 |
+
|
2076 |
$title = trim( $new_title );
|
2077 |
|
2078 |
return $title;
|
2273 |
*
|
2274 |
* @param $tax
|
2275 |
*
|
2276 |
+
* @since 2.3.10 Remove option for capitalize categories. We still respect the option,
|
2277 |
* and the default (true) or a legacy option in the db can be overridden with the new filter hook aioseop_capitalize_categories
|
2278 |
+
* @since 2.3.15 Remove category capitalization completely
|
2279 |
*
|
2280 |
* @return mixed|void
|
2281 |
*/
|
2293 |
$name = single_term_title( '', false );
|
2294 |
}
|
2295 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2296 |
return $this->internationalize( $name );
|
2297 |
}
|
2298 |
|
2513 |
*
|
2514 |
* @since 2.3.13 #899 Fixes non breacking space, applies filter "aioseop_description".
|
2515 |
* @since 2.3.14 #932 Removes filter "aioseop_description".
|
2516 |
+
* @since 2.3.15 Always do_shortcode.
|
2517 |
*
|
2518 |
* @param object $post Post object.
|
2519 |
*
|
2534 |
$description = $this->trim_excerpt_without_filters_full_length( $this->internationalize( $post->post_excerpt ) );
|
2535 |
}
|
2536 |
if ( ! $description && isset( $aioseop_options['aiosp_generate_descriptions'] ) && $aioseop_options['aiosp_generate_descriptions'] ) {
|
2537 |
+
$content = do_shortcode( $post->post_content );
|
|
|
|
|
|
|
|
|
2538 |
$description = $this->trim_excerpt_without_filters( $this->internationalize( $content ) );
|
2539 |
}
|
2540 |
}
|
2543 |
}
|
2544 |
|
2545 |
/**
|
2546 |
+
* @since 2.3.15 Brackets not longer replaced from filters.
|
2547 |
+
*
|
2548 |
* @param $text
|
2549 |
*
|
2550 |
* @return string
|
2551 |
*/
|
2552 |
function trim_excerpt_without_filters_full_length( $text ) {
|
2553 |
$text = str_replace( ']]>', ']]>', $text );
|
2554 |
+
$text = preg_replace( '|(.+?\[/\\1\])?|s', '', $text );
|
2555 |
$text = wp_strip_all_tags( $text );
|
2556 |
|
2557 |
return trim( $text );
|
2558 |
}
|
2559 |
|
2560 |
/**
|
2561 |
+
* @since 2.3.15 Brackets not longer replaced from filters.
|
2562 |
+
*
|
2563 |
* @param $text
|
2564 |
* @param int $max
|
2565 |
*
|
2567 |
*/
|
2568 |
function trim_excerpt_without_filters( $text, $max = 0 ) {
|
2569 |
$text = str_replace( ']]>', ']]>', $text );
|
2570 |
+
$text = preg_replace( '|(.+?\[/\\1\])?|s', '', $text );
|
2571 |
$text = wp_strip_all_tags( $text );
|
2572 |
// Treat other common word-break characters like a space.
|
2573 |
$text2 = preg_replace( '/[,._\-=+&!\?;:*]/s', ' ', $text );
|
3124 |
$this->help_text[ $field ] .= sprintf( __( "%%tax_%s%% - This post's associated %s taxonomy title", 'all-in-one-seo-pack' ), $n, $t->label ) . '</li><li>';
|
3125 |
}
|
3126 |
}
|
3127 |
+
$this->help_text[ $field ] .=
|
3128 |
__( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '</li><li>' .
|
3129 |
__( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '</li><li>' .
|
3130 |
__( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
3131 |
__( "%post_author_lastname% - This post's author' last name (capitalized)", 'all-in-one-seo-pack' ) . '</li>' .
|
3132 |
+
__( "%current_date% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
3133 |
+
__( "%post_date% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
3134 |
+
__( "%post_year% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li><li>' .
|
3135 |
+
__( "%post_month% - The current date (localized)", 'all-in-one-seo-pack' ) . '</li>' .
|
3136 |
+
'</ul>' .
|
3137 |
'</ul>';
|
3138 |
$this->help_anchors[ $field ] = '#custom-titles';
|
3139 |
$this->layout['cpt']['options'][] = $field;
|
4012 |
if ( strpos( $description, '%current_date%' ) !== false ) {
|
4013 |
$description = str_replace( '%current_date%', date_i18n( get_option( 'date_format' ) ), $description );
|
4014 |
}
|
4015 |
+
if ( strpos( $description, "%post_date%" ) !== false ){
|
4016 |
+
$description = str_replace( '%post_date%', get_the_date(), $description );
|
4017 |
+
}
|
4018 |
+
if ( strpos( $description, "%post_year%" ) !== false ){
|
4019 |
+
$description = str_replace( '%post_year%', get_the_date( 'Y' ), $description );
|
4020 |
+
}
|
4021 |
+
if ( strpos( $description, "%post_month%" ) !== false ){
|
4022 |
+
$description = str_replace( '%post_month%', get_the_date( 'F' ), $description );
|
4023 |
+
}
|
4024 |
|
4025 |
/*this was intended to make attachment descriptions unique if pulling from the parent... let's remove it and see if there are any problems
|
4026 |
*on the roadmap is to have a better hierarchy for attachment description pulling
|
all_in_one_seo_pack.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: All In One SEO Pack
|
4 |
Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
|
5 |
Description: Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 30 million downloads since 2007.
|
6 |
-
Version: 2.3.
|
7 |
Author: Michael Torbert
|
8 |
Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
|
9 |
Text Domain: all-in-one-seo-pack
|
@@ -31,14 +31,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
31 |
* The original WordPress SEO plugin.
|
32 |
*
|
33 |
* @package All-in-One-SEO-Pack
|
34 |
-
* @version 2.3.
|
35 |
*/
|
36 |
|
37 |
if ( ! defined( 'AIOSEOPPRO' ) ) {
|
38 |
define( 'AIOSEOPPRO', false );
|
39 |
}
|
40 |
if ( ! defined( 'AIOSEOP_VERSION' ) ) {
|
41 |
-
define( 'AIOSEOP_VERSION', '2.3.
|
42 |
}
|
43 |
global $aioseop_plugin_name;
|
44 |
$aioseop_plugin_name = 'All in One SEO Pack';
|
3 |
Plugin Name: All In One SEO Pack
|
4 |
Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
|
5 |
Description: Out-of-the-box SEO for your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 30 million downloads since 2007.
|
6 |
+
Version: 2.3.15
|
7 |
Author: Michael Torbert
|
8 |
Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
|
9 |
Text Domain: all-in-one-seo-pack
|
31 |
* The original WordPress SEO plugin.
|
32 |
*
|
33 |
* @package All-in-One-SEO-Pack
|
34 |
+
* @version 2.3.15
|
35 |
*/
|
36 |
|
37 |
if ( ! defined( 'AIOSEOPPRO' ) ) {
|
38 |
define( 'AIOSEOPPRO', false );
|
39 |
}
|
40 |
if ( ! defined( 'AIOSEOP_VERSION' ) ) {
|
41 |
+
define( 'AIOSEOP_VERSION', '2.3.15' );
|
42 |
}
|
43 |
global $aioseop_plugin_name;
|
44 |
$aioseop_plugin_name = 'All in One SEO Pack';
|
inc/sitemap-xsl.php
CHANGED
@@ -156,15 +156,17 @@ echo '<?xml version="1.0" encoding="UTF-8"?>';
|
|
156 |
<a href="{$itemURL}">
|
157 |
<xsl:value-of select="sitemap:loc"/>
|
158 |
</a>
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
|
|
|
|
168 |
</td>
|
169 |
<td>
|
170 |
<xsl:if test="string(number(sitemap:priority))!='NaN'">
|
156 |
<a href="{$itemURL}">
|
157 |
<xsl:value-of select="sitemap:loc"/>
|
158 |
</a>
|
159 |
+
<xsl:for-each select="video:video">
|
160 |
+
<xsl:variable name="thumbURL">
|
161 |
+
<xsl:value-of select="video:thumbnail_loc"/>
|
162 |
+
</xsl:variable>
|
163 |
+
<xsl:variable name="playURL">
|
164 |
+
<xsl:value-of select="video:player_loc"/>
|
165 |
+
</xsl:variable>
|
166 |
+
<xsl:if test="$thumbURL != ''">
|
167 |
+
<a href="{$playURL}"><img src="{$thumbURL}" style="max-width:60px;float:right;"/></a>
|
168 |
+
</xsl:if>
|
169 |
+
</xsl:for-each>
|
170 |
</td>
|
171 |
<td>
|
172 |
<xsl:if test="string(number(sitemap:priority))!='NaN'">
|
js/modules/aioseop_module.js
CHANGED
@@ -248,12 +248,20 @@ jQuery( document ).ready(function() {
|
|
248 |
* @summary Custom jQuery plugin that enables image uploader in wordpress.
|
249 |
*
|
250 |
* @since 2.3.13
|
|
|
251 |
* @see http://www.webmaster-source.com/2013/02/06/using-the-wordpress-3-5-media-uploader-in-your-plugin-or-theme/
|
|
|
|
|
252 |
*/
|
253 |
-
jQuery.fn.aioseopImageUploader = function() {
|
254 |
// Keep reference to this.
|
255 |
var self = this;
|
256 |
|
|
|
|
|
|
|
|
|
|
|
257 |
// Set input target when to update image url value
|
258 |
self.target = jQuery( self ).next();
|
259 |
|
@@ -271,10 +279,11 @@ jQuery.fn.aioseopImageUploader = function() {
|
|
271 |
* Event handler that will be called when an image is selected from media uploader.
|
272 |
*/
|
273 |
self.onSelect = function() {
|
|
|
274 |
if ( self.target.length >= 0 )
|
275 |
-
jQuery( self.target ).val(
|
276 |
-
|
277 |
-
);
|
278 |
}
|
279 |
|
280 |
/**
|
@@ -305,7 +314,13 @@ jQuery.fn.aioseopImageUploader = function() {
|
|
305 |
jQuery(document).ready(function($){
|
306 |
|
307 |
jQuery( '.aioseop_upload_image_button' ).each(function() {
|
308 |
-
jQuery( this ).aioseopImageUploader(
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
});
|
310 |
|
311 |
});
|
248 |
* @summary Custom jQuery plugin that enables image uploader in wordpress.
|
249 |
*
|
250 |
* @since 2.3.13
|
251 |
+
* @since 2.4.14 Added success callback and options.
|
252 |
* @see http://www.webmaster-source.com/2013/02/06/using-the-wordpress-3-5-media-uploader-in-your-plugin-or-theme/
|
253 |
+
*
|
254 |
+
* @param object options Plugin options.
|
255 |
*/
|
256 |
+
jQuery.fn.aioseopImageUploader = function( options ) {
|
257 |
// Keep reference to this.
|
258 |
var self = this;
|
259 |
|
260 |
+
// Options
|
261 |
+
self.options = jQuery.extend({
|
262 |
+
success: undefined,
|
263 |
+
}, options);
|
264 |
+
|
265 |
// Set input target when to update image url value
|
266 |
self.target = jQuery( self ).next();
|
267 |
|
279 |
* Event handler that will be called when an image is selected from media uploader.
|
280 |
*/
|
281 |
self.onSelect = function() {
|
282 |
+
var url = self.uploader.state().get( 'selection' ).first().toJSON().url;
|
283 |
if ( self.target.length >= 0 )
|
284 |
+
jQuery( self.target ).val( url );
|
285 |
+
if ( self.options.success !== undefined )
|
286 |
+
self.options.success( url, self );
|
287 |
}
|
288 |
|
289 |
/**
|
314 |
jQuery(document).ready(function($){
|
315 |
|
316 |
jQuery( '.aioseop_upload_image_button' ).each(function() {
|
317 |
+
jQuery( this ).aioseopImageUploader({
|
318 |
+
success: function( url, el ) {
|
319 |
+
// Update checker
|
320 |
+
if ( jQuery( el ).prev().length > 0 )
|
321 |
+
jQuery( el ).prev().val( 1 );
|
322 |
+
},
|
323 |
+
});
|
324 |
});
|
325 |
|
326 |
});
|
modules/aioseop_opengraph.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* @package All-in-One-SEO-Pack
|
4 |
-
*/
|
5 |
/**
|
6 |
* The Opengraph class.
|
|
|
|
|
|
|
7 |
*/
|
8 |
if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
9 |
class All_in_One_SEO_Pack_Opengraph extends All_in_One_SEO_Pack_Module {
|
@@ -13,7 +13,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
13 |
/**
|
14 |
* Module constructor.
|
15 |
*
|
16 |
-
* @since 2.4.14 Added display filter.
|
17 |
*/
|
18 |
function __construct() {
|
19 |
add_action( 'admin_enqueue_scripts', array( $this, 'og_admin_enqueue_scripts' ) );
|
@@ -81,12 +81,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
81 |
);
|
82 |
parent::__construct();
|
83 |
|
84 |
-
$categories = Array(
|
85 |
-
'blog' => __( 'Blog', 'all-in-one-seo-pack' ),
|
86 |
-
'website' => __( 'Website', 'all-in-one-seo-pack' ),
|
87 |
-
'article' => __( 'Article', 'all-in-one-seo-pack' ),
|
88 |
-
);
|
89 |
-
|
90 |
$this->help_text = Array(
|
91 |
"setmeta" => __( "Checking this box will use the Home Title and Home Description set in All in One SEO Pack, General Settings as the Open Graph title and description for your home page.", 'all-in-one-seo-pack' ),
|
92 |
"key" => __( "Enter your Facebook Admin ID here. You can enter multiple IDs separated by a comma. You can look up your Facebook ID using this tool http://findmyfbid.com/", 'all-in-one-seo-pack' ),
|
@@ -97,7 +91,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
97 |
"hometitle" => __( "The Home Title is the Open Graph title for your home page.", 'all-in-one-seo-pack' ),
|
98 |
"description" => __( "The Home Description is the Open Graph description for your home page.", 'all-in-one-seo-pack' ),
|
99 |
"homeimage" => __( "The Home Image is the Open Graph image for your home page.", 'all-in-one-seo-pack' ),
|
100 |
-
"hometag" => __( "The Home Tag allows you to add a list of keywords that best describe your home page content.", 'all-in-one-seo-pack' ),
|
101 |
"generate_descriptions" => __( "This option will auto generate your Open Graph descriptions from your post content instead of your post excerpt. WooCommerce users should read the documentation regarding this setting.", 'all-in-one-seo-pack' ),
|
102 |
"defimg" => __( "This option lets you choose which image will be displayed by default for the Open Graph image. You may override this on individual posts.", 'all-in-one-seo-pack' ),
|
103 |
"fallback" => __( "This option lets you fall back to the default image if no image could be found above.", 'all-in-one-seo-pack' ),
|
@@ -105,7 +98,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
105 |
"dimgwidth" => __( "This option lets you set a default width for your images, where unspecified.", 'all-in-one-seo-pack' ),
|
106 |
"dimgheight" => __( "This option lets you set a default height for your images, where unspecified.", 'all-in-one-seo-pack' ),
|
107 |
"meta_key" => __( "Enter the name of a custom field (or multiple field names separated by commas) to use that field to specify the Open Graph image on Pages or Posts.", 'all-in-one-seo-pack' ),
|
108 |
-
"categories" => __( "Set the Open Graph type for your website as either a blog or a website.", 'all-in-one-seo-pack' ),
|
109 |
"image" => __( "This option lets you select the Open Graph image that will be used for this Page or Post, overriding the default settings.", 'all-in-one-seo-pack' ),
|
110 |
"customimg" => __( "This option lets you upload an image to use as the Open Graph image for this Page or Post.", 'all-in-one-seo-pack' ),
|
111 |
"imagewidth" => __( "Enter the width for your Open Graph image in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
|
@@ -146,7 +138,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
146 |
'hometitle' => '#home-title-and-description',
|
147 |
'description' => '#home-title-and-description',
|
148 |
'homeimage' => '#home-image',
|
149 |
-
'hometag' => '#home-article-tags',
|
150 |
'defimg' => '#select-og-image-source',
|
151 |
'fallback' => '#use-default-if-no-image-found',
|
152 |
'dimg' => '#default-og-image',
|
@@ -158,7 +149,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
158 |
'social_name' => '#social-profile-links',
|
159 |
'key' => '#facebook-admin-id',
|
160 |
'appid' => '#facebook-app-id',
|
161 |
-
'categories' => '#facebook-object-type',
|
162 |
'gen_tags' => '#automatically-generate-article-tags',
|
163 |
'gen_keywords' => '#use-keywords-in-article-tags',
|
164 |
'gen_categories' => '#use-categories-in-article-tags',
|
@@ -167,7 +157,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
167 |
'facebook_author' => '#show-facebook-author-on-articles',
|
168 |
'types' => '#enable-facebook-meta-for',
|
169 |
'defcard' => '#default-twitter-card',
|
170 |
-
'setcard' => '#default-twitter-card',
|
171 |
'twitter_site' => '#twitter-site',
|
172 |
'twitter_creator' => '#show-twitter-author',
|
173 |
'twitter_domain' => '#twitter-domain',
|
@@ -189,310 +178,323 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
189 |
'customimg_twitter' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-twitter-image',
|
190 |
);
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
'save' => true,
|
198 |
-
),
|
199 |
-
'setmeta' => Array(
|
200 |
-
'name' => __( 'Use AIOSEO Title and Description', 'all-in-one-seo-pack' ),
|
201 |
-
'type' => 'checkbox',
|
202 |
-
),
|
203 |
-
'key' => Array(
|
204 |
-
'name' => __( 'Facebook Admin ID', 'all-in-one-seo-pack' ),
|
205 |
-
'default' => '',
|
206 |
-
'type' => 'text',
|
207 |
-
),
|
208 |
-
'appid' => Array(
|
209 |
-
'name' => __( 'Facebook App ID', 'all-in-one-seo-pack' ),
|
210 |
-
'default' => '',
|
211 |
-
'type' => 'text',
|
212 |
-
),
|
213 |
-
'title_shortcodes' => Array( 'name' => __( 'Run Shortcodes In Title', 'all-in-one-seo-pack' ) ),
|
214 |
-
'description_shortcodes' => Array( 'name' => __( 'Run Shortcodes In Description', 'all-in-one-seo-pack' ) ),
|
215 |
-
'sitename' => Array(
|
216 |
-
'name' => __( 'Site Name', 'all-in-one-seo-pack' ),
|
217 |
-
'default' => get_bloginfo( 'name' ),
|
218 |
-
'type' => 'text',
|
219 |
-
),
|
220 |
-
'hometitle' => Array(
|
221 |
-
'name' => __( 'Home Title', 'all-in-one-seo-pack' ),
|
222 |
-
'default' => '',
|
223 |
-
'type' => 'textarea',
|
224 |
-
'condshow' => Array(
|
225 |
-
'aiosp_opengraph_setmeta' => Array(
|
226 |
-
'lhs' => "aiosp_opengraph_setmeta",
|
227 |
-
'op' => '!=',
|
228 |
-
'rhs' => 'on',
|
229 |
-
),
|
230 |
-
),
|
231 |
-
),
|
232 |
-
'description' => Array(
|
233 |
-
'name' => __( 'Home Description', 'all-in-one-seo-pack' ),
|
234 |
-
'default' => '',
|
235 |
-
'type' => 'textarea',
|
236 |
-
'condshow' => Array(
|
237 |
-
'aiosp_opengraph_setmeta' => Array(
|
238 |
-
'lhs' => "aiosp_opengraph_setmeta",
|
239 |
-
'op' => '!=',
|
240 |
-
'rhs' => 'on',
|
241 |
-
),
|
242 |
-
),
|
243 |
-
),
|
244 |
-
'homeimage' => Array(
|
245 |
-
'name' => __( 'Home Image', 'all-in-one-seo-pack' ),
|
246 |
-
'type' => 'image',
|
247 |
-
),
|
248 |
-
'hometag' => Array(
|
249 |
-
'name' => __( 'Home Article Tags', 'all-in-one-seo-pack' ),
|
250 |
-
'type' => 'text',
|
251 |
-
'default' => '',
|
252 |
-
'condshow' => Array( 'aiosp_opengraph_categories' => 'article' ),
|
253 |
-
),
|
254 |
-
'generate_descriptions' => Array(
|
255 |
-
'name' => __( 'Use Content For Autogenerated OG Descriptions', 'all-in-one-seo-pack' ),
|
256 |
-
'default' => 0,
|
257 |
-
),
|
258 |
-
'defimg' => Array(
|
259 |
-
'name' => __( 'Select OG:Image Source', 'all-in-one-seo-pack' ),
|
260 |
-
'type' => 'select',
|
261 |
-
'initial_options' => Array(
|
262 |
-
'' => __( 'Default Image', 'all-in-one-seo-pack' ),
|
263 |
-
'featured' => __( 'Featured Image', 'all-in-one-seo-pack' ),
|
264 |
-
'attach' => __( 'First Attached Image', 'all-in-one-seo-pack' ),
|
265 |
-
'content' => __( 'First Image In Content', 'all-in-one-seo-pack' ),
|
266 |
-
'custom' => __( 'Image From Custom Field', 'all-in-one-seo-pack' ),
|
267 |
-
'author' => __( 'Post Author Image', 'all-in-one-seo-pack' ),
|
268 |
-
'auto' => __( 'First Available Image', 'all-in-one-seo-pack' ),
|
269 |
-
),
|
270 |
-
),
|
271 |
-
'fallback' => Array(
|
272 |
-
'name' => __( 'Use Default If No Image Found', 'all-in-one-seo-pack' ),
|
273 |
-
'type' => 'checkbox',
|
274 |
-
),
|
275 |
-
'dimg' => Array(
|
276 |
-
'name' => __( 'Default OG:Image', 'all-in-one-seo-pack' ),
|
277 |
-
'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png',
|
278 |
-
'type' => 'image',
|
279 |
-
),
|
280 |
-
'dimgwidth' => Array(
|
281 |
-
'name' => __( 'Default Image Width', 'all-in-one-seo-pack' ),
|
282 |
-
'type' => 'text',
|
283 |
-
'default' => '',
|
284 |
-
),
|
285 |
-
'dimgheight' => Array(
|
286 |
-
'name' => __( 'Default Image Height', 'all-in-one-seo-pack' ),
|
287 |
-
'type' => 'text',
|
288 |
-
'default' => '',
|
289 |
-
),
|
290 |
-
'meta_key' => Array(
|
291 |
-
'name' => __( 'Use Custom Field For Image', 'all-in-one-seo-pack' ),
|
292 |
-
'type' => 'text',
|
293 |
-
'default' => '',
|
294 |
-
),
|
295 |
-
'categories' => Array(
|
296 |
-
'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ),
|
297 |
-
'type' => 'radio',
|
298 |
-
'initial_options' => $categories,
|
299 |
-
'default' => 'blog',
|
300 |
-
),
|
301 |
-
'image' => Array(
|
302 |
-
'name' => __( 'Image', 'all-in-one-seo-pack' ),
|
303 |
-
'type' => 'radio',
|
304 |
-
'initial_options' => Array( 0 => '<img style="width:50px;height:auto;display:inline-block;vertical-align:bottom;" src="' . AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png' . '">' ),
|
305 |
-
),
|
306 |
-
'customimg' => Array(
|
307 |
-
'name' => __( 'Custom Image', 'all-in-one-seo-pack' ),
|
308 |
-
'type' => 'image',
|
309 |
-
),
|
310 |
-
'imagewidth' => Array(
|
311 |
-
'name' => __( 'Specify Image Width', 'all-in-one-seo-pack' ),
|
312 |
-
'type' => 'text',
|
313 |
-
'default' => '',
|
314 |
-
),
|
315 |
-
'imageheight' => Array(
|
316 |
-
'name' => __( 'Specify Image Height', 'all-in-one-seo-pack' ),
|
317 |
-
'type' => 'text',
|
318 |
-
'default' => '',
|
319 |
-
),
|
320 |
-
'video' => Array(
|
321 |
-
'name' => __( 'Custom Video', 'all-in-one-seo-pack' ),
|
322 |
-
'type' => 'text',
|
323 |
-
),
|
324 |
-
'videowidth' => Array(
|
325 |
-
'name' => __( 'Specify Video Width', 'all-in-one-seo-pack' ),
|
326 |
-
'type' => 'text',
|
327 |
-
'default' => '',
|
328 |
-
'condshow' => Array(
|
329 |
-
'aioseop_opengraph_settings_video' => Array(
|
330 |
-
'lhs' => "aioseop_opengraph_settings_video",
|
331 |
-
'op' => '!=',
|
332 |
-
'rhs' => '',
|
333 |
-
),
|
334 |
-
),
|
335 |
-
),
|
336 |
-
'videoheight' => Array(
|
337 |
-
'name' => __( 'Specify Video Height', 'all-in-one-seo-pack' ),
|
338 |
-
'type' => 'text',
|
339 |
-
'default' => '',
|
340 |
-
'condshow' => Array(
|
341 |
-
'aioseop_opengraph_settings_video' => Array(
|
342 |
-
'lhs' => "aioseop_opengraph_settings_video",
|
343 |
-
'op' => '!=',
|
344 |
-
'rhs' => '',
|
345 |
-
),
|
346 |
-
),
|
347 |
-
),
|
348 |
-
'defcard' => Array(
|
349 |
-
'name' => __( 'Default Twitter Card', 'all-in-one-seo-pack' ),
|
350 |
-
'type' => 'select',
|
351 |
-
'initial_options' => Array(
|
352 |
-
'summary' => __( 'Summary', 'all-in-one-seo-pack' ),
|
353 |
-
'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' )
|
354 |
-
/*, *******REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE****** 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) */
|
355 |
-
),
|
356 |
-
'default' => 'summary',
|
357 |
-
),
|
358 |
-
'setcard' => Array(
|
359 |
-
'name' => __( 'Twitter Card Type', 'all-in-one-seo-pack' ),
|
360 |
-
'type' => 'select',
|
361 |
-
'initial_options' => Array(
|
362 |
-
'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ),
|
363 |
-
'summary' => __( 'Summary', 'all-in-one-seo-pack' )
|
364 |
-
/*, *******REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE****** 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) */
|
365 |
-
),
|
366 |
-
),
|
367 |
-
'twitter_site' => Array(
|
368 |
-
'name' => __( 'Twitter Site', 'all-in-one-seo-pack' ),
|
369 |
-
'type' => 'text',
|
370 |
-
'default' => '',
|
371 |
-
),
|
372 |
-
'twitter_creator' => Array( 'name' => __( 'Show Twitter Author', 'all-in-one-seo-pack' ) ),
|
373 |
-
'twitter_domain' => Array(
|
374 |
-
'name' => __( 'Twitter Domain', 'all-in-one-seo-pack' ),
|
375 |
-
'type' => 'text',
|
376 |
-
'default' => '',
|
377 |
-
),
|
378 |
-
'customimg_twitter' => Array(
|
379 |
-
'name' => __( 'Custom Twitter Image', 'all-in-one-seo-pack' ),
|
380 |
-
'type' => 'image',
|
381 |
-
),
|
382 |
-
'gen_tags' => Array( 'name' => __( 'Automatically Generate Article Tags', 'all-in-one-seo-pack' ) ),
|
383 |
-
'gen_keywords' => Array(
|
384 |
-
'name' => __( 'Use Keywords In Article Tags', 'all-in-one-seo-pack' ),
|
385 |
-
'default' => 'on',
|
386 |
-
'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' ),
|
387 |
-
),
|
388 |
-
'gen_categories' => Array(
|
389 |
-
'name' => __( 'Use Categories In Article Tags', 'all-in-one-seo-pack' ),
|
390 |
-
'default' => 'on',
|
391 |
-
'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' ),
|
392 |
-
),
|
393 |
-
'gen_post_tags' => Array(
|
394 |
-
'name' => __( 'Use Post Tags In Article Tags', 'all-in-one-seo-pack' ),
|
395 |
-
'default' => 'on',
|
396 |
-
'condshow' => Array( 'aiosp_opengraph_gen_tags' => 'on' ),
|
397 |
-
),
|
398 |
-
'types' => Array(
|
399 |
-
'name' => __( 'Enable Facebook Meta for Post Types', 'all-in-one-seo-pack' ),
|
400 |
-
'type' => 'multicheckbox',
|
401 |
-
'initial_options' => $this->get_post_type_titles( Array( '_builtin' => false ) ),
|
402 |
-
'default' => Array( 'post' => 'Post', 'page' => 'Page' ),
|
403 |
-
),
|
404 |
-
'title' => Array(
|
405 |
-
'name' => __( 'Title', 'all-in-one-seo-pack' ),
|
406 |
-
'default' => '',
|
407 |
-
'type' => 'text',
|
408 |
-
'size' => 95,
|
409 |
-
'count' => 1,
|
410 |
-
'count_desc' => $count_desc,
|
411 |
-
),
|
412 |
-
'desc' => Array(
|
413 |
-
'name' => __( 'Description', 'all-in-one-seo-pack' ),
|
414 |
-
'default' => '',
|
415 |
-
'type' => 'textarea',
|
416 |
-
'cols' => 250,
|
417 |
-
'rows' => 4,
|
418 |
-
'count' => 1,
|
419 |
-
'count_desc' => $count_desc,
|
420 |
-
),
|
421 |
-
'category' => Array(
|
422 |
-
'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ),
|
423 |
-
'type' => 'select',
|
424 |
-
'style' => '',
|
425 |
-
'initial_options' => $this->fb_object_types,
|
426 |
-
'default' => '',
|
427 |
-
),
|
428 |
-
'facebook_debug' => Array(
|
429 |
-
'name' => __( 'Facebook Debug', 'all-in-one-seo-pack' ),
|
430 |
-
'type' => 'html',
|
431 |
-
'save' => false,
|
432 |
-
'default' =>
|
433 |
-
'<script>
|
434 |
-
jQuery(document).ready(function() {
|
435 |
-
var snippet = jQuery("#aioseop_snippet_link");
|
436 |
-
if ( !snippet ) {
|
437 |
-
jQuery( "#aioseop_opengraph_settings_facebook_debug_wrapper").hide();
|
438 |
-
} else {
|
439 |
-
snippet = snippet.html();
|
440 |
-
jQuery("#aioseop_opengraph_settings_facebook_debug").attr( "href", "https://developers.facebook.com/tools/debug/sharing/?q=" + snippet );
|
441 |
-
}
|
442 |
-
});
|
443 |
-
</script>
|
444 |
-
<a name="aioseop_opengraph_settings_facebook_debug" id="aioseop_opengraph_settings_facebook_debug" class="button-primary" href="" target=_blank>' . __( 'Debug This Post', 'all-in-one-seo-pack' )
|
445 |
-
. '</a>',
|
446 |
-
),
|
447 |
-
|
448 |
-
'section' => Array(
|
449 |
-
'name' => __( 'Article Section', 'all-in-one-seo-pack' ),
|
450 |
-
'type' => 'text',
|
451 |
-
'default' => '',
|
452 |
-
'condshow' => Array( 'aioseop_opengraph_settings_category' => 'article' ),
|
453 |
-
),
|
454 |
-
'tag' => Array(
|
455 |
-
'name' => __( 'Article Tags', 'all-in-one-seo-pack' ),
|
456 |
-
'type' => 'text',
|
457 |
-
'default' => '',
|
458 |
-
'condshow' => Array( 'aioseop_opengraph_settings_category' => 'article' ),
|
459 |
-
),
|
460 |
-
'facebook_publisher' => Array(
|
461 |
-
'name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ),
|
462 |
-
'type' => 'text',
|
463 |
-
'default' => '',
|
464 |
-
),
|
465 |
-
'facebook_author' => Array( 'name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' ) ),
|
466 |
-
'profile_links' => Array(
|
467 |
-
'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ),
|
468 |
-
'type' => 'textarea',
|
469 |
-
'cols' => 60,
|
470 |
-
'rows' => 5,
|
471 |
-
),
|
472 |
-
'person_or_org' => Array(
|
473 |
-
'name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ),
|
474 |
-
'type' => 'radio',
|
475 |
-
'initial_options' => Array(
|
476 |
-
'person' => __( 'Person', 'all-in-one-seo-pack' ),
|
477 |
-
'org' => __( 'Organization', 'all-in-one-seo-pack' ),
|
478 |
-
),
|
479 |
-
),
|
480 |
-
'social_name' => Array(
|
481 |
-
'name' => __( "Associated Name", 'all-in-one-seo-pack' ),
|
482 |
-
'type' => 'text',
|
483 |
-
'default' => "",
|
484 |
-
),
|
485 |
-
);
|
486 |
-
|
487 |
-
// load initial options / set defaults
|
488 |
-
$this->update_options();
|
489 |
|
490 |
-
|
491 |
-
|
492 |
-
$display = $this->options['aiosp_opengraph_types'];
|
493 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
|
495 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
'opengraph' => Array(
|
497 |
'name' => $this->name,
|
498 |
'prefix' => 'aiosp_',
|
@@ -508,7 +510,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
508 |
'hometitle',
|
509 |
'description',
|
510 |
'homeimage',
|
511 |
-
'hometag',
|
512 |
'generate_descriptions',
|
513 |
'defimg',
|
514 |
'fallback',
|
@@ -516,7 +517,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
516 |
'dimgwidth',
|
517 |
'dimgheight',
|
518 |
'meta_key',
|
519 |
-
'categories',
|
520 |
'defcard',
|
521 |
'profile_links',
|
522 |
'person_or_org',
|
@@ -558,12 +558,11 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
558 |
'prefix' => 'aioseop_opengraph_',
|
559 |
),
|
560 |
);
|
561 |
-
|
562 |
-
$this->layout = Array(
|
563 |
'home' => Array(
|
564 |
'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
|
565 |
'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#use-aioseo-title-and-description',
|
566 |
-
'options' => Array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage'
|
567 |
),
|
568 |
'image' => Array(
|
569 |
'name' => __( 'Image Settings', 'all-in-one-seo-pack' ),
|
@@ -586,7 +585,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
586 |
'gen_keywords',
|
587 |
'gen_categories',
|
588 |
'gen_post_tags',
|
589 |
-
'categories',
|
590 |
'facebook_publisher',
|
591 |
'facebook_author',
|
592 |
),
|
@@ -607,30 +605,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
607 |
'options' => Array( 'scan_header' ),
|
608 |
),
|
609 |
);
|
610 |
-
|
611 |
$other_options = Array();
|
612 |
foreach ( $this->layout as $k => $v ) {
|
613 |
$other_options = array_merge( $other_options, $v['options'] );
|
614 |
}
|
615 |
|
616 |
$this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options );
|
617 |
-
|
618 |
-
if ( is_admin() ) {
|
619 |
-
add_action( 'admin_init', Array( $this, 'debug_post_types' ), 5 );
|
620 |
-
} else {
|
621 |
-
add_action( 'wp', Array( $this, 'type_setup' ) );
|
622 |
-
}
|
623 |
-
|
624 |
-
if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
|
625 |
-
$this->do_opengraph();
|
626 |
-
}
|
627 |
-
|
628 |
-
add_filter( 'jetpack_enable_open_graph', '__return_false' ); // Avoid having duplicate meta tags
|
629 |
-
|
630 |
-
// Force refresh of Facebook cache.
|
631 |
-
add_action( 'post_updated', array( $this, 'force_fb_refresh_update' ), 10, 3 );
|
632 |
-
add_action( 'transition_post_status', array( $this, 'force_fb_refresh_transition' ), 10, 3 );
|
633 |
-
}
|
634 |
|
635 |
/**
|
636 |
* Forces FaceBook OpenGraph to refresh its cache when a post is changed to
|
@@ -691,20 +672,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
691 |
|
692 |
function settings_page_init() {
|
693 |
add_filter( 'aiosp_output_option', Array( $this, 'display_custom_options' ), 10, 2 );
|
694 |
-
$cat = $this->options["{$this->prefix}categories"];
|
695 |
-
if ( ! empty( $cat ) ) {
|
696 |
-
if ( $cat == 'blog' ) {
|
697 |
-
$show_on_front = get_option( 'show_on_front' );
|
698 |
-
if ( ( $show_on_front == 'page' ) && ( get_option( 'page_on_front' ) ) ) {
|
699 |
-
$this->output_error( '<p>' . __( "Static front page detected, suggested Facebook Object Type is 'website'.", 'all-in-one-seo-pack' ) . '</p>' );
|
700 |
-
}
|
701 |
-
} elseif ( $cat == 'website' ) {
|
702 |
-
$show_on_front = get_option( 'show_on_front' );
|
703 |
-
if ( ( $show_on_front == 'posts' ) ) {
|
704 |
-
$this->output_error( '<p>' . __( "Blog on front page detected, suggested Facebook Object Type is 'blog'.", 'all-in-one-seo-pack' ) . '</p>' );
|
705 |
-
}
|
706 |
-
}
|
707 |
-
}
|
708 |
}
|
709 |
|
710 |
function filter_options( $options, $location ) {
|
@@ -733,6 +700,15 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
733 |
return $options;
|
734 |
}
|
735 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
736 |
function filter_settings( $settings, $location, $current ) {
|
737 |
global $aiosp, $post;
|
738 |
if ( $location == 'opengraph' || $location == 'settings' ) {
|
@@ -765,25 +741,25 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
765 |
$info = $aiosp->get_page_snippet_info();
|
766 |
extract( $info );
|
767 |
|
768 |
-
|
769 |
if ( is_object( $post ) )
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
|
|
782 |
$description = apply_filters( 'aioseop_description', $description );
|
783 |
// Add placholders
|
784 |
-
|
785 |
-
|
786 |
-
$settings["{$prefix}desc"]['placeholder'] = $description;
|
787 |
}
|
788 |
if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) {
|
789 |
foreach ( $opts as $opt ) {
|
@@ -800,14 +776,54 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
800 |
return $settings;
|
801 |
}
|
802 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
803 |
function override_options( $options, $location, $settings ) {
|
804 |
-
$
|
|
|
|
|
|
|
805 |
foreach ( $settings as $k => $v ) {
|
806 |
if ( $v['save'] ) {
|
807 |
$opts[ $k ] = $v['default'];
|
808 |
}
|
809 |
}
|
810 |
foreach ( $options as $k => $v ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
811 |
if ( $v === null ) {
|
812 |
unset( $options[ $k ] );
|
813 |
}
|
@@ -817,19 +833,34 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
817 |
return $options;
|
818 |
}
|
819 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
820 |
function filter_metabox_options( $options, $location, $post_id ) {
|
821 |
if ( $location == 'settings' ) {
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
}
|
831 |
-
|
832 |
-
return $options;
|
833 |
}
|
834 |
|
835 |
/** Custom settings **/
|
@@ -903,10 +934,17 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
903 |
* @since 1.0.0
|
904 |
* @since 2.3.11.5 Support for multiple fb_admins.
|
905 |
* @since 2.3.13 Adds filter:aioseop_description on description.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
906 |
*/
|
907 |
function add_meta() {
|
908 |
global $post, $aiosp, $aioseop_options, $wp_query;
|
909 |
-
$metabox = $this->get_current_options(
|
910 |
$key = $this->options['aiosp_opengraph_key'];
|
911 |
$dimg = $this->options['aiosp_opengraph_dimg'];
|
912 |
$current_post_type = get_post_type();
|
@@ -973,9 +1011,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
973 |
if ( empty( $description ) && $first_page ) {
|
974 |
$description = get_bloginfo( 'description' );
|
975 |
}
|
976 |
-
if ( $type == 'article' && ( ! empty( $this->options['aiosp_opengraph_hometag'] ) ) ) {
|
977 |
-
$tag = $this->options['aiosp_opengraph_hometag'];
|
978 |
-
}
|
979 |
if ( ! empty( $this->options['aiosp_opengraph_profile_links'] ) ) {
|
980 |
$social_links = $this->options['aiosp_opengraph_profile_links'];
|
981 |
if ( ! empty( $this->options['aiosp_opengraph_social_name'] ) ) {
|
@@ -1056,6 +1091,76 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
1056 |
if ( empty( $type ) ) {
|
1057 |
$type = 'article';
|
1058 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1059 |
} else {
|
1060 |
return;
|
1061 |
}
|
@@ -1085,15 +1190,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
|
1085 |
}
|
1086 |
}
|
1087 |
|
1088 |
-
if ( ! empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) {
|
1089 |
-
$title = do_shortcode( $title );
|
1090 |
-
}
|
1091 |
-
|
1092 |
if ( ! empty( $description ) ) {
|
1093 |
$description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) );
|
1094 |
-
|
1095 |
-
$description = do_shortcode( $description );
|
1096 |
-
}
|
1097 |
$description = $aiosp->trim_excerpt_without_filters( $description, 1000 );
|
1098 |
}
|
1099 |
|
@@ -1328,27 +1427,37 @@ END;
|
|
1328 |
echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema );
|
1329 |
}
|
1330 |
|
1331 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1332 |
global $aioseop_options;
|
1333 |
-
if ( ! empty( $aioseop_options )
|
1334 |
-
|
1335 |
-
|
|
|
1336 |
if ( ! defined( 'DOING_AJAX' ) ) {
|
1337 |
-
add_action( 'aioseop_modules_wp_head',
|
1338 |
-
|
1339 |
-
if (
|
1340 |
-
add_action( 'amp_post_template_head',
|
1341 |
-
}
|
1342 |
}
|
1343 |
}
|
1344 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1345 |
function type_setup() {
|
1346 |
-
|
1347 |
-
|
1348 |
-
if (
|
1349 |
-
|
1350 |
-
$this->type = $this->options['aiosp_opengraph_categories'];
|
1351 |
-
}
|
1352 |
} elseif ( is_singular() && $this->option_isset( 'types' ) ) {
|
1353 |
$metabox = $this->get_current_options( Array(), 'settings' );
|
1354 |
$current_post_type = get_post_type();
|
@@ -1360,13 +1469,25 @@ END;
|
|
1360 |
}
|
1361 |
}
|
1362 |
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1368 |
'filter_metabox_options',
|
1369 |
), 10, 3 );
|
|
|
|
|
|
|
|
|
1370 |
$post_types = $this->get_post_type_titles();
|
1371 |
$rempost = array( 'revision' => 1, 'nav_menu_item' => 1, 'custom_css' => 1, 'customize_changeset' => 1 );
|
1372 |
$post_types = array_diff_key( $post_types, $rempost );
|
@@ -1469,7 +1590,7 @@ END;
|
|
1469 |
*/
|
1470 |
function og_admin_enqueue_scripts($hook){
|
1471 |
|
1472 |
-
if ( 'all-in-one-seo_page_aiosp_opengraph' != $hook ) {
|
1473 |
// Only enqueue if we're on the social module settings page.
|
1474 |
return;
|
1475 |
}
|
@@ -1479,5 +1600,96 @@ END;
|
|
1479 |
wp_enqueue_style('thickbox');
|
1480 |
wp_enqueue_media();
|
1481 |
}
|
1482 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1483 |
}
|
1 |
<?php
|
|
|
|
|
|
|
2 |
/**
|
3 |
* The Opengraph class.
|
4 |
+
*
|
5 |
+
* @package All-in-One-SEO-Pack
|
6 |
+
* @version 2.4.14
|
7 |
*/
|
8 |
if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
|
9 |
class All_in_One_SEO_Pack_Opengraph extends All_in_One_SEO_Pack_Module {
|
13 |
/**
|
14 |
* Module constructor.
|
15 |
*
|
16 |
+
* @since 2.4.14 Added display filter.
|
17 |
*/
|
18 |
function __construct() {
|
19 |
add_action( 'admin_enqueue_scripts', array( $this, 'og_admin_enqueue_scripts' ) );
|
81 |
);
|
82 |
parent::__construct();
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
$this->help_text = Array(
|
85 |
"setmeta" => __( "Checking this box will use the Home Title and Home Description set in All in One SEO Pack, General Settings as the Open Graph title and description for your home page.", 'all-in-one-seo-pack' ),
|
86 |
"key" => __( "Enter your Facebook Admin ID here. You can enter multiple IDs separated by a comma. You can look up your Facebook ID using this tool http://findmyfbid.com/", 'all-in-one-seo-pack' ),
|
91 |
"hometitle" => __( "The Home Title is the Open Graph title for your home page.", 'all-in-one-seo-pack' ),
|
92 |
"description" => __( "The Home Description is the Open Graph description for your home page.", 'all-in-one-seo-pack' ),
|
93 |
"homeimage" => __( "The Home Image is the Open Graph image for your home page.", 'all-in-one-seo-pack' ),
|
|
|
94 |
"generate_descriptions" => __( "This option will auto generate your Open Graph descriptions from your post content instead of your post excerpt. WooCommerce users should read the documentation regarding this setting.", 'all-in-one-seo-pack' ),
|
95 |
"defimg" => __( "This option lets you choose which image will be displayed by default for the Open Graph image. You may override this on individual posts.", 'all-in-one-seo-pack' ),
|
96 |
"fallback" => __( "This option lets you fall back to the default image if no image could be found above.", 'all-in-one-seo-pack' ),
|
98 |
"dimgwidth" => __( "This option lets you set a default width for your images, where unspecified.", 'all-in-one-seo-pack' ),
|
99 |
"dimgheight" => __( "This option lets you set a default height for your images, where unspecified.", 'all-in-one-seo-pack' ),
|
100 |
"meta_key" => __( "Enter the name of a custom field (or multiple field names separated by commas) to use that field to specify the Open Graph image on Pages or Posts.", 'all-in-one-seo-pack' ),
|
|
|
101 |
"image" => __( "This option lets you select the Open Graph image that will be used for this Page or Post, overriding the default settings.", 'all-in-one-seo-pack' ),
|
102 |
"customimg" => __( "This option lets you upload an image to use as the Open Graph image for this Page or Post.", 'all-in-one-seo-pack' ),
|
103 |
"imagewidth" => __( "Enter the width for your Open Graph image in pixels (i.e. 600).", 'all-in-one-seo-pack' ),
|
138 |
'hometitle' => '#home-title-and-description',
|
139 |
'description' => '#home-title-and-description',
|
140 |
'homeimage' => '#home-image',
|
|
|
141 |
'defimg' => '#select-og-image-source',
|
142 |
'fallback' => '#use-default-if-no-image-found',
|
143 |
'dimg' => '#default-og-image',
|
149 |
'social_name' => '#social-profile-links',
|
150 |
'key' => '#facebook-admin-id',
|
151 |
'appid' => '#facebook-app-id',
|
|
|
152 |
'gen_tags' => '#automatically-generate-article-tags',
|
153 |
'gen_keywords' => '#use-keywords-in-article-tags',
|
154 |
'gen_categories' => '#use-categories-in-article-tags',
|
157 |
'facebook_author' => '#show-facebook-author-on-articles',
|
158 |
'types' => '#enable-facebook-meta-for',
|
159 |
'defcard' => '#default-twitter-card',
|
|
|
160 |
'twitter_site' => '#twitter-site',
|
161 |
'twitter_creator' => '#show-twitter-author',
|
162 |
'twitter_domain' => '#twitter-domain',
|
178 |
'customimg_twitter' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-twitter-image',
|
179 |
);
|
180 |
|
181 |
+
if ( is_admin() ) {
|
182 |
+
add_action( 'admin_init', Array( $this, 'admin_init' ), 5 );
|
183 |
+
} else {
|
184 |
+
add_action( 'wp', Array( $this, 'type_setup' ) );
|
185 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
|
187 |
+
if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
|
188 |
+
$this->do_opengraph();
|
|
|
189 |
}
|
190 |
+
// Set variables after wordpress load.
|
191 |
+
add_action( 'init', array( &$this, 'init' ), 999999 );
|
192 |
+
add_filter( 'jetpack_enable_open_graph', '__return_false' ); // Avoid having duplicate meta tags
|
193 |
+
// Force refresh of Facebook cache.
|
194 |
+
add_action( 'post_updated', array( &$this, 'force_fb_refresh_update' ), 10, 3 );
|
195 |
+
add_action( 'transition_post_status', array( &$this, 'force_fb_refresh_transition' ), 10, 3 );
|
196 |
+
add_action( 'edited_term', array( &$this, 'save_tax_data' ), 10, 3 );
|
197 |
+
// Adds special filters
|
198 |
+
add_filter( 'aioseop_opengraph_placeholder', array( &$this, 'filter_placeholder' ) );
|
199 |
+
}
|
200 |
|
201 |
+
/**
|
202 |
+
* Hook called after wordpress has been loaded.
|
203 |
+
* @since 2.4.14
|
204 |
+
*/
|
205 |
+
public function init() {
|
206 |
+
$count_desc = __( ' characters. Open Graph allows up to a maximum of %s chars for the %s.', 'all-in-one-seo-pack' );
|
207 |
+
// Create default options
|
208 |
+
$this->default_options = array(
|
209 |
+
'scan_header' => array(
|
210 |
+
'name' => __( 'Scan Header', 'all-in-one-seo-pack' ),
|
211 |
+
'type' => 'custom',
|
212 |
+
'save' => true,
|
213 |
+
),
|
214 |
+
'setmeta' => array(
|
215 |
+
'name' => __( 'Use AIOSEO Title and Description', 'all-in-one-seo-pack' ),
|
216 |
+
'type' => 'checkbox',
|
217 |
+
),
|
218 |
+
'key' => array(
|
219 |
+
'name' => __( 'Facebook Admin ID', 'all-in-one-seo-pack' ),
|
220 |
+
'default' => '',
|
221 |
+
'type' => 'text',
|
222 |
+
),
|
223 |
+
'appid' => array(
|
224 |
+
'name' => __( 'Facebook App ID', 'all-in-one-seo-pack' ),
|
225 |
+
'default' => '',
|
226 |
+
'type' => 'text',
|
227 |
+
),
|
228 |
+
'title_shortcodes' => array(
|
229 |
+
'name' => __( 'Run Shortcodes In Title', 'all-in-one-seo-pack' ),
|
230 |
+
),
|
231 |
+
'description_shortcodes' => array(
|
232 |
+
'name' => __( 'Run Shortcodes In Description', 'all-in-one-seo-pack' ),
|
233 |
+
),
|
234 |
+
'sitename' => array(
|
235 |
+
'name' => __( 'Site Name', 'all-in-one-seo-pack' ),
|
236 |
+
'default' => get_bloginfo( 'name' ),
|
237 |
+
'type' => 'text',
|
238 |
+
),
|
239 |
+
'hometitle' => array(
|
240 |
+
'name' => __( 'Home Title', 'all-in-one-seo-pack' ),
|
241 |
+
'default' => '',
|
242 |
+
'type' => 'textarea',
|
243 |
+
'condshow' => array(
|
244 |
+
'aiosp_opengraph_setmeta' => array(
|
245 |
+
'lhs' => 'aiosp_opengraph_setmeta',
|
246 |
+
'op' => '!=',
|
247 |
+
'rhs' => 'on',
|
248 |
+
),
|
249 |
+
),
|
250 |
+
),
|
251 |
+
'description' => array(
|
252 |
+
'name' => __( 'Home Description', 'all-in-one-seo-pack' ),
|
253 |
+
'default' => '',
|
254 |
+
'type' => 'textarea',
|
255 |
+
'condshow' => array(
|
256 |
+
'aiosp_opengraph_setmeta' => array(
|
257 |
+
'lhs' => 'aiosp_opengraph_setmeta',
|
258 |
+
'op' => '!=',
|
259 |
+
'rhs' => 'on',
|
260 |
+
),
|
261 |
+
),
|
262 |
+
),
|
263 |
+
'homeimage' => array(
|
264 |
+
'name' => __( 'Home Image', 'all-in-one-seo-pack' ),
|
265 |
+
'type' => 'image',
|
266 |
+
),
|
267 |
+
'generate_descriptions' => array(
|
268 |
+
'name' => __( 'Use Content For Autogenerated OG Descriptions', 'all-in-one-seo-pack' ),
|
269 |
+
'default' => 0,
|
270 |
+
),
|
271 |
+
'defimg' => array(
|
272 |
+
'name' => __( 'Select OG:Image Source', 'all-in-one-seo-pack' ),
|
273 |
+
'type' => 'select',
|
274 |
+
'initial_options' => array(
|
275 |
+
'' => __( 'Default Image' ),
|
276 |
+
'featured' => __( 'Featured Image' ),
|
277 |
+
'attach' => __( 'First Attached Image' ),
|
278 |
+
'content' => __( 'First Image In Content' ),
|
279 |
+
'custom' => __( 'Image From Custom Field' ),
|
280 |
+
'author' => __( 'Post Author Image' ),
|
281 |
+
'auto' => __( 'First Available Image' ),
|
282 |
+
),
|
283 |
+
),
|
284 |
+
'fallback' => array(
|
285 |
+
'name' => __( 'Use Default If No Image Found', 'all-in-one-seo-pack' ),
|
286 |
+
'type' => 'checkbox',
|
287 |
+
),
|
288 |
+
'dimg' => array(
|
289 |
+
'name' => __( 'Default OG:Image', 'all-in-one-seo-pack' ),
|
290 |
+
'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png',
|
291 |
+
'type' => 'image',
|
292 |
+
),
|
293 |
+
'dimgwidth' => array(
|
294 |
+
'name' => __( 'Default Image Width', 'all-in-one-seo-pack' ),
|
295 |
+
'type' => 'text',
|
296 |
+
'default' => '',
|
297 |
+
),
|
298 |
+
'dimgheight' => array(
|
299 |
+
'name' => __( 'Default Image Height', 'all-in-one-seo-pack' ),
|
300 |
+
'type' => 'text',
|
301 |
+
'default' => '',
|
302 |
+
),
|
303 |
+
'meta_key' => array(
|
304 |
+
'name' => __( 'Use Custom Field For Image', 'all-in-one-seo-pack' ),
|
305 |
+
'type' => 'text',
|
306 |
+
'default' => '',
|
307 |
+
),
|
308 |
+
'image' => array(
|
309 |
+
'name' => __( 'Image', 'all-in-one-seo-pack' ),
|
310 |
+
'type' => 'radio',
|
311 |
+
'initial_options' => array(
|
312 |
+
0 => '<img style="width:50px;height:auto;display:inline-block;vertical-align:bottom;" src="' . AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png' . '">'
|
313 |
+
),
|
314 |
+
),
|
315 |
+
'customimg' => array(
|
316 |
+
'name' => __( 'Custom Image', 'all-in-one-seo-pack' ),
|
317 |
+
'type' => 'image',
|
318 |
+
),
|
319 |
+
'imagewidth' => array(
|
320 |
+
'name' => __( 'Specify Image Width', 'all-in-one-seo-pack' ),
|
321 |
+
'type' => 'text',
|
322 |
+
'default' => '',
|
323 |
+
),
|
324 |
+
'imageheight' => array(
|
325 |
+
'name' => __( 'Specify Image Height', 'all-in-one-seo-pack' ),
|
326 |
+
'type' => 'text',
|
327 |
+
'default' => '',
|
328 |
+
),
|
329 |
+
'video' => array(
|
330 |
+
'name' => __( 'Custom Video', 'all-in-one-seo-pack' ),
|
331 |
+
'type' => 'text',
|
332 |
+
),
|
333 |
+
'videowidth' => array(
|
334 |
+
'name' => __( 'Specify Video Width', 'all-in-one-seo-pack' ),
|
335 |
+
'type' => 'text',
|
336 |
+
'default' => '',
|
337 |
+
'condshow' => array(
|
338 |
+
'aioseop_opengraph_settings_video' => array(
|
339 |
+
'lhs' => 'aioseop_opengraph_settings_video',
|
340 |
+
'op' => '!=',
|
341 |
+
'rhs' => '',
|
342 |
+
),
|
343 |
+
),
|
344 |
+
),
|
345 |
+
'videoheight' => array(
|
346 |
+
'name' => __( 'Specify Video Height', 'all-in-one-seo-pack' ),
|
347 |
+
'type' => 'text',
|
348 |
+
'default' => '',
|
349 |
+
'condshow' => array(
|
350 |
+
'aioseop_opengraph_settings_video' => array(
|
351 |
+
'lhs' => 'aioseop_opengraph_settings_video',
|
352 |
+
'op' => '!=',
|
353 |
+
'rhs' => '',
|
354 |
+
),
|
355 |
+
),
|
356 |
+
),
|
357 |
+
'defcard' => array(
|
358 |
+
'name' => __( 'Default Twitter Card', 'all-in-one-seo-pack' ),
|
359 |
+
'type' => 'select',
|
360 |
+
'default' => 'summary',
|
361 |
+
'initial_options' => array(
|
362 |
+
'summary' => __( 'Summary', 'all-in-one-seo-pack' ),
|
363 |
+
'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' )
|
364 |
+
/* REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE
|
365 |
+
'photo' => __( 'Photo', 'all-in-one-seo-pack' )
|
366 |
+
*/
|
367 |
+
),
|
368 |
+
),
|
369 |
+
'setcard' => array(
|
370 |
+
'name' => __( 'Twitter Card Type', 'all-in-one-seo-pack' ),
|
371 |
+
'type' => 'select',
|
372 |
+
'initial_options' => array(
|
373 |
+
'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ),
|
374 |
+
'summary' => __( 'Summary', 'all-in-one-seo-pack' )
|
375 |
+
/* REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE
|
376 |
+
'photo' => __( 'Photo', 'all-in-one-seo-pack' )
|
377 |
+
*/
|
378 |
+
),
|
379 |
+
),
|
380 |
+
'twitter_site' => array(
|
381 |
+
'name' => __( 'Twitter Site', 'all-in-one-seo-pack' ),
|
382 |
+
'type' => 'text',
|
383 |
+
'default' => '',
|
384 |
+
),
|
385 |
+
'twitter_creator' => array(
|
386 |
+
'name' => __( 'Show Twitter Author', 'all-in-one-seo-pack' )
|
387 |
+
),
|
388 |
+
'twitter_domain' => array(
|
389 |
+
'name' => __( 'Twitter Domain', 'all-in-one-seo-pack' ),
|
390 |
+
'type' => 'text',
|
391 |
+
'default' => '',
|
392 |
+
),
|
393 |
+
'customimg_twitter' => array(
|
394 |
+
'name' => __( 'Custom Twitter Image', 'all-in-one-seo-pack' ),
|
395 |
+
'type' => 'image',
|
396 |
+
),
|
397 |
+
'gen_tags' => array(
|
398 |
+
'name' => __( 'Automatically Generate Article Tags', 'all-in-one-seo-pack' )
|
399 |
+
),
|
400 |
+
'gen_keywords' => array(
|
401 |
+
'name' => __( 'Use Keywords In Article Tags', 'all-in-one-seo-pack' ),
|
402 |
+
'default' => 'on',
|
403 |
+
'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ),
|
404 |
+
),
|
405 |
+
'gen_categories' => array(
|
406 |
+
'name' => __( 'Use Categories In Article Tags', 'all-in-one-seo-pack' ),
|
407 |
+
'default' => 'on',
|
408 |
+
'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ),
|
409 |
+
),
|
410 |
+
'gen_post_tags' => array(
|
411 |
+
'name' => __( 'Use Post Tags In Article Tags', 'all-in-one-seo-pack' ),
|
412 |
+
'default' => 'on',
|
413 |
+
'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ),
|
414 |
+
),
|
415 |
+
'types' => array(
|
416 |
+
'name' => __( 'Enable Facebook Meta for Post Types', 'all-in-one-seo-pack' ),
|
417 |
+
'type' => 'multicheckbox',
|
418 |
+
'default' => array( 'post' => 'Post', 'page' => 'Page' ),
|
419 |
+
'initial_options' => $this->get_post_type_titles( array( '_builtin' => false ) ),
|
420 |
+
),
|
421 |
+
'title' => array(
|
422 |
+
'name' => __( 'Title', 'all-in-one-seo-pack' ),
|
423 |
+
'default' => '',
|
424 |
+
'type' => 'text',
|
425 |
+
'size' => 95,
|
426 |
+
'count' => 1,
|
427 |
+
'count_desc' => $count_desc,
|
428 |
+
),
|
429 |
+
'desc' => array(
|
430 |
+
'name' => __( 'Description', 'all-in-one-seo-pack' ),
|
431 |
+
'default' => '',
|
432 |
+
'type' => 'textarea',
|
433 |
+
'cols' => 250,
|
434 |
+
'rows' => 4,
|
435 |
+
'count' => 1,
|
436 |
+
'count_desc' => $count_desc,
|
437 |
+
),
|
438 |
+
'category' => array(
|
439 |
+
'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ),
|
440 |
+
'type' => 'select',
|
441 |
+
'style' => '',
|
442 |
+
'default' => '',
|
443 |
+
'initial_options' => $this->fb_object_types,
|
444 |
+
),
|
445 |
+
'facebook_debug' => array(
|
446 |
+
'name' => __( 'Facebook Debug', 'all-in-one-seo-pack' ),
|
447 |
+
'type' => 'html',
|
448 |
+
'save' => false,
|
449 |
+
'default' => $this->get_facebook_debug(),
|
450 |
+
),
|
451 |
+
'section' => array(
|
452 |
+
'name' => __( 'Article Section', 'all-in-one-seo-pack' ),
|
453 |
+
'type' => 'text',
|
454 |
+
'default' => '',
|
455 |
+
'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ),
|
456 |
+
),
|
457 |
+
'tag' => array(
|
458 |
+
'name' => __( 'Article Tags', 'all-in-one-seo-pack' ),
|
459 |
+
'type' => 'text',
|
460 |
+
'default' => '',
|
461 |
+
'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ),
|
462 |
+
),
|
463 |
+
'facebook_publisher' => array(
|
464 |
+
'name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ),
|
465 |
+
'type' => 'text',
|
466 |
+
'default' => '',
|
467 |
+
),
|
468 |
+
'facebook_author'=> array(
|
469 |
+
'name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' )
|
470 |
+
),
|
471 |
+
'profile_links' => array(
|
472 |
+
'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ),
|
473 |
+
'type' => 'textarea',
|
474 |
+
'cols' => 60,
|
475 |
+
'rows' => 5,
|
476 |
+
),
|
477 |
+
'person_or_org' => array(
|
478 |
+
'name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ),
|
479 |
+
'type' => 'radio',
|
480 |
+
'initial_options' => array(
|
481 |
+
'person' => __( 'Person', 'all-in-one-seo-pack' ),
|
482 |
+
'org' => __( 'Organization', 'all-in-one-seo-pack' ),
|
483 |
+
),
|
484 |
+
),
|
485 |
+
'social_name' => array(
|
486 |
+
'name' => __( "Associated Name", 'all-in-one-seo-pack' ),
|
487 |
+
'type' => 'text',
|
488 |
+
'default' => "",
|
489 |
+
),
|
490 |
+
);
|
491 |
+
// load initial options / set defaults
|
492 |
+
$this->update_options();
|
493 |
+
$display = Array();
|
494 |
+
if ( isset( $this->options['aiosp_opengraph_types'] ) ) {
|
495 |
+
$display = $this->options['aiosp_opengraph_types'];
|
496 |
+
}
|
497 |
+
$this->locations = array(
|
498 |
'opengraph' => Array(
|
499 |
'name' => $this->name,
|
500 |
'prefix' => 'aiosp_',
|
510 |
'hometitle',
|
511 |
'description',
|
512 |
'homeimage',
|
|
|
513 |
'generate_descriptions',
|
514 |
'defimg',
|
515 |
'fallback',
|
517 |
'dimgwidth',
|
518 |
'dimgheight',
|
519 |
'meta_key',
|
|
|
520 |
'defcard',
|
521 |
'profile_links',
|
522 |
'person_or_org',
|
558 |
'prefix' => 'aioseop_opengraph_',
|
559 |
),
|
560 |
);
|
561 |
+
$this->layout = Array(
|
|
|
562 |
'home' => Array(
|
563 |
'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ),
|
564 |
'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#use-aioseo-title-and-description',
|
565 |
+
'options' => Array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage' ),
|
566 |
),
|
567 |
'image' => Array(
|
568 |
'name' => __( 'Image Settings', 'all-in-one-seo-pack' ),
|
585 |
'gen_keywords',
|
586 |
'gen_categories',
|
587 |
'gen_post_tags',
|
|
|
588 |
'facebook_publisher',
|
589 |
'facebook_author',
|
590 |
),
|
605 |
'options' => Array( 'scan_header' ),
|
606 |
),
|
607 |
);
|
|
|
608 |
$other_options = Array();
|
609 |
foreach ( $this->layout as $k => $v ) {
|
610 |
$other_options = array_merge( $other_options, $v['options'] );
|
611 |
}
|
612 |
|
613 |
$this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options );
|
614 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
615 |
|
616 |
/**
|
617 |
* Forces FaceBook OpenGraph to refresh its cache when a post is changed to
|
672 |
|
673 |
function settings_page_init() {
|
674 |
add_filter( 'aiosp_output_option', Array( $this, 'display_custom_options' ), 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
675 |
}
|
676 |
|
677 |
function filter_options( $options, $location ) {
|
700 |
return $options;
|
701 |
}
|
702 |
|
703 |
+
/**
|
704 |
+
* Applies filter to module settings.
|
705 |
+
*
|
706 |
+
* @since 2.3.11
|
707 |
+
* @since 2.4.14 Added filter for description and title placeholders.
|
708 |
+
* @since 2.3.15 do_shortcode on description.
|
709 |
+
*
|
710 |
+
* @see [plugin]\admin\aioseop_module_class.php > display_options()
|
711 |
+
*/
|
712 |
function filter_settings( $settings, $location, $current ) {
|
713 |
global $aiosp, $post;
|
714 |
if ( $location == 'opengraph' || $location == 'settings' ) {
|
741 |
$info = $aiosp->get_page_snippet_info();
|
742 |
extract( $info );
|
743 |
|
744 |
+
// Description options
|
745 |
if ( is_object( $post ) )
|
746 |
+
// Always show excerpt
|
747 |
+
$description = empty( $this->options['aiosp_opengraph_generate_descriptions'] )
|
748 |
+
? $aiosp->trim_excerpt_without_filters(
|
749 |
+
$aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ),
|
750 |
+
1000
|
751 |
+
)
|
752 |
+
: $aiosp->trim_excerpt_without_filters(
|
753 |
+
$aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ),
|
754 |
+
1000
|
755 |
+
);
|
756 |
+
|
757 |
+
// Add filters
|
758 |
+
$description = do_shortcode( $description );
|
759 |
$description = apply_filters( 'aioseop_description', $description );
|
760 |
// Add placholders
|
761 |
+
$settings["{$prefix}title"]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $title );
|
762 |
+
$settings["{$prefix}desc"]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $description );
|
|
|
763 |
}
|
764 |
if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) {
|
765 |
foreach ( $opts as $opt ) {
|
776 |
return $settings;
|
777 |
}
|
778 |
|
779 |
+
/**
|
780 |
+
* Applies filter to module options.
|
781 |
+
* These will display in the "Social Settings" object tab.
|
782 |
+
* filter:{prefix}override_options
|
783 |
+
*
|
784 |
+
* @since 2.3.11
|
785 |
+
* @since 2.4.14 Overrides empty og:type values.
|
786 |
+
*
|
787 |
+
* @see [plugin]\admin\aioseop_module_class.php > display_options()
|
788 |
+
*
|
789 |
+
* @global array $aioseop_options Plugin options.
|
790 |
+
*
|
791 |
+
* @param array $options Current options.
|
792 |
+
* @param string $location Location where filter is called.
|
793 |
+
* @param array $settings Settings.
|
794 |
+
*
|
795 |
+
* @return array
|
796 |
+
*/
|
797 |
function override_options( $options, $location, $settings ) {
|
798 |
+
global $aioseop_options;
|
799 |
+
// Prepare default and prefix
|
800 |
+
$prefix = $this->get_prefix( $location ) . $location . '_';
|
801 |
+
$opts = array();
|
802 |
foreach ( $settings as $k => $v ) {
|
803 |
if ( $v['save'] ) {
|
804 |
$opts[ $k ] = $v['default'];
|
805 |
}
|
806 |
}
|
807 |
foreach ( $options as $k => $v ) {
|
808 |
+
switch ($k) {
|
809 |
+
case $prefix . 'category':
|
810 |
+
if ( empty( $v ) ) {
|
811 |
+
// Get post type
|
812 |
+
$type = isset( get_current_screen()->post_type )
|
813 |
+
? get_current_screen()->post_type
|
814 |
+
: null;
|
815 |
+
// Assign default from plugin options
|
816 |
+
if ( ! empty( $type )
|
817 |
+
&& isset( $aioseop_options['modules'] )
|
818 |
+
&& isset( $aioseop_options['modules']['aiosp_opengraph_options'] )
|
819 |
+
&& isset( $aioseop_options['modules']['aiosp_opengraph_options']['aiosp_opengraph_'.$type.'_fb_object_type'] )
|
820 |
+
)
|
821 |
+
$options[ $prefix . 'category' ] =
|
822 |
+
$aioseop_options['modules']['aiosp_opengraph_options']['aiosp_opengraph_'.$type.'_fb_object_type'];
|
823 |
+
continue;
|
824 |
+
}
|
825 |
+
break;
|
826 |
+
}
|
827 |
if ( $v === null ) {
|
828 |
unset( $options[ $k ] );
|
829 |
}
|
833 |
return $options;
|
834 |
}
|
835 |
|
836 |
+
/**
|
837 |
+
* Applies filter to metabox settings before they are saved.
|
838 |
+
* Sets custom as default if a custom image is uploaded.
|
839 |
+
* filter:{prefix}filter_metabox_options
|
840 |
+
* filter:{prefix}filter_term_metabox_options
|
841 |
+
*
|
842 |
+
* @since 2.3.11
|
843 |
+
* @since 2.4.14 Fixes for aioseop-pro #67 and other bugs found.
|
844 |
+
*
|
845 |
+
* @see [plugin]\admin\aioseop_module_class.php > save_post_data()
|
846 |
+
* @see [this file] > save_tax_data()
|
847 |
+
*
|
848 |
+
* @param array $options List of current options.
|
849 |
+
* @param string $location Location where filter is called.
|
850 |
+
* @param int $id Either post_id or term_id.
|
851 |
+
*
|
852 |
+
* @return array
|
853 |
+
*/
|
854 |
function filter_metabox_options( $options, $location, $post_id ) {
|
855 |
if ( $location == 'settings' ) {
|
856 |
+
$prefix = $this->get_prefix( $location ) . $location . '_';
|
857 |
+
if ( isset( $options[ $prefix . 'customimg_checker' ] )
|
858 |
+
&& $options[ $prefix . 'customimg_checker' ]
|
859 |
+
) {
|
860 |
+
$options[ $prefix . 'image' ] = $options[ $prefix . 'customimg' ];
|
861 |
+
}
|
862 |
+
}
|
863 |
+
return $options;
|
|
|
|
|
|
|
864 |
}
|
865 |
|
866 |
/** Custom settings **/
|
934 |
* @since 1.0.0
|
935 |
* @since 2.3.11.5 Support for multiple fb_admins.
|
936 |
* @since 2.3.13 Adds filter:aioseop_description on description.
|
937 |
+
* @since 2.4.14 Fixes for aioseop-pro #67.
|
938 |
+
* @since 2.3.15 Always do_shortcode on descriptions, removed for titles.
|
939 |
+
*
|
940 |
+
* @global object $post Current WP_Post object.
|
941 |
+
* @global object $aiosp All in one seo plugin object.
|
942 |
+
* @global array $aioseop_options All in one seo plugin options.
|
943 |
+
* @global object $wp_query WP_Query global instance.
|
944 |
*/
|
945 |
function add_meta() {
|
946 |
global $post, $aiosp, $aioseop_options, $wp_query;
|
947 |
+
$metabox = $this->get_current_options( array(), 'settings' );
|
948 |
$key = $this->options['aiosp_opengraph_key'];
|
949 |
$dimg = $this->options['aiosp_opengraph_dimg'];
|
950 |
$current_post_type = get_post_type();
|
1011 |
if ( empty( $description ) && $first_page ) {
|
1012 |
$description = get_bloginfo( 'description' );
|
1013 |
}
|
|
|
|
|
|
|
1014 |
if ( ! empty( $this->options['aiosp_opengraph_profile_links'] ) ) {
|
1015 |
$social_links = $this->options['aiosp_opengraph_profile_links'];
|
1016 |
if ( ! empty( $this->options['aiosp_opengraph_social_name'] ) ) {
|
1091 |
if ( empty( $type ) ) {
|
1092 |
$type = 'article';
|
1093 |
}
|
1094 |
+
} else if ( AIOSEOPPRO && ( is_category() || is_tag() || is_tax() ) ) {
|
1095 |
+
if ( isset( $this->options['aioseop_opengraph_settings_category'] ) )
|
1096 |
+
$type = $this->options['aioseop_opengraph_settings_category'];
|
1097 |
+
if ( isset( $metabox['aioseop_opengraph_settings_category'] ) )
|
1098 |
+
$type = $metabox['aioseop_opengraph_settings_category'];
|
1099 |
+
if ( $type == 'article' ) {
|
1100 |
+
if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) {
|
1101 |
+
$section = $metabox['aioseop_opengraph_settings_section'];
|
1102 |
+
}
|
1103 |
+
if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) {
|
1104 |
+
$tag = $metabox['aioseop_opengraph_settings_tag'];
|
1105 |
+
}
|
1106 |
+
if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) {
|
1107 |
+
$publisher = $this->options['aiosp_opengraph_facebook_publisher'];
|
1108 |
+
}
|
1109 |
+
}
|
1110 |
+
if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) {
|
1111 |
+
$domain = $this->options['aiosp_opengraph_twitter_domain'];
|
1112 |
+
}
|
1113 |
+
if ( $type == 'article' && ! empty( $post ) ) {
|
1114 |
+
if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) {
|
1115 |
+
$author = get_the_author_meta( 'facebook', $post->post_author );
|
1116 |
+
}
|
1117 |
+
if ( isset( $post->post_date ) ) {
|
1118 |
+
$published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date ) );
|
1119 |
+
}
|
1120 |
+
if ( isset( $post->post_modified ) ) {
|
1121 |
+
$modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified ) );
|
1122 |
+
}
|
1123 |
+
}
|
1124 |
+
$image = $metabox['aioseop_opengraph_settings_image'];
|
1125 |
+
$video = $metabox['aioseop_opengraph_settings_video'];
|
1126 |
+
$title = $metabox['aioseop_opengraph_settings_title'];
|
1127 |
+
$description = $metabox['aioseop_opengraph_settings_desc'];
|
1128 |
+
/* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */
|
1129 |
+
global $aiosp;
|
1130 |
+
if ( empty( $title ) ) {
|
1131 |
+
$title = $aiosp->wp_title();
|
1132 |
+
}
|
1133 |
+
if ( empty( $description ) ) {
|
1134 |
+
$term_id = isset( $_GET['tag_ID'] ) ? (int) $_GET['tag_ID'] : 0;
|
1135 |
+
$term_id = $term_id ? $term_id : get_queried_object()->term_id;
|
1136 |
+
$description = trim( strip_tags( get_term_meta( $term_id, '_aioseop_description', true ) ) );
|
1137 |
+
}
|
1138 |
+
// Add default title
|
1139 |
+
if ( empty( $title ) ) {
|
1140 |
+
$title = get_the_title();
|
1141 |
+
}
|
1142 |
+
// Add default description.
|
1143 |
+
if ( empty( $description ) && ! post_password_required( $post ) ) {
|
1144 |
+
$description = get_queried_object()->description;
|
1145 |
+
}
|
1146 |
+
if ( empty( $type ) ) {
|
1147 |
+
$type = 'website';
|
1148 |
+
}
|
1149 |
+
} else if ( is_home() && ! is_front_page() ) {
|
1150 |
+
// This is the blog page but not the homepage.
|
1151 |
+
global $aiosp;
|
1152 |
+
$image = $metabox['aioseop_opengraph_settings_image'];
|
1153 |
+
$video = $metabox['aioseop_opengraph_settings_video'];
|
1154 |
+
$title = $metabox['aioseop_opengraph_settings_title'];
|
1155 |
+
$description = $metabox['aioseop_opengraph_settings_desc'];
|
1156 |
+
|
1157 |
+
if ( empty( $description ) ) {
|
1158 |
+
// If there's not social description, fall back to the SEO description.
|
1159 |
+
$description = trim( strip_tags( get_post_meta( get_option( 'page_for_posts' ), '_aioseop_description', true ) ) );
|
1160 |
+
}
|
1161 |
+
if ( empty( $title ) ) {
|
1162 |
+
$title = $aiosp->wp_title();
|
1163 |
+
}
|
1164 |
} else {
|
1165 |
return;
|
1166 |
}
|
1190 |
}
|
1191 |
}
|
1192 |
|
|
|
|
|
|
|
|
|
1193 |
if ( ! empty( $description ) ) {
|
1194 |
$description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) );
|
1195 |
+
$description = do_shortcode( $description );
|
|
|
|
|
1196 |
$description = $aiosp->trim_excerpt_without_filters( $description, 1000 );
|
1197 |
}
|
1198 |
|
1427 |
echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema );
|
1428 |
}
|
1429 |
|
1430 |
+
/**
|
1431 |
+
* Do / adds opengraph properties to meta.
|
1432 |
+
* @since 2.3.11
|
1433 |
+
*
|
1434 |
+
* @global array $aioseop_options AIOSEOP plugin options.
|
1435 |
+
*/
|
1436 |
+
public function do_opengraph() {
|
1437 |
global $aioseop_options;
|
1438 |
+
if ( ! empty( $aioseop_options )
|
1439 |
+
&& ! empty( $aioseop_options['aiosp_schema_markup'] )
|
1440 |
+
)
|
1441 |
+
add_filter( 'language_attributes', array( &$this, 'add_attributes' ) );
|
1442 |
if ( ! defined( 'DOING_AJAX' ) ) {
|
1443 |
+
add_action( 'aioseop_modules_wp_head', array( &$this, 'add_meta' ), 5 );
|
1444 |
+
// Add social meta to AMP plugin.
|
1445 |
+
if ( apply_filters( 'aioseop_enable_amp_social_meta', true ) === true )
|
1446 |
+
add_action( 'amp_post_template_head', array( &$this, 'add_meta' ), 12 );
|
|
|
1447 |
}
|
1448 |
}
|
1449 |
|
1450 |
+
/**
|
1451 |
+
* Set up types.
|
1452 |
+
*
|
1453 |
+
* @since ?
|
1454 |
+
* @since 2.3.15 Change to website for homepage and blog post index page, default to object.
|
1455 |
+
*/
|
1456 |
function type_setup() {
|
1457 |
+
$this->type = 'object'; // Default to type object if we don't have some other rule.
|
1458 |
+
|
1459 |
+
if ( is_home() || is_front_page() ) {
|
1460 |
+
$this->type = 'website'; // Home page and blog page should be website.
|
|
|
|
|
1461 |
} elseif ( is_singular() && $this->option_isset( 'types' ) ) {
|
1462 |
$metabox = $this->get_current_options( Array(), 'settings' );
|
1463 |
$current_post_type = get_post_type();
|
1469 |
}
|
1470 |
}
|
1471 |
|
1472 |
+
/**
|
1473 |
+
* Inits hooks and others for admin init.
|
1474 |
+
* action:admin_init.
|
1475 |
+
*
|
1476 |
+
* @since 2.3.11
|
1477 |
+
* @since 2.4.14 Refactored function name, and new filter added for defaults and missing term metabox.
|
1478 |
+
*/
|
1479 |
+
function admin_init() {
|
1480 |
+
add_filter( $this->prefix . 'display_settings', array( &$this, 'filter_settings' ), 10, 3 );
|
1481 |
+
add_filter( $this->prefix . 'override_options', array( &$this, 'override_options' ), 10, 3 );
|
1482 |
+
add_filter( $this->get_prefix( 'settings' ) . 'default_options', array( &$this, 'filter_default_options' ), 10, 2 );
|
1483 |
+
add_filter( $this->get_prefix( 'settings' ) . 'filter_metabox_options', array(
|
1484 |
+
&$this,
|
1485 |
'filter_metabox_options',
|
1486 |
), 10, 3 );
|
1487 |
+
add_filter( $this->get_prefix( 'settings' ) . 'filter_term_metabox_options', array(
|
1488 |
+
&$this,
|
1489 |
+
'filter_metabox_options',
|
1490 |
+
), 10, 3 );
|
1491 |
$post_types = $this->get_post_type_titles();
|
1492 |
$rempost = array( 'revision' => 1, 'nav_menu_item' => 1, 'custom_css' => 1, 'customize_changeset' => 1 );
|
1493 |
$post_types = array_diff_key( $post_types, $rempost );
|
1590 |
*/
|
1591 |
function og_admin_enqueue_scripts($hook){
|
1592 |
|
1593 |
+
if ( 'all-in-one-seo_page_aiosp_opengraph' != $hook && 'term.php' != $hook ) {
|
1594 |
// Only enqueue if we're on the social module settings page.
|
1595 |
return;
|
1596 |
}
|
1600 |
wp_enqueue_style('thickbox');
|
1601 |
wp_enqueue_media();
|
1602 |
}
|
1603 |
+
|
1604 |
+
function save_tax_data( $term_id, $tt_id, $taxonomy ) {
|
1605 |
+
static $update = false;
|
1606 |
+
if ( $update )
|
1607 |
+
return;
|
1608 |
+
if ( $this->locations !== null ) {
|
1609 |
+
foreach ( $this->locations as $k => $v ) {
|
1610 |
+
if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) {
|
1611 |
+
$opts = $this->default_options( $k );
|
1612 |
+
$options = array();
|
1613 |
+
$update = false;
|
1614 |
+
foreach ( $opts as $l => $o ) {
|
1615 |
+
if ( isset( $_POST[ $l ] ) ) {
|
1616 |
+
$options[ $l ] = stripslashes_deep( $_POST[ $l ] );
|
1617 |
+
$options[ $l ] = esc_attr( $options[ $l ] );
|
1618 |
+
$update = true;
|
1619 |
+
}
|
1620 |
+
}
|
1621 |
+
if ( $update ) {
|
1622 |
+
$prefix = $this->get_prefix( $k );
|
1623 |
+
$options = apply_filters( $prefix . 'filter_term_metabox_options', $options, $k, $term_id );
|
1624 |
+
update_term_meta( $term_id, '_' . $prefix . $k, $options );
|
1625 |
+
}
|
1626 |
+
}
|
1627 |
+
}
|
1628 |
+
}
|
1629 |
+
}
|
1630 |
+
|
1631 |
+
/**
|
1632 |
+
* Returns the placeholder filtered and ready for DOM display.
|
1633 |
+
* filter:aioseop_opengraph_placeholder
|
1634 |
+
* @since 2.4.14
|
1635 |
+
*
|
1636 |
+
* @param mixed $placeholder Placeholder to be filtered.
|
1637 |
+
* @param string $type Type of the value to be filtered.
|
1638 |
+
*
|
1639 |
+
* @return string
|
1640 |
+
*/
|
1641 |
+
public function filter_placeholder( $placeholder, $type = 'text' ) {
|
1642 |
+
return strip_tags( trim( $placeholder ) );
|
1643 |
+
}
|
1644 |
+
|
1645 |
+
/**
|
1646 |
+
* Returns filtered default options.
|
1647 |
+
* filter:{prefix}default_options
|
1648 |
+
* @since 2.4.13
|
1649 |
+
*
|
1650 |
+
* @param array $options Default options.
|
1651 |
+
* @param string $location Location.
|
1652 |
+
*
|
1653 |
+
* @return array
|
1654 |
+
*/
|
1655 |
+
public function filter_default_options( $options, $location ) {
|
1656 |
+
if ( $location === 'settings' ) {
|
1657 |
+
$prefix = $this->get_prefix( $location ) . $location . '_';
|
1658 |
+
// Add image checker as default
|
1659 |
+
$options[ $prefix . 'customimg_checker' ] = 0;
|
1660 |
+
}
|
1661 |
+
return $options;
|
1662 |
+
}
|
1663 |
+
|
1664 |
+
/**
|
1665 |
+
* Returns facebook debug script and link.
|
1666 |
+
* @since 2.4.14
|
1667 |
+
*
|
1668 |
+
* @return string
|
1669 |
+
*/
|
1670 |
+
private function get_facebook_debug() {
|
1671 |
+
ob_start();
|
1672 |
+
?>
|
1673 |
+
<script>
|
1674 |
+
jQuery(document).ready(function() {
|
1675 |
+
var snippet = jQuery("#aioseop_snippet_link");
|
1676 |
+
if ( snippet.length === 0 ) {
|
1677 |
+
jQuery( "#aioseop_opengraph_settings_facebook_debug_wrapper").hide();
|
1678 |
+
} else {
|
1679 |
+
snippet = snippet.html();
|
1680 |
+
jQuery("#aioseop_opengraph_settings_facebook_debug")
|
1681 |
+
.attr( "href", "https://developers.facebook.com/tools/debug/sharing/?q=" + snippet );
|
1682 |
+
}
|
1683 |
+
});
|
1684 |
+
</script>
|
1685 |
+
<a name="aioseop_opengraph_settings_facebook_debug"
|
1686 |
+
id="aioseop_opengraph_settings_facebook_debug"
|
1687 |
+
class="button-primary"
|
1688 |
+
href=""
|
1689 |
+
target="_blank"
|
1690 |
+
><?php echo __( 'Debug This Post', 'all-in-one-seo-pack' ); ?></a>
|
1691 |
+
<?php
|
1692 |
+
return ob_get_clean();
|
1693 |
+
}
|
1694 |
+
}
|
1695 |
}
|
public/google-analytics.php
CHANGED
@@ -7,19 +7,8 @@ if ( ! class_exists( 'aioseop_google_analytics' ) ) {
|
|
7 |
class aioseop_google_analytics extends All_in_One_SEO_Pack_Module {
|
8 |
// TODO Rather than extending the module base class, we should find a better way for the shared functions like moving them to our common functions class.
|
9 |
|
10 |
-
private $aiosp_ga_use_universal_analytics = true;
|
11 |
-
|
12 |
function __construct() {
|
13 |
-
|
14 |
-
$this->filter_universal();
|
15 |
-
|
16 |
$this->google_analytics();
|
17 |
-
|
18 |
-
}
|
19 |
-
|
20 |
-
function filter_universal() {
|
21 |
-
$aiosp_ga_use_universal_analytics = $this->aiosp_ga_use_universal_analytics;
|
22 |
-
$this->aiosp_ga_use_universal_analytics = apply_filters( 'aiosp_universal_analytics', $aiosp_ga_use_universal_analytics );
|
23 |
}
|
24 |
|
25 |
function google_analytics() {
|
@@ -41,113 +30,63 @@ if ( ! class_exists( 'aioseop_google_analytics' ) ) {
|
|
41 |
ob_start();
|
42 |
$analytics = $this->universal_analytics();
|
43 |
echo $analytics;
|
44 |
-
if ( empty( $analytics ) ) {
|
45 |
-
?>
|
46 |
-
<script type="text/javascript">
|
47 |
-
var _gaq = _gaq || [];
|
48 |
-
<?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_link_attribution'] ) ) {
|
49 |
-
?> var pluginUrl =
|
50 |
-
'//www.google-analytics.com/plugins/ga/inpage_linkid.js';
|
51 |
-
_gaq.push(['_require', 'inpage_linkid', pluginUrl]);
|
52 |
-
<?php
|
53 |
-
}
|
54 |
-
?> _gaq.push(['_setAccount', '<?php
|
55 |
-
echo $aioseop_options['aiosp_google_analytics_id'];
|
56 |
-
?>']);
|
57 |
-
<?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) {
|
58 |
-
?> _gaq.push(['_gat._anonymizeIp']);
|
59 |
-
<?php
|
60 |
-
}
|
61 |
-
?>
|
62 |
-
<?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
|
63 |
-
?> _gaq.push(['_setAllowLinker', true]);
|
64 |
-
<?php
|
65 |
-
}
|
66 |
-
?>
|
67 |
-
<?php if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_domain'] ) ) {
|
68 |
-
$domain = $this->get_analytics_domain();
|
69 |
-
?> _gaq.push(['_setDomainName', '<?php echo $domain; ?>']);
|
70 |
-
<?php
|
71 |
-
}
|
72 |
-
?> _gaq.push(['_trackPageview']);
|
73 |
-
(function () {
|
74 |
-
var ga = document.createElement('script');
|
75 |
-
ga.type = 'text/javascript';
|
76 |
-
ga.async = true;
|
77 |
-
<?php
|
78 |
-
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) {
|
79 |
-
?> ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
|
80 |
-
<?php
|
81 |
-
} else {
|
82 |
-
?> ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
83 |
-
<?php
|
84 |
-
}
|
85 |
-
?> var s = document.getElementsByTagName('script')[0];
|
86 |
-
s.parentNode.insertBefore(ga, s);
|
87 |
-
})();
|
88 |
-
</script>
|
89 |
-
<?php
|
90 |
-
}
|
91 |
-
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && $aioseop_options['aiosp_ga_track_outbound_links'] ) { ?>
|
92 |
-
<script type="text/javascript">
|
93 |
-
function recordOutboundLink(link, category, action) {
|
94 |
-
<?php if ( $this->aiosp_ga_use_universal_analytics ) { ?>
|
95 |
-
ga('send', 'event', category, action);
|
96 |
-
<?php }
|
97 |
-
if ( ! $this->aiosp_ga_use_universal_analytics ) { ?>
|
98 |
-
_gat._getTrackerByName()._trackEvent(category, action);
|
99 |
-
<?php } ?>
|
100 |
-
if (link.target == '_blank') return true;
|
101 |
-
setTimeout('document.location = "' + link.href + '"', 100);
|
102 |
-
return false;
|
103 |
-
}
|
104 |
-
/* use regular Javascript for this */
|
105 |
-
function getAttr(ele, attr) {
|
106 |
-
var result = (ele.getAttribute && ele.getAttribute(attr)) || null;
|
107 |
-
if (!result) {
|
108 |
-
var attrs = ele.attributes;
|
109 |
-
var length = attrs.length;
|
110 |
-
for (var i = 0; i < length; i++)
|
111 |
-
if (attr[i].nodeName === attr) result = attr[i].nodeValue;
|
112 |
-
}
|
113 |
-
return result;
|
114 |
-
}
|
115 |
-
|
116 |
-
function aiosp_addLoadEvent(func) {
|
117 |
-
var oldonload = window.onload;
|
118 |
-
if (typeof window.onload != 'function') {
|
119 |
-
window.onload = func;
|
120 |
-
} else {
|
121 |
-
window.onload = function () {
|
122 |
-
if (oldonload) {
|
123 |
-
oldonload();
|
124 |
-
}
|
125 |
-
func();
|
126 |
-
}
|
127 |
-
}
|
128 |
-
}
|
129 |
-
|
130 |
-
function aiosp_addEvent(element, evnt, funct) {
|
131 |
-
if (element.attachEvent)
|
132 |
-
return element.attachEvent('on' + evnt, funct);
|
133 |
-
else
|
134 |
-
return element.addEventListener(evnt, funct, false);
|
135 |
-
}
|
136 |
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
<?php
|
152 |
}
|
153 |
$analytics = ob_get_clean();
|
@@ -157,83 +96,93 @@ if ( ! class_exists( 'aioseop_google_analytics' ) ) {
|
|
157 |
|
158 |
}
|
159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
function universal_analytics() {
|
161 |
global $aioseop_options;
|
162 |
-
$analytics
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
if ( ! empty( $
|
184 |
-
|
185 |
-
$domain_list .= ', ';
|
186 |
-
}
|
187 |
-
$domain_list .= "'" . $d . "'";
|
188 |
}
|
|
|
189 |
}
|
190 |
}
|
191 |
}
|
192 |
}
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
$extra_options .= "ga('require', 'ec');";
|
202 |
}
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
$extra_options .= "
|
208 |
}
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
$extra_options .= "
|
214 |
}
|
|
|
|
|
215 |
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
}
|
220 |
-
$extra_options .= "ga('set', 'anonymizeIp', true);";
|
221 |
}
|
222 |
-
$
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
if ( ! empty( $js_options ) ) {
|
229 |
-
$js_options = implode( ',', $js_options );
|
230 |
-
$js_options = ', { ' . $js_options . ' } ';
|
231 |
-
} else {
|
232 |
-
$js_options = '';
|
233 |
}
|
234 |
-
|
235 |
-
|
236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
238 |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
239 |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
@@ -245,7 +194,6 @@ if ( ! class_exists( 'aioseop_google_analytics' ) ) {
|
|
245 |
</script>
|
246 |
|
247 |
EOF;
|
248 |
-
}
|
249 |
|
250 |
return $analytics;
|
251 |
}
|
7 |
class aioseop_google_analytics extends All_in_One_SEO_Pack_Module {
|
8 |
// TODO Rather than extending the module base class, we should find a better way for the shared functions like moving them to our common functions class.
|
9 |
|
|
|
|
|
10 |
function __construct() {
|
|
|
|
|
|
|
11 |
$this->google_analytics();
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
13 |
|
14 |
function google_analytics() {
|
30 |
ob_start();
|
31 |
$analytics = $this->universal_analytics();
|
32 |
echo $analytics;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && $aioseop_options['aiosp_ga_track_outbound_links'] ) { ?>
|
35 |
+
<script type="text/javascript">
|
36 |
+
function recordOutboundLink(link, category, action) {
|
37 |
+
ga('send', 'event', category, action);
|
38 |
+
if (link.target == '_blank') return true;
|
39 |
+
setTimeout('document.location = "' + link.href + '"', 100);
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
|
43 |
+
/* use regular Javascript for this */
|
44 |
+
function getAttr(ele, attr) {
|
45 |
+
var result = (ele.getAttribute && ele.getAttribute(attr)) || null;
|
46 |
+
if (!result) {
|
47 |
+
var attrs = ele.attributes;
|
48 |
+
var length = attrs.length;
|
49 |
+
for (var i = 0; i < length; i++)
|
50 |
+
if (attr[i].nodeName === attr) result = attr[i].nodeValue;
|
51 |
+
}
|
52 |
+
return result;
|
53 |
+
}
|
54 |
+
|
55 |
+
function aiosp_addLoadEvent(func) {
|
56 |
+
var oldonload = window.onload;
|
57 |
+
if (typeof window.onload != 'function') {
|
58 |
+
window.onload = func;
|
59 |
+
} else {
|
60 |
+
window.onload = function () {
|
61 |
+
if (oldonload) {
|
62 |
+
oldonload();
|
63 |
+
}
|
64 |
+
func();
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
function aiosp_addEvent(element, evnt, funct) {
|
70 |
+
if (element.attachEvent)
|
71 |
+
return element.attachEvent('on' + evnt, funct);
|
72 |
+
else
|
73 |
+
return element.addEventListener(evnt, funct, false);
|
74 |
+
}
|
75 |
+
|
76 |
+
aiosp_addLoadEvent(function () {
|
77 |
+
var links = document.getElementsByTagName('a');
|
78 |
+
for (var x = 0; x < links.length; x++) {
|
79 |
+
if (typeof links[x] == 'undefined') continue;
|
80 |
+
aiosp_addEvent(links[x], 'onclick', function () {
|
81 |
+
var mydomain = new RegExp(document.domain, 'i');
|
82 |
+
href = getAttr(this, 'href');
|
83 |
+
if (href && href.toLowerCase().indexOf('http') === 0 && !mydomain.test(href)) {
|
84 |
+
recordOutboundLink(this, 'Outbound Links', href);
|
85 |
+
}
|
86 |
+
});
|
87 |
+
}
|
88 |
+
});
|
89 |
+
</script>
|
90 |
<?php
|
91 |
}
|
92 |
$analytics = ob_get_clean();
|
96 |
|
97 |
}
|
98 |
|
99 |
+
/**
|
100 |
+
* Handle Universal Analytics.
|
101 |
+
*
|
102 |
+
* @since ?
|
103 |
+
* @since 2.3.15 Added aioseop_ga_attributes filter hook for attributes.
|
104 |
+
*
|
105 |
+
* @return string
|
106 |
+
*/
|
107 |
function universal_analytics() {
|
108 |
global $aioseop_options;
|
109 |
+
$analytics = '';
|
110 |
+
$allow_linker = $cookie_domain = $domain = $addl_domains = $domain_list = '';
|
111 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) ) {
|
112 |
+
$cookie_domain = $this->get_analytics_domain();
|
113 |
+
}
|
114 |
+
if ( ! empty( $cookie_domain ) ) {
|
115 |
+
$cookie_domain = esc_js( $cookie_domain );
|
116 |
+
$cookie_domain = "'cookieDomain': '{$cookie_domain}'";
|
117 |
+
}
|
118 |
+
if ( empty( $cookie_domain ) ) {
|
119 |
+
$domain = ", 'auto'";
|
120 |
+
}
|
121 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
|
122 |
+
$allow_linker = "'allowLinker': true"; // This is put into $js_options later.
|
123 |
+
if ( ! empty( $aioseop_options['aiosp_ga_addl_domains'] ) ) {
|
124 |
+
$addl_domains = trim( $aioseop_options['aiosp_ga_addl_domains'] );
|
125 |
+
$addl_domains = preg_split( '/[\s,]+/', $addl_domains );
|
126 |
+
if ( ! empty( $addl_domains ) ) {
|
127 |
+
foreach ( $addl_domains as $d ) {
|
128 |
+
$d = $this->sanitize_domain( $d );
|
129 |
+
if ( ! empty( $d ) ) {
|
130 |
+
if ( ! empty( $domain_list ) ) {
|
131 |
+
$domain_list .= ', ';
|
|
|
|
|
|
|
132 |
}
|
133 |
+
$domain_list .= "'" . $d . "'";
|
134 |
}
|
135 |
}
|
136 |
}
|
137 |
}
|
138 |
+
}
|
139 |
+
$extra_options = '';
|
140 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) {
|
141 |
+
$extra_options .= "ga('require', 'displayfeatures');";
|
142 |
+
}
|
143 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_enhanced_ecommerce'] ) ) {
|
144 |
+
if ( ! empty( $extra_options ) ) {
|
145 |
+
$extra_options .= "\n\t\t\t";
|
|
|
146 |
}
|
147 |
+
$extra_options .= "ga('require', 'ec');";
|
148 |
+
}
|
149 |
+
if ( ! empty( $domain_list ) ) {
|
150 |
+
if ( ! empty( $extra_options ) ) {
|
151 |
+
$extra_options .= "\n\t\t\t";
|
152 |
}
|
153 |
+
$extra_options .= "ga('require', 'linker');\n\t\t\tga('linker:autoLink', [{$domain_list}] );";
|
154 |
+
}
|
155 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_link_attribution'] ) ) {
|
156 |
+
if ( ! empty( $extra_options ) ) {
|
157 |
+
$extra_options .= "\n\t\t\t";
|
158 |
}
|
159 |
+
$extra_options .= "ga('require', 'linkid', 'linkid.js');";
|
160 |
+
}
|
161 |
|
162 |
+
if ( ! empty( $aioseop_options['aiosp_ga_advanced_options'] ) && ! empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) {
|
163 |
+
if ( ! empty( $extra_options ) ) {
|
164 |
+
$extra_options .= "\n\t\t\t";
|
|
|
|
|
165 |
}
|
166 |
+
$extra_options .= "ga('set', 'anonymizeIp', true);";
|
167 |
+
}
|
168 |
+
$js_options = array();
|
169 |
+
foreach ( array( 'cookie_domain', 'allow_linker' ) as $opts ) {
|
170 |
+
if ( ! empty( $$opts ) ) {
|
171 |
+
$js_options[] = $$opts;
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
+
}
|
174 |
+
if ( ! empty( $js_options ) ) {
|
175 |
+
$js_options = implode( ',', $js_options );
|
176 |
+
$js_options = ', { ' . $js_options . ' } ';
|
177 |
+
} else {
|
178 |
+
$js_options = '';
|
179 |
+
}
|
180 |
+
$analytics_id = esc_js( $aioseop_options['aiosp_google_analytics_id'] );
|
181 |
+
$attributes = apply_filters( 'aioseop_ga_attributes', '' );
|
182 |
+
$open_script_line = preg_replace( '/\s+/', ' ', "<script $attributes type=\"text/javascript\">" ); // This is just to get the number of spaces right.
|
183 |
+
$analytics = <<<EOF
|
184 |
+
|
185 |
+
$open_script_line
|
186 |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
187 |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
188 |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
194 |
</script>
|
195 |
|
196 |
EOF;
|
|
|
197 |
|
198 |
return $analytics;
|
199 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtor
|
|
4 |
Tags: seo, all in one seo, google, twitter, page, image seo, social, search engine optimization, sitemap, WordPress SEO, meta, meta description, xml sitemap, google sitemap, sitemaps, robots meta, yahoo, bing, news sitemaps, multisite, canonical, nofollow, noindex, keywords, description, webmaster tools, google webmaster tools, google analytics
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.8
|
7 |
-
Stable tag: 2.3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
4 |
Tags: seo, all in one seo, google, twitter, page, image seo, social, search engine optimization, sitemap, WordPress SEO, meta, meta description, xml sitemap, google sitemap, sitemaps, robots meta, yahoo, bing, news sitemaps, multisite, canonical, nofollow, noindex, keywords, description, webmaster tools, google webmaster tools, google analytics
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.8
|
7 |
+
Stable tag: 2.3.15
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|