From 1994b321bd147edf42c79baf1a0e199fb7daf402 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Wed, 4 Oct 2017 11:56:38 +0530 Subject: [PATCH 01/54] XML Sitemap - Add support for images in JetPack and NextGen galleries #1230 support nextgen --- modules/aioseop_sitemap.php | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index 18e499954..ca78e997c 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -2763,6 +2763,7 @@ private function get_images_from_post( $post ) { } } + $content .= $this->get_content_from_galleries( $content ); $this->parse_content_for_images( $content, $images ); if ( $images ) { @@ -2784,6 +2785,71 @@ private function get_images_from_post( $post ) { return $images; } + /** + * Parses the content to find out if specified images galleries exist and if they do, parse them for images. + * Supports NextGen. + * + * @param string $content The post content. + * + * @since 2.4.1 + * + * @return string + */ + private function get_content_from_galleries( $content ) { + // Support for NextGen Gallery. + static $gallery_types = array( 'ngg_images' ); + + $gallery_content = ''; + + $found = array(); + foreach ( $gallery_types as $type ) { + if ( has_shortcode( $content, $type ) ) { + $found[] = $type; + } + } + + // If none of the shortcodes-of-interest are found, bail. + if ( empty( $found ) ) { + return $gallery_content; + } + + $galleries = array(); + + if ( ! preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) { + return $gallery_content; + } + + // Collect the shortcodes and their attributes. + foreach ( $found as $type ) { + foreach ( $matches as $shortcode ) { + if ( $type === $shortcode[2] ) { + + $attributes = shortcode_parse_atts( $shortcode[3] ); + + if ( '' === $attributes ) { // Valid shortcode without any attributes. + $attributes = array(); + } + + $galleries[ $shortcode[2] ] = $attributes; + } + } + } + + // Recreate the shortcodes and then render them to get the HTML content. + if ( $galleries ) { + foreach ( $galleries as $shortcode => $attributes ) { + $code = "[$shortcode"; + foreach ( $attributes as $key => $value ) { + $code .= " $key=$value"; + } + $code .= "]"; + $gallery_content .= do_shortcode( $code ); + } + } + + return $gallery_content; + } + /** * Cleans the URL so that its acceptable in the sitemap. * From 4294a7d1dddea345c8bb2cfbb82d7bef0c3f3476 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Wed, 4 Oct 2017 12:05:48 +0530 Subject: [PATCH 02/54] add filter --- modules/aioseop_sitemap.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index ca78e997c..588e7b621 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -2797,14 +2797,16 @@ private function get_images_from_post( $post ) { */ private function get_content_from_galleries( $content ) { // Support for NextGen Gallery. - static $gallery_types = array( 'ngg_images' ); + static $gallery_types = apply_filters( 'aioseop_gallery_shortcodes', array( 'ngg_images' ) ); $gallery_content = ''; $found = array(); - foreach ( $gallery_types as $type ) { - if ( has_shortcode( $content, $type ) ) { - $found[] = $type; + if ( $gallery_types ) { + foreach ( $gallery_types as $type ) { + if ( has_shortcode( $content, $type ) ) { + $found[] = $type; + } } } From b7c9e89e1145e6c77e1fa47574979f2c95580096 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Wed, 4 Oct 2017 19:20:02 +0530 Subject: [PATCH 03/54] add filter for additional galleries --- modules/aioseop_sitemap.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index 588e7b621..f657893cb 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -2797,13 +2797,14 @@ private function get_images_from_post( $post ) { */ private function get_content_from_galleries( $content ) { // Support for NextGen Gallery. - static $gallery_types = apply_filters( 'aioseop_gallery_shortcodes', array( 'ngg_images' ) ); + static $gallery_types = array( 'ngg_images' ); + $types = apply_filters( 'aioseop_gallery_shortcodes', $gallery_types ); $gallery_content = ''; $found = array(); - if ( $gallery_types ) { - foreach ( $gallery_types as $type ) { + if ( $types ) { + foreach ( $types as $type ) { if ( has_shortcode( $content, $type ) ) { $found[] = $type; } From 1cd6d80a2d0e659708399932c8c250be072fff6f Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Thu, 5 Oct 2017 11:51:52 +0530 Subject: [PATCH 04/54] support for jetpack --- modules/aioseop_sitemap.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index f657893cb..67b3c142d 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -2755,6 +2755,17 @@ private function get_images_from_post( $post ) { // Check images galleries in the content. DO NOT run the_content filter here as it might cause issues with other shortcodes. if ( has_shortcode( $content, 'gallery' ) ) { + // Get the jetpack gallery images. + if ( class_exists( 'Jetpack_PostImages' ) ) { + $jetpack = Jetpack_PostImages::get_images( $post->ID ); + if ( $jetpack ) { + foreach ( $jetpack as $jetpack_image ) { + $images[] = $jetpack_image['src']; + } + } + } + + // Get the default WP gallery images. $galleries = get_post_galleries( $post, false ); if ( $galleries ) { foreach ( $galleries as $gallery ) { From 99ec1c0316f20283f5dc711b79ef2becd43cb7d2 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Thu, 5 Oct 2017 12:03:01 +0530 Subject: [PATCH 05/54] modular code + codeclimate --- modules/aioseop_sitemap.php | 65 ++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index 67b3c142d..d882860cc 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -2753,26 +2753,7 @@ private function get_images_from_post( $post ) { $content = ''; $content = $post->post_content; - // Check images galleries in the content. DO NOT run the_content filter here as it might cause issues with other shortcodes. - if ( has_shortcode( $content, 'gallery' ) ) { - // Get the jetpack gallery images. - if ( class_exists( 'Jetpack_PostImages' ) ) { - $jetpack = Jetpack_PostImages::get_images( $post->ID ); - if ( $jetpack ) { - foreach ( $jetpack as $jetpack_image ) { - $images[] = $jetpack_image['src']; - } - } - } - - // Get the default WP gallery images. - $galleries = get_post_galleries( $post, false ); - if ( $galleries ) { - foreach ( $galleries as $gallery ) { - $images = array_merge( $images, $gallery['src'] ); - } - } - } + $this->get_gallery_images( $post, $images ); $content .= $this->get_content_from_galleries( $content ); $this->parse_content_for_images( $content, $images ); @@ -2796,6 +2777,42 @@ private function get_images_from_post( $post ) { return $images; } + /** + * Fetch images from WP and Jetpack galleries. + * + * @param string $content The post content. + * @param array $images the array of images. + * + * @since 2.4.2 + * + */ + private function get_gallery_images( $post, &$images ) { + if ( false === apply_filters( 'aioseo_include_images_in_wp_gallery', true ) ) { + return; + } + + // Check images galleries in the content. DO NOT run the_content filter here as it might cause issues with other shortcodes. + if ( has_shortcode( $post->post_content, 'gallery' ) ) { + // Get the jetpack gallery images. + if ( class_exists( 'Jetpack_PostImages' ) ) { + $jetpack = Jetpack_PostImages::get_images( $post->ID ); + if ( $jetpack ) { + foreach ( $jetpack as $jetpack_image ) { + $images[] = $jetpack_image['src']; + } + } + } + + // Get the default WP gallery images. + $galleries = get_post_galleries( $post, false ); + if ( $galleries ) { + foreach ( $galleries as $gallery ) { + $images = array_merge( $images, $gallery['src'] ); + } + } + } + } + /** * Parses the content to find out if specified images galleries exist and if they do, parse them for images. * Supports NextGen. @@ -2813,6 +2830,10 @@ private function get_content_from_galleries( $content ) { $gallery_content = ''; + if ( ! $types ) { + return $gallery_content; + } + $found = array(); if ( $types ) { foreach ( $types as $type ) { @@ -2852,11 +2873,11 @@ private function get_content_from_galleries( $content ) { // Recreate the shortcodes and then render them to get the HTML content. if ( $galleries ) { foreach ( $galleries as $shortcode => $attributes ) { - $code = "[$shortcode"; + $code = '[' . $shortcode; foreach ( $attributes as $key => $value ) { $code .= " $key=$value"; } - $code .= "]"; + $code .= ']'; $gallery_content .= do_shortcode( $code ); } } From 6e0916f40c892de9dae882bd249f68ff5b2e1af3 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Thu, 5 Oct 2017 12:07:45 +0530 Subject: [PATCH 06/54] codeclimate --- modules/aioseop_sitemap.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index d882860cc..8720b511b 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -2779,12 +2779,11 @@ private function get_images_from_post( $post ) { /** * Fetch images from WP and Jetpack galleries. - * - * @param string $content The post content. + * + * @param string $post The post. * @param array $images the array of images. * * @since 2.4.2 - * */ private function get_gallery_images( $post, &$images ) { if ( false === apply_filters( 'aioseo_include_images_in_wp_gallery', true ) ) { @@ -2816,10 +2815,10 @@ private function get_gallery_images( $post, &$images ) { /** * Parses the content to find out if specified images galleries exist and if they do, parse them for images. * Supports NextGen. - * + * * @param string $content The post content. * - * @since 2.4.1 + * @since 2.4.2 * * @return string */ From d7928f7e77ffe225f5f46d85201a59e05e516db0 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Thu, 5 Oct 2017 12:11:43 +0530 Subject: [PATCH 07/54] add only unique images --- modules/aioseop_sitemap.php | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index 8720b511b..a39773c97 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -2810,6 +2810,7 @@ private function get_gallery_images( $post, &$images ) { } } } + $images = array_unique( $images ); } /** From f336b9d207ba4959f26009ffc370ca84f923f581 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Wed, 22 Nov 2017 14:20:20 +0530 Subject: [PATCH 08/54] Add WooCommerce product gallery images to XML sitemap #366 --- modules/aioseop_sitemap.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index a39773c97..b6f56789b 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -2778,7 +2778,7 @@ private function get_images_from_post( $post ) { } /** - * Fetch images from WP and Jetpack galleries. + * Fetch images from WP, Jetpack and WooCommerce galleries. * * @param string $post The post. * @param array $images the array of images. @@ -2810,6 +2810,20 @@ private function get_gallery_images( $post, &$images ) { } } } + + // Check WooCommerce product gallery. + if ( class_exists( 'WooCommerce' ) ) { + $woo_images = get_post_meta( $post->ID, '_product_image_gallery', true ); + if ( ! empty( $woo_images ) ) { + $woo_images = array_filter( explode( ',', $woo_images ) ); + if ( is_array( $woo_images ) ) { + foreach ( $woo_images as $id ) { + $images[] = wp_get_attachment_url( $id ); + } + } + } + } + $images = array_unique( $images ); } From 1956db834079cf0a1025ef31a240db013853229e Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Sat, 20 Jan 2018 10:23:12 +0530 Subject: [PATCH 09/54] test case --- tests/aioseop-test-base.php | 1 + tests/test-sitemap.php | 46 +++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/tests/aioseop-test-base.php b/tests/aioseop-test-base.php index 5a545c3bc..543116057 100644 --- a/tests/aioseop-test-base.php +++ b/tests/aioseop-test-base.php @@ -15,6 +15,7 @@ protected final function upload_image_and_maybe_attach( $image, $id = 0 ) { if ( 0 !== $id ) { update_post_meta( $id, '_thumbnail_id', $attachment_id ); } + return $attachment_id; } protected final function init() { diff --git a/tests/test-sitemap.php b/tests/test-sitemap.php index 0989d39ab..928c6d2cd 100644 --- a/tests/test-sitemap.php +++ b/tests/test-sitemap.php @@ -106,6 +106,52 @@ public function test_exclude_images() { ) ); } + + public function test_woocommerce_gallery() { + $woo = 'woocommerce/woocommerce.php'; + $file = dirname(dirname( dirname( __FILE__ ) )) . '/'; + + if ( ! file_exists( $file . $woo ) ) { + $this->markTestSkipped( 'WooCommerce not installed. Skipping.' ); + } + + tests_add_filter( 'muplugins_loaded', function(){ + require $file . $woo; + } ); + + activate_plugin( $woo ); + + if ( ! is_plugin_active( $woo ) ) { + $this->markTestSkipped( 'WooCommerce not activated. Skipping.' ); + } + + + // create 4 attachments. + $attachments = array(); + for ( $x = 0; $x < 4; $x++ ) { + $attachments[] = $this->upload_image_and_maybe_attach( str_replace( '\\', '/', trailingslashit( __DIR__ ) . 'resources/images/footer-logo.png' ) ); + } + + $id = $this->factory->post->create( array( 'post_type' => 'product' ) ); + update_post_meta( $id, '_product_image_gallery', implode( ',', $attachments ) ); + $url = get_permalink( $id ); + + $custom_options = array(); + $custom_options['aiosp_sitemap_indexes'] = ''; + $custom_options['aiosp_sitemap_images'] = ''; + $custom_options['aiosp_sitemap_gzipped'] = ''; + $custom_options['aiosp_sitemap_posttypes'] = array( 'product' ); + + $this->_setup_options( 'sitemap', $custom_options ); + + $this->validate_sitemap( + array( + $url => array( + 'image' => true, + ), + ) + ); + } } From 9f5dd05fc3093f0cdb002e73c9a514bcb6528cb9 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Fri, 26 Jan 2018 11:05:38 +0530 Subject: [PATCH 10/54] sync with master --- tests/modules/sitemap/test-sitemap.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/modules/sitemap/test-sitemap.php b/tests/modules/sitemap/test-sitemap.php index c3b4ba75f..daf6280fd 100644 --- a/tests/modules/sitemap/test-sitemap.php +++ b/tests/modules/sitemap/test-sitemap.php @@ -118,9 +118,14 @@ public function test_exclude_images() { ); } + /** + * Add WooCommerce product gallery images to XML sitemap. + * + * @ticket 366 Add WooCommerce product gallery images to XML sitemap + */ public function test_woocommerce_gallery() { $woo = 'woocommerce/woocommerce.php'; - $file = dirname(dirname( dirname( __FILE__ ) )) . '/'; + $file = dirname( dirname( AIOSEOP_UNIT_TESTING_DIR ) ) . '/'; if ( ! file_exists( $file . $woo ) ) { $this->markTestSkipped( 'WooCommerce not installed. Skipping.' ); @@ -136,11 +141,10 @@ public function test_woocommerce_gallery() { $this->markTestSkipped( 'WooCommerce not activated. Skipping.' ); } - // create 4 attachments. $attachments = array(); for ( $x = 0; $x < 4; $x++ ) { - $attachments[] = $this->upload_image_and_maybe_attach( str_replace( '\\', '/', trailingslashit( __DIR__ ) . 'resources/images/footer-logo.png' ) ); + $attachments[] = $this->upload_image_and_maybe_attach( str_replace( '\\', '/', AIOSEOP_UNIT_TESTING_DIR . '/resources/images/footer-logo.png' ) ); } $id = $this->factory->post->create( array( 'post_type' => 'product' ) ); From bc6f7d8039fa39d2cad91a83e7826c819eb1d2c9 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Fri, 26 Jan 2018 12:44:47 +0530 Subject: [PATCH 11/54] sync with master --- tests/base/class-sitemap-test-base.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/base/class-sitemap-test-base.php b/tests/base/class-sitemap-test-base.php index f528088ad..f0ab9682d 100644 --- a/tests/base/class-sitemap-test-base.php +++ b/tests/base/class-sitemap-test-base.php @@ -93,6 +93,8 @@ protected final function validate_sitemap( $elements, $debug = false ) { } } + $contents = file_get_contents( $file ); @unlink( $file ); + return $contents; } } \ No newline at end of file From 4cb6691b1b01731dd8f43dda403b624ebb961214 Mon Sep 17 00:00:00 2001 From: Shohei Tanaka Date: Wed, 2 May 2018 15:52:30 +0900 Subject: [PATCH 12/54] Fix 1$ to %1$s Fix 1$ to %1$s and 2$ to %2$s --- aioseop_class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aioseop_class.php b/aioseop_class.php index 07635ab33..7f2289dd8 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -123,7 +123,7 @@ function __construct() { __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '
  • ' . __( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '
  • ' . __( '%category_title% - The (main) category of the post', 'all-in-one-seo-pack' ) . '
  • ' . - __( '%1$category% - Alias for %2$category_title%', 'all-in-one-seo-pack' ) . '
  • ' . + __( '%%1$scategory% - Alias for %%2$scategory_title%', 'all-in-one-seo-pack' ) . '
  • ' . __( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '
  • ' . __( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '
  • ' . __( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '
  • ' . From 8853a007fe2cb212bdff0a6a6cc53973edd1ba9b Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Fri, 3 Aug 2018 03:13:16 +0530 Subject: [PATCH 13/54] In social settings for a post, attached image is still selected even with a custom image #673 (#1587) --- css/modules/aioseop_module.css | 3008 +++++++++++++-------------- js/modules/aioseop_module.js | 17 +- modules/aioseop_opengraph.php | 3478 ++++++++++++++++---------------- 3 files changed, 3258 insertions(+), 3245 deletions(-) diff --git a/css/modules/aioseop_module.css b/css/modules/aioseop_module.css index 883d26a64..6039c18f5 100644 --- a/css/modules/aioseop_module.css +++ b/css/modules/aioseop_module.css @@ -1,1505 +1,1505 @@ -/** - * Controls all the styling of the plugin. - * - * @author Michael Torbert. - * @author Semper Fi Web Design. - * @copyright http://semperplugins.com - * @package All-in-One-SEO-Pack. - */ - -.form-table.aioseop { - clear: none; -} - -.form-table.aioseop td { - vertical-align: top; - padding: 16px 0 10px 0; - line-height: 20px; - font-size: 12px; -} - -.form-table.aioseop th { - width: 200px; - padding: 10px 0 12px 9px; -} - -.aioseop_help_text_link, -.aioseop_help_text_link:active { - text-align: left; - float: left; - max-width: 300px; - min-width: 1px; - padding-top: 2px; - outline: none; - color: #888; - font-family: sans-serif; -} - -.aioseop_help_text_link span { - font-size: 14px; -} - -.aioseop_help_text_link:before { - content: "\f223"; - font-size: 27px; - font-family: dashicons; - vertical-align: middle; -} - -#aioseop-support .aioseop_metabox_text, -#aioseop-support a { - font-size: 14px; - color: #000; - text-decoration: none; -} - -.aioseop_icon { - display: inline-block; - width: 40px; - height: 40px; - background-repeat: no-repeat; - background-size: 100%; - vertical-align: middle; - margin: 10px; -} - -.aioseop_book_icon { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAKlBMVEUAAAAAn+cAneEAnuABnuEBnuEAnuEAn+QAn+QAneAAnuEAneAAnuAAneFPI9ocAAAADnRSTlMAII/P/wCQMADwANDvnyPbz6kAAAB9SURBVHgB7c+xCQMgEIVhZwiSSRzhkRBImsA5gVUmuBGcJbUDxlhY6T2wvh/sPvBd+HdJWCSj0N8bsEEiIIOAyEBhIDGAcwA4cDBy4MDBTeuqCR5abXCvBHy+6ybQrs2R0jsH/As+srEzC55qggi81AIZ+waQxkBmQK5tD34LnXJVZf9y5gAAAABJRU5ErkJggg==); -} - -.aioseop_cog_icon { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAeFBMVEUAAAAAn+MAnOIAn+cAneIAneEAn+MAnuEAneIAnuAAnuAAneEAn+cAn+QAn98AnuEAn98AneAAneEAneAAnOIAnuAAnuEAnuAAneEAn+EAnuEAnuAAneEAneAAneAAn+QAnuEAnuABnuEAneAAn+EAnuIAnuMBnuHeY3dlAAAAJ3RSTlMAQFAAYIAAkADP3wAgMACgEACfrwC/X++PbwAAcODwALDAANAATz8hP00ZAAACHklEQVR4Xq3XbWObIBAHcPAJJRjJVmtso4vL2vv+33AzJO2J/LuE9PfGFyR4HHiAgCQxyRMiYEtGTL5BBGzJiVEviIAtFTH6FRGowdBC/QsQqKGhhebeIdTkqe+LwFbkqew2SGyDftDKz12Q2AXYlhgeA46AD/G5oyD9zJO0zIEhvXd91L0mSPcmnZlek0nPhHu4mKu2ov+q2rZzOWE5kBRBFjNRzDRFqD6X8oGiHK5fo+0oSmcv06goknLfQk3RzHkaWwIGlUhrZaIGAto5iQn6uyw+yAFOpSgUTDEHJqqZc5DR2rgqw8lIa7mbRkkMLOOBoWZlWYrynwzGzx1C/3cdlEcvf7sgL5MTq8rGz22QNwjDP+cGBYBDOC6qcnLTNqQCeRbuYdEU4In47YjL84RSwEk+Tq8qT7xvhMc5eXsj78Buga866O4dQrXs4OEk3jaNTWC1Cfc43nSa0MQ0fCFFLWXL9saWFjQMgFOfEUR+zsl1KWeRBaWr3e7c01q3Lmld+FfiSVFQ/2ehp6B8IzaorGvJ8q8Jl/ViIkDv396tfX/bawKm81J+eGtLH91cX+xIUUZ7XYmPHTBmA0U4feMh6zqVwzTe8ubQvmBoUJeDphoIGtT5tVaq0Ttopvyom4M4xqz8YGXhiCLAnIKhg8N2iA30cLzrxmJH/H4cASejrjzcFHXpwrcukwIiRQZv2QICtjQP352/9fYuC+Qv593CTVvcgwkAAAAASUVORK5CYII=); -} - -.aioseop_file_icon { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAPFBMVEUAAAAAneAAn98AneIAneEAnuAAn+QAnuAAnuAAnuEAn+MAnuEAneAAnuEAn+EAneEAnOIAnuEAnuABnuG5yOaaAAAAE3RSTlMA0BBgn88wv++gQLCvX2+PUJDAyp/15gAAALdJREFUeF7t1z2ygzAMhVFJjm0C5Ff732uaMCSWCVzTJO/paz1zRsVtTM/OUT+Wx5PQchJ1Q2O/CETdVk51IOjWugAeYLvUAEU6rAO4oLhQB2bSvh+NAAKU2AgYQGIEDHgXbjhQCFcYKIQuoUApZBQwQg8CRhhAwArSBlCagNAI0LTqAQCq3fcC+jOA7e8DDuhK/wDwHfgOfAe+A98B2BcC3Aaw+XiCBdp3AtOcNAgs9FoACZ7ufwCe6pfMGb29UwAAAABJRU5ErkJggg==); -} - -.aioseop_help_icon { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAflBMVEUAAAAAn98AnuIAn+EAneAAnuAAnuAAn+QAn+QAneEAnuAAnuAAn+EAnuAAnuEAneAAn+cAneAAnuAAn98AnOIAnuEAneIAn+MAnuEAnuEAn+EAneIAneEAneEAnuEAn+MAneAAneEAnuMAnOIAn+cAneEBnuEAneAAnuMBnuEoGewkAAAAKXRSTlMAEE9/r7/fADCPzwBv718AIPDAAFCwYEAAoAAAn4CQAOAAPwAAcADQAFP96WQAAAMNSURBVHhelZcNc5swDIatBghpoCGEj9Jij2XLMv3/P7glkoNtZJo+d+0lhBOveSXZUjHgZZOkGf4nS5PNC5wiKPFqvnvFgNddvpVQy0tQZCiSFfCEAtiUGKXcwFcB3kpcpXx791HetypFn2NdH9EnrX67KPdL46g/tl3PeqHvWidM2fxyUM7n3fzgof8R0A9zjN3PGTV/HB+6teg66EeIUQqQIGOiSQMGmeRgUQfGPn/Ktyv0k9UQKrCxWzitAq3V6dvYIDG8f8mAROO6ULF/3ecTaHazcvIgjTw/PxfFeVFErCHd31C3fx2v39cKGy6qLKyA1tGr/v8BLWDyb3OLqiw+XGCiq8DFxIvypMKIHqMXvaeLmmyEkn1xSTCAjWcMS7gruFD+eo/QuEC7AYCy+nJXkC1/r5A4Gq2NrQCvjMnL7OZCLggY3KoAI5jMEvKt2hohBYK3wiveuwx8i3qn/uvVf0O2Hh5MnLwOZMTrXgGt4OCi7RuyXNg1F1oDqEZIQh2K6oUALalSWqgiIwUIM4VVqZZvdlkE7QQFFLRVNS3l5NLZarMkgkx6ebWiNPqzSu9nEkM2KDZhjbykh+19KKri3+LkIxLhVlE/E4CaAjsd4AYo9zJkR9huGF7CtPYSX9FyXG4XFHe2UQIt9fIGa6NNJBErX2r35O0wp7KEbZYSNpVtMYngSpbZYoI1G9YClFzOp+vKS6jviLFJ+fWgDralfZO5peW2xX8LKB9NdTtxsQuc7/wV0OTv/YRyiUuIugCls7FwizffsXHgzcRurjEjYgH8zdVKyODZJUDGAuxZubNnt5BIgMQ7YNyowy2c0XfCqyNX6HzE2Ve8A28+nmDDHaJyD9sNChpkxvCYRxgkEjitAkl40AzPjxm7KdNnSAzLgaNFZhcVATtkBmliGaTJSJ6mBnnkMWgpx+XAMZZoMbGZqXEHm6Q4sxA4F4k7DEkjD1PVGJCmGFDLQ5elO+Iqx7B/q88A0FKI+DSlBLMuE4pMF3h6+DZXDLia6PAtA41u67uUqW51E02uf46zvXx+HY4YAAAAAElFTkSuQmCC); -} - -.aioseop_support_icon { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAe1BMVEUAAAAAn98AnuIAn+EAneAAnuAAnuABnuEAn98An+QAneEAnuAAn+QAn+EAnuAAnuEAneAAnuEAneIAn+MAn+cAn+cAnuEAnuEAnOIAneEAneEAnOIAnuAAneEAn+MAneAAneEAneIAnuEAnuIAneAAnuAAneABnuEAnuPdwDkgAAAAKXRSTlMAEE9/r7/f/wAwj88Ab+9f0JBgQCAAALBQcAAAAJ8AAIAAoADgwPAAP4Dl7rAAAALsSURBVHgBtdcBc6I6EAfwRCH/KjUSTCW2eHK8kHff/xM+Dg5NlsTTOu830xmc0BhJdtllKXy1znKBgciz9Yq/JbC3mM22AFFsN+8x7H2B7wSixI4/sAK+lkiSa/63CfbXfy9VddAfA32oVHmdYn8MsaNP55jUhpOFmRqTXH/4mP/BSExOnxEnTKT58jDveouZaCIEZltvWna7POPm8GPhgJtzbIIMnvq4UMOTXWZsvjgjoD8IjcCZrkAh1H4SLUIq3EYDQjSEBGH8XdASVPUzUIGS2jsHORbyJpC8gzWDChGaPsL4ItnwxyUiuuPqnBdAkW9X/3SIkPxPMLWIkZJcL7XTNnKJb5J8XMEJ33YaVyCQYJUZ0tjGKIsE8XsXNuNUFpStvFMQGR4Xvhlyoppi51AjUAcZhdPRIVzr8UCzYzEfS91afxOJDle2Hc9IBaBoGMdg/raq/3s49/NPm/6TGQDl5Up3DoCN5G9uAbjOO6AlAMPa8Zd4JI0kP55k41EAWlaT+w0Ae4mytyAenQDUrCcZsCMr8igydADQM0ECrydf4zEA+uZGAygYBv96ivF4RG3GffNgsJiAfr439v9MUN7/CeXFgwGzrz1Eu9hG9eQ2Rg+SaKJE5CB1y6Ps7h1ld/FMR9mEm6vPEoCIBZMAIM/e8xoTQRjO+5y8fT0ZJvlc5PwJ57fymlDWMloBLKoHsb4mlPLCLnNKyxDIwpRGR72UtsEgUhoKrx7bR4Z3c1J9Tyft7ep3Wl9t04l/rFBefrFwh29y/N7L1TlynXy5JpbQHY3qS6Dslfnq4guYa+UXC4xBj4W+CSTvYFMEuOeLLKf9Ytssd5hw6TJv9FKhOeqeK3W7ZcNRP1Nsd7GOpXu83O/iLY8ij5CwmKlUz2TcIy2PIy2PT/eYZLRV5fsMk542XaHK3VrV/a+p7fu1uzWyjiZs9pPgrUOSa6ONJ8FPFlH2xB9uvlUJolTJ5juOm7buLQa2r1uvkSX+A/xd+1xZLxG0AAAAAElFTkSuQmCC); -} - -.aioseop_youtube_icon { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAARVBMVEUAAAAAn+cAn+EAneAAnuABnuEAn+cAn98AneEAn98AnOIAnuAAnOIAneIAneIAnuEAnuEAneEAnuEBnuEAn+QAneAAneCXjc90AAAAF3RSTlMAIG+vz/8AEJ8AUO8AYACgAHCwADDw0E/SOHoAAAEBSURBVHgB7dbBjsIgGATgH+UvCAso3fL+j7rDYZMerGGZQ5NNv8TrREZLRy47F3O7Wx1m7zezAMjSOa9/5t2jkweEqBNi+ALBJ+mklHOWnINOC/0buKjTokMHRQnlKUYpRl5HBQ32KFXfW783HVDFHgWsrg0EWNEDK4z0+yEAEhuAIsgAFMEFQOECILEBKIIMQBFcABQuABIbgCLIABTBBUBhAzx5BEuWGM/9GT35V7bkwxTPfZw9eaVZ8lKN517rI8NHmr43cPyufXi5Rh1Q+dc7PTAWduI83abTNteHJjvz6KEJYeoU2+/UBVcm+tuNbTCv2nRYq2k/9ylXwL8I+AGj+lzlceKDYQAAAABJRU5ErkJggg==); -} - -.aioseop_meta_box_help > label { - position: absolute; - margin-left: 8px; -} - -div.aioseop_tip_icon { - font-size: 14px; - border: 1px solid #888; - width: 1em; - text-align: center; - padding: 0 4px; - -webkit-border-radius: 12px; - -moz-border-radius: 12px; - -webkit-box-shadow: 1px 1px 1px #888; - -moz-box-shadow: 1px 1px 1px #888; - box-shadow: 1px 1px 1px #888; - border-radius: 12px; -} - -div.aioseop_tip_icon:before { - content: '?'; -} - -.aioseop_help_text_link img { - width: 40px; - float: left; -} - -.aioseop_meta_box_help, -.aioseop_meta_box_help:active { - float: right; - padding-left: 0; - width: 16px; - margin-right: 32px; - text-decoration: none; - height: 15px; - padding-top: 1px; - position: relative; -} - -.aioseop_tabs .aioseop_meta_box_help, -.aioseop_tabs .aioseop_meta_box_help:active { - margin-top: 4px; - margin-right: 45px; -} - -.aioseop_label { - color: #5F5F5F; - font-weight: bold; - line-height: 19px; - display: inline-block; - text-align: left; - position: absolute; - font-family: 'Open Sans', sans-serif; - width: 26%; - min-width: 120px; - max-width: 230px; -} - -.aioseop_option_div { - max-height: 360px; - min-height: 37px; - width: 95%; - overflow-y: auto; -} - -.aioseop_overflowed { - border: 1px solid #e1e1e1; -} - -.aioseop input[type="text"] { - color: #515151; - height: 35px; - padding: 10px 0 10px 10px; - font-size: 14px; - width: 95%; - max-width: 600px; -} - -.aioseop textarea { - color: #515151; - padding: 10px 0 0 10px; - margin: 0; - font-size: 14px; - line-height: 25px; - width: 95%; - max-width: 600px; -} - -.aioseop_help_text_div { - text-align: left; - width: 100%; - margin: 0; -} - -.aioseop_help_text { - font-size: 12px; - float: left; - clear: left; - color: #797979; - line-height: 15px; - font-style: italic; -} - -.aioseop_head_tagline { - color: #5F5F5F; - font-size: 13px; -} - -.aioseop_head_nav { - float: left; - font-size: 18px; - margin: 0 0 16px 0; - font-family: "HelveticaNeue-Light", - "Helvetica Neue Light", - "Helvetica Neue", - sans-serif; - border-bottom: 1px solid #CCC; - width: 100%; -} - -.aioseop_head_nav_tab { - padding: 10px 15px 10px 15px; - margin: 0 0 0 15px; - border-radius: 4px 4px 0 0; - border: 1px solid #CCC; - border-bottom: 0 white; - float: left; - opacity: 0.5; - color: black; - text-shadow: white 0 1px 0; - text-decoration: none; -} - -.aioseop_head_nav_tab.aioseop_head_nav_active { - opacity: 1; - margin-bottom: -1px; - border-width: 1px; -} - -.aioseop_head_nav_tab:first-child { - margin-left: 0; -} - -.aioseop_head_nav_tab:hover { - opacity: 1; -} - -.aioseop_header { - float: left; - clear: left; -} - -.aioseop_advert { - padding: 10px; - margin-bottom: 30px; - border: 1px solid #DDD; - height: 200px; - width: 423px; -} - -.aioseop_nopad { - padding-left: 0; - padding-top: 0; -} - -.aioseop_nopad_all { - padding: 0; - height: 220px; - width: 445px; - margin-bottom: 20px; - border: none; -} - -.aioseop_adverts { - float: right; -} - -.wincherad { - width: 100%; - height: 100%; - background-size: 100%; - background-repeat: no-repeat; - margin-bottom: 0; - border: none; -} - -#wincher21 { - background-image: url(../../modules/images/banner21.jpg); -} - -#wincher22 { - background-image: url(../../modules/images/banner22.jpg); -} - -.aioseop_content { - min-width: 760px; - clear: left; -} - -.aioseop_options_wrapper .hndle { - font-size: 15px; - font-family: Georgia, - "Times New Roman", - "Bitstream Charter", - Times, - serif; - font-weight: normal; - padding: 7px 10px; - margin: 0; - line-height: 1; -} - -.aioseop_options_wrapper .submit input.button-primary { - margin-bottom: 5px; -} - -#aiosp_feature_manager_metabox.postbox { - margin-top: 20px; - float: left; -} - -.aioseop_advert p { - margin: 25px 0 25px 0; -} - -.aioseop_options_wrapper .postarea { - border-color: #DFDFDF; - -moz-box-shadow: inset 0 1px 0 #fff; - -webkit-box-shadow: inset 0 1px 0 #fff; - box-shadow: inset 0 1px 0 #fff; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; -} - -.aioseop_advert h3 { - padding: 0; - margin-top: 6px; -} - -.aioseop_metabox_text p { - margin: 0 0 0 0; - width: 101%; -} - -.aioseop_sidebar { - width: 457px; - margin-left: 10px; -} - -.aioseop_metabox_text { - margin-bottom: 0; -} - -.aioseop_metabox_wrapper { - padding: 0; -} - -.aioseop_metabox_text *:last-child { - margin: 0; -} - -.aioseop_metabox_feature { - margin-top: 20px; -} - -.aioseop_translations { - margin-top: 15px; -} - -.aioseop_option_label { - float: left; - margin: 0; - min-width: 150px; - width: 37%; - max-width: 270px; - padding-top: 3px; - padding-bottom: 3px; - height: 67px !important; /*added for certain language support*/ -} - -.aioseop_metabox_text h2 { - font-size: 14px; - padding: 0; - font-weight: bold; - line-height: 29px; -} - -#aioseop-about { - width: 443px; - margin-bottom: 20px; -} - -#aioseop-about .aioseop_metabox_text #mc-embedded-subscribe-form h2 { - font-size: 13px; -} - -.aioseop_sidebar #mc-embedded-subscribe-form { - margin: 0 0 10px 0; - background: white; - padding: 10px 10px; - border: 1px solid #DDD; -} - -#aioseop-about .aioseop_metabox_text ul { - list-style-type: disc; - padding-left: 15px; -} - -.aioseop input[readonly] { - background-color: #EEE; - margin: 5px 0 5px 0 !important; -} - -.aioseop_settings_left { - float: left; - padding: 0; - margin: 0; - width: 100%; -} - -body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_settings_left { - margin-top: 20px; -} - -body.all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager .aioseop_settings_left { - margin-top: 20px; -} - -#aioseop_top_button { - margin-top: 5px; - height: 30px; -} - -#aioseop-list #mce-EMAIL { - margin-top: 5px; - width: 250px; -} - -.aioseop_top { - margin: 10px 10px 0 0; - /* margin: 10px 477px 0px 0px; */ -} - -.aioseop_top #aioseop-list { - margin-bottom: 0; -} - -.aioseop_top #aioseop-list.postbox.closed { - overflow: hidden; -} - -.aioseop_right_sidebar { - float: right; - margin-top: 35px; -} - -#aiosp_settings_form .button-primary.hidden { - display: none; -} - -form#edittag div#aiosp_titleatr_wrapper, -form#edittag div#aiosp_menulabel_wrapper, -form#edittag div#aiosp_sitemap_exclude_wrapper { - display: none; -} - -.All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > #aioseop_top_button { - height: 5px; - position: absolute; - top: 0; - width: 97%; -} - -.All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > .aioseop_settings_left { - margin-top: 10px; -} - -.All_in_One_SEO_Pack_Feature_Manager > .aioseop_right_sidebar.aioseop_options_wrapper { - margin-top: 10px; -} - -div#aiosp_feature_manager_metabox .inside { - padding: 8px; -} - -div.aioseop_feature { - position: relative; - display: inline-block; - float: left; - vertical-align: top; - width: 240px; - height: 288px; - margin: 8px; - border: 1px solid #DEDEDE; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - background: white; - padding: 10px 0 0; - -webkit-box-shadow: inset 0 1px 0 #fff, - inset 0 0 20px rgba(0, 0, 0, 0.05), - 0 1px 2px rgba(0, 0, 0, 0.1); - -moz-box-shadow: inset 0 1px 0 #fff, - inset 0 0 20px rgba(0, 0, 0, 0.05), - 0 1px 2px rgba(0, 0, 0, 0.1); - box-shadow: inset 0 1px 0 #fff, - inset 0 0 20px rgba(0, 0, 0, 0.05), - 0 1px 2px rgba(0, 0, 0, 0.1); - -webkit-transition-duration: .4s; - -moz-transition-duration: .4s; -} - -.aioseop_feature .flag { - float: right; - margin-right: -7px; - background: none repeat scroll 0 0 #D23D46; - color: #FFFFFF; - padding: 5px 12px 6px 5px; - position: relative; -} - -.aioseop_feature .flag:before { - border-color: #D23D46 #D23D46 #D23D46 transparent; - border-style: solid; - border-width: 14px 4px 15px 10px; - content: ""; - left: -14px; - position: absolute; - top: 0; -} - -.aioseop_feature .flag:after { - border-color: #892026 transparent transparent; - border-style: solid; - border-width: 6px 6px 6px 0; - bottom: -12px; - content: ""; - position: absolute; - right: 0; -} - -.aioseop_feature .flag.pro { - display: none; -} - -#aioseop_coming_soon .free.flag, -.all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager .aioseop_feature .free.flag { - display: none; -} - -#aioseop_coming_soon .flag.pro { - display: block; - margin-top: -30px; -} - -.all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager #aioseop_coming_soon .flag.pro { - display: none; -} - -.aioseop_feature h3 { - font-size: 17px; - margin: 0; - padding: 0 10px 5px 10px; - font-weight: normal; - font-style: normal; - font-family: "Helvetica Neue", - Helvetica, - Arial, - "Lucida Grande", - Verdana, - "Bitstream Vera Sans", - sans-serif; -} - -.aioseop_feature p { - line-height: 150%; - font-size: 12px; - font-family: Georgia, - "Times New Roman", - "Bitstream Charter", - Times, serif; - margin-bottom: 20px; - color: #666; - padding: 0 10px; -} - -.aioseop_feature p.aioseop_desc { - min-height: 80px; -} - -.aioseop_feature .feature_button { - float: right; - margin-bottom: 10px; - margin-right: 10px; - min-width: 80px; - text-align: center; -} - -.aioseop_feature .feature_button:before { - content: "Activate"; -} - -.aioseop_feature .active.feature_button:before { - content: "Deactivate"; -} - -div.aioseop_feature .aioseop_featured_image { - min-height: 100px; - background-repeat: no-repeat; - display: block; - margin: 0 auto; - width: 133px; -} - -div.aioseop_feature .aioseop_featured_image { - background-image: url(../../modules/images/Default-BW-Standard.png); -} - -div.aioseop_feature .aioseop_featured_image.active { - background-image: url(../../modules/images/Default-Color-Standard.png); -} - -div.aioseop_feature#aioseop_sitemap .aioseop_featured_image { - background-image: url(../../modules/images/XMLSitemaps-BW-Standard.png); -} - -div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active { - background-image: url(../../modules/images/XMLSitemaps-Color-Standard.png); -} - -div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image { - background-image: url(../../modules/images/VideoSitemap-BW-Standard.png); -} - -div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active { - background-image: url(../../modules/images/VideoSitemap-Color-Standard.png); -} - -div.aioseop_feature#aioseop_opengraph .aioseop_featured_image { - background-image: url(../../modules/images/SocialMeta-BW-Standard.png); -} - -div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active { - background-image: url(../../modules/images/SocialMeta-Color-Standard.png); -} - -div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image { - background-image: url(../../modules/images/Robots-BW-Standard.png); -} - -div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active { - background-image: url(../../modules/images/Robots-Color-Standard.png); -} - -div.aioseop_feature#aioseop_file_editor .aioseop_featured_image { - background-image: url(../../modules/images/FileEditor-BW-Standard.png); -} - -div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active { - background-image: url(../../modules/images/FileEditor-Color-Standard.png); -} - -div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image { - background-image: url(../../modules/images/ImporterExporter-BW-Standard.png); -} - -div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active { - background-image: url(../../modules/images/ImporterExporter-Color-Standard.png); -} - -div.aioseop_feature#aioseop_performance .aioseop_featured_image { - background-image: url(../../modules/images/Performance-BW-Standard.png); -} - -div.aioseop_feature#aioseop_performance .aioseop_featured_image.active { - background-image: url(../../modules/images/Performance-Color-Standard.png); -} - -div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image { - background-image: url(../../modules/images/Default-Color-Standard.png); -} - -div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image { - background-image: url(../../modules/images/Default-Color-Standard.png); -} - -.All_in_One_SEO_Pack_Sitemap > form > .wrap > .form-table, -.All_in_One_SEO_Pack_Video_Sitemap > form > .wrap > .form-table { - max-width: 500px; - clear: none; -} - -.aioseop_follow_button { - min-height: 50px; - background-repeat: no-repeat; - display: inline-block; - width: 100px; - background-size: auto 50px !important; - margin-right: 0; -} - -.aioseop_facebook_follow { - background-image: url(../../modules/images/facebook-follow-standard.png); -} - -.aioseop_twitter_follow { - background-image: url(../../modules/images/twitter-follow-standard.png); -} - -@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and ( min--moz-device-pixel-ratio: 1.5), only screen and ( -o-min-device-pixel-ratio: 3/2), only screen and ( min-device-pixel-ratio: 1.5), only screen and ( min-resolution: 1.5dppx) { - div.aioseop_feature .aioseop_featured_image { - background-size: auto 100px !important; - } - - div.aioseop_feature .aioseop_featured_image.active { - background-image: url(../../modules/images/Default-Color-Retina.png); - } - - div.aioseop_feature .aioseop_featured_image { - background-image: url(../../modules/images/Default-BW-Retina.png); - } - - div.aioseop_feature#aioseop_sitemap .aioseop_featured_image { - background-image: url(../../modules/images/XMLSitemaps-BW-Retina.png); - } - - div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active { - background-image: url(../../modules/images/XMLSitemaps-Color-Retina.png); - } - - div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image { - background-image: url(../../modules/images/VideoSitemap-BW-Retina.png); - } - - div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active { - background-image: url(../../modules/images/VideoSitemap-Color-Retina.png); - } - - div.aioseop_feature#aioseop_opengraph .aioseop_featured_image { - background-image: url(../../modules/images/SocialMeta-BW-Retina.png); - } - - div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active { - background-image: url(../../modules/images/SocialMeta-Color-Retina.png); - } - - div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image { - background-image: url(../../modules/images/Robots-BW-Retina.png); - } - - div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active { - background-image: url(../../modules/images/Robots-Color-Retina.png); - } - - div.aioseop_feature#aioseop_file_editor .aioseop_featured_image { - background-image: url(../../modules/images/FileEditor-BW-Retina.png); - } - - div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active { - background-image: url(../../modules/images/FileEditor-Color-Retina.png); - } - - div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image { - background-image: url(../../modules/images/ImporterExporter-BW-Retina.png); - } - - div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active { - background-image: url(../../modules/images/ImporterExporter-Color-Retina.png); - } - - div.aioseop_feature#aioseop_performance .aioseop_featured_image { - background-image: url(../../modules/images/Performance-BW-Retina.png); - } - - div.aioseop_feature#aioseop_performance .aioseop_featured_image.active { - background-image: url(../../modules/images/Performance-Color-Retina.png); - } - - div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image { - background-image: url(../../modules/images/Default-BW-Retina.png); - } - - div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image { - background-image: url(../../modules/images/Default-BW-Retina.png); - } - - .aioseop_facebook_follow { - background-image: url(../../modules/images/facebook-follow-retina.png); - } - - .aioseop_twitter_follow { - background-image: url(../../modules/images/twitter-follow-retina.png); - } -} - -.aioseop_options { - width: 100%; - margin: 18px 0 10px 0; -} - -.aioseop_wrapper { - width: 100%; - padding-left: 5px; -} - -.aioseop_input { - clear: left; - width: 100%; - padding: 5px; - display: inline; -} - -.aioseop_option_input { - float: left; - width: 61%; - margin: 0; - padding-left: 1px; - min-width: 160px; - /* max-width: 900px; */ -} - -/*** Sitemap Additional Pages section ***/ -#aiosp_sitemap_addl_pages_metabox .aioseop_options, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_options { - width: 97%; - margin: 5px; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_sitemap_addl_instructions_wrapper, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_video_sitemap_addl_instructions_wrapper { - display: block; - width: 100%; - float: none; - margin: 0; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_sitemap_addl_instructions_wrapper .aioseop_input, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_video_sitemap_addl_instructions_wrapper .aioseop_input { - display: block; - width: 100%; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper { - padding: 0; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_input, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_input { - display: inline-block; - vertical-align: middle; - width: 25%; - min-width: 120px; - height: 70px; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_top_label, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_top_label { - width: 70%; - margin: 0; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_option_label, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_option_label { - height: 30px !important; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_sitemap_addl_mod_wrapper input.aiseop-date, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_video_sitemap_addl_mod_wrapper input.aiseop-date { - height: 36px; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type { - margin: 0; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type input.button-primary, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type input.button-primary { - margin-left: 0 !important; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_help_text_div, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_help_text_div { - position: absolute; - width: auto; - margin: 5px 0 10px 0; -} - -#aiosp_sitemap_addl_pages_metabox table.aioseop_table, -#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table { - width: 96%; - border: 1px solid #CCC; - margin: 5px 5px 10px; -} - -table.aioseop_table tr:nth-child(odd) { - background-color: #EEE; -} - -.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr:nth-child(odd) { - background-color: rgba(238, 238, 238, 0.5); -} - -table.aioseop_table td { - width: 23%; -} - -.All_in_One_SEO_Pack_Opengraph table.aioseop_table { - width: 80%; - max-width: 800px; - display: block; - border-top: 1px solid #dfdfdf; - border-left: 1px solid #dfdfdf; -} - -.All_in_One_SEO_Pack_Opengraph table.aioseop_table th { - width: 18%; - border-right: 1px solid #dfdfdf; - border-bottom: 1px solid #dfdfdf; -} - -.All_in_One_SEO_Pack_Opengraph div.aioseop_meta_info { - margin-top: 10px; - border: 1px solid #dfdfdf; - width: 80%; - max-width: 800px; -} - -.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr.aioseop_table_header th { - background: #f1f1f1; - background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9)); - background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9); - background-image: -moz-linear-gradient(bottom, #ececec, #f9f9f9); - background-image: -o-linear-gradient(bottom, #ececec, #f9f9f9); - background-image: linear-gradient(to top, #ececec, #f9f9f9); - padding: 5px; - border-bottom-color: #dfdfdf; - text-shadow: #fff 0 1px 0; - -webkit-box-shadow: 0 1px 0 #fff; - -moz-box-shadow: 0 1px 0 #fff; - box-shadow: 0 1px 0 #fff; -} - -.All_in_One_SEO_Pack_Opengraph table.aioseop_table td { - border-right: 1px solid #dfdfdf; - border-bottom: 1px solid #dfdfdf; -} - -#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item { - display: inline-block; - width: 30%; - vertical-align: top; -} - -#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(even) { - font-weight: bold; -} - -#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(odd) { - width: 70%; -} - -#aiosp_sitemap_addl_pages_metabox table.aioseop_table td, -#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td { - width: 27%; - padding-left: 5%; -} - -#aiosp_sitemap_addl_pages_metabox table.aioseop_table td:first-child, -#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td:first-child { - padding-left: 2%; -} - -table.aioseop_table td, table.aioseop_table th { - padding: 3px; -} - -.aioseop_top_label .aioseop_option_input, -.aioseop_no_label .aioseop_option_input { - width: 100%; -} - -#aiosp_settings_form .postbox { - margin: 0 0 20px 0; -} - -.aioseop_settings_left .postbox { - float: left; - width: 100%; -} - -.aioseop_option_setting_label { - min-height: 35px; - display: inline-block; - white-space: nowrap; - overflow: hidden; - padding-left: 1px; - max-width: 229px; - min-width: 160px; - width: 33%; -} - -.aioseop_settings_left .postbox .inside { - padding: 0; - margin: 0; - clear: right; -} - -#aiosp_robots_rules { - clear: left; - margin-left: 20px; - max-width: 1072px; -} - -#aiosp_robots_default_metabox .aioseop_wrapper { - width: 31%; - min-width: 165px; - display: inline-block; - max-width: 265px; -} - -#aiosp_robots_default_metabox .aioseop_help_text_div { - position: absolute; - margin: 5px 0 10px 0; -} - -#aiosp_robots_default_metabox .aioseop_option_input { - width: 94%; - min-width: 94%; -} - -#aiosp_robots_default_metabox table.aioseop_table { - width: 96%; - border: 1px solid #CCC; - margin: 5px 0 10px 0; -} - -#aiosp_robots_default_metabox table.aioseop_table td { - width: 25%; - padding-left: 5%; -} - -#aiosp_settings_form .aioseop_no_label, .aioseop_no_label { - float: left; - width: 92%; - max-width: 100%; - margin: 0 23px 0 13px; -} - -#aiosp_sitemap_status_metabox .handlediv.button-link { - display: none; -} - -#aiosp_sitemap_status_metabox.closed .inside { - display: block; -} - -.aioseop_top_label { - width: 96%; - margin: 0 10px; -} - -.aioseop_hidden_type { - margin: 0; - padding: 0; - height: 0; -} - -#aiosp_title_metabox #aiosp_force_rewrites_wrapper { - display: none; - height: 0; -} - -.aioseop_module.error.below-h2 { - padding: 5px 0; - margin: 0 477px 15px 0 !important; -} - -#aioseop_opengraph_settings .inside { - margin: 0; -} - -#aioseop_opengraph_settings_image_wrapper img { - width: auto; - height: 75px; -} - -#aioseop_opengraph_settings_image_wrapper .aioseop_option_setting_label { - max-width: 160px; - min-width: 100px; - width: 30%; -} - -.aioseop_input input[type="checkbox"], -.aioseop_input input[type="radio"] { - vertical-align: text-bottom; - margin-top: 8px; -} - -#aiosp_importer_exporter_import_export_help_wrapper .aioseop_option_div { - max-height: initial; -} - -#aiosp { - width: auto; -} - -.aioseop_input.aioseop_top_label .aioseop_option_input { - margin: 0 0 10px 0; -} - -.aiosp_file_editor_settings > .aioseop_textarea_type .aioseop_option_div { - max-height: none; -} - -/* Robots.txt styling */ -#aiosp_robots_generator_robotgen_wrapper .aioseop_option_div, -#aiosp_robots_generator_robothtml_wrapper .aioseop_option_div { - max-height: none; -} - -.aioseop_option_input .widefat td { - vertical-align: middle; -} - -.entry-row.robots.quirks { - font-weight: bold; - opacity: 1; -} - -.entry-row.robots { - opacity: 0.8; -} - -.entry-row.robots.invalid { - opacity: 1; - font-weight: bold; -} - -.invalid .entry_label { - font-weight: bold; -} - -.aioseop .aioseop_option_input tbody { - background: #FCFCFC; -} - -.All_in_One_SEO_Pack_Robots .aioseop .aioseop_option_input tbody { - background: transparent; -} - -.entry-row.robots div { - height: 20px; - vertical-align: middle; - width: 90%; - margin: 0 0 4px 0; -} - -.robots img { - margin: 0 0 0 2px; - opacity: 0.6; -} - -.aioseop_option_docs { - width: 98%; - display: none; - border: 1px solid #D3D3D3; - margin-top: 20px; - padding: 1%; - background-color: #EEE; -} - -.aioseop_option_docs h3 { - background: none; -} - -div.aioseop_notice { - position: relative; -} - -div.aioseop_notice a.aioseop_dismiss_link { - position: absolute; - top: 10px; - right: 10px; -} - -.aioseop_error_notice { - color: #f00; - font-weight: bold; -} - -.aioseop_input select { - margin: 7px 0; -} - -.aioseop_help_text ul { - margin: 15px 0 0 20px; -} - -.aioseop_help_text ul li { - line-height: 20px; - margin: 0; -} - -.aioseop_sidebar #side-sortables { - width: 98%; -} - -#aioseop_opengraph_settings .aioseop_option_label { - width: 30%; -} - -.aioseop_tabs { - padding-top: 6px; -} - -.aioseop_tabs.hide, -.aioseop_header_tabs.hide { - display: block !important; -} - -.aioseop_header_tabs li { - display: inline; - padding: 0; - margin: 0; -} - -.aioseop_header_tabs { - margin: 0; -} - -.aioseop_header_nav { - margin: 0; -} - -.aioseop_header_tabs li a.aioseop_header_tab.active { - background-color: rgb(255, 255, 255); - border-bottom-color: rgba(255, 255, 255, 0.5); - font-weight: bold; -} - -.aioseop_header_tabs li a.aioseop_header_tab { - font-size: 14px; - line-height: 37px; - text-decoration: none; - margin: 5px 5px 0 0; - padding: 10px; - cursor: pointer; - -webkit-border-top-right-radius: 3px; - -webkit-border-top-left-radius: 3px; - border-top-right-radius: 3px; - border-top-left-radius: 3px; - background-color: #e5e5e5; - border: 1px solid #ccc; - color: #5F5F5F; -} - -.aioseop_header_tabs li:first-child a.aioseop_header_tab { - border-left: solid 1px #CCC; - margin-left: 5px; -} - -.aioseop_tab { - border: solid 1px #CCC; - background-color: rgb(255, 255, 255); - background-color: rgba(255, 255, 255, 0.5); - padding: 10px; -} - -.aioseop_loading { - background-image: url('../../images/activity.gif'); - display: inline-block; - width: 24px; - height: 24px; - margin: 0; - padding: 0; - vertical-align: bottom; -} - -.aiosp_delete { - background-image: url('../../images/delete.png'); - display: inline-block; - width: 16px; - height: 16px; - margin: 0; - padding: 0; - vertical-align: bottom; -} - -form#aiosp_settings_form, -.aioseop_tabs_div { - padding-right: 477px; -} - -.aioseop_tabs_div { - margin-top: 10px; -} - -#aiosp_settings_form ul.sfwd_debug_settings li strong { - display: block; - float: left; - text-align: right; - background-color: #DDD; - margin-right: 8px; - padding: 1px 8px 1px 1px; - overflow: auto; - width: 200px; - min-height: 16px; -} - -#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n+1) strong { - background-color: #CCC; -} - -#aiosp_settings_form ul.sfwd_debug_settings li { - clear: left; - margin: 0; - padding: 0; - background-color: #EEE; - overflow: auto; - max-width: 75%; - min-width: 800px; -} - -#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n) { - background-color: #DDD; -} - -div.sfwd_debug_mail_sent { - background-color: #080; - border: 1px solid #0A0; - margin: 10px 0 10px 0; - width: 598px; - color: #FFF; - text-align: center; -} - -div.sfwd_debug_error { - background-color: #F00; - color: #FFF; - border: 1px solid #A00; - margin: 10px 0 10px 0; - width: 598px; - text-align: center; - font-weight: bolder; -} - -#aiosp_performance_status_wrapper .aioseop_option_div { - max-height: 420px; -} - -#aioseop_coming_soon, #aioseop_coming_soon2 { - padding-top: 40px; - text-align: center; - height: 258px; - font-size: 16px; -} - -.MRL { - margin-left: 20px !important; - margin-bottom: 10px !important; -} - -/** -* Edit Post screen specific styling -* -*/ -.postbox-container .aioseop_option_div { - width: 100%; -} - -.postbox-container .aioseop_option_div input[type="text"], -.postbox-container .aioseop_option_div textarea { - width: 99%; - max-width: 900px; -} - -.postbox-container .aioseop_option_label { - max-width: none; - height: auto !important; -} - -.postbox-container .aioseop_wrapper { - padding: 0; -} - -.postbox-container .aioseop_input { - display: block; - margin-bottom: 10px; - padding: 0; -} - -.postbox-container .aioseop_option_input { - width: 63%; - padding: 0; -} - -.postbox-container div#aiosp_upgrade_wrapper { - float: none; - width: auto; - margin: 0; - padding: 0; -} - -.postbox-container div#aiosp_upgrade_wrapper .aioseop_input { - display: block; - padding: 0; -} - -.postbox-container div#aiosp_upgrade_wrapper .aioseop_input .aioseop_option_input { - float: none; - width: auto; - padding: 0; -} - -.postbox-container div#aiosp_upgrade_wrapper .aioseop_input .aioseop_option_input .aioseop_option_div { - width: auto; - min-height: 0; - padding: 10px 0; -} - -.aioseop_tabs .aioseop_options { - margin: 0; -} - -#aioseop_opengraph_settings .aioseop_options { - clear: both; - margin-top: 35px; -} - -#aioseop_opengraph_settings .aioseop_option_input { - width: 70%; -} - -/** -* Preview Snippet styling -* -*/ -div#aiosp_snippet_wrapper { - border: 1px solid #888; - clear: both; - padding: 10px 10px 0; - max-width: 97%; - margin-bottom: 15px; -} - -div#aiosp_snippet_wrapper .aioseop_option_label { - height: auto !important; -} - -div#aiosp_snippet_wrapper .aioseop_input.aioseop_top_label .aioseop_option_input { - margin: 0; -} - -div#aioseop_snippet { - font-family: arial, sans-serif; - font-size: 13px; -} - -div#aioseop_snippet > h3 { - margin: 10px 0 5px; - font-size: 18px; - border: 0; - background: inherit; - font-weight: normal; -} - -div#aioseop_snippet > h3 > a { - color: #12c; - text-decoration: none; - cursor: pointer; -} - -div#aioseop_snippet > div { - color: #545454; - max-width: 48em; -} - -div#aioseop_snippet > div > div { - display: block; - margin-bottom: 1px; -} - -div#aioseop_snippet > div > div > cite { - color: #093; - font-style: normal; -} - -div#aioseop_snippet > div > span { - margin: 0; - padding: 0; - border: 0; -} - -/* the good, the bad and the ugly character counts */ -.aioseop_count_good { - color: #515151 !important; - background-color: #eee !important; -} -.aioseop_count_bad { - color: #515151 !important; - background-color: #ff0 !important; -} -.aioseop_count_ugly { - color: #fff !important; - background-color: #f00 !important; -} - -textarea.robots-text { - background-color: #eee; - width: 100%; - height: 100%; +/** + * Controls all the styling of the plugin. + * + * @author Michael Torbert. + * @author Semper Fi Web Design. + * @copyright http://semperplugins.com + * @package All-in-One-SEO-Pack. + */ + +.form-table.aioseop { + clear: none; +} + +.form-table.aioseop td { + vertical-align: top; + padding: 16px 0 10px 0; + line-height: 20px; + font-size: 12px; +} + +.form-table.aioseop th { + width: 200px; + padding: 10px 0 12px 9px; +} + +.aioseop_help_text_link, +.aioseop_help_text_link:active { + text-align: left; + float: left; + max-width: 300px; + min-width: 1px; + padding-top: 2px; + outline: none; + color: #888; + font-family: sans-serif; +} + +.aioseop_help_text_link span { + font-size: 14px; +} + +.aioseop_help_text_link:before { + content: "\f223"; + font-size: 27px; + font-family: dashicons; + vertical-align: middle; +} + +#aioseop-support .aioseop_metabox_text, +#aioseop-support a { + font-size: 14px; + color: #000; + text-decoration: none; +} + +.aioseop_icon { + display: inline-block; + width: 40px; + height: 40px; + background-repeat: no-repeat; + background-size: 100%; + vertical-align: middle; + margin: 10px; +} + +.aioseop_book_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAKlBMVEUAAAAAn+cAneEAnuABnuEBnuEAnuEAn+QAn+QAneAAnuEAneAAnuAAneFPI9ocAAAADnRSTlMAII/P/wCQMADwANDvnyPbz6kAAAB9SURBVHgB7c+xCQMgEIVhZwiSSRzhkRBImsA5gVUmuBGcJbUDxlhY6T2wvh/sPvBd+HdJWCSj0N8bsEEiIIOAyEBhIDGAcwA4cDBy4MDBTeuqCR5abXCvBHy+6ybQrs2R0jsH/As+srEzC55qggi81AIZ+waQxkBmQK5tD34LnXJVZf9y5gAAAABJRU5ErkJggg==); +} + +.aioseop_cog_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAeFBMVEUAAAAAn+MAnOIAn+cAneIAneEAn+MAnuEAneIAnuAAnuAAneEAn+cAn+QAn98AnuEAn98AneAAneEAneAAnOIAnuAAnuEAnuAAneEAn+EAnuEAnuAAneEAneAAneAAn+QAnuEAnuABnuEAneAAn+EAnuIAnuMBnuHeY3dlAAAAJ3RSTlMAQFAAYIAAkADP3wAgMACgEACfrwC/X++PbwAAcODwALDAANAATz8hP00ZAAACHklEQVR4Xq3XbWObIBAHcPAJJRjJVmtso4vL2vv+33AzJO2J/LuE9PfGFyR4HHiAgCQxyRMiYEtGTL5BBGzJiVEviIAtFTH6FRGowdBC/QsQqKGhhebeIdTkqe+LwFbkqew2SGyDftDKz12Q2AXYlhgeA46AD/G5oyD9zJO0zIEhvXd91L0mSPcmnZlek0nPhHu4mKu2ov+q2rZzOWE5kBRBFjNRzDRFqD6X8oGiHK5fo+0oSmcv06goknLfQk3RzHkaWwIGlUhrZaIGAto5iQn6uyw+yAFOpSgUTDEHJqqZc5DR2rgqw8lIa7mbRkkMLOOBoWZlWYrynwzGzx1C/3cdlEcvf7sgL5MTq8rGz22QNwjDP+cGBYBDOC6qcnLTNqQCeRbuYdEU4In47YjL84RSwEk+Tq8qT7xvhMc5eXsj78Buga866O4dQrXs4OEk3jaNTWC1Cfc43nSa0MQ0fCFFLWXL9saWFjQMgFOfEUR+zsl1KWeRBaWr3e7c01q3Lmld+FfiSVFQ/2ehp6B8IzaorGvJ8q8Jl/ViIkDv396tfX/bawKm81J+eGtLH91cX+xIUUZ7XYmPHTBmA0U4feMh6zqVwzTe8ubQvmBoUJeDphoIGtT5tVaq0Ttopvyom4M4xqz8YGXhiCLAnIKhg8N2iA30cLzrxmJH/H4cASejrjzcFHXpwrcukwIiRQZv2QICtjQP352/9fYuC+Qv593CTVvcgwkAAAAASUVORK5CYII=); +} + +.aioseop_file_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAPFBMVEUAAAAAneAAn98AneIAneEAnuAAn+QAnuAAnuAAnuEAn+MAnuEAneAAnuEAn+EAneEAnOIAnuEAnuABnuG5yOaaAAAAE3RSTlMA0BBgn88wv++gQLCvX2+PUJDAyp/15gAAALdJREFUeF7t1z2ygzAMhVFJjm0C5Ff732uaMCSWCVzTJO/paz1zRsVtTM/OUT+Wx5PQchJ1Q2O/CETdVk51IOjWugAeYLvUAEU6rAO4oLhQB2bSvh+NAAKU2AgYQGIEDHgXbjhQCFcYKIQuoUApZBQwQg8CRhhAwArSBlCagNAI0LTqAQCq3fcC+jOA7e8DDuhK/wDwHfgOfAe+A98B2BcC3Aaw+XiCBdp3AtOcNAgs9FoACZ7ufwCe6pfMGb29UwAAAABJRU5ErkJggg==); +} + +.aioseop_help_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAflBMVEUAAAAAn98AnuIAn+EAneAAnuAAnuAAn+QAn+QAneEAnuAAnuAAn+EAnuAAnuEAneAAn+cAneAAnuAAn98AnOIAnuEAneIAn+MAnuEAnuEAn+EAneIAneEAneEAnuEAn+MAneAAneEAnuMAnOIAn+cAneEBnuEAneAAnuMBnuEoGewkAAAAKXRSTlMAEE9/r7/fADCPzwBv718AIPDAAFCwYEAAoAAAn4CQAOAAPwAAcADQAFP96WQAAAMNSURBVHhelZcNc5swDIatBghpoCGEj9Jij2XLMv3/P7glkoNtZJo+d+0lhBOveSXZUjHgZZOkGf4nS5PNC5wiKPFqvnvFgNddvpVQy0tQZCiSFfCEAtiUGKXcwFcB3kpcpXx791HetypFn2NdH9EnrX67KPdL46g/tl3PeqHvWidM2fxyUM7n3fzgof8R0A9zjN3PGTV/HB+6teg66EeIUQqQIGOiSQMGmeRgUQfGPn/Ktyv0k9UQKrCxWzitAq3V6dvYIDG8f8mAROO6ULF/3ecTaHazcvIgjTw/PxfFeVFErCHd31C3fx2v39cKGy6qLKyA1tGr/v8BLWDyb3OLqiw+XGCiq8DFxIvypMKIHqMXvaeLmmyEkn1xSTCAjWcMS7gruFD+eo/QuEC7AYCy+nJXkC1/r5A4Gq2NrQCvjMnL7OZCLggY3KoAI5jMEvKt2hohBYK3wiveuwx8i3qn/uvVf0O2Hh5MnLwOZMTrXgGt4OCi7RuyXNg1F1oDqEZIQh2K6oUALalSWqgiIwUIM4VVqZZvdlkE7QQFFLRVNS3l5NLZarMkgkx6ebWiNPqzSu9nEkM2KDZhjbykh+19KKri3+LkIxLhVlE/E4CaAjsd4AYo9zJkR9huGF7CtPYSX9FyXG4XFHe2UQIt9fIGa6NNJBErX2r35O0wp7KEbZYSNpVtMYngSpbZYoI1G9YClFzOp+vKS6jviLFJ+fWgDralfZO5peW2xX8LKB9NdTtxsQuc7/wV0OTv/YRyiUuIugCls7FwizffsXHgzcRurjEjYgH8zdVKyODZJUDGAuxZubNnt5BIgMQ7YNyowy2c0XfCqyNX6HzE2Ve8A28+nmDDHaJyD9sNChpkxvCYRxgkEjitAkl40AzPjxm7KdNnSAzLgaNFZhcVATtkBmliGaTJSJ6mBnnkMWgpx+XAMZZoMbGZqXEHm6Q4sxA4F4k7DEkjD1PVGJCmGFDLQ5elO+Iqx7B/q88A0FKI+DSlBLMuE4pMF3h6+DZXDLia6PAtA41u67uUqW51E02uf46zvXx+HY4YAAAAAElFTkSuQmCC); +} + +.aioseop_support_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAe1BMVEUAAAAAn98AnuIAn+EAneAAnuAAnuABnuEAn98An+QAneEAnuAAn+QAn+EAnuAAnuEAneAAnuEAneIAn+MAn+cAn+cAnuEAnuEAnOIAneEAneEAnOIAnuAAneEAn+MAneAAneEAneIAnuEAnuIAneAAnuAAneABnuEAnuPdwDkgAAAAKXRSTlMAEE9/r7/f/wAwj88Ab+9f0JBgQCAAALBQcAAAAJ8AAIAAoADgwPAAP4Dl7rAAAALsSURBVHgBtdcBc6I6EAfwRCH/KjUSTCW2eHK8kHff/xM+Dg5NlsTTOu830xmc0BhJdtllKXy1znKBgciz9Yq/JbC3mM22AFFsN+8x7H2B7wSixI4/sAK+lkiSa/63CfbXfy9VddAfA32oVHmdYn8MsaNP55jUhpOFmRqTXH/4mP/BSExOnxEnTKT58jDveouZaCIEZltvWna7POPm8GPhgJtzbIIMnvq4UMOTXWZsvjgjoD8IjcCZrkAh1H4SLUIq3EYDQjSEBGH8XdASVPUzUIGS2jsHORbyJpC8gzWDChGaPsL4ItnwxyUiuuPqnBdAkW9X/3SIkPxPMLWIkZJcL7XTNnKJb5J8XMEJ33YaVyCQYJUZ0tjGKIsE8XsXNuNUFpStvFMQGR4Xvhlyoppi51AjUAcZhdPRIVzr8UCzYzEfS91afxOJDle2Hc9IBaBoGMdg/raq/3s49/NPm/6TGQDl5Up3DoCN5G9uAbjOO6AlAMPa8Zd4JI0kP55k41EAWlaT+w0Ae4mytyAenQDUrCcZsCMr8igydADQM0ECrydf4zEA+uZGAygYBv96ivF4RG3GffNgsJiAfr439v9MUN7/CeXFgwGzrz1Eu9hG9eQ2Rg+SaKJE5CB1y6Ps7h1ld/FMR9mEm6vPEoCIBZMAIM/e8xoTQRjO+5y8fT0ZJvlc5PwJ57fymlDWMloBLKoHsb4mlPLCLnNKyxDIwpRGR72UtsEgUhoKrx7bR4Z3c1J9Tyft7ep3Wl9t04l/rFBefrFwh29y/N7L1TlynXy5JpbQHY3qS6Dslfnq4guYa+UXC4xBj4W+CSTvYFMEuOeLLKf9Ytssd5hw6TJv9FKhOeqeK3W7ZcNRP1Nsd7GOpXu83O/iLY8ij5CwmKlUz2TcIy2PIy2PT/eYZLRV5fsMk542XaHK3VrV/a+p7fu1uzWyjiZs9pPgrUOSa6ONJ8FPFlH2xB9uvlUJolTJ5juOm7buLQa2r1uvkSX+A/xd+1xZLxG0AAAAAElFTkSuQmCC); +} + +.aioseop_youtube_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAARVBMVEUAAAAAn+cAn+EAneAAnuABnuEAn+cAn98AneEAn98AnOIAnuAAnOIAneIAneIAnuEAnuEAneEAnuEBnuEAn+QAneAAneCXjc90AAAAF3RSTlMAIG+vz/8AEJ8AUO8AYACgAHCwADDw0E/SOHoAAAEBSURBVHgB7dbBjsIgGATgH+UvCAso3fL+j7rDYZMerGGZQ5NNv8TrREZLRy47F3O7Wx1m7zezAMjSOa9/5t2jkweEqBNi+ALBJ+mklHOWnINOC/0buKjTokMHRQnlKUYpRl5HBQ32KFXfW783HVDFHgWsrg0EWNEDK4z0+yEAEhuAIsgAFMEFQOECILEBKIIMQBFcABQuABIbgCLIABTBBUBhAzx5BEuWGM/9GT35V7bkwxTPfZw9eaVZ8lKN517rI8NHmr43cPyufXi5Rh1Q+dc7PTAWduI83abTNteHJjvz6KEJYeoU2+/UBVcm+tuNbTCv2nRYq2k/9ylXwL8I+AGj+lzlceKDYQAAAABJRU5ErkJggg==); +} + +.aioseop_meta_box_help > label { + position: absolute; + margin-left: 8px; +} + +div.aioseop_tip_icon { + font-size: 14px; + border: 1px solid #888; + width: 1em; + text-align: center; + padding: 0 4px; + -webkit-border-radius: 12px; + -moz-border-radius: 12px; + -webkit-box-shadow: 1px 1px 1px #888; + -moz-box-shadow: 1px 1px 1px #888; + box-shadow: 1px 1px 1px #888; + border-radius: 12px; +} + +div.aioseop_tip_icon:before { + content: '?'; +} + +.aioseop_help_text_link img { + width: 40px; + float: left; +} + +.aioseop_meta_box_help, +.aioseop_meta_box_help:active { + float: right; + padding-left: 0; + width: 16px; + margin-right: 32px; + text-decoration: none; + height: 15px; + padding-top: 1px; + position: relative; +} + +.aioseop_tabs .aioseop_meta_box_help, +.aioseop_tabs .aioseop_meta_box_help:active { + margin-top: 4px; + margin-right: 45px; +} + +.aioseop_label { + color: #5F5F5F; + font-weight: bold; + line-height: 19px; + display: inline-block; + text-align: left; + position: absolute; + font-family: 'Open Sans', sans-serif; + width: 26%; + min-width: 120px; + max-width: 230px; +} + +.aioseop_option_div { + max-height: 360px; + min-height: 37px; + width: 95%; + overflow-y: auto; +} + +.aioseop_overflowed { + border: 1px solid #e1e1e1; +} + +.aioseop input[type="text"] { + color: #515151; + height: 35px; + padding: 10px 0 10px 10px; + font-size: 14px; + width: 95%; + max-width: 600px; +} + +.aioseop textarea { + color: #515151; + padding: 10px 0 0 10px; + margin: 0; + font-size: 14px; + line-height: 25px; + width: 95%; + max-width: 600px; +} + +.aioseop_help_text_div { + text-align: left; + width: 100%; + margin: 0; +} + +.aioseop_help_text { + font-size: 12px; + float: left; + clear: left; + color: #797979; + line-height: 15px; + font-style: italic; +} + +.aioseop_head_tagline { + color: #5F5F5F; + font-size: 13px; +} + +.aioseop_head_nav { + float: left; + font-size: 18px; + margin: 0 0 16px 0; + font-family: "HelveticaNeue-Light", + "Helvetica Neue Light", + "Helvetica Neue", + sans-serif; + border-bottom: 1px solid #CCC; + width: 100%; +} + +.aioseop_head_nav_tab { + padding: 10px 15px 10px 15px; + margin: 0 0 0 15px; + border-radius: 4px 4px 0 0; + border: 1px solid #CCC; + border-bottom: 0 white; + float: left; + opacity: 0.5; + color: black; + text-shadow: white 0 1px 0; + text-decoration: none; +} + +.aioseop_head_nav_tab.aioseop_head_nav_active { + opacity: 1; + margin-bottom: -1px; + border-width: 1px; +} + +.aioseop_head_nav_tab:first-child { + margin-left: 0; +} + +.aioseop_head_nav_tab:hover { + opacity: 1; +} + +.aioseop_header { + float: left; + clear: left; +} + +.aioseop_advert { + padding: 10px; + margin-bottom: 30px; + border: 1px solid #DDD; + height: 200px; + width: 423px; +} + +.aioseop_nopad { + padding-left: 0; + padding-top: 0; +} + +.aioseop_nopad_all { + padding: 0; + height: 220px; + width: 445px; + margin-bottom: 20px; + border: none; +} + +.aioseop_adverts { + float: right; +} + +.wincherad { + width: 100%; + height: 100%; + background-size: 100%; + background-repeat: no-repeat; + margin-bottom: 0; + border: none; +} + +#wincher21 { + background-image: url(../../modules/images/banner21.jpg); +} + +#wincher22 { + background-image: url(../../modules/images/banner22.jpg); +} + +.aioseop_content { + min-width: 760px; + clear: left; +} + +.aioseop_options_wrapper .hndle { + font-size: 15px; + font-family: Georgia, + "Times New Roman", + "Bitstream Charter", + Times, + serif; + font-weight: normal; + padding: 7px 10px; + margin: 0; + line-height: 1; +} + +.aioseop_options_wrapper .submit input.button-primary { + margin-bottom: 5px; +} + +#aiosp_feature_manager_metabox.postbox { + margin-top: 20px; + float: left; +} + +.aioseop_advert p { + margin: 25px 0 25px 0; +} + +.aioseop_options_wrapper .postarea { + border-color: #DFDFDF; + -moz-box-shadow: inset 0 1px 0 #fff; + -webkit-box-shadow: inset 0 1px 0 #fff; + box-shadow: inset 0 1px 0 #fff; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.aioseop_advert h3 { + padding: 0; + margin-top: 6px; +} + +.aioseop_metabox_text p { + margin: 0 0 0 0; + width: 101%; +} + +.aioseop_sidebar { + width: 457px; + margin-left: 10px; +} + +.aioseop_metabox_text { + margin-bottom: 0; +} + +.aioseop_metabox_wrapper { + padding: 0; +} + +.aioseop_metabox_text *:last-child { + margin: 0; +} + +.aioseop_metabox_feature { + margin-top: 20px; +} + +.aioseop_translations { + margin-top: 15px; +} + +.aioseop_option_label { + float: left; + margin: 0; + min-width: 150px; + width: 37%; + max-width: 270px; + padding-top: 3px; + padding-bottom: 3px; + height: 67px !important; /*added for certain language support*/ +} + +.aioseop_metabox_text h2 { + font-size: 14px; + padding: 0; + font-weight: bold; + line-height: 29px; +} + +#aioseop-about { + width: 443px; + margin-bottom: 20px; +} + +#aioseop-about .aioseop_metabox_text #mc-embedded-subscribe-form h2 { + font-size: 13px; +} + +.aioseop_sidebar #mc-embedded-subscribe-form { + margin: 0 0 10px 0; + background: white; + padding: 10px 10px; + border: 1px solid #DDD; +} + +#aioseop-about .aioseop_metabox_text ul { + list-style-type: disc; + padding-left: 15px; +} + +.aioseop input[readonly] { + background-color: #EEE; + margin: 5px 0 5px 0 !important; +} + +.aioseop_settings_left { + float: left; + padding: 0; + margin: 0; + width: 100%; +} + +body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_settings_left { + margin-top: 20px; +} + +body.all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager .aioseop_settings_left { + margin-top: 20px; +} + +#aioseop_top_button { + margin-top: 5px; + height: 30px; +} + +#aioseop-list #mce-EMAIL { + margin-top: 5px; + width: 250px; +} + +.aioseop_top { + margin: 10px 10px 0 0; + /* margin: 10px 477px 0px 0px; */ +} + +.aioseop_top #aioseop-list { + margin-bottom: 0; +} + +.aioseop_top #aioseop-list.postbox.closed { + overflow: hidden; +} + +.aioseop_right_sidebar { + float: right; + margin-top: 35px; +} + +#aiosp_settings_form .button-primary.hidden { + display: none; +} + +form#edittag div#aiosp_titleatr_wrapper, +form#edittag div#aiosp_menulabel_wrapper, +form#edittag div#aiosp_sitemap_exclude_wrapper { + display: none; +} + +.All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > #aioseop_top_button { + height: 5px; + position: absolute; + top: 0; + width: 97%; +} + +.All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > .aioseop_settings_left { + margin-top: 10px; +} + +.All_in_One_SEO_Pack_Feature_Manager > .aioseop_right_sidebar.aioseop_options_wrapper { + margin-top: 10px; +} + +div#aiosp_feature_manager_metabox .inside { + padding: 8px; +} + +div.aioseop_feature { + position: relative; + display: inline-block; + float: left; + vertical-align: top; + width: 240px; + height: 288px; + margin: 8px; + border: 1px solid #DEDEDE; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + background: white; + padding: 10px 0 0; + -webkit-box-shadow: inset 0 1px 0 #fff, + inset 0 0 20px rgba(0, 0, 0, 0.05), + 0 1px 2px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0 1px 0 #fff, + inset 0 0 20px rgba(0, 0, 0, 0.05), + 0 1px 2px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 0 #fff, + inset 0 0 20px rgba(0, 0, 0, 0.05), + 0 1px 2px rgba(0, 0, 0, 0.1); + -webkit-transition-duration: .4s; + -moz-transition-duration: .4s; +} + +.aioseop_feature .flag { + float: right; + margin-right: -7px; + background: none repeat scroll 0 0 #D23D46; + color: #FFFFFF; + padding: 5px 12px 6px 5px; + position: relative; +} + +.aioseop_feature .flag:before { + border-color: #D23D46 #D23D46 #D23D46 transparent; + border-style: solid; + border-width: 14px 4px 15px 10px; + content: ""; + left: -14px; + position: absolute; + top: 0; +} + +.aioseop_feature .flag:after { + border-color: #892026 transparent transparent; + border-style: solid; + border-width: 6px 6px 6px 0; + bottom: -12px; + content: ""; + position: absolute; + right: 0; +} + +.aioseop_feature .flag.pro { + display: none; +} + +#aioseop_coming_soon .free.flag, +.all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager .aioseop_feature .free.flag { + display: none; +} + +#aioseop_coming_soon .flag.pro { + display: block; + margin-top: -30px; +} + +.all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager #aioseop_coming_soon .flag.pro { + display: none; +} + +.aioseop_feature h3 { + font-size: 17px; + margin: 0; + padding: 0 10px 5px 10px; + font-weight: normal; + font-style: normal; + font-family: "Helvetica Neue", + Helvetica, + Arial, + "Lucida Grande", + Verdana, + "Bitstream Vera Sans", + sans-serif; +} + +.aioseop_feature p { + line-height: 150%; + font-size: 12px; + font-family: Georgia, + "Times New Roman", + "Bitstream Charter", + Times, serif; + margin-bottom: 20px; + color: #666; + padding: 0 10px; +} + +.aioseop_feature p.aioseop_desc { + min-height: 80px; +} + +.aioseop_feature .feature_button { + float: right; + margin-bottom: 10px; + margin-right: 10px; + min-width: 80px; + text-align: center; +} + +.aioseop_feature .feature_button:before { + content: "Activate"; +} + +.aioseop_feature .active.feature_button:before { + content: "Deactivate"; +} + +div.aioseop_feature .aioseop_featured_image { + min-height: 100px; + background-repeat: no-repeat; + display: block; + margin: 0 auto; + width: 133px; +} + +div.aioseop_feature .aioseop_featured_image { + background-image: url(../../modules/images/Default-BW-Standard.png); +} + +div.aioseop_feature .aioseop_featured_image.active { + background-image: url(../../modules/images/Default-Color-Standard.png); +} + +div.aioseop_feature#aioseop_sitemap .aioseop_featured_image { + background-image: url(../../modules/images/XMLSitemaps-BW-Standard.png); +} + +div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active { + background-image: url(../../modules/images/XMLSitemaps-Color-Standard.png); +} + +div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image { + background-image: url(../../modules/images/VideoSitemap-BW-Standard.png); +} + +div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active { + background-image: url(../../modules/images/VideoSitemap-Color-Standard.png); +} + +div.aioseop_feature#aioseop_opengraph .aioseop_featured_image { + background-image: url(../../modules/images/SocialMeta-BW-Standard.png); +} + +div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active { + background-image: url(../../modules/images/SocialMeta-Color-Standard.png); +} + +div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image { + background-image: url(../../modules/images/Robots-BW-Standard.png); +} + +div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active { + background-image: url(../../modules/images/Robots-Color-Standard.png); +} + +div.aioseop_feature#aioseop_file_editor .aioseop_featured_image { + background-image: url(../../modules/images/FileEditor-BW-Standard.png); +} + +div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active { + background-image: url(../../modules/images/FileEditor-Color-Standard.png); +} + +div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image { + background-image: url(../../modules/images/ImporterExporter-BW-Standard.png); +} + +div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active { + background-image: url(../../modules/images/ImporterExporter-Color-Standard.png); +} + +div.aioseop_feature#aioseop_performance .aioseop_featured_image { + background-image: url(../../modules/images/Performance-BW-Standard.png); +} + +div.aioseop_feature#aioseop_performance .aioseop_featured_image.active { + background-image: url(../../modules/images/Performance-Color-Standard.png); +} + +div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image { + background-image: url(../../modules/images/Default-Color-Standard.png); +} + +div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image { + background-image: url(../../modules/images/Default-Color-Standard.png); +} + +.All_in_One_SEO_Pack_Sitemap > form > .wrap > .form-table, +.All_in_One_SEO_Pack_Video_Sitemap > form > .wrap > .form-table { + max-width: 500px; + clear: none; +} + +.aioseop_follow_button { + min-height: 50px; + background-repeat: no-repeat; + display: inline-block; + width: 100px; + background-size: auto 50px !important; + margin-right: 0; +} + +.aioseop_facebook_follow { + background-image: url(../../modules/images/facebook-follow-standard.png); +} + +.aioseop_twitter_follow { + background-image: url(../../modules/images/twitter-follow-standard.png); +} + +@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and ( min--moz-device-pixel-ratio: 1.5), only screen and ( -o-min-device-pixel-ratio: 3/2), only screen and ( min-device-pixel-ratio: 1.5), only screen and ( min-resolution: 1.5dppx) { + div.aioseop_feature .aioseop_featured_image { + background-size: auto 100px !important; + } + + div.aioseop_feature .aioseop_featured_image.active { + background-image: url(../../modules/images/Default-Color-Retina.png); + } + + div.aioseop_feature .aioseop_featured_image { + background-image: url(../../modules/images/Default-BW-Retina.png); + } + + div.aioseop_feature#aioseop_sitemap .aioseop_featured_image { + background-image: url(../../modules/images/XMLSitemaps-BW-Retina.png); + } + + div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active { + background-image: url(../../modules/images/XMLSitemaps-Color-Retina.png); + } + + div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image { + background-image: url(../../modules/images/VideoSitemap-BW-Retina.png); + } + + div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active { + background-image: url(../../modules/images/VideoSitemap-Color-Retina.png); + } + + div.aioseop_feature#aioseop_opengraph .aioseop_featured_image { + background-image: url(../../modules/images/SocialMeta-BW-Retina.png); + } + + div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active { + background-image: url(../../modules/images/SocialMeta-Color-Retina.png); + } + + div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image { + background-image: url(../../modules/images/Robots-BW-Retina.png); + } + + div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active { + background-image: url(../../modules/images/Robots-Color-Retina.png); + } + + div.aioseop_feature#aioseop_file_editor .aioseop_featured_image { + background-image: url(../../modules/images/FileEditor-BW-Retina.png); + } + + div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active { + background-image: url(../../modules/images/FileEditor-Color-Retina.png); + } + + div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image { + background-image: url(../../modules/images/ImporterExporter-BW-Retina.png); + } + + div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active { + background-image: url(../../modules/images/ImporterExporter-Color-Retina.png); + } + + div.aioseop_feature#aioseop_performance .aioseop_featured_image { + background-image: url(../../modules/images/Performance-BW-Retina.png); + } + + div.aioseop_feature#aioseop_performance .aioseop_featured_image.active { + background-image: url(../../modules/images/Performance-Color-Retina.png); + } + + div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image { + background-image: url(../../modules/images/Default-BW-Retina.png); + } + + div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image { + background-image: url(../../modules/images/Default-BW-Retina.png); + } + + .aioseop_facebook_follow { + background-image: url(../../modules/images/facebook-follow-retina.png); + } + + .aioseop_twitter_follow { + background-image: url(../../modules/images/twitter-follow-retina.png); + } +} + +.aioseop_options { + width: 100%; + margin: 18px 0 10px 0; +} + +.aioseop_wrapper { + width: 100%; + padding-left: 5px; +} + +.aioseop_input { + clear: left; + width: 100%; + padding: 5px; + display: inline; +} + +.aioseop_option_input { + float: left; + width: 61%; + margin: 0; + padding-left: 1px; + min-width: 160px; + /* max-width: 900px; */ +} + +/*** Sitemap Additional Pages section ***/ +#aiosp_sitemap_addl_pages_metabox .aioseop_options, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_options { + width: 97%; + margin: 5px; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_sitemap_addl_instructions_wrapper, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_video_sitemap_addl_instructions_wrapper { + display: block; + width: 100%; + float: none; + margin: 0; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_sitemap_addl_instructions_wrapper .aioseop_input, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_video_sitemap_addl_instructions_wrapper .aioseop_input { + display: block; + width: 100%; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper { + padding: 0; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_input, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_input { + display: inline-block; + vertical-align: middle; + width: 25%; + min-width: 120px; + height: 70px; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_top_label, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_top_label { + width: 70%; + margin: 0; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_option_label, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_option_label { + height: 30px !important; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_sitemap_addl_mod_wrapper input.aiseop-date, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_video_sitemap_addl_mod_wrapper input.aiseop-date { + height: 36px; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type { + margin: 0; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type input.button-primary, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type input.button-primary { + margin-left: 0 !important; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_help_text_div, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_help_text_div { + position: absolute; + width: auto; + margin: 5px 0 10px 0; +} + +#aiosp_sitemap_addl_pages_metabox table.aioseop_table, +#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table { + width: 96%; + border: 1px solid #CCC; + margin: 5px 5px 10px; +} + +table.aioseop_table tr:nth-child(odd) { + background-color: #EEE; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr:nth-child(odd) { + background-color: rgba(238, 238, 238, 0.5); +} + +table.aioseop_table td { + width: 23%; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table { + width: 80%; + max-width: 800px; + display: block; + border-top: 1px solid #dfdfdf; + border-left: 1px solid #dfdfdf; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table th { + width: 18%; + border-right: 1px solid #dfdfdf; + border-bottom: 1px solid #dfdfdf; +} + +.All_in_One_SEO_Pack_Opengraph div.aioseop_meta_info { + margin-top: 10px; + border: 1px solid #dfdfdf; + width: 80%; + max-width: 800px; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr.aioseop_table_header th { + background: #f1f1f1; + background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9)); + background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9); + background-image: -moz-linear-gradient(bottom, #ececec, #f9f9f9); + background-image: -o-linear-gradient(bottom, #ececec, #f9f9f9); + background-image: linear-gradient(to top, #ececec, #f9f9f9); + padding: 5px; + border-bottom-color: #dfdfdf; + text-shadow: #fff 0 1px 0; + -webkit-box-shadow: 0 1px 0 #fff; + -moz-box-shadow: 0 1px 0 #fff; + box-shadow: 0 1px 0 #fff; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table td { + border-right: 1px solid #dfdfdf; + border-bottom: 1px solid #dfdfdf; +} + +#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item { + display: inline-block; + width: 30%; + vertical-align: top; +} + +#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(even) { + font-weight: bold; +} + +#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(odd) { + width: 70%; +} + +#aiosp_sitemap_addl_pages_metabox table.aioseop_table td, +#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td { + width: 27%; + padding-left: 5%; +} + +#aiosp_sitemap_addl_pages_metabox table.aioseop_table td:first-child, +#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td:first-child { + padding-left: 2%; +} + +table.aioseop_table td, table.aioseop_table th { + padding: 3px; +} + +.aioseop_top_label .aioseop_option_input, +.aioseop_no_label .aioseop_option_input { + width: 100%; +} + +#aiosp_settings_form .postbox { + margin: 0 0 20px 0; +} + +.aioseop_settings_left .postbox { + float: left; + width: 100%; +} + +.aioseop_option_setting_label { + min-height: 35px; + display: inline-block; + white-space: nowrap; + overflow: hidden; + padding-left: 1px; + max-width: 229px; + min-width: 160px; + width: 33%; +} + +.aioseop_settings_left .postbox .inside { + padding: 0; + margin: 0; + clear: right; +} + +#aiosp_robots_rules { + clear: left; + margin-left: 20px; + max-width: 1072px; +} + +#aiosp_robots_default_metabox .aioseop_wrapper { + width: 31%; + min-width: 165px; + display: inline-block; + max-width: 265px; +} + +#aiosp_robots_default_metabox .aioseop_help_text_div { + position: absolute; + margin: 5px 0 10px 0; +} + +#aiosp_robots_default_metabox .aioseop_option_input { + width: 94%; + min-width: 94%; +} + +#aiosp_robots_default_metabox table.aioseop_table { + width: 96%; + border: 1px solid #CCC; + margin: 5px 0 10px 0; +} + +#aiosp_robots_default_metabox table.aioseop_table td { + width: 25%; + padding-left: 5%; +} + +#aiosp_settings_form .aioseop_no_label, .aioseop_no_label { + float: left; + width: 92%; + max-width: 100%; + margin: 0 23px 0 13px; +} + +#aiosp_sitemap_status_metabox .handlediv.button-link { + display: none; +} + +#aiosp_sitemap_status_metabox.closed .inside { + display: block; +} + +.aioseop_top_label { + width: 96%; + margin: 0 10px; +} + +.aioseop_hidden_type { + margin: 0; + padding: 0; + height: 0; +} + +#aiosp_title_metabox #aiosp_force_rewrites_wrapper { + display: none; + height: 0; +} + +.aioseop_module.error.below-h2 { + padding: 5px 0; + margin: 0 477px 15px 0 !important; +} + +#aioseop_opengraph_settings .inside { + margin: 0; +} + +#aioseop_opengraph_settings_image_wrapper img { + width: auto; + height: 75px; +} + +#aioseop_opengraph_settings_image_wrapper .aioseop_option_setting_label { + max-width: 160px; + min-width: 100px; + width: 30%; +} + +.aioseop_input input[type="checkbox"], +.aioseop_input input[type="radio"] { + vertical-align: text-bottom; + margin-top: 8px; +} + +#aiosp_importer_exporter_import_export_help_wrapper .aioseop_option_div { + max-height: initial; +} + +#aiosp { + width: auto; +} + +.aioseop_input.aioseop_top_label .aioseop_option_input { + margin: 0 0 10px 0; +} + +.aiosp_file_editor_settings > .aioseop_textarea_type .aioseop_option_div { + max-height: none; +} + +/* Robots.txt styling */ +#aiosp_robots_generator_robotgen_wrapper .aioseop_option_div, +#aiosp_robots_generator_robothtml_wrapper .aioseop_option_div { + max-height: none; +} + +.aioseop_option_input .widefat td { + vertical-align: middle; +} + +.entry-row.robots.quirks { + font-weight: bold; + opacity: 1; +} + +.entry-row.robots { + opacity: 0.8; +} + +.entry-row.robots.invalid { + opacity: 1; + font-weight: bold; +} + +.invalid .entry_label { + font-weight: bold; +} + +.aioseop .aioseop_option_input tbody { + background: #FCFCFC; +} + +.All_in_One_SEO_Pack_Robots .aioseop .aioseop_option_input tbody { + background: transparent; +} + +.entry-row.robots div { + height: 20px; + vertical-align: middle; + width: 90%; + margin: 0 0 4px 0; +} + +.robots img { + margin: 0 0 0 2px; + opacity: 0.6; +} + +.aioseop_option_docs { + width: 98%; + display: none; + border: 1px solid #D3D3D3; + margin-top: 20px; + padding: 1%; + background-color: #EEE; +} + +.aioseop_option_docs h3 { + background: none; +} + +div.aioseop_notice { + position: relative; +} + +div.aioseop_notice a.aioseop_dismiss_link { + position: absolute; + top: 10px; + right: 10px; +} + +.aioseop_error_notice { + color: #f00; + font-weight: bold; +} + +.aioseop_input select { + margin: 7px 0; +} + +.aioseop_help_text ul { + margin: 15px 0 0 20px; +} + +.aioseop_help_text ul li { + line-height: 20px; + margin: 0; +} + +.aioseop_sidebar #side-sortables { + width: 98%; +} + +#aioseop_opengraph_settings .aioseop_option_label { + width: 30%; +} + +.aioseop_tabs { + padding-top: 6px; +} + +.aioseop_tabs.hide, +.aioseop_header_tabs.hide { + display: block !important; +} + +.aioseop_header_tabs li { + display: inline; + padding: 0; + margin: 0; +} + +.aioseop_header_tabs { + margin: 0; +} + +.aioseop_header_nav { + margin: 0; +} + +.aioseop_header_tabs li a.aioseop_header_tab.active { + background-color: rgb(255, 255, 255); + border-bottom-color: rgba(255, 255, 255, 0.5); + font-weight: bold; +} + +.aioseop_header_tabs li a.aioseop_header_tab { + font-size: 14px; + line-height: 37px; + text-decoration: none; + margin: 5px 5px 0 0; + padding: 10px; + cursor: pointer; + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; + background-color: #e5e5e5; + border: 1px solid #ccc; + color: #5F5F5F; +} + +.aioseop_header_tabs li:first-child a.aioseop_header_tab { + border-left: solid 1px #CCC; + margin-left: 5px; +} + +.aioseop_tab { + border: solid 1px #CCC; + background-color: rgb(255, 255, 255); + background-color: rgba(255, 255, 255, 0.5); + padding: 10px; +} + +.aioseop_loading { + background-image: url('../../images/activity.gif'); + display: inline-block; + width: 24px; + height: 24px; + margin: 0; + padding: 0; + vertical-align: bottom; +} + +.aiosp_delete { + background-image: url('../../images/delete.png'); + display: inline-block; + width: 16px; + height: 16px; + margin: 0; + padding: 0; + vertical-align: bottom; +} + +form#aiosp_settings_form, +.aioseop_tabs_div { + padding-right: 477px; +} + +.aioseop_tabs_div { + margin-top: 10px; +} + +#aiosp_settings_form ul.sfwd_debug_settings li strong { + display: block; + float: left; + text-align: right; + background-color: #DDD; + margin-right: 8px; + padding: 1px 8px 1px 1px; + overflow: auto; + width: 200px; + min-height: 16px; +} + +#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n+1) strong { + background-color: #CCC; +} + +#aiosp_settings_form ul.sfwd_debug_settings li { + clear: left; + margin: 0; + padding: 0; + background-color: #EEE; + overflow: auto; + max-width: 75%; + min-width: 800px; +} + +#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n) { + background-color: #DDD; +} + +div.sfwd_debug_mail_sent { + background-color: #080; + border: 1px solid #0A0; + margin: 10px 0 10px 0; + width: 598px; + color: #FFF; + text-align: center; +} + +div.sfwd_debug_error { + background-color: #F00; + color: #FFF; + border: 1px solid #A00; + margin: 10px 0 10px 0; + width: 598px; + text-align: center; + font-weight: bolder; +} + +#aiosp_performance_status_wrapper .aioseop_option_div { + max-height: 420px; +} + +#aioseop_coming_soon, #aioseop_coming_soon2 { + padding-top: 40px; + text-align: center; + height: 258px; + font-size: 16px; +} + +.MRL { + margin-left: 20px !important; + margin-bottom: 10px !important; +} + +/** +* Edit Post screen specific styling +* +*/ +.postbox-container .aioseop_option_div { + width: 100%; +} + +.postbox-container .aioseop_option_div input[type="text"], +.postbox-container .aioseop_option_div textarea { + width: 99%; + max-width: 900px; +} + +.postbox-container .aioseop_option_label { + max-width: none; + height: auto !important; +} + +.postbox-container .aioseop_wrapper { + padding: 0; +} + +.postbox-container .aioseop_input { + display: block; + margin-bottom: 10px; + padding: 0; +} + +.postbox-container .aioseop_option_input { + width: 63%; + padding: 0; +} + +.postbox-container div#aiosp_upgrade_wrapper { + float: none; + width: auto; + margin: 0; + padding: 0; +} + +.postbox-container div#aiosp_upgrade_wrapper .aioseop_input { + display: block; + padding: 0; +} + +.postbox-container div#aiosp_upgrade_wrapper .aioseop_input .aioseop_option_input { + float: none; + width: auto; + padding: 0; +} + +.postbox-container div#aiosp_upgrade_wrapper .aioseop_input .aioseop_option_input .aioseop_option_div { + width: auto; + min-height: 0; + padding: 10px 0; +} + +.aioseop_tabs .aioseop_options { + margin: 0; +} + +#aioseop_opengraph_settings .aioseop_options { + clear: both; + margin-top: 35px; +} + +#aioseop_opengraph_settings .aioseop_option_input { + width: 70%; +} + +/** +* Preview Snippet styling +* +*/ +div#aiosp_snippet_wrapper { + border: 1px solid #888; + clear: both; + padding: 10px 10px 0; + max-width: 97%; + margin-bottom: 15px; +} + +div#aiosp_snippet_wrapper .aioseop_option_label { + height: auto !important; +} + +div#aiosp_snippet_wrapper .aioseop_input.aioseop_top_label .aioseop_option_input { + margin: 0; +} + +div#aioseop_snippet { + font-family: arial, sans-serif; + font-size: 13px; +} + +div#aioseop_snippet > h3 { + margin: 10px 0 5px; + font-size: 18px; + border: 0; + background: inherit; + font-weight: normal; +} + +div#aioseop_snippet > h3 > a { + color: #12c; + text-decoration: none; + cursor: pointer; +} + +div#aioseop_snippet > div { + color: #545454; + max-width: 48em; +} + +div#aioseop_snippet > div > div { + display: block; + margin-bottom: 1px; +} + +div#aioseop_snippet > div > div > cite { + color: #093; + font-style: normal; +} + +div#aioseop_snippet > div > span { + margin: 0; + padding: 0; + border: 0; +} + +/* the good, the bad and the ugly character counts */ +.aioseop_count_good { + color: #515151 !important; + background-color: #eee !important; +} +.aioseop_count_bad { + color: #515151 !important; + background-color: #ff0 !important; +} +.aioseop_count_ugly { + color: #fff !important; + background-color: #f00 !important; +} + +textarea.robots-text { + background-color: #eee; + width: 100%; + height: 100%; } \ No newline at end of file diff --git a/js/modules/aioseop_module.js b/js/modules/aioseop_module.js index 7d8e4d927..5a5bcfef2 100644 --- a/js/modules/aioseop_module.js +++ b/js/modules/aioseop_module.js @@ -855,7 +855,12 @@ function aioseop_overflow_border( el ) { } function aiospinitAll(){ - if ( jQuery( '.aiseop-date' ).length > 0 && jQuery( '.aiseop-date' ).eq( 0 ).prop( 'type' ).toLowerCase() === 'text' ) { + aiospinitSocialMetaInPosts(jQuery); + aiospinitCalendar(); +} + +function aiospinitCalendar(){ + if ( jQuery( '.aiseop-date' ).length > 0 && jQuery( '.aiseop-date' ).eq( 0 ).prop( 'type' ).toLowerCase() === 'text' ) { jQuery( '.aiseop-date' ).datepicker( { dateFormat: "yy-mm-dd" @@ -864,6 +869,14 @@ function aiospinitAll(){ } } +function aiospinitSocialMetaInPosts($) { + // clear the radio buttons when the user clicks the upload button. + $('input[name="aioseop_opengraph_settings_customimg_checker"] ~ .aioseop_upload_image_button').on('click', function(e){ + $('input[name="aioseop_opengraph_settings_image"]').attr('checked', false); + }); +} + + function aiospinitCounting(){ /* count them characters */ jQuery( '.aioseop_count_chars' ).on('keyup keydown', function(){ @@ -872,4 +885,4 @@ function aiospinitCounting(){ jQuery( '.aioseop_count_chars' ).each(function(){ countChars( jQuery(this).eq(0), jQuery(this).parent().find('[name="' + jQuery(this).attr('data-length-field') + '"]').eq(0)); }); -} +} \ No newline at end of file diff --git a/modules/aioseop_opengraph.php b/modules/aioseop_opengraph.php index d516f6ffe..4828e6a24 100644 --- a/modules/aioseop_opengraph.php +++ b/modules/aioseop_opengraph.php @@ -1,1740 +1,1740 @@ -name = __( 'Social Meta', 'all-in-one-seo-pack' ); // Human-readable name of the plugin - $this->prefix = 'aiosp_opengraph_'; // option prefix - $this->file = __FILE__; // the current file - $this->fb_object_types = array( - 'Activities' => array( - 'activity' => __( 'Activity', 'all-in-one-seo-pack' ), - 'sport' => __( 'Sport', 'all-in-one-seo-pack' ), - ), - 'Businesses' => array( - 'bar' => __( 'Bar', 'all-in-one-seo-pack' ), - 'company' => __( 'Company', 'all-in-one-seo-pack' ), - 'cafe' => __( 'Cafe', 'all-in-one-seo-pack' ), - 'hotel' => __( 'Hotel', 'all-in-one-seo-pack' ), - 'restaurant' => __( 'Restaurant', 'all-in-one-seo-pack' ), - ), - 'Groups' => array( - 'cause' => __( 'Cause', 'all-in-one-seo-pack' ), - 'sports_league' => __( 'Sports League', 'all-in-one-seo-pack' ), - 'sports_team' => __( 'Sports Team', 'all-in-one-seo-pack' ), - ), - 'Organizations' => array( - 'band' => __( 'Band', 'all-in-one-seo-pack' ), - 'government' => __( 'Government', 'all-in-one-seo-pack' ), - 'non_profit' => __( 'Non Profit', 'all-in-one-seo-pack' ), - 'school' => __( 'School', 'all-in-one-seo-pack' ), - 'university' => __( 'University', 'all-in-one-seo-pack' ), - ), - 'People' => array( - 'actor' => __( 'Actor', 'all-in-one-seo-pack' ), - 'athlete' => __( 'Athlete', 'all-in-one-seo-pack' ), - 'author' => __( 'Author', 'all-in-one-seo-pack' ), - 'director' => __( 'Director', 'all-in-one-seo-pack' ), - 'musician' => __( 'Musician', 'all-in-one-seo-pack' ), - 'politician' => __( 'Politician', 'all-in-one-seo-pack' ), - 'profile' => __( 'Profile', 'all-in-one-seo-pack' ), - 'public_figure' => __( 'Public Figure', 'all-in-one-seo-pack' ), - ), - 'Places' => array( - 'city' => __( 'City', 'all-in-one-seo-pack' ), - 'country' => __( 'Country', 'all-in-one-seo-pack' ), - 'landmark' => __( 'Landmark', 'all-in-one-seo-pack' ), - 'state_province' => __( 'State Province', 'all-in-one-seo-pack' ), - ), - 'Products and Entertainment' => array( - 'album' => __( 'Album', 'all-in-one-seo-pack' ), - 'book' => __( 'Book', 'all-in-one-seo-pack' ), - 'drink' => __( 'Drink', 'all-in-one-seo-pack' ), - 'food' => __( 'Food', 'all-in-one-seo-pack' ), - 'game' => __( 'Game', 'all-in-one-seo-pack' ), - 'movie' => __( 'Movie', 'all-in-one-seo-pack' ), - 'product' => __( 'Product', 'all-in-one-seo-pack' ), - 'song' => __( 'Song', 'all-in-one-seo-pack' ), - 'tv_show' => __( 'TV Show', 'all-in-one-seo-pack' ), - 'episode' => __( 'Episode', 'all-in-one-seo-pack' ), - ), - 'Websites' => array( - 'article' => __( 'Article', 'all-in-one-seo-pack' ), - 'blog' => __( 'Blog', 'all-in-one-seo-pack' ), - 'website' => __( 'Website', 'all-in-one-seo-pack' ), - ), - ); - parent::__construct(); - - $this->help_text = array( - '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' ), - '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' ), - 'appid' => __( 'Enter your Facebook App ID here. Information about how to get your Facebook App ID can be found at https://developers.facebook.com/docs/apps/register', 'all-in-one-seo-pack' ), - 'title_shortcodes' => __( 'Run shortcodes that appear in social title meta tags.', 'all-in-one-seo-pack' ), - 'description_shortcodes' => __( 'Run shortcodes that appear in social description meta tags.', 'all-in-one-seo-pack' ), - 'sitename' => __( 'The Site Name is the name that is used to identify your website.', 'all-in-one-seo-pack' ), - 'hometitle' => __( 'The Home Title is the Open Graph title for your home page.', 'all-in-one-seo-pack' ), - 'description' => __( 'The Home Description is the Open Graph description for your home page.', 'all-in-one-seo-pack' ), - 'homeimage' => __( 'The Home Image is the Open Graph image for your home page.', 'all-in-one-seo-pack' ), - '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' ), - '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' ), - 'fallback' => __( 'This option lets you fall back to the default image if no image could be found above.', 'all-in-one-seo-pack' ), - 'dimg' => __( 'This option sets a default image that can be used for the Open Graph image. You can upload an image, select an image from your Media Library or paste the URL of an image here.', 'all-in-one-seo-pack' ), - 'dimgwidth' => __( 'This option lets you set a default width for your images, where unspecified.', 'all-in-one-seo-pack' ), - 'dimgheight' => __( 'This option lets you set a default height for your images, where unspecified.', 'all-in-one-seo-pack' ), - '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' ), - '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' ), - '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' ), - 'imagewidth' => __( 'Enter the width for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ), - 'imageheight' => __( 'Enter the height for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ), - 'video' => __( 'This option lets you specify a link to the Open Graph video used on this Page or Post.', 'all-in-one-seo-pack' ), - 'videowidth' => __( 'Enter the width for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ), - 'videoheight' => __( 'Enter the height for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ), - 'defcard' => __( 'Select the default type of Twitter Card to display.', 'all-in-one-seo-pack' ), - 'setcard' => __( 'Select the Twitter Card type to use for this Page or Post, overriding the default setting.', 'all-in-one-seo-pack' ), - 'twitter_site' => __( 'Enter the Twitter username associated with your website here.', 'all-in-one-seo-pack' ), - 'twitter_creator' => __( 'Allows your authors to be identified by their Twitter usernames as content creators on the Twitter cards for their posts.', 'all-in-one-seo-pack' ), - 'twitter_domain' => __( 'Enter the name of your website here.', 'all-in-one-seo-pack' ), - 'customimg_twitter' => __( 'This option lets you upload an image to use as the Twitter image for this Page or Post.', 'all-in-one-seo-pack' ), - 'gen_tags' => __( 'Automatically generate article tags for Facebook type article when not provided.', 'all-in-one-seo-pack' ), - 'gen_keywords' => __( 'Use keywords in generated article tags.', 'all-in-one-seo-pack' ), - 'gen_categories' => __( 'Use categories in generated article tags.', 'all-in-one-seo-pack' ), - 'gen_post_tags' => __( 'Use post tags in generated article tags.', 'all-in-one-seo-pack' ), - 'types' => __( 'Select which Post Types you want to use All in One SEO Pack to set Open Graph meta values for.', 'all-in-one-seo-pack' ), - 'title' => __( 'This is the Open Graph title of this Page or Post.', 'all-in-one-seo-pack' ), - 'desc' => __( 'This is the Open Graph description of this Page or Post.', 'all-in-one-seo-pack' ), - 'category' => __( 'Select the Open Graph type that best describes the content of this Page or Post.', 'all-in-one-seo-pack' ), - 'facebook_debug' => __( 'Press this button to have Facebook re-fetch and debug this page.', 'all-in-one-seo-pack' ), - 'section' => __( 'This Open Graph meta allows you to add a general section name that best describes this content.', 'all-in-one-seo-pack' ), - 'tag' => __( 'This Open Graph meta allows you to add a list of keywords that best describe this content.', 'all-in-one-seo-pack' ), - 'facebook_publisher' => __( 'Link articles to the Facebook page associated with your website.', 'all-in-one-seo-pack' ), - 'facebook_author' => __( 'Allows your authors to be identified by their Facebook pages as content authors on the Opengraph meta for their articles.', 'all-in-one-seo-pack' ), - 'person_or_org' => __( 'Are the social profile links for your website for a person or an organization?', 'all-in-one-seo-pack' ), - 'profile_links' => __( "Add URLs for your website's social profiles here (Facebook, Twitter, Google+, Instagram, LinkedIn), one per line.", 'all-in-one-seo-pack' ), - 'social_name' => __( 'Add the name of the person or organization who owns these profiles.', 'all-in-one-seo-pack' ), - ); - - $this->help_anchors = array( - 'title_shortcodes' => '#run-shortcodes-in-title', - 'description_shortcodes' => '#run-shortcodes-in-description', - 'generate_descriptions' => '#auto-generate-og-descriptions', - 'setmeta' => '#use-aioseo-title-and-description', - 'sitename' => '#site-name', - 'hometitle' => '#home-title-and-description', - 'description' => '#home-title-and-description', - 'homeimage' => '#home-image', - 'defimg' => '#select-og-image-source', - 'fallback' => '#use-default-if-no-image-found', - 'dimg' => '#default-og-image', - 'dimgwidth' => '#default-image-width', - 'dimgheight' => '#default-image-height', - 'meta_key' => '#use-custom-field-for-image', - 'profile_links' => '#social-profile-links', - 'person_or_org' => '#social-profile-links', - 'social_name' => '#social-profile-links', - 'key' => '#facebook-admin-id', - 'appid' => '#facebook-app-id', - 'gen_tags' => '#automatically-generate-article-tags', - 'gen_keywords' => '#use-keywords-in-article-tags', - 'gen_categories' => '#use-categories-in-article-tags', - 'gen_post_tags' => '#use-post-tags-in-article-tags', - 'facebook_publisher' => '#show-facebook-publisher-on-articles', - 'facebook_author' => '#show-facebook-author-on-articles', - 'types' => '#enable-facebook-meta-for', - 'defcard' => '#default-twitter-card', - 'twitter_site' => '#twitter-site', - 'twitter_creator' => '#show-twitter-author', - 'twitter_domain' => '#twitter-domain', - 'scan_header' => '#scan-social-meta', - 'title' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#title', - 'desc' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#description', - 'image' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#image', - 'customimg' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-image', - 'imagewidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height', - 'imageheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height', - 'video' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-video', - 'videowidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height', - 'videoheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height', - 'category' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-object-type', - 'facebook_debug' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-debug', - 'section' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-section', - 'tag' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-tags', - 'setcard' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#twitter-card-type', - 'customimg_twitter' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-twitter-image', - ); - - if ( is_admin() ) { - add_action( 'admin_init', array( $this, 'admin_init' ), 5 ); - } else { - add_action( 'wp', array( $this, 'type_setup' ) ); - } - - if ( ! is_admin() || defined( 'DOING_AJAX' ) ) { - $this->do_opengraph(); - } - // Set variables after WordPress load. - add_action( 'init', array( &$this, 'init' ), 999999 ); - add_filter( 'jetpack_enable_open_graph', '__return_false' ); // Avoid having duplicate meta tags - // Force refresh of Facebook cache. - add_action( 'post_updated', array( &$this, 'force_fb_refresh_update' ), 10, 3 ); - add_action( 'transition_post_status', array( &$this, 'force_fb_refresh_transition' ), 10, 3 ); - add_action( 'edited_term', array( &$this, 'save_tax_data' ), 10, 3 ); - // Adds special filters - add_filter( 'aioseop_opengraph_placeholder', array( &$this, 'filter_placeholder' ) ); - // Call to init to generate menus - $this->init(); - } - - /** - * Hook called after WordPress has been loaded. - * - * @since 2.4.14 - */ - public function init() { - $count_desc = __( ' characters. Open Graph allows up to a maximum of %1$s chars for the %2$s.', 'all-in-one-seo-pack' ); - // Create default options - $this->default_options = array( - 'scan_header' => array( - 'name' => __( 'Scan Header', 'all-in-one-seo-pack' ), - 'type' => 'custom', - 'save' => true, - ), - 'setmeta' => array( - 'name' => __( 'Use AIOSEO Title and Description', 'all-in-one-seo-pack' ), - 'type' => 'checkbox', - ), - 'key' => array( - 'name' => __( 'Facebook Admin ID', 'all-in-one-seo-pack' ), - 'default' => '', - 'type' => 'text', - ), - 'appid' => array( - 'name' => __( 'Facebook App ID', 'all-in-one-seo-pack' ), - 'default' => '', - 'type' => 'text', - ), - 'title_shortcodes' => array( - 'name' => __( 'Run Shortcodes In Title', 'all-in-one-seo-pack' ), - ), - 'description_shortcodes' => array( - 'name' => __( 'Run Shortcodes In Description', 'all-in-one-seo-pack' ), - ), - 'sitename' => array( - 'name' => __( 'Site Name', 'all-in-one-seo-pack' ), - 'default' => get_bloginfo( 'name' ), - 'type' => 'text', - ), - 'hometitle' => array( - 'name' => __( 'Home Title', 'all-in-one-seo-pack' ), - 'default' => '', - 'type' => 'textarea', - 'condshow' => array( - 'aiosp_opengraph_setmeta' => array( - 'lhs' => 'aiosp_opengraph_setmeta', - 'op' => '!=', - 'rhs' => 'on', - ), - ), - ), - 'description' => array( - 'name' => __( 'Home Description', 'all-in-one-seo-pack' ), - 'default' => '', - 'type' => 'textarea', - 'condshow' => array( - 'aiosp_opengraph_setmeta' => array( - 'lhs' => 'aiosp_opengraph_setmeta', - 'op' => '!=', - 'rhs' => 'on', - ), - ), - ), - 'homeimage' => array( - 'name' => __( 'Home Image', 'all-in-one-seo-pack' ), - 'type' => 'image', - ), - 'generate_descriptions' => array( - 'name' => __( 'Use Content For Autogenerated OG Descriptions', 'all-in-one-seo-pack' ), - 'default' => 0, - ), - 'defimg' => array( - 'name' => __( 'Select OG:Image Source', 'all-in-one-seo-pack' ), - 'type' => 'select', - 'initial_options' => array( - '' => __( 'Default Image' ), - 'featured' => __( 'Featured Image' ), - 'attach' => __( 'First Attached Image' ), - 'content' => __( 'First Image In Content' ), - 'custom' => __( 'Image From Custom Field' ), - 'author' => __( 'Post Author Image' ), - 'auto' => __( 'First Available Image' ), - ), - ), - 'fallback' => array( - 'name' => __( 'Use Default If No Image Found', 'all-in-one-seo-pack' ), - 'type' => 'checkbox', - ), - 'dimg' => array( - 'name' => __( 'Default OG:Image', 'all-in-one-seo-pack' ), - 'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png', - 'type' => 'image', - ), - 'dimgwidth' => array( - 'name' => __( 'Default Image Width', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'dimgheight' => array( - 'name' => __( 'Default Image Height', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'meta_key' => array( - 'name' => __( 'Use Custom Field For Image', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'image' => array( - 'name' => __( 'Image', 'all-in-one-seo-pack' ), - 'type' => 'radio', - 'initial_options' => array( - 0 => '', - ), - ), - 'customimg' => array( - 'name' => __( 'Custom Image', 'all-in-one-seo-pack' ), - 'type' => 'image', - ), - 'imagewidth' => array( - 'name' => __( 'Specify Image Width', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'imageheight' => array( - 'name' => __( 'Specify Image Height', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'video' => array( - 'name' => __( 'Custom Video', 'all-in-one-seo-pack' ), - 'type' => 'text', - ), - 'videowidth' => array( - 'name' => __( 'Specify Video Width', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - 'condshow' => array( - 'aioseop_opengraph_settings_video' => array( - 'lhs' => 'aioseop_opengraph_settings_video', - 'op' => '!=', - 'rhs' => '', - ), - ), - ), - 'videoheight' => array( - 'name' => __( 'Specify Video Height', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - 'condshow' => array( - 'aioseop_opengraph_settings_video' => array( - 'lhs' => 'aioseop_opengraph_settings_video', - 'op' => '!=', - 'rhs' => '', - ), - ), - ), - 'defcard' => array( - 'name' => __( 'Default Twitter Card', 'all-in-one-seo-pack' ), - 'type' => 'select', - 'default' => 'summary', - 'initial_options' => array( - 'summary' => __( 'Summary', 'all-in-one-seo-pack' ), - 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ), - - /* - REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE - 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) - */ - ), - ), - 'setcard' => array( - 'name' => __( 'Twitter Card Type', 'all-in-one-seo-pack' ), - 'type' => 'select', - 'initial_options' => array( - 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ), - 'summary' => __( 'Summary', 'all-in-one-seo-pack' ), - - /* - REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE - 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) - */ - ), - ), - 'twitter_site' => array( - 'name' => __( 'Twitter Site', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'twitter_creator' => array( - 'name' => __( 'Show Twitter Author', 'all-in-one-seo-pack' ), - ), - 'twitter_domain' => array( - 'name' => __( 'Twitter Domain', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'customimg_twitter' => array( - 'name' => __( 'Custom Twitter Image', 'all-in-one-seo-pack' ), - 'type' => 'image', - ), - 'gen_tags' => array( - 'name' => __( 'Automatically Generate Article Tags', 'all-in-one-seo-pack' ), - ), - 'gen_keywords' => array( - 'name' => __( 'Use Keywords In Article Tags', 'all-in-one-seo-pack' ), - 'default' => 'on', - 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), - ), - 'gen_categories' => array( - 'name' => __( 'Use Categories In Article Tags', 'all-in-one-seo-pack' ), - 'default' => 'on', - 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), - ), - 'gen_post_tags' => array( - 'name' => __( 'Use Post Tags In Article Tags', 'all-in-one-seo-pack' ), - 'default' => 'on', - 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), - ), - 'types' => array( - 'name' => __( 'Enable Facebook Meta for Post Types', 'all-in-one-seo-pack' ), - 'type' => 'multicheckbox', - 'default' => array( 'post' => 'post', 'page' => 'page' ), - 'initial_options' => $this->get_post_type_titles( array( '_builtin' => false ) ), - ), - 'title' => array( - 'name' => __( 'Title', 'all-in-one-seo-pack' ), - 'default' => '', - 'type' => 'text', - 'size' => 95, - 'count' => 1, - 'count_desc' => $count_desc, - ), - 'desc' => array( - 'name' => __( 'Description', 'all-in-one-seo-pack' ), - 'default' => '', - 'type' => 'textarea', - 'cols' => 250, - 'rows' => 4, - 'count' => 1, - 'count_desc' => $count_desc, - ), - 'category' => array( - 'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ), - 'type' => 'select', - 'style' => '', - 'default' => '', - 'initial_options' => $this->fb_object_types, - ), - 'facebook_debug' => array( - 'name' => __( 'Facebook Debug', 'all-in-one-seo-pack' ), - 'type' => 'html', - 'save' => false, - 'default' => $this->get_facebook_debug(), - ), - 'section' => array( - 'name' => __( 'Article Section', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ), - ), - 'tag' => array( - 'name' => __( 'Article Tags', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ), - ), - 'facebook_publisher' => array( - 'name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'facebook_author' => array( - 'name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' ), - ), - 'profile_links' => array( - 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), - 'type' => 'textarea', - 'cols' => 60, - 'rows' => 5, - ), - 'person_or_org' => array( - 'name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ), - 'type' => 'radio', - 'initial_options' => array( - 'person' => __( 'Person', 'all-in-one-seo-pack' ), - 'org' => __( 'Organization', 'all-in-one-seo-pack' ), - ), - ), - 'social_name' => array( - 'name' => __( 'Associated Name', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - ); - // load initial options / set defaults - $this->update_options(); - $display = array(); - if ( isset( $this->options['aiosp_opengraph_types'] ) && ! empty( $this->options['aiosp_opengraph_types'] ) ) { - $display = $this->options['aiosp_opengraph_types']; - } - $this->locations = array( - 'opengraph' => array( - 'name' => $this->name, - 'prefix' => 'aiosp_', - 'type' => 'settings', - 'options' => array( - 'scan_header', - 'setmeta', - 'key', - 'appid', - 'sitename', - 'title_shortcodes', - 'description_shortcodes', - 'hometitle', - 'description', - 'homeimage', - 'generate_descriptions', - 'defimg', - 'fallback', - 'dimg', - 'dimgwidth', - 'dimgheight', - 'meta_key', - 'defcard', - 'profile_links', - 'person_or_org', - 'social_name', - 'twitter_site', - 'twitter_creator', - 'twitter_domain', - 'gen_tags', - 'gen_keywords', - 'gen_categories', - 'gen_post_tags', - 'types', - 'facebook_publisher', - 'facebook_author', - ), - ), - 'settings' => array( - 'name' => __( 'Social Settings', 'all-in-one-seo-pack' ), - 'type' => 'metabox', - 'help_link' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/', - 'options' => array( - 'title', - 'desc', - 'image', - 'customimg', - 'imagewidth', - 'imageheight', - 'video', - 'videowidth', - 'videoheight', - 'category', - 'facebook_debug', - 'section', - 'tag', - 'setcard', - 'customimg_twitter', - ), - 'display' => apply_filters( 'aioseop_opengraph_display', $display ), - 'prefix' => 'aioseop_opengraph_', - ), - ); - $this->layout = array( - 'home' => array( - 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#use-aioseo-title-and-description', - 'options' => array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage' ), - ), - 'image' => array( - 'name' => __( 'Image Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#select-og-image-source', - 'options' => array( 'defimg', 'fallback', 'dimg', 'dimgwidth', 'dimgheight', 'meta_key' ), - ), - 'links' => array( - 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#social-profile-links', - 'options' => array( 'profile_links', 'person_or_org', 'social_name' ), - ), - 'facebook' => array( - 'name' => __( 'Facebook Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#facebook-settings', - 'options' => array( - 'key', - 'appid', - 'types', - 'gen_tags', - 'gen_keywords', - 'gen_categories', - 'gen_post_tags', - 'facebook_publisher', - 'facebook_author', - ), - ), - 'twitter' => array( - 'name' => __( 'Twitter Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#default-twitter-card', - 'options' => array( 'defcard', 'setcard', 'twitter_site', 'twitter_creator', 'twitter_domain' ), - ), - 'default' => array( - 'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/', - 'options' => array(), // this is set below, to the remaining options -- pdb - ), - 'scan_meta' => array( - 'name' => __( 'Scan Social Meta', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#scan_meta', - 'options' => array( 'scan_header' ), - ), - ); - $other_options = array(); - foreach ( $this->layout as $k => $v ) { - $other_options = array_merge( $other_options, $v['options'] ); - } - - $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options ); - } - - /** - * Forces FaceBook OpenGraph to refresh its cache when a post is changed to - * - * @param $new_status - * @param $old_status - * @param $post - * - * @todo this and force_fb_refresh_update can probably have the remote POST extracted out. - * - * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update - * @since 2.3.11 - */ - function force_fb_refresh_transition( $new_status, $old_status, $post ) { - if ( 'publish' !== $new_status ) { - return; - } - if ( 'future' !== $old_status ) { - return; - } - - $current_post_type = get_post_type(); - - // Only ping Facebook if Social SEO is enabled on this post type. - if ( $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) { - $post_url = aioseop_get_permalink( $post->ID ); - $endpoint = sprintf( - 'https://graph.facebook.com/?%s', http_build_query( - array( - 'id' => $post_url, - 'scrape' => true, - ) - ) - ); - wp_remote_post( $endpoint, array( 'blocking' => false ) ); - } - } - - /** - * Forces FaceBook OpenGraph refresh on update. - * - * @param $post_id - * @param $post_after - * - * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update - * @since 2.3.11 - */ - function force_fb_refresh_update( $post_id, $post_after ) { - - $current_post_type = get_post_type(); - - // Only ping Facebook if Social SEO is enabled on this post type. - if ( 'publish' === $post_after->post_status && $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) { - $post_url = aioseop_get_permalink( $post_id ); - $endpoint = sprintf( - 'https://graph.facebook.com/?%s', http_build_query( - array( - 'id' => $post_url, - 'scrape' => true, - ) - ) - ); - wp_remote_post( $endpoint, array( 'blocking' => false ) ); - } - } - - function settings_page_init() { - add_filter( 'aiosp_output_option', array( $this, 'display_custom_options' ), 10, 2 ); - } - - function filter_options( $options, $location ) { - if ( $location == 'settings' ) { - $prefix = $this->get_prefix( $location ) . $location . '_'; - list( $legacy, $images ) = $this->get_all_images( $options ); - if ( isset( $options ) && isset( $options["{$prefix}image"] ) ) { - $thumbnail = $options["{$prefix}image"]; - if ( ctype_digit( (string) $thumbnail ) || ( $thumbnail == 'post' ) ) { - if ( $thumbnail == 'post' ) { - $thumbnail = $images['post1']; - } elseif ( ! empty( $legacy[ $thumbnail ] ) ) { - $thumbnail = $legacy[ $thumbnail ]; - } - } - $options["{$prefix}image"] = $thumbnail; - } - if ( empty( $options[ $prefix . 'image' ] ) ) { - $img = array_keys( $images ); - if ( ! empty( $img ) && ! empty( $img[1] ) ) { - $options[ $prefix . 'image' ] = $img[1]; - } - } - } - - return $options; - } - - /** - * Applies filter to module settings. - * - * @since 2.3.11 - * @since 2.4.14 Added filter for description and title placeholders. - * @since 2.3.15 do_shortcode on description. - * - * @see [plugin]\admin\aioseop_module_class.php > display_options() - */ - function filter_settings( $settings, $location, $current ) { - global $aiosp, $post; - if ( $location == 'opengraph' || $location == 'settings' ) { - $prefix = $this->get_prefix( $location ) . $location . '_'; - if ( $location == 'opengraph' ) { - return $settings; - } - if ( $location == 'settings' ) { - list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current ); - $opts = array( 'title', 'desc' ); - $current_post_type = get_post_type(); - if ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) { - $flat_type_list = array(); - foreach ( $this->fb_object_types as $k => $v ) { - if ( is_array( $v ) ) { - $flat_type_list = array_merge( $flat_type_list, $v ); - } else { - $flat_type_list[ $k ] = $v; - } - } - $settings[ $prefix . 'category' ]['initial_options'] = array_merge( - array( - $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] => __( 'Default ', 'all-in-one-seo-pack' ) . ' - ' - . $flat_type_list[ $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ], - ), - $settings[ $prefix . 'category' ]['initial_options'] - ); - } - if ( isset( $this->options['aiosp_opengraph_defcard'] ) ) { - $settings[ $prefix . 'setcard' ]['default'] = $this->options['aiosp_opengraph_defcard']; - } - $info = $aiosp->get_page_snippet_info(); - $title = $info['title']; - $description = $info['description']; - - // Description options - if ( is_object( $post ) ) { - // Always show excerpt - $description = empty( $this->options['aiosp_opengraph_generate_descriptions'] ) - ? $aiosp->trim_excerpt_without_filters( - $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ), - 1000 - ) - : $aiosp->trim_excerpt_without_filters( - $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), - 1000 - ); - } - - // Add filters - $description = apply_filters( 'aioseop_description', $description ); - // Add placholders - $settings[ "{$prefix}title" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $title ); - $settings[ "{$prefix}desc" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $description ); - } - if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) { - foreach ( $opts as $opt ) { - if ( isset( $settings[ $prefix . $opt ] ) ) { - $settings[ $prefix . $opt ]['type'] = 'hidden'; - $settings[ $prefix . $opt ]['label'] = 'none'; - $settings[ $prefix . $opt ]['help_text'] = ''; - unset( $settings[ $prefix . $opt ]['count'] ); - } - } - } - } - - return $settings; - } - - /** - * Applies filter to module options. - * These will display in the "Social Settings" object tab. - * filter:{prefix}override_options - * - * @since 2.3.11 - * @since 2.4.14 Overrides empty og:type values. - * - * @see [plugin]\admin\aioseop_module_class.php > display_options() - * - * @global array $aioseop_options Plugin options. - * - * @param array $options Current options. - * @param string $location Location where filter is called. - * @param array $settings Settings. - * - * @return array - */ - function override_options( $options, $location, $settings ) { - global $aioseop_options; - // Prepare default and prefix - $prefix = $this->get_prefix( $location ) . $location . '_'; - $opts = array(); - - foreach ( $settings as $k => $v ) { - if ( $v['save'] ) { - $opts[ $k ] = $v['default']; - } - } - foreach ( $options as $k => $v ) { - switch ( $k ) { - case $prefix . 'category': - if ( empty( $v ) ) { - // Get post type - $type = isset( get_current_screen()->post_type ) - ? get_current_screen()->post_type - : null; - // Assign default from plugin options - if ( ! empty( $type ) - && isset( $aioseop_options['modules'] ) - && isset( $aioseop_options['modules']['aiosp_opengraph_options'] ) - && isset( $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ] ) - ) { - $options[ $prefix . 'category' ] = - $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ]; - } - continue; - } - break; - } - if ( $v === null ) { - unset( $options[ $k ] ); - } - } - $options = wp_parse_args( $options, $opts ); - - return $options; - } - - /** - * Applies filter to metabox settings before they are saved. - * Sets custom as default if a custom image is uploaded. - * filter:{prefix}filter_metabox_options - * filter:{prefix}filter_term_metabox_options - * - * @since 2.3.11 - * @since 2.4.14 Fixes for aioseop-pro #67 and other bugs found. - * - * @see [plugin]\admin\aioseop_module_class.php > save_post_data() - * @see [this file] > save_tax_data() - * - * @param array $options List of current options. - * @param string $location Location where filter is called. - * @param int $id Either post_id or term_id. - * - * @return array - */ - function filter_metabox_options( $options, $location, $post_id ) { - if ( $location == 'settings' ) { - $prefix = $this->get_prefix( $location ) . $location . '_'; - if ( isset( $options[ $prefix . 'customimg_checker' ] ) - && $options[ $prefix . 'customimg_checker' ] - ) { - $options[ $prefix . 'image' ] = $options[ $prefix . 'customimg' ]; - } - } - return $options; - } - - /** Custom settings **/ - function display_custom_options( $buf, $args ) { - if ( $args['name'] == 'aiosp_opengraph_scan_header' ) { - $buf .= '
    '; - $args['options']['type'] = 'submit'; - $args['attr'] = " class='button-primary' "; - $args['value'] = $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' ); - $buf .= __( 'Scan your site for duplicate social meta tags.', 'all-in-one-seo-pack' ); - $buf .= '

    ' . $this->get_option_html( $args ); - $buf .= '
    '; - } - - return $buf; - } - - function add_attributes( $output ) { - // avoid having duplicate meta tags - $type = $this->type; - if ( empty( $type ) ) { - $type = 'website'; - } - - $schema_types = array( - 'album' => 'MusicAlbum', - 'article' => 'Article', - 'bar' => 'BarOrPub', - 'blog' => 'Blog', - 'book' => 'Book', - 'cafe' => 'CafeOrCoffeeShop', - 'city' => 'City', - 'country' => 'Country', - 'episode' => 'Episode', - 'food' => 'FoodEvent', - 'game' => 'Game', - 'hotel' => 'Hotel', - 'landmark' => 'LandmarksOrHistoricalBuildings', - 'movie' => 'Movie', - 'product' => 'Product', - 'profile' => 'ProfilePage', - 'restaurant' => 'Restaurant', - 'school' => 'School', - 'sport' => 'SportsEvent', - 'website' => 'WebSite', - ); - - if ( ! empty( $schema_types[ $type ] ) ) { - $type = $schema_types[ $type ]; - } else { - $type = 'WebSite'; - } - - $attributes = apply_filters( - $this->prefix . 'attributes', array( - 'itemscope', - 'itemtype="http://schema.org/' . ucfirst( $type ) . '"', - 'prefix="og: http://ogp.me/ns#"', - ) - ); - - foreach ( $attributes as $attr ) { - if ( strpos( $output, $attr ) === false ) { - $output .= "\n\t$attr "; - } - } - - return $output; - } - - /** - * Add our social meta. - * - * @since 1.0.0 - * @since 2.3.11.5 Support for multiple fb_admins. - * @since 2.3.13 Adds filter:aioseop_description on description. - * @since 2.4.14 Fixes for aioseop-pro #67. - * @since 2.3.15 Always do_shortcode on descriptions, removed for titles. - * - * @global object $post Current WP_Post object. - * @global object $aiosp All in one seo plugin object. - * @global array $aioseop_options All in one seo plugin options. - * @global object $wp_query WP_Query global instance. - */ - function add_meta() { - global $post, $aiosp, $aioseop_options, $wp_query; - $metabox = $this->get_current_options( array(), 'settings' ); - $key = $this->options['aiosp_opengraph_key']; - $dimg = $this->options['aiosp_opengraph_dimg']; - $current_post_type = get_post_type(); - $title = $description = $image = $video = ''; - $type = $this->type; - $sitename = $this->options['aiosp_opengraph_sitename']; - - $appid = isset( $this->options['aiosp_opengraph_appid'] ) ? $this->options['aiosp_opengraph_appid'] : ''; - - if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) { - $first_page = false; - if ( $aiosp->get_page_number() < 2 ) { - $first_page = true; - } - } else { - $first_page = true; - } - $url = $aiosp->aiosp_mrt_get_url( $wp_query ); - $url = apply_filters( 'aioseop_canonical_url', $url ); - - $setmeta = $this->options['aiosp_opengraph_setmeta']; - $social_links = ''; - if ( is_front_page() ) { - $title = $this->options['aiosp_opengraph_hometitle']; - if ( $first_page ) { - $description = $this->options['aiosp_opengraph_description']; - if ( empty( $description ) ) { - $description = get_bloginfo( 'description' ); - } - } - if ( ! empty( $this->options['aiosp_opengraph_homeimage'] ) ) { - $thumbnail = $this->options['aiosp_opengraph_homeimage']; - } else { - $thumbnail = $this->options['aiosp_opengraph_dimg']; - } - - /* If Use AIOSEO Title and Desc Selected */ - if ( $setmeta ) { - $title = $aiosp->wp_title(); - if ( $first_page ) { - $description = $aiosp->get_aioseop_description( $post ); - } - } - - /* Add some defaults */ - if ( empty( $title ) ) { - $title = get_bloginfo( 'name' ); - } - if ( empty( $sitename ) ) { - $sitename = get_bloginfo( 'name' ); - } - - if ( empty( $description ) && $first_page && ! empty( $post ) && ! post_password_required( $post ) ) { - - if ( ! empty( $post->post_content ) || ! empty( $post->post_excerpt ) ) { - $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ), 1000 ); - - if ( ! empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) { - $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 ); - } - } - } - - if ( empty( $description ) && $first_page ) { - $description = get_bloginfo( 'description' ); - } - if ( ! empty( $this->options['aiosp_opengraph_profile_links'] ) ) { - $social_links = $this->options['aiosp_opengraph_profile_links']; - if ( ! empty( $this->options['aiosp_opengraph_social_name'] ) ) { - $social_name = $this->options['aiosp_opengraph_social_name']; - } else { - $social_name = ''; - } - if ( $this->options['aiosp_opengraph_person_or_org'] == 'person' ) { - $social_type = 'Person'; - } else { - $social_type = 'Organization'; - } - } - } elseif ( is_singular() && $this->option_isset( 'types' ) - && is_array( $this->options['aiosp_opengraph_types'] ) - && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) - ) { - - if ( $type == 'article' ) { - if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) { - $section = $metabox['aioseop_opengraph_settings_section']; - } - if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) { - $tag = $metabox['aioseop_opengraph_settings_tag']; - } - if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) { - $publisher = $this->options['aiosp_opengraph_facebook_publisher']; - } - } - - if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { - $domain = $this->options['aiosp_opengraph_twitter_domain']; - } - - if ( $type == 'article' && ! empty( $post ) ) { - if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) { - $author = get_the_author_meta( 'facebook', $post->post_author ); - } - - if ( isset( $post->post_date_gmt ) ) { - $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date_gmt ) ); - } - - if ( isset( $post->post_modified_gmt ) ) { - $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified_gmt ) ); - } - } - - $image = $metabox['aioseop_opengraph_settings_image']; - $video = $metabox['aioseop_opengraph_settings_video']; - $title = $metabox['aioseop_opengraph_settings_title']; - $description = $metabox['aioseop_opengraph_settings_desc']; - - /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */ - global $aiosp; - if ( empty( $title ) ) { - $title = $aiosp->wp_title(); - } - if ( empty( $description ) ) { - $description = trim( strip_tags( get_post_meta( $post->ID, '_aioseop_description', true ) ) ); - } - - /* Add default title */ - if ( empty( $title ) ) { - $title = get_the_title(); - } - - // Add default description. - if ( empty( $description ) && ! post_password_required( $post ) ) { - - $description = $post->post_excerpt; - - if ( $this->options['aiosp_opengraph_generate_descriptions'] || empty( $description ) ) { - $description = $post->post_content; - } - } - if ( empty( $type ) ) { - $type = 'article'; - } - } elseif ( AIOSEOPPRO && ( is_category() || is_tag() || is_tax() ) ) { - if ( isset( $this->options['aioseop_opengraph_settings_category'] ) ) { - $type = $this->options['aioseop_opengraph_settings_category']; - } - if ( isset( $metabox['aioseop_opengraph_settings_category'] ) ) { - $type = $metabox['aioseop_opengraph_settings_category']; - } - if ( $type == 'article' ) { - if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) { - $section = $metabox['aioseop_opengraph_settings_section']; - } - if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) { - $tag = $metabox['aioseop_opengraph_settings_tag']; - } - if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) { - $publisher = $this->options['aiosp_opengraph_facebook_publisher']; - } - } - if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { - $domain = $this->options['aiosp_opengraph_twitter_domain']; - } - if ( $type == 'article' && ! empty( $post ) ) { - if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) { - $author = get_the_author_meta( 'facebook', $post->post_author ); - } - - if ( isset( $post->post_date_gmt ) ) { - $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date_gmt ) ); - } - if ( isset( $post->post_modified_gmt ) ) { - $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified_gmt ) ); - } - } - $image = $metabox['aioseop_opengraph_settings_image']; - $video = $metabox['aioseop_opengraph_settings_video']; - $title = $metabox['aioseop_opengraph_settings_title']; - $description = $metabox['aioseop_opengraph_settings_desc']; - /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */ - global $aiosp; - if ( empty( $title ) ) { - $title = $aiosp->wp_title(); - } - if ( empty( $description ) ) { - $term_id = isset( $_GET['tag_ID'] ) ? (int) $_GET['tag_ID'] : 0; - $term_id = $term_id ? $term_id : get_queried_object()->term_id; - $description = trim( strip_tags( get_term_meta( $term_id, '_aioseop_description', true ) ) ); - } - // Add default title - if ( empty( $title ) ) { - $title = get_the_title(); - } - // Add default description. - if ( empty( $description ) && ! post_password_required( $post ) ) { - $description = get_queried_object()->description; - } - if ( empty( $type ) ) { - $type = 'website'; - } - } elseif ( is_home() && ! is_front_page() ) { - // This is the blog page but not the homepage. - global $aiosp; - $image = $metabox['aioseop_opengraph_settings_image']; - $video = $metabox['aioseop_opengraph_settings_video']; - $title = $metabox['aioseop_opengraph_settings_title']; - $description = $metabox['aioseop_opengraph_settings_desc']; - - if ( empty( $description ) ) { - // If there's not social description, fall back to the SEO description. - $description = trim( strip_tags( get_post_meta( get_option( 'page_for_posts' ), '_aioseop_description', true ) ) ); - } - if ( empty( $title ) ) { - $title = $aiosp->wp_title(); - } - } else { - return; - } - - if ( $type === 'article' && ! empty( $post ) && is_singular() ) { - if ( ! empty( $this->options['aiosp_opengraph_gen_tags'] ) ) { - if ( ! empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) { - $keywords = $aiosp->get_main_keywords(); - $keywords = $this->apply_cf_fields( $keywords ); - $keywords = apply_filters( 'aioseop_keywords', $keywords ); - if ( ! empty( $keywords ) && ! empty( $tag ) ) { - $tag .= ',' . $keywords; - } elseif ( empty( $tag ) ) { - $tag = $keywords; - } - } - $tag = $aiosp->keyword_string_to_list( $tag ); - if ( ! empty( $this->options['aiosp_opengraph_gen_categories'] ) ) { - $tag = array_merge( $tag, $aiosp->get_all_categories( $post->ID ) ); - } - if ( ! empty( $this->options['aiosp_opengraph_gen_post_tags'] ) ) { - $tag = array_merge( $tag, $aiosp->get_all_tags( $post->ID ) ); - } - } - if ( ! empty( $tag ) ) { - $tag = $aiosp->clean_keyword_list( $tag ); - } - } - - if ( ! empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) { - $title = do_shortcode( $title ); - } - if ( ! empty( $description ) ) { - $description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) ); - if ( ! empty( $this->options['aiosp_opengraph_description_shortcodes'] ) ) { - $description = do_shortcode( $description ); - } - $description = $aiosp->trim_excerpt_without_filters( $description, 1000 ); - } - - $title = $this->apply_cf_fields( $title ); - $description = $this->apply_cf_fields( $description ); - - /* Data Validation */ - $title = strip_tags( esc_attr( $title ) ); - $sitename = strip_tags( esc_attr( $sitename ) ); - $description = strip_tags( esc_attr( $description ) ); - - if ( empty( $thumbnail ) && ! empty( $image ) ) { - $thumbnail = $image; - } - - // Add user supplied default image. - if ( empty( $thumbnail ) ) { - if ( empty( $this->options['aiosp_opengraph_defimg'] ) ) { - $thumbnail = $this->options['aiosp_opengraph_dimg']; - } else { - switch ( $this->options['aiosp_opengraph_defimg'] ) { - case 'featured': - $thumbnail = $this->get_the_image_by_post_thumbnail(); - break; - case 'attach': - $thumbnail = $this->get_the_image_by_attachment(); - break; - case 'content': - $thumbnail = $this->get_the_image_by_scan(); - break; - case 'custom': - $meta_key = $this->options['aiosp_opengraph_meta_key']; - if ( ! empty( $meta_key ) && ! empty( $post ) ) { - $meta_key = explode( ',', $meta_key ); - $thumbnail = $this->get_the_image_by_meta_key( - array( - 'post_id' => $post->ID, - 'meta_key' => $meta_key, - ) - ); - } - break; - case 'auto': - $thumbnail = $this->get_the_image(); - break; - case 'author': - $thumbnail = $this->get_the_image_by_author(); - break; - default: - $thumbnail = $this->options['aiosp_opengraph_dimg']; - } - } - } - - if ( ( empty( $thumbnail ) && ! empty( $this->options['aiosp_opengraph_fallback'] ) ) ) { - $thumbnail = $this->options['aiosp_opengraph_dimg']; - } - - if ( ! empty( $thumbnail ) ) { - $thumbnail = esc_url( $thumbnail ); - $thumbnail = set_url_scheme( $thumbnail ); - } - - $width = $height = ''; - if ( ! empty( $thumbnail ) ) { - if ( ! empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) ) { - $width = $metabox['aioseop_opengraph_settings_imagewidth']; - } - if ( ! empty( $metabox['aioseop_opengraph_settings_imageheight'] ) ) { - $height = $metabox['aioseop_opengraph_settings_imageheight']; - } - if ( empty( $width ) && ! empty( $this->options['aiosp_opengraph_dimgwidth'] ) ) { - $width = $this->options['aiosp_opengraph_dimgwidth']; - } - if ( empty( $height ) && ! empty( $this->options['aiosp_opengraph_dimgheight'] ) ) { - $height = $this->options['aiosp_opengraph_dimgheight']; - } - } - - if ( ! empty( $video ) ) { - if ( ! empty( $metabox['aioseop_opengraph_settings_videowidth'] ) ) { - $videowidth = $metabox['aioseop_opengraph_settings_videowidth']; - } - if ( ! empty( $metabox['aioseop_opengraph_settings_videoheight'] ) ) { - $videoheight = $metabox['aioseop_opengraph_settings_videoheight']; - } - } - - $card = 'summary'; - if ( ! empty( $this->options['aiosp_opengraph_defcard'] ) ) { - $card = $this->options['aiosp_opengraph_defcard']; - } - - if ( ! empty( $metabox['aioseop_opengraph_settings_setcard'] ) ) { - $card = $metabox['aioseop_opengraph_settings_setcard']; - } - - // support for changing legacy twitter cardtype-photo to summary large image - if ( $card == 'photo' ) { - $card = 'summary_large_image'; - } - - $site = $domain = $creator = ''; - - if ( ! empty( $this->options['aiosp_opengraph_twitter_site'] ) ) { - $site = $this->options['aiosp_opengraph_twitter_site']; - $site = AIOSEOP_Opengraph_Public::prepare_twitter_username( $site ); - } - - if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { - $domain = $this->options['aiosp_opengraph_twitter_domain']; - } - - if ( ! empty( $post ) && isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_twitter_creator'] ) ) { - $creator = get_the_author_meta( 'twitter', $post->post_author ); - $creator = AIOSEOP_Opengraph_Public::prepare_twitter_username( $creator ); - } - - if ( ! empty( $thumbnail ) ) { - $twitter_thumbnail = $thumbnail; // Default Twitter image if custom isn't set. - } - - if ( isset( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) && ! empty( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) ) { - // Set Twitter image from custom. - $twitter_thumbnail = set_url_scheme( $metabox['aioseop_opengraph_settings_customimg_twitter'] ); - } - - // Apply last filters. - $description = apply_filters( 'aioseop_description', $description ); - - $meta = array( - 'facebook' => array( - 'title' => 'og:title', - 'type' => 'og:type', - 'url' => 'og:url', - 'thumbnail' => 'og:image', - 'width' => 'og:image:width', - 'height' => 'og:image:height', - 'video' => 'og:video', - 'videowidth' => 'og:video:width', - 'videoheight' => 'og:video:height', - 'sitename' => 'og:site_name', - 'key' => 'fb:admins', - 'appid' => 'fb:app_id', - 'description' => 'og:description', - 'section' => 'article:section', - 'tag' => 'article:tag', - 'publisher' => 'article:publisher', - 'author' => 'article:author', - 'published_time' => 'article:published_time', - 'modified_time' => 'article:modified_time', - ), - 'twitter' => array( - 'card' => 'twitter:card', - 'site' => 'twitter:site', - 'creator' => 'twitter:creator', - 'domain' => 'twitter:domain', - 'title' => 'twitter:title', - 'description' => 'twitter:description', - 'twitter_thumbnail' => 'twitter:image', - ), - ); - - // Only show if "use schema.org markup is checked". - if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) { - $meta['google+'] = array( 'thumbnail' => 'image' ); - } - - $tags = array( - 'facebook' => array( 'name' => 'property', 'value' => 'content' ), - 'twitter' => array( 'name' => 'name', 'value' => 'content' ), - 'google+' => array( 'name' => 'itemprop', 'value' => 'content' ), - ); - - foreach ( $meta as $t => $data ) { - foreach ( $data as $k => $v ) { - if ( empty( $$k ) ) { - $$k = ''; - } - $filtered_value = $$k; - $filtered_value = apply_filters( $this->prefix . 'meta', $filtered_value, $t, $k ); - if ( ! empty( $filtered_value ) ) { - if ( ! is_array( $filtered_value ) ) { - $filtered_value = array( $filtered_value ); - } - - /** - * This is to accomodate multiple fb:admins on separate lines. - * @TODO Eventually we'll want to put this in its own function so things like images work too. - */ - if ( 'key' === $k ) { - $fbadmins = explode( ',', str_replace( ' ', '', $filtered_value[0] ) ); // Trim spaces then turn comma-separated values into an array. - foreach ( $fbadmins as $fbadmin ) { - echo '' . "\n"; - } - } else { - // For everything else. - foreach ( $filtered_value as $f ) { - echo '' . "\n"; - } - } - } - } - } - $social_link_schema = ''; - if ( ! empty( $social_links ) ) { - $home_url = esc_url( get_home_url() ); - $social_links = explode( "\n", $social_links ); - foreach ( $social_links as $k => $v ) { - $v = trim( $v ); - if ( empty( $v ) ) { - unset( $social_links[ $k ] ); - } else { - $v = esc_url( $v ); - $social_links[ $k ] = $v; - } - } - $social_links = join( '","', $social_links ); - $social_link_schema = << -{ "@context" : "http://schema.org", - "@type" : "{$social_type}", - "name" : "{$social_name}", - "url" : "{$home_url}", - "sameAs" : ["{$social_links}"] -} - - -END; - } - echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema ); - } - - /** - * Do / adds opengraph properties to meta. - * @since 2.3.11 - * - * @global array $aioseop_options AIOSEOP plugin options. - */ - public function do_opengraph() { - global $aioseop_options; - if ( ! empty( $aioseop_options ) - && ! empty( $aioseop_options['aiosp_schema_markup'] ) - ) { - add_filter( 'language_attributes', array( &$this, 'add_attributes' ) ); - } - if ( ! defined( 'DOING_AJAX' ) ) { - add_action( 'aioseop_modules_wp_head', array( &$this, 'add_meta' ), 5 ); - // Add social meta to AMP plugin. - if ( apply_filters( 'aioseop_enable_amp_social_meta', true ) === true ) { - add_action( 'amp_post_template_head', array( &$this, 'add_meta' ), 12 ); - } - } - } - - /** - * Set up types. - * - * @since ? - * @since 2.3.15 Change to website for homepage and blog post index page, default to object. - */ - function type_setup() { - $this->type = 'object'; // Default to type object if we don't have some other rule. - - if ( is_home() || is_front_page() ) { - $this->type = 'website'; // Home page and blog page should be website. - } elseif ( is_singular() && $this->option_isset( 'types' ) ) { - $metabox = $this->get_current_options( array(), 'settings' ); - $current_post_type = get_post_type(); - if ( ! empty( $metabox['aioseop_opengraph_settings_category'] ) ) { - $this->type = $metabox['aioseop_opengraph_settings_category']; - } elseif ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) { - $this->type = $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ]; - } - } - } - - /** - * Inits hooks and others for admin init. - * action:admin_init. - * - * @since 2.3.11 - * @since 2.4.14 Refactored function name, and new filter added for defaults and missing term metabox. - */ - function admin_init() { - add_filter( $this->prefix . 'display_settings', array( &$this, 'filter_settings' ), 10, 3 ); - add_filter( $this->prefix . 'override_options', array( &$this, 'override_options' ), 10, 3 ); - add_filter( $this->get_prefix( 'settings' ) . 'default_options', array( - &$this, - 'filter_default_options', - ), 10, 2 ); - add_filter( - $this->get_prefix( 'settings' ) . 'filter_metabox_options', array( - &$this, - 'filter_metabox_options', - ), 10, 3 - ); - add_filter( - $this->get_prefix( 'settings' ) . 'filter_term_metabox_options', array( - &$this, - 'filter_metabox_options', - ), 10, 3 - ); - $post_types = $this->get_post_type_titles(); - $rempost = array( - 'revision' => 1, - 'nav_menu_item' => 1, - 'custom_css' => 1, - 'customize_changeset' => 1, - ); - $post_types = array_diff_key( $post_types, $rempost ); - $this->default_options['types']['initial_options'] = $post_types; - foreach ( $post_types as $slug => $name ) { - $field = $slug . '_fb_object_type'; - $this->default_options[ $field ] = array( - 'name' => "$name " . __( 'Object Type', 'all-in-one-seo-pack' ) . "
    ($slug)", - 'type' => 'select', - 'style' => '', - 'initial_options' => $this->fb_object_types, - 'default' => 'article', - 'condshow' => array( 'aiosp_opengraph_types\[\]' => $slug ), - ); - $this->help_text[ $field ] = __( 'Choose a default value that best describes the content of your post type.', 'all-in-one-seo-pack' ); - $this->help_anchors[ $field ] = '#content-object-types'; - $this->locations['opengraph']['options'][] = $field; - $this->layout['facebook']['options'][] = $field; - } - $this->setting_options(); - $this->add_help_text_links(); - - } - - function get_all_images( $options = null, $p = null ) { - static $img = array(); - if ( ! is_array( $options ) ) { - $options = array(); - } - if ( ! empty( $this->options['aiosp_opengraph_meta_key'] ) ) { - $options['meta_key'] = $this->options['aiosp_opengraph_meta_key']; - } - if ( empty( $img ) ) { - $size = apply_filters( 'post_thumbnail_size', 'large' ); - $default = $this->get_the_image_by_default(); - if ( ! empty( $default ) ) { - $default = set_url_scheme( $default ); - $img[ $default ] = 0; - } - $img = array_merge( $img, parent::get_all_images( $options, null ) ); - } - - if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) { - $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg'; - } - - if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) { - $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg'; - $img[ $options['aioseop_opengraph_settings_customimg_twitter'] ] = 'customimg_twitter'; - } - - if ( $author_img = $this->get_the_image_by_author( $p ) ) { - $image['author'] = $author_img; - } - $image = array_flip( $img ); - $images = array(); - if ( ! empty( $image ) ) { - foreach ( $image as $k => $v ) { - $images[ $v ] = ''; - } - } - - return array( $image, $images ); - } - - function get_the_image_by_author( $options = null, $p = null ) { - if ( $p === null ) { - global $post; - } else { - $post = $p; - } - if ( ! empty( $post ) && ! empty( $post->post_author ) ) { - $matches = array(); - $get_avatar = get_avatar( $post->post_author, 300 ); - if ( preg_match( "/src='(.*?)'/i", $get_avatar, $matches ) ) { - return $matches[1]; - } - } - - return false; - } - - function get_the_image( $options = null, $p = null ) { - $meta_key = $this->options['aiosp_opengraph_meta_key']; - - return parent::get_the_image( array( 'meta_key' => $meta_key ), $p ); - } - - function get_the_image_by_default( $args = array() ) { - return $this->options['aiosp_opengraph_dimg']; - } - - function settings_update() { - - } - - /** - * Enqueue our file upload scripts and styles. - * @param $hook - */ - function og_admin_enqueue_scripts( $hook ) { - - if ( 'all-in-one-seo_page_aiosp_opengraph' != $hook && 'term.php' != $hook ) { - // Only enqueue if we're on the social module settings page. - return; - } - - wp_enqueue_script( 'media-upload' ); - wp_enqueue_script( 'thickbox' ); - wp_enqueue_style( 'thickbox' ); - wp_enqueue_media(); - } - - function save_tax_data( $term_id, $tt_id, $taxonomy ) { - static $update = false; - if ( $update ) { - return; - } - if ( $this->locations !== null ) { - foreach ( $this->locations as $k => $v ) { - if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) { - $opts = $this->default_options( $k ); - $options = array(); - $update = false; - foreach ( $opts as $l => $o ) { - if ( isset( $_POST[ $l ] ) ) { - $options[ $l ] = stripslashes_deep( $_POST[ $l ] ); - $options[ $l ] = esc_attr( $options[ $l ] ); - $update = true; - } - } - if ( $update ) { - $prefix = $this->get_prefix( $k ); - $options = apply_filters( $prefix . 'filter_term_metabox_options', $options, $k, $term_id ); - update_term_meta( $term_id, '_' . $prefix . $k, $options ); - } - } - } - } - } - - /** - * Returns the placeholder filtered and ready for DOM display. - * filter:aioseop_opengraph_placeholder - * @since 2.4.14 - * - * @param mixed $placeholder Placeholder to be filtered. - * @param string $type Type of the value to be filtered. - * - * @return string - */ - public function filter_placeholder( $placeholder, $type = 'text' ) { - return strip_tags( trim( $placeholder ) ); - } - - /** - * Returns filtered default options. - * filter:{prefix}default_options - * @since 2.4.13 - * - * @param array $options Default options. - * @param string $location Location. - * - * @return array - */ - public function filter_default_options( $options, $location ) { - if ( $location === 'settings' ) { - $prefix = $this->get_prefix( $location ) . $location . '_'; - // Add image checker as default - $options[ $prefix . 'customimg_checker' ] = 0; - } - return $options; - } - - /** - * Returns facebook debug script and link. - * @since 2.4.14 - * - * @return string - */ - private function get_facebook_debug() { - ob_start(); - ?> - - - name = __( 'Social Meta', 'all-in-one-seo-pack' ); // Human-readable name of the plugin + $this->prefix = 'aiosp_opengraph_'; // option prefix + $this->file = __FILE__; // the current file + $this->fb_object_types = array( + 'Activities' => array( + 'activity' => __( 'Activity', 'all-in-one-seo-pack' ), + 'sport' => __( 'Sport', 'all-in-one-seo-pack' ), + ), + 'Businesses' => array( + 'bar' => __( 'Bar', 'all-in-one-seo-pack' ), + 'company' => __( 'Company', 'all-in-one-seo-pack' ), + 'cafe' => __( 'Cafe', 'all-in-one-seo-pack' ), + 'hotel' => __( 'Hotel', 'all-in-one-seo-pack' ), + 'restaurant' => __( 'Restaurant', 'all-in-one-seo-pack' ), + ), + 'Groups' => array( + 'cause' => __( 'Cause', 'all-in-one-seo-pack' ), + 'sports_league' => __( 'Sports League', 'all-in-one-seo-pack' ), + 'sports_team' => __( 'Sports Team', 'all-in-one-seo-pack' ), + ), + 'Organizations' => array( + 'band' => __( 'Band', 'all-in-one-seo-pack' ), + 'government' => __( 'Government', 'all-in-one-seo-pack' ), + 'non_profit' => __( 'Non Profit', 'all-in-one-seo-pack' ), + 'school' => __( 'School', 'all-in-one-seo-pack' ), + 'university' => __( 'University', 'all-in-one-seo-pack' ), + ), + 'People' => array( + 'actor' => __( 'Actor', 'all-in-one-seo-pack' ), + 'athlete' => __( 'Athlete', 'all-in-one-seo-pack' ), + 'author' => __( 'Author', 'all-in-one-seo-pack' ), + 'director' => __( 'Director', 'all-in-one-seo-pack' ), + 'musician' => __( 'Musician', 'all-in-one-seo-pack' ), + 'politician' => __( 'Politician', 'all-in-one-seo-pack' ), + 'profile' => __( 'Profile', 'all-in-one-seo-pack' ), + 'public_figure' => __( 'Public Figure', 'all-in-one-seo-pack' ), + ), + 'Places' => array( + 'city' => __( 'City', 'all-in-one-seo-pack' ), + 'country' => __( 'Country', 'all-in-one-seo-pack' ), + 'landmark' => __( 'Landmark', 'all-in-one-seo-pack' ), + 'state_province' => __( 'State Province', 'all-in-one-seo-pack' ), + ), + 'Products and Entertainment' => array( + 'album' => __( 'Album', 'all-in-one-seo-pack' ), + 'book' => __( 'Book', 'all-in-one-seo-pack' ), + 'drink' => __( 'Drink', 'all-in-one-seo-pack' ), + 'food' => __( 'Food', 'all-in-one-seo-pack' ), + 'game' => __( 'Game', 'all-in-one-seo-pack' ), + 'movie' => __( 'Movie', 'all-in-one-seo-pack' ), + 'product' => __( 'Product', 'all-in-one-seo-pack' ), + 'song' => __( 'Song', 'all-in-one-seo-pack' ), + 'tv_show' => __( 'TV Show', 'all-in-one-seo-pack' ), + 'episode' => __( 'Episode', 'all-in-one-seo-pack' ), + ), + 'Websites' => array( + 'article' => __( 'Article', 'all-in-one-seo-pack' ), + 'blog' => __( 'Blog', 'all-in-one-seo-pack' ), + 'website' => __( 'Website', 'all-in-one-seo-pack' ), + ), + ); + parent::__construct(); + + $this->help_text = array( + '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' ), + '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' ), + 'appid' => __( 'Enter your Facebook App ID here. Information about how to get your Facebook App ID can be found at https://developers.facebook.com/docs/apps/register', 'all-in-one-seo-pack' ), + 'title_shortcodes' => __( 'Run shortcodes that appear in social title meta tags.', 'all-in-one-seo-pack' ), + 'description_shortcodes' => __( 'Run shortcodes that appear in social description meta tags.', 'all-in-one-seo-pack' ), + 'sitename' => __( 'The Site Name is the name that is used to identify your website.', 'all-in-one-seo-pack' ), + 'hometitle' => __( 'The Home Title is the Open Graph title for your home page.', 'all-in-one-seo-pack' ), + 'description' => __( 'The Home Description is the Open Graph description for your home page.', 'all-in-one-seo-pack' ), + 'homeimage' => __( 'The Home Image is the Open Graph image for your home page.', 'all-in-one-seo-pack' ), + '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' ), + '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' ), + 'fallback' => __( 'This option lets you fall back to the default image if no image could be found above.', 'all-in-one-seo-pack' ), + 'dimg' => __( 'This option sets a default image that can be used for the Open Graph image. You can upload an image, select an image from your Media Library or paste the URL of an image here.', 'all-in-one-seo-pack' ), + 'dimgwidth' => __( 'This option lets you set a default width for your images, where unspecified.', 'all-in-one-seo-pack' ), + 'dimgheight' => __( 'This option lets you set a default height for your images, where unspecified.', 'all-in-one-seo-pack' ), + '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' ), + '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' ), + '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' ), + 'imagewidth' => __( 'Enter the width for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ), + 'imageheight' => __( 'Enter the height for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ), + 'video' => __( 'This option lets you specify a link to the Open Graph video used on this Page or Post.', 'all-in-one-seo-pack' ), + 'videowidth' => __( 'Enter the width for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ), + 'videoheight' => __( 'Enter the height for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ), + 'defcard' => __( 'Select the default type of Twitter Card to display.', 'all-in-one-seo-pack' ), + 'setcard' => __( 'Select the Twitter Card type to use for this Page or Post, overriding the default setting.', 'all-in-one-seo-pack' ), + 'twitter_site' => __( 'Enter the Twitter username associated with your website here.', 'all-in-one-seo-pack' ), + 'twitter_creator' => __( 'Allows your authors to be identified by their Twitter usernames as content creators on the Twitter cards for their posts.', 'all-in-one-seo-pack' ), + 'twitter_domain' => __( 'Enter the name of your website here.', 'all-in-one-seo-pack' ), + 'customimg_twitter' => __( 'This option lets you upload an image to use as the Twitter image for this Page or Post.', 'all-in-one-seo-pack' ), + 'gen_tags' => __( 'Automatically generate article tags for Facebook type article when not provided.', 'all-in-one-seo-pack' ), + 'gen_keywords' => __( 'Use keywords in generated article tags.', 'all-in-one-seo-pack' ), + 'gen_categories' => __( 'Use categories in generated article tags.', 'all-in-one-seo-pack' ), + 'gen_post_tags' => __( 'Use post tags in generated article tags.', 'all-in-one-seo-pack' ), + 'types' => __( 'Select which Post Types you want to use All in One SEO Pack to set Open Graph meta values for.', 'all-in-one-seo-pack' ), + 'title' => __( 'This is the Open Graph title of this Page or Post.', 'all-in-one-seo-pack' ), + 'desc' => __( 'This is the Open Graph description of this Page or Post.', 'all-in-one-seo-pack' ), + 'category' => __( 'Select the Open Graph type that best describes the content of this Page or Post.', 'all-in-one-seo-pack' ), + 'facebook_debug' => __( 'Press this button to have Facebook re-fetch and debug this page.', 'all-in-one-seo-pack' ), + 'section' => __( 'This Open Graph meta allows you to add a general section name that best describes this content.', 'all-in-one-seo-pack' ), + 'tag' => __( 'This Open Graph meta allows you to add a list of keywords that best describe this content.', 'all-in-one-seo-pack' ), + 'facebook_publisher' => __( 'Link articles to the Facebook page associated with your website.', 'all-in-one-seo-pack' ), + 'facebook_author' => __( 'Allows your authors to be identified by their Facebook pages as content authors on the Opengraph meta for their articles.', 'all-in-one-seo-pack' ), + 'person_or_org' => __( 'Are the social profile links for your website for a person or an organization?', 'all-in-one-seo-pack' ), + 'profile_links' => __( "Add URLs for your website's social profiles here (Facebook, Twitter, Google+, Instagram, LinkedIn), one per line.", 'all-in-one-seo-pack' ), + 'social_name' => __( 'Add the name of the person or organization who owns these profiles.', 'all-in-one-seo-pack' ), + ); + + $this->help_anchors = array( + 'title_shortcodes' => '#run-shortcodes-in-title', + 'description_shortcodes' => '#run-shortcodes-in-description', + 'generate_descriptions' => '#auto-generate-og-descriptions', + 'setmeta' => '#use-aioseo-title-and-description', + 'sitename' => '#site-name', + 'hometitle' => '#home-title-and-description', + 'description' => '#home-title-and-description', + 'homeimage' => '#home-image', + 'defimg' => '#select-og-image-source', + 'fallback' => '#use-default-if-no-image-found', + 'dimg' => '#default-og-image', + 'dimgwidth' => '#default-image-width', + 'dimgheight' => '#default-image-height', + 'meta_key' => '#use-custom-field-for-image', + 'profile_links' => '#social-profile-links', + 'person_or_org' => '#social-profile-links', + 'social_name' => '#social-profile-links', + 'key' => '#facebook-admin-id', + 'appid' => '#facebook-app-id', + 'gen_tags' => '#automatically-generate-article-tags', + 'gen_keywords' => '#use-keywords-in-article-tags', + 'gen_categories' => '#use-categories-in-article-tags', + 'gen_post_tags' => '#use-post-tags-in-article-tags', + 'facebook_publisher' => '#show-facebook-publisher-on-articles', + 'facebook_author' => '#show-facebook-author-on-articles', + 'types' => '#enable-facebook-meta-for', + 'defcard' => '#default-twitter-card', + 'twitter_site' => '#twitter-site', + 'twitter_creator' => '#show-twitter-author', + 'twitter_domain' => '#twitter-domain', + 'scan_header' => '#scan-social-meta', + 'title' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#title', + 'desc' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#description', + 'image' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#image', + 'customimg' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-image', + 'imagewidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height', + 'imageheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height', + 'video' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-video', + 'videowidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height', + 'videoheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height', + 'category' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-object-type', + 'facebook_debug' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-debug', + 'section' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-section', + 'tag' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-tags', + 'setcard' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#twitter-card-type', + 'customimg_twitter' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-twitter-image', + ); + + if ( is_admin() ) { + add_action( 'admin_init', array( $this, 'admin_init' ), 5 ); + } else { + add_action( 'wp', array( $this, 'type_setup' ) ); + } + + if ( ! is_admin() || defined( 'DOING_AJAX' ) ) { + $this->do_opengraph(); + } + // Set variables after WordPress load. + add_action( 'init', array( &$this, 'init' ), 999999 ); + add_filter( 'jetpack_enable_open_graph', '__return_false' ); // Avoid having duplicate meta tags + // Force refresh of Facebook cache. + add_action( 'post_updated', array( &$this, 'force_fb_refresh_update' ), 10, 3 ); + add_action( 'transition_post_status', array( &$this, 'force_fb_refresh_transition' ), 10, 3 ); + add_action( 'edited_term', array( &$this, 'save_tax_data' ), 10, 3 ); + // Adds special filters + add_filter( 'aioseop_opengraph_placeholder', array( &$this, 'filter_placeholder' ) ); + // Call to init to generate menus + $this->init(); + } + + /** + * Hook called after WordPress has been loaded. + * + * @since 2.4.14 + */ + public function init() { + $count_desc = __( ' characters. Open Graph allows up to a maximum of %1$s chars for the %2$s.', 'all-in-one-seo-pack' ); + // Create default options + $this->default_options = array( + 'scan_header' => array( + 'name' => __( 'Scan Header', 'all-in-one-seo-pack' ), + 'type' => 'custom', + 'save' => true, + ), + 'setmeta' => array( + 'name' => __( 'Use AIOSEO Title and Description', 'all-in-one-seo-pack' ), + 'type' => 'checkbox', + ), + 'key' => array( + 'name' => __( 'Facebook Admin ID', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'text', + ), + 'appid' => array( + 'name' => __( 'Facebook App ID', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'text', + ), + 'title_shortcodes' => array( + 'name' => __( 'Run Shortcodes In Title', 'all-in-one-seo-pack' ), + ), + 'description_shortcodes' => array( + 'name' => __( 'Run Shortcodes In Description', 'all-in-one-seo-pack' ), + ), + 'sitename' => array( + 'name' => __( 'Site Name', 'all-in-one-seo-pack' ), + 'default' => get_bloginfo( 'name' ), + 'type' => 'text', + ), + 'hometitle' => array( + 'name' => __( 'Home Title', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'textarea', + 'condshow' => array( + 'aiosp_opengraph_setmeta' => array( + 'lhs' => 'aiosp_opengraph_setmeta', + 'op' => '!=', + 'rhs' => 'on', + ), + ), + ), + 'description' => array( + 'name' => __( 'Home Description', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'textarea', + 'condshow' => array( + 'aiosp_opengraph_setmeta' => array( + 'lhs' => 'aiosp_opengraph_setmeta', + 'op' => '!=', + 'rhs' => 'on', + ), + ), + ), + 'homeimage' => array( + 'name' => __( 'Home Image', 'all-in-one-seo-pack' ), + 'type' => 'image', + ), + 'generate_descriptions' => array( + 'name' => __( 'Use Content For Autogenerated OG Descriptions', 'all-in-one-seo-pack' ), + 'default' => 0, + ), + 'defimg' => array( + 'name' => __( 'Select OG:Image Source', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'initial_options' => array( + '' => __( 'Default Image' ), + 'featured' => __( 'Featured Image' ), + 'attach' => __( 'First Attached Image' ), + 'content' => __( 'First Image In Content' ), + 'custom' => __( 'Image From Custom Field' ), + 'author' => __( 'Post Author Image' ), + 'auto' => __( 'First Available Image' ), + ), + ), + 'fallback' => array( + 'name' => __( 'Use Default If No Image Found', 'all-in-one-seo-pack' ), + 'type' => 'checkbox', + ), + 'dimg' => array( + 'name' => __( 'Default OG:Image', 'all-in-one-seo-pack' ), + 'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png', + 'type' => 'image', + ), + 'dimgwidth' => array( + 'name' => __( 'Default Image Width', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'dimgheight' => array( + 'name' => __( 'Default Image Height', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'meta_key' => array( + 'name' => __( 'Use Custom Field For Image', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'image' => array( + 'name' => __( 'Image', 'all-in-one-seo-pack' ), + 'type' => 'radio', + 'initial_options' => array( + 0 => '', + ), + ), + 'customimg' => array( + 'name' => __( 'Custom Image', 'all-in-one-seo-pack' ), + 'type' => 'image', + ), + 'imagewidth' => array( + 'name' => __( 'Specify Image Width', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'imageheight' => array( + 'name' => __( 'Specify Image Height', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'video' => array( + 'name' => __( 'Custom Video', 'all-in-one-seo-pack' ), + 'type' => 'text', + ), + 'videowidth' => array( + 'name' => __( 'Specify Video Width', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => array( + 'aioseop_opengraph_settings_video' => array( + 'lhs' => 'aioseop_opengraph_settings_video', + 'op' => '!=', + 'rhs' => '', + ), + ), + ), + 'videoheight' => array( + 'name' => __( 'Specify Video Height', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => array( + 'aioseop_opengraph_settings_video' => array( + 'lhs' => 'aioseop_opengraph_settings_video', + 'op' => '!=', + 'rhs' => '', + ), + ), + ), + 'defcard' => array( + 'name' => __( 'Default Twitter Card', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'default' => 'summary', + 'initial_options' => array( + 'summary' => __( 'Summary', 'all-in-one-seo-pack' ), + 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ), + + /* + REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE + 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) + */ + ), + ), + 'setcard' => array( + 'name' => __( 'Twitter Card Type', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'initial_options' => array( + 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ), + 'summary' => __( 'Summary', 'all-in-one-seo-pack' ), + + /* + REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE + 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) + */ + ), + ), + 'twitter_site' => array( + 'name' => __( 'Twitter Site', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'twitter_creator' => array( + 'name' => __( 'Show Twitter Author', 'all-in-one-seo-pack' ), + ), + 'twitter_domain' => array( + 'name' => __( 'Twitter Domain', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'customimg_twitter' => array( + 'name' => __( 'Custom Twitter Image', 'all-in-one-seo-pack' ), + 'type' => 'image', + ), + 'gen_tags' => array( + 'name' => __( 'Automatically Generate Article Tags', 'all-in-one-seo-pack' ), + ), + 'gen_keywords' => array( + 'name' => __( 'Use Keywords In Article Tags', 'all-in-one-seo-pack' ), + 'default' => 'on', + 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), + ), + 'gen_categories' => array( + 'name' => __( 'Use Categories In Article Tags', 'all-in-one-seo-pack' ), + 'default' => 'on', + 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), + ), + 'gen_post_tags' => array( + 'name' => __( 'Use Post Tags In Article Tags', 'all-in-one-seo-pack' ), + 'default' => 'on', + 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), + ), + 'types' => array( + 'name' => __( 'Enable Facebook Meta for Post Types', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'default' => array( 'post' => 'post', 'page' => 'page' ), + 'initial_options' => $this->get_post_type_titles( array( '_builtin' => false ) ), + ), + 'title' => array( + 'name' => __( 'Title', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'text', + 'size' => 95, + 'count' => 1, + 'count_desc' => $count_desc, + ), + 'desc' => array( + 'name' => __( 'Description', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'textarea', + 'cols' => 250, + 'rows' => 4, + 'count' => 1, + 'count_desc' => $count_desc, + ), + 'category' => array( + 'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'style' => '', + 'default' => '', + 'initial_options' => $this->fb_object_types, + ), + 'facebook_debug' => array( + 'name' => __( 'Facebook Debug', 'all-in-one-seo-pack' ), + 'type' => 'html', + 'save' => false, + 'default' => $this->get_facebook_debug(), + ), + 'section' => array( + 'name' => __( 'Article Section', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ), + ), + 'tag' => array( + 'name' => __( 'Article Tags', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ), + ), + 'facebook_publisher' => array( + 'name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'facebook_author' => array( + 'name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' ), + ), + 'profile_links' => array( + 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), + 'type' => 'textarea', + 'cols' => 60, + 'rows' => 5, + ), + 'person_or_org' => array( + 'name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ), + 'type' => 'radio', + 'initial_options' => array( + 'person' => __( 'Person', 'all-in-one-seo-pack' ), + 'org' => __( 'Organization', 'all-in-one-seo-pack' ), + ), + ), + 'social_name' => array( + 'name' => __( 'Associated Name', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + ); + // load initial options / set defaults + $this->update_options(); + $display = array(); + if ( isset( $this->options['aiosp_opengraph_types'] ) && ! empty( $this->options['aiosp_opengraph_types'] ) ) { + $display = $this->options['aiosp_opengraph_types']; + } + $this->locations = array( + 'opengraph' => array( + 'name' => $this->name, + 'prefix' => 'aiosp_', + 'type' => 'settings', + 'options' => array( + 'scan_header', + 'setmeta', + 'key', + 'appid', + 'sitename', + 'title_shortcodes', + 'description_shortcodes', + 'hometitle', + 'description', + 'homeimage', + 'generate_descriptions', + 'defimg', + 'fallback', + 'dimg', + 'dimgwidth', + 'dimgheight', + 'meta_key', + 'defcard', + 'profile_links', + 'person_or_org', + 'social_name', + 'twitter_site', + 'twitter_creator', + 'twitter_domain', + 'gen_tags', + 'gen_keywords', + 'gen_categories', + 'gen_post_tags', + 'types', + 'facebook_publisher', + 'facebook_author', + ), + ), + 'settings' => array( + 'name' => __( 'Social Settings', 'all-in-one-seo-pack' ), + 'type' => 'metabox', + 'help_link' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/', + 'options' => array( + 'title', + 'desc', + 'image', + 'customimg', + 'imagewidth', + 'imageheight', + 'video', + 'videowidth', + 'videoheight', + 'category', + 'facebook_debug', + 'section', + 'tag', + 'setcard', + 'customimg_twitter', + ), + 'display' => apply_filters( 'aioseop_opengraph_display', $display ), + 'prefix' => 'aioseop_opengraph_', + ), + ); + $this->layout = array( + 'home' => array( + 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#use-aioseo-title-and-description', + 'options' => array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage' ), + ), + 'image' => array( + 'name' => __( 'Image Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#select-og-image-source', + 'options' => array( 'defimg', 'fallback', 'dimg', 'dimgwidth', 'dimgheight', 'meta_key' ), + ), + 'links' => array( + 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#social-profile-links', + 'options' => array( 'profile_links', 'person_or_org', 'social_name' ), + ), + 'facebook' => array( + 'name' => __( 'Facebook Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#facebook-settings', + 'options' => array( + 'key', + 'appid', + 'types', + 'gen_tags', + 'gen_keywords', + 'gen_categories', + 'gen_post_tags', + 'facebook_publisher', + 'facebook_author', + ), + ), + 'twitter' => array( + 'name' => __( 'Twitter Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#default-twitter-card', + 'options' => array( 'defcard', 'setcard', 'twitter_site', 'twitter_creator', 'twitter_domain' ), + ), + 'default' => array( + 'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/', + 'options' => array(), // this is set below, to the remaining options -- pdb + ), + 'scan_meta' => array( + 'name' => __( 'Scan Social Meta', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#scan_meta', + 'options' => array( 'scan_header' ), + ), + ); + $other_options = array(); + foreach ( $this->layout as $k => $v ) { + $other_options = array_merge( $other_options, $v['options'] ); + } + + $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options ); + } + + /** + * Forces FaceBook OpenGraph to refresh its cache when a post is changed to + * + * @param $new_status + * @param $old_status + * @param $post + * + * @todo this and force_fb_refresh_update can probably have the remote POST extracted out. + * + * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update + * @since 2.3.11 + */ + function force_fb_refresh_transition( $new_status, $old_status, $post ) { + if ( 'publish' !== $new_status ) { + return; + } + if ( 'future' !== $old_status ) { + return; + } + + $current_post_type = get_post_type(); + + // Only ping Facebook if Social SEO is enabled on this post type. + if ( $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) { + $post_url = aioseop_get_permalink( $post->ID ); + $endpoint = sprintf( + 'https://graph.facebook.com/?%s', http_build_query( + array( + 'id' => $post_url, + 'scrape' => true, + ) + ) + ); + wp_remote_post( $endpoint, array( 'blocking' => false ) ); + } + } + + /** + * Forces FaceBook OpenGraph refresh on update. + * + * @param $post_id + * @param $post_after + * + * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update + * @since 2.3.11 + */ + function force_fb_refresh_update( $post_id, $post_after ) { + + $current_post_type = get_post_type(); + + // Only ping Facebook if Social SEO is enabled on this post type. + if ( 'publish' === $post_after->post_status && $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) { + $post_url = aioseop_get_permalink( $post_id ); + $endpoint = sprintf( + 'https://graph.facebook.com/?%s', http_build_query( + array( + 'id' => $post_url, + 'scrape' => true, + ) + ) + ); + wp_remote_post( $endpoint, array( 'blocking' => false ) ); + } + } + + function settings_page_init() { + add_filter( 'aiosp_output_option', array( $this, 'display_custom_options' ), 10, 2 ); + } + + function filter_options( $options, $location ) { + if ( $location == 'settings' ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + list( $legacy, $images ) = $this->get_all_images( $options ); + if ( isset( $options ) && isset( $options["{$prefix}image"] ) ) { + $thumbnail = $options["{$prefix}image"]; + if ( ctype_digit( (string) $thumbnail ) || ( $thumbnail == 'post' ) ) { + if ( $thumbnail == 'post' ) { + $thumbnail = $images['post1']; + } elseif ( ! empty( $legacy[ $thumbnail ] ) ) { + $thumbnail = $legacy[ $thumbnail ]; + } + } + $options["{$prefix}image"] = $thumbnail; + } + if ( empty( $options[ $prefix . 'image' ] ) ) { + $img = array_keys( $images ); + if ( ! empty( $img ) && ! empty( $img[1] ) ) { + $options[ $prefix . 'image' ] = $img[1]; + } + } + } + + return $options; + } + + /** + * Applies filter to module settings. + * + * @since 2.3.11 + * @since 2.4.14 Added filter for description and title placeholders. + * @since 2.3.15 do_shortcode on description. + * + * @see [plugin]\admin\aioseop_module_class.php > display_options() + */ + function filter_settings( $settings, $location, $current ) { + global $aiosp, $post; + if ( $location == 'opengraph' || $location == 'settings' ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + if ( $location == 'opengraph' ) { + return $settings; + } + if ( $location == 'settings' ) { + list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current ); + $opts = array( 'title', 'desc' ); + $current_post_type = get_post_type(); + if ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) { + $flat_type_list = array(); + foreach ( $this->fb_object_types as $k => $v ) { + if ( is_array( $v ) ) { + $flat_type_list = array_merge( $flat_type_list, $v ); + } else { + $flat_type_list[ $k ] = $v; + } + } + $settings[ $prefix . 'category' ]['initial_options'] = array_merge( + array( + $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] => __( 'Default ', 'all-in-one-seo-pack' ) . ' - ' + . $flat_type_list[ $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ], + ), + $settings[ $prefix . 'category' ]['initial_options'] + ); + } + if ( isset( $this->options['aiosp_opengraph_defcard'] ) ) { + $settings[ $prefix . 'setcard' ]['default'] = $this->options['aiosp_opengraph_defcard']; + } + $info = $aiosp->get_page_snippet_info(); + $title = $info['title']; + $description = $info['description']; + + // Description options + if ( is_object( $post ) ) { + // Always show excerpt + $description = empty( $this->options['aiosp_opengraph_generate_descriptions'] ) + ? $aiosp->trim_excerpt_without_filters( + $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ), + 1000 + ) + : $aiosp->trim_excerpt_without_filters( + $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), + 1000 + ); + } + + // Add filters + $description = apply_filters( 'aioseop_description', $description ); + // Add placholders + $settings[ "{$prefix}title" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $title ); + $settings[ "{$prefix}desc" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $description ); + } + if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) { + foreach ( $opts as $opt ) { + if ( isset( $settings[ $prefix . $opt ] ) ) { + $settings[ $prefix . $opt ]['type'] = 'hidden'; + $settings[ $prefix . $opt ]['label'] = 'none'; + $settings[ $prefix . $opt ]['help_text'] = ''; + unset( $settings[ $prefix . $opt ]['count'] ); + } + } + } + } + + return $settings; + } + + /** + * Applies filter to module options. + * These will display in the "Social Settings" object tab. + * filter:{prefix}override_options + * + * @since 2.3.11 + * @since 2.4.14 Overrides empty og:type values. + * + * @see [plugin]\admin\aioseop_module_class.php > display_options() + * + * @global array $aioseop_options Plugin options. + * + * @param array $options Current options. + * @param string $location Location where filter is called. + * @param array $settings Settings. + * + * @return array + */ + function override_options( $options, $location, $settings ) { + global $aioseop_options; + // Prepare default and prefix + $prefix = $this->get_prefix( $location ) . $location . '_'; + $opts = array(); + + foreach ( $settings as $k => $v ) { + if ( $v['save'] ) { + $opts[ $k ] = $v['default']; + } + } + foreach ( $options as $k => $v ) { + switch ( $k ) { + case $prefix . 'category': + if ( empty( $v ) ) { + // Get post type + $type = isset( get_current_screen()->post_type ) + ? get_current_screen()->post_type + : null; + // Assign default from plugin options + if ( ! empty( $type ) + && isset( $aioseop_options['modules'] ) + && isset( $aioseop_options['modules']['aiosp_opengraph_options'] ) + && isset( $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ] ) + ) { + $options[ $prefix . 'category' ] = + $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ]; + } + continue; + } + break; + } + if ( $v === null ) { + unset( $options[ $k ] ); + } + } + $options = wp_parse_args( $options, $opts ); + + return $options; + } + + /** + * Applies filter to metabox settings before they are saved. + * Sets custom as default if a custom image is uploaded. + * filter:{prefix}filter_metabox_options + * filter:{prefix}filter_term_metabox_options + * + * @since 2.3.11 + * @since 2.4.14 Fixes for aioseop-pro #67 and other bugs found. + * + * @see [plugin]\admin\aioseop_module_class.php > save_post_data() + * @see [this file] > save_tax_data() + * + * @param array $options List of current options. + * @param string $location Location where filter is called. + * @param int $id Either post_id or term_id. + * + * @return array + */ + function filter_metabox_options( $options, $location, $post_id ) { + if ( $location == 'settings' ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + if ( isset( $options[ $prefix . 'customimg_checker' ] ) + && $options[ $prefix . 'customimg_checker' ] + ) { + $options[ $prefix . 'image' ] = $options[ $prefix . 'customimg' ]; + } + } + return $options; + } + + /** Custom settings **/ + function display_custom_options( $buf, $args ) { + if ( $args['name'] == 'aiosp_opengraph_scan_header' ) { + $buf .= '
    '; + $args['options']['type'] = 'submit'; + $args['attr'] = " class='button-primary' "; + $args['value'] = $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' ); + $buf .= __( 'Scan your site for duplicate social meta tags.', 'all-in-one-seo-pack' ); + $buf .= '

    ' . $this->get_option_html( $args ); + $buf .= '
    '; + } + + return $buf; + } + + function add_attributes( $output ) { + // avoid having duplicate meta tags + $type = $this->type; + if ( empty( $type ) ) { + $type = 'website'; + } + + $schema_types = array( + 'album' => 'MusicAlbum', + 'article' => 'Article', + 'bar' => 'BarOrPub', + 'blog' => 'Blog', + 'book' => 'Book', + 'cafe' => 'CafeOrCoffeeShop', + 'city' => 'City', + 'country' => 'Country', + 'episode' => 'Episode', + 'food' => 'FoodEvent', + 'game' => 'Game', + 'hotel' => 'Hotel', + 'landmark' => 'LandmarksOrHistoricalBuildings', + 'movie' => 'Movie', + 'product' => 'Product', + 'profile' => 'ProfilePage', + 'restaurant' => 'Restaurant', + 'school' => 'School', + 'sport' => 'SportsEvent', + 'website' => 'WebSite', + ); + + if ( ! empty( $schema_types[ $type ] ) ) { + $type = $schema_types[ $type ]; + } else { + $type = 'WebSite'; + } + + $attributes = apply_filters( + $this->prefix . 'attributes', array( + 'itemscope', + 'itemtype="http://schema.org/' . ucfirst( $type ) . '"', + 'prefix="og: http://ogp.me/ns#"', + ) + ); + + foreach ( $attributes as $attr ) { + if ( strpos( $output, $attr ) === false ) { + $output .= "\n\t$attr "; + } + } + + return $output; + } + + /** + * Add our social meta. + * + * @since 1.0.0 + * @since 2.3.11.5 Support for multiple fb_admins. + * @since 2.3.13 Adds filter:aioseop_description on description. + * @since 2.4.14 Fixes for aioseop-pro #67. + * @since 2.3.15 Always do_shortcode on descriptions, removed for titles. + * + * @global object $post Current WP_Post object. + * @global object $aiosp All in one seo plugin object. + * @global array $aioseop_options All in one seo plugin options. + * @global object $wp_query WP_Query global instance. + */ + function add_meta() { + global $post, $aiosp, $aioseop_options, $wp_query; + $metabox = $this->get_current_options( array(), 'settings' ); + $key = $this->options['aiosp_opengraph_key']; + $dimg = $this->options['aiosp_opengraph_dimg']; + $current_post_type = get_post_type(); + $title = $description = $image = $video = ''; + $type = $this->type; + $sitename = $this->options['aiosp_opengraph_sitename']; + + $appid = isset( $this->options['aiosp_opengraph_appid'] ) ? $this->options['aiosp_opengraph_appid'] : ''; + + if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) { + $first_page = false; + if ( $aiosp->get_page_number() < 2 ) { + $first_page = true; + } + } else { + $first_page = true; + } + $url = $aiosp->aiosp_mrt_get_url( $wp_query ); + $url = apply_filters( 'aioseop_canonical_url', $url ); + + $setmeta = $this->options['aiosp_opengraph_setmeta']; + $social_links = ''; + if ( is_front_page() ) { + $title = $this->options['aiosp_opengraph_hometitle']; + if ( $first_page ) { + $description = $this->options['aiosp_opengraph_description']; + if ( empty( $description ) ) { + $description = get_bloginfo( 'description' ); + } + } + if ( ! empty( $this->options['aiosp_opengraph_homeimage'] ) ) { + $thumbnail = $this->options['aiosp_opengraph_homeimage']; + } else { + $thumbnail = $this->options['aiosp_opengraph_dimg']; + } + + /* If Use AIOSEO Title and Desc Selected */ + if ( $setmeta ) { + $title = $aiosp->wp_title(); + if ( $first_page ) { + $description = $aiosp->get_aioseop_description( $post ); + } + } + + /* Add some defaults */ + if ( empty( $title ) ) { + $title = get_bloginfo( 'name' ); + } + if ( empty( $sitename ) ) { + $sitename = get_bloginfo( 'name' ); + } + + if ( empty( $description ) && $first_page && ! empty( $post ) && ! post_password_required( $post ) ) { + + if ( ! empty( $post->post_content ) || ! empty( $post->post_excerpt ) ) { + $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ), 1000 ); + + if ( ! empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) { + $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 ); + } + } + } + + if ( empty( $description ) && $first_page ) { + $description = get_bloginfo( 'description' ); + } + if ( ! empty( $this->options['aiosp_opengraph_profile_links'] ) ) { + $social_links = $this->options['aiosp_opengraph_profile_links']; + if ( ! empty( $this->options['aiosp_opengraph_social_name'] ) ) { + $social_name = $this->options['aiosp_opengraph_social_name']; + } else { + $social_name = ''; + } + if ( $this->options['aiosp_opengraph_person_or_org'] == 'person' ) { + $social_type = 'Person'; + } else { + $social_type = 'Organization'; + } + } + } elseif ( is_singular() && $this->option_isset( 'types' ) + && is_array( $this->options['aiosp_opengraph_types'] ) + && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) + ) { + + if ( $type == 'article' ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) { + $section = $metabox['aioseop_opengraph_settings_section']; + } + if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) { + $tag = $metabox['aioseop_opengraph_settings_tag']; + } + if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) { + $publisher = $this->options['aiosp_opengraph_facebook_publisher']; + } + } + + if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { + $domain = $this->options['aiosp_opengraph_twitter_domain']; + } + + if ( $type == 'article' && ! empty( $post ) ) { + if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) { + $author = get_the_author_meta( 'facebook', $post->post_author ); + } + + if ( isset( $post->post_date_gmt ) ) { + $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date_gmt ) ); + } + + if ( isset( $post->post_modified_gmt ) ) { + $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified_gmt ) ); + } + } + + $image = $metabox['aioseop_opengraph_settings_image']; + $video = $metabox['aioseop_opengraph_settings_video']; + $title = $metabox['aioseop_opengraph_settings_title']; + $description = $metabox['aioseop_opengraph_settings_desc']; + + /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */ + global $aiosp; + if ( empty( $title ) ) { + $title = $aiosp->wp_title(); + } + if ( empty( $description ) ) { + $description = trim( strip_tags( get_post_meta( $post->ID, '_aioseop_description', true ) ) ); + } + + /* Add default title */ + if ( empty( $title ) ) { + $title = get_the_title(); + } + + // Add default description. + if ( empty( $description ) && ! post_password_required( $post ) ) { + + $description = $post->post_excerpt; + + if ( $this->options['aiosp_opengraph_generate_descriptions'] || empty( $description ) ) { + $description = $post->post_content; + } + } + if ( empty( $type ) ) { + $type = 'article'; + } + } elseif ( AIOSEOPPRO && ( is_category() || is_tag() || is_tax() ) ) { + if ( isset( $this->options['aioseop_opengraph_settings_category'] ) ) { + $type = $this->options['aioseop_opengraph_settings_category']; + } + if ( isset( $metabox['aioseop_opengraph_settings_category'] ) ) { + $type = $metabox['aioseop_opengraph_settings_category']; + } + if ( $type == 'article' ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) { + $section = $metabox['aioseop_opengraph_settings_section']; + } + if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) { + $tag = $metabox['aioseop_opengraph_settings_tag']; + } + if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) { + $publisher = $this->options['aiosp_opengraph_facebook_publisher']; + } + } + if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { + $domain = $this->options['aiosp_opengraph_twitter_domain']; + } + if ( $type == 'article' && ! empty( $post ) ) { + if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) { + $author = get_the_author_meta( 'facebook', $post->post_author ); + } + + if ( isset( $post->post_date_gmt ) ) { + $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date_gmt ) ); + } + if ( isset( $post->post_modified_gmt ) ) { + $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified_gmt ) ); + } + } + $image = $metabox['aioseop_opengraph_settings_image']; + $video = $metabox['aioseop_opengraph_settings_video']; + $title = $metabox['aioseop_opengraph_settings_title']; + $description = $metabox['aioseop_opengraph_settings_desc']; + /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */ + global $aiosp; + if ( empty( $title ) ) { + $title = $aiosp->wp_title(); + } + if ( empty( $description ) ) { + $term_id = isset( $_GET['tag_ID'] ) ? (int) $_GET['tag_ID'] : 0; + $term_id = $term_id ? $term_id : get_queried_object()->term_id; + $description = trim( strip_tags( get_term_meta( $term_id, '_aioseop_description', true ) ) ); + } + // Add default title + if ( empty( $title ) ) { + $title = get_the_title(); + } + // Add default description. + if ( empty( $description ) && ! post_password_required( $post ) ) { + $description = get_queried_object()->description; + } + if ( empty( $type ) ) { + $type = 'website'; + } + } elseif ( is_home() && ! is_front_page() ) { + // This is the blog page but not the homepage. + global $aiosp; + $image = $metabox['aioseop_opengraph_settings_image']; + $video = $metabox['aioseop_opengraph_settings_video']; + $title = $metabox['aioseop_opengraph_settings_title']; + $description = $metabox['aioseop_opengraph_settings_desc']; + + if ( empty( $description ) ) { + // If there's not social description, fall back to the SEO description. + $description = trim( strip_tags( get_post_meta( get_option( 'page_for_posts' ), '_aioseop_description', true ) ) ); + } + if ( empty( $title ) ) { + $title = $aiosp->wp_title(); + } + } else { + return; + } + + if ( $type === 'article' && ! empty( $post ) && is_singular() ) { + if ( ! empty( $this->options['aiosp_opengraph_gen_tags'] ) ) { + if ( ! empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) { + $keywords = $aiosp->get_main_keywords(); + $keywords = $this->apply_cf_fields( $keywords ); + $keywords = apply_filters( 'aioseop_keywords', $keywords ); + if ( ! empty( $keywords ) && ! empty( $tag ) ) { + $tag .= ',' . $keywords; + } elseif ( empty( $tag ) ) { + $tag = $keywords; + } + } + $tag = $aiosp->keyword_string_to_list( $tag ); + if ( ! empty( $this->options['aiosp_opengraph_gen_categories'] ) ) { + $tag = array_merge( $tag, $aiosp->get_all_categories( $post->ID ) ); + } + if ( ! empty( $this->options['aiosp_opengraph_gen_post_tags'] ) ) { + $tag = array_merge( $tag, $aiosp->get_all_tags( $post->ID ) ); + } + } + if ( ! empty( $tag ) ) { + $tag = $aiosp->clean_keyword_list( $tag ); + } + } + + if ( ! empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) { + $title = do_shortcode( $title ); + } + if ( ! empty( $description ) ) { + $description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) ); + if ( ! empty( $this->options['aiosp_opengraph_description_shortcodes'] ) ) { + $description = do_shortcode( $description ); + } + $description = $aiosp->trim_excerpt_without_filters( $description, 1000 ); + } + + $title = $this->apply_cf_fields( $title ); + $description = $this->apply_cf_fields( $description ); + + /* Data Validation */ + $title = strip_tags( esc_attr( $title ) ); + $sitename = strip_tags( esc_attr( $sitename ) ); + $description = strip_tags( esc_attr( $description ) ); + + if ( empty( $thumbnail ) && ! empty( $image ) ) { + $thumbnail = $image; + } + + // Add user supplied default image. + if ( empty( $thumbnail ) ) { + if ( empty( $this->options['aiosp_opengraph_defimg'] ) ) { + $thumbnail = $this->options['aiosp_opengraph_dimg']; + } else { + switch ( $this->options['aiosp_opengraph_defimg'] ) { + case 'featured': + $thumbnail = $this->get_the_image_by_post_thumbnail(); + break; + case 'attach': + $thumbnail = $this->get_the_image_by_attachment(); + break; + case 'content': + $thumbnail = $this->get_the_image_by_scan(); + break; + case 'custom': + $meta_key = $this->options['aiosp_opengraph_meta_key']; + if ( ! empty( $meta_key ) && ! empty( $post ) ) { + $meta_key = explode( ',', $meta_key ); + $thumbnail = $this->get_the_image_by_meta_key( + array( + 'post_id' => $post->ID, + 'meta_key' => $meta_key, + ) + ); + } + break; + case 'auto': + $thumbnail = $this->get_the_image(); + break; + case 'author': + $thumbnail = $this->get_the_image_by_author(); + break; + default: + $thumbnail = $this->options['aiosp_opengraph_dimg']; + } + } + } + + if ( ( empty( $thumbnail ) && ! empty( $this->options['aiosp_opengraph_fallback'] ) ) ) { + $thumbnail = $this->options['aiosp_opengraph_dimg']; + } + + if ( ! empty( $thumbnail ) ) { + $thumbnail = esc_url( $thumbnail ); + $thumbnail = set_url_scheme( $thumbnail ); + } + + $width = $height = ''; + if ( ! empty( $thumbnail ) ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) ) { + $width = $metabox['aioseop_opengraph_settings_imagewidth']; + } + if ( ! empty( $metabox['aioseop_opengraph_settings_imageheight'] ) ) { + $height = $metabox['aioseop_opengraph_settings_imageheight']; + } + if ( empty( $width ) && ! empty( $this->options['aiosp_opengraph_dimgwidth'] ) ) { + $width = $this->options['aiosp_opengraph_dimgwidth']; + } + if ( empty( $height ) && ! empty( $this->options['aiosp_opengraph_dimgheight'] ) ) { + $height = $this->options['aiosp_opengraph_dimgheight']; + } + } + + if ( ! empty( $video ) ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_videowidth'] ) ) { + $videowidth = $metabox['aioseop_opengraph_settings_videowidth']; + } + if ( ! empty( $metabox['aioseop_opengraph_settings_videoheight'] ) ) { + $videoheight = $metabox['aioseop_opengraph_settings_videoheight']; + } + } + + $card = 'summary'; + if ( ! empty( $this->options['aiosp_opengraph_defcard'] ) ) { + $card = $this->options['aiosp_opengraph_defcard']; + } + + if ( ! empty( $metabox['aioseop_opengraph_settings_setcard'] ) ) { + $card = $metabox['aioseop_opengraph_settings_setcard']; + } + + // support for changing legacy twitter cardtype-photo to summary large image + if ( $card == 'photo' ) { + $card = 'summary_large_image'; + } + + $site = $domain = $creator = ''; + + if ( ! empty( $this->options['aiosp_opengraph_twitter_site'] ) ) { + $site = $this->options['aiosp_opengraph_twitter_site']; + $site = AIOSEOP_Opengraph_Public::prepare_twitter_username( $site ); + } + + if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { + $domain = $this->options['aiosp_opengraph_twitter_domain']; + } + + if ( ! empty( $post ) && isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_twitter_creator'] ) ) { + $creator = get_the_author_meta( 'twitter', $post->post_author ); + $creator = AIOSEOP_Opengraph_Public::prepare_twitter_username( $creator ); + } + + if ( ! empty( $thumbnail ) ) { + $twitter_thumbnail = $thumbnail; // Default Twitter image if custom isn't set. + } + + if ( isset( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) && ! empty( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) ) { + // Set Twitter image from custom. + $twitter_thumbnail = set_url_scheme( $metabox['aioseop_opengraph_settings_customimg_twitter'] ); + } + + // Apply last filters. + $description = apply_filters( 'aioseop_description', $description ); + + $meta = array( + 'facebook' => array( + 'title' => 'og:title', + 'type' => 'og:type', + 'url' => 'og:url', + 'thumbnail' => 'og:image', + 'width' => 'og:image:width', + 'height' => 'og:image:height', + 'video' => 'og:video', + 'videowidth' => 'og:video:width', + 'videoheight' => 'og:video:height', + 'sitename' => 'og:site_name', + 'key' => 'fb:admins', + 'appid' => 'fb:app_id', + 'description' => 'og:description', + 'section' => 'article:section', + 'tag' => 'article:tag', + 'publisher' => 'article:publisher', + 'author' => 'article:author', + 'published_time' => 'article:published_time', + 'modified_time' => 'article:modified_time', + ), + 'twitter' => array( + 'card' => 'twitter:card', + 'site' => 'twitter:site', + 'creator' => 'twitter:creator', + 'domain' => 'twitter:domain', + 'title' => 'twitter:title', + 'description' => 'twitter:description', + 'twitter_thumbnail' => 'twitter:image', + ), + ); + + // Only show if "use schema.org markup is checked". + if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) { + $meta['google+'] = array( 'thumbnail' => 'image' ); + } + + $tags = array( + 'facebook' => array( 'name' => 'property', 'value' => 'content' ), + 'twitter' => array( 'name' => 'name', 'value' => 'content' ), + 'google+' => array( 'name' => 'itemprop', 'value' => 'content' ), + ); + + foreach ( $meta as $t => $data ) { + foreach ( $data as $k => $v ) { + if ( empty( $$k ) ) { + $$k = ''; + } + $filtered_value = $$k; + $filtered_value = apply_filters( $this->prefix . 'meta', $filtered_value, $t, $k ); + if ( ! empty( $filtered_value ) ) { + if ( ! is_array( $filtered_value ) ) { + $filtered_value = array( $filtered_value ); + } + + /** + * This is to accomodate multiple fb:admins on separate lines. + * @TODO Eventually we'll want to put this in its own function so things like images work too. + */ + if ( 'key' === $k ) { + $fbadmins = explode( ',', str_replace( ' ', '', $filtered_value[0] ) ); // Trim spaces then turn comma-separated values into an array. + foreach ( $fbadmins as $fbadmin ) { + echo '' . "\n"; + } + } else { + // For everything else. + foreach ( $filtered_value as $f ) { + echo '' . "\n"; + } + } + } + } + } + $social_link_schema = ''; + if ( ! empty( $social_links ) ) { + $home_url = esc_url( get_home_url() ); + $social_links = explode( "\n", $social_links ); + foreach ( $social_links as $k => $v ) { + $v = trim( $v ); + if ( empty( $v ) ) { + unset( $social_links[ $k ] ); + } else { + $v = esc_url( $v ); + $social_links[ $k ] = $v; + } + } + $social_links = join( '","', $social_links ); + $social_link_schema = << +{ "@context" : "http://schema.org", + "@type" : "{$social_type}", + "name" : "{$social_name}", + "url" : "{$home_url}", + "sameAs" : ["{$social_links}"] +} + + +END; + } + echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema ); + } + + /** + * Do / adds opengraph properties to meta. + * @since 2.3.11 + * + * @global array $aioseop_options AIOSEOP plugin options. + */ + public function do_opengraph() { + global $aioseop_options; + if ( ! empty( $aioseop_options ) + && ! empty( $aioseop_options['aiosp_schema_markup'] ) + ) { + add_filter( 'language_attributes', array( &$this, 'add_attributes' ) ); + } + if ( ! defined( 'DOING_AJAX' ) ) { + add_action( 'aioseop_modules_wp_head', array( &$this, 'add_meta' ), 5 ); + // Add social meta to AMP plugin. + if ( apply_filters( 'aioseop_enable_amp_social_meta', true ) === true ) { + add_action( 'amp_post_template_head', array( &$this, 'add_meta' ), 12 ); + } + } + } + + /** + * Set up types. + * + * @since ? + * @since 2.3.15 Change to website for homepage and blog post index page, default to object. + */ + function type_setup() { + $this->type = 'object'; // Default to type object if we don't have some other rule. + + if ( is_home() || is_front_page() ) { + $this->type = 'website'; // Home page and blog page should be website. + } elseif ( is_singular() && $this->option_isset( 'types' ) ) { + $metabox = $this->get_current_options( array(), 'settings' ); + $current_post_type = get_post_type(); + if ( ! empty( $metabox['aioseop_opengraph_settings_category'] ) ) { + $this->type = $metabox['aioseop_opengraph_settings_category']; + } elseif ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) { + $this->type = $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ]; + } + } + } + + /** + * Inits hooks and others for admin init. + * action:admin_init. + * + * @since 2.3.11 + * @since 2.4.14 Refactored function name, and new filter added for defaults and missing term metabox. + */ + function admin_init() { + add_filter( $this->prefix . 'display_settings', array( &$this, 'filter_settings' ), 10, 3 ); + add_filter( $this->prefix . 'override_options', array( &$this, 'override_options' ), 10, 3 ); + add_filter( $this->get_prefix( 'settings' ) . 'default_options', array( + &$this, + 'filter_default_options', + ), 10, 2 ); + add_filter( + $this->get_prefix( 'settings' ) . 'filter_metabox_options', array( + &$this, + 'filter_metabox_options', + ), 10, 3 + ); + add_filter( + $this->get_prefix( 'settings' ) . 'filter_term_metabox_options', array( + &$this, + 'filter_metabox_options', + ), 10, 3 + ); + $post_types = $this->get_post_type_titles(); + $rempost = array( + 'revision' => 1, + 'nav_menu_item' => 1, + 'custom_css' => 1, + 'customize_changeset' => 1, + ); + $post_types = array_diff_key( $post_types, $rempost ); + $this->default_options['types']['initial_options'] = $post_types; + foreach ( $post_types as $slug => $name ) { + $field = $slug . '_fb_object_type'; + $this->default_options[ $field ] = array( + 'name' => "$name " . __( 'Object Type', 'all-in-one-seo-pack' ) . "
    ($slug)", + 'type' => 'select', + 'style' => '', + 'initial_options' => $this->fb_object_types, + 'default' => 'article', + 'condshow' => array( 'aiosp_opengraph_types\[\]' => $slug ), + ); + $this->help_text[ $field ] = __( 'Choose a default value that best describes the content of your post type.', 'all-in-one-seo-pack' ); + $this->help_anchors[ $field ] = '#content-object-types'; + $this->locations['opengraph']['options'][] = $field; + $this->layout['facebook']['options'][] = $field; + } + $this->setting_options(); + $this->add_help_text_links(); + + } + + function get_all_images( $options = null, $p = null ) { + static $img = array(); + if ( ! is_array( $options ) ) { + $options = array(); + } + if ( ! empty( $this->options['aiosp_opengraph_meta_key'] ) ) { + $options['meta_key'] = $this->options['aiosp_opengraph_meta_key']; + } + if ( empty( $img ) ) { + $size = apply_filters( 'post_thumbnail_size', 'large' ); + $default = $this->get_the_image_by_default(); + if ( ! empty( $default ) ) { + $default = set_url_scheme( $default ); + $img[ $default ] = 0; + } + $img = array_merge( $img, parent::get_all_images( $options, null ) ); + } + + if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) { + $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg'; + } + + if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) { + $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg'; + $img[ $options['aioseop_opengraph_settings_customimg_twitter'] ] = 'customimg_twitter'; + } + + if ( $author_img = $this->get_the_image_by_author( $p ) ) { + $image['author'] = $author_img; + } + $image = array_flip( $img ); + $images = array(); + if ( ! empty( $image ) ) { + foreach ( $image as $k => $v ) { + $images[ $v ] = ''; + } + } + + return array( $image, $images ); + } + + function get_the_image_by_author( $options = null, $p = null ) { + if ( $p === null ) { + global $post; + } else { + $post = $p; + } + if ( ! empty( $post ) && ! empty( $post->post_author ) ) { + $matches = array(); + $get_avatar = get_avatar( $post->post_author, 300 ); + if ( preg_match( "/src='(.*?)'/i", $get_avatar, $matches ) ) { + return $matches[1]; + } + } + + return false; + } + + function get_the_image( $options = null, $p = null ) { + $meta_key = $this->options['aiosp_opengraph_meta_key']; + + return parent::get_the_image( array( 'meta_key' => $meta_key ), $p ); + } + + function get_the_image_by_default( $args = array() ) { + return $this->options['aiosp_opengraph_dimg']; + } + + function settings_update() { + + } + + /** + * Enqueue our file upload scripts and styles. + * @param $hook + */ + function og_admin_enqueue_scripts( $hook ) { + + if ( 'all-in-one-seo_page_aiosp_opengraph' != $hook && 'term.php' != $hook ) { + // Only enqueue if we're on the social module settings page. + return; + } + + wp_enqueue_script( 'media-upload' ); + wp_enqueue_script( 'thickbox' ); + wp_enqueue_style( 'thickbox' ); + wp_enqueue_media(); + } + + function save_tax_data( $term_id, $tt_id, $taxonomy ) { + static $update = false; + if ( $update ) { + return; + } + if ( $this->locations !== null ) { + foreach ( $this->locations as $k => $v ) { + if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) { + $opts = $this->default_options( $k ); + $options = array(); + $update = false; + foreach ( $opts as $l => $o ) { + if ( isset( $_POST[ $l ] ) ) { + $options[ $l ] = stripslashes_deep( $_POST[ $l ] ); + $options[ $l ] = esc_attr( $options[ $l ] ); + $update = true; + } + } + if ( $update ) { + $prefix = $this->get_prefix( $k ); + $options = apply_filters( $prefix . 'filter_term_metabox_options', $options, $k, $term_id ); + update_term_meta( $term_id, '_' . $prefix . $k, $options ); + } + } + } + } + } + + /** + * Returns the placeholder filtered and ready for DOM display. + * filter:aioseop_opengraph_placeholder + * @since 2.4.14 + * + * @param mixed $placeholder Placeholder to be filtered. + * @param string $type Type of the value to be filtered. + * + * @return string + */ + public function filter_placeholder( $placeholder, $type = 'text' ) { + return strip_tags( trim( $placeholder ) ); + } + + /** + * Returns filtered default options. + * filter:{prefix}default_options + * @since 2.4.13 + * + * @param array $options Default options. + * @param string $location Location. + * + * @return array + */ + public function filter_default_options( $options, $location ) { + if ( $location === 'settings' ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + // Add image checker as default + $options[ $prefix . 'customimg_checker' ] = 0; + } + return $options; + } + + /** + * Returns facebook debug script and link. + * @since 2.4.14 + * + * @return string + */ + private function get_facebook_debug() { + ob_start(); + ?> + + + Date: Tue, 7 Aug 2018 15:28:15 -0600 Subject: [PATCH 14/54] Use `rewrite_rules_array` as a filter --- modules/aioseop_sitemap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index b5ccfcb46..9e5e09503 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -1136,7 +1136,7 @@ function debug_message( $msg ) { * Set up hooks for rewrite rules for dynamic sitemap generation. */ function setup_rewrites() { - add_action( 'rewrite_rules_array', array( $this, 'rewrite_hook' ) ); + add_filter( 'rewrite_rules_array', array( $this, 'rewrite_hook' ) ); add_filter( 'query_vars', array( $this, 'query_var_hook' ) ); add_action( 'parse_query', array( $this, 'sitemap_output_hook' ) ); if ( ! get_transient( "{$this->prefix}rules_flushed" ) ) { From 5d1e19d0605cd60681c52b9ecafc37d249caaab1 Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Mon, 13 Aug 2018 13:22:58 -0400 Subject: [PATCH 15/54] Update readme.txt --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index a36db0d39..8c9e4272b 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtor Tags: SEO, all in one seo, WordPress SEO, Google Search Console, XML Sitemap, image seo Requires at least: 4.4 Tested up to: 4.9 -Stable tag: 2.7.1 +Stable tag: 2.7.3 License: GPLv2 or later Requires PHP: 5.2.4 From 9e01da0ae3a78adf9da5212f105a72cdc0c3af97 Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Mon, 13 Aug 2018 13:23:20 -0400 Subject: [PATCH 16/54] version bump to 2.7.3 --- all_in_one_seo_pack.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/all_in_one_seo_pack.php b/all_in_one_seo_pack.php index 6c7a992ab..68039c696 100644 --- a/all_in_one_seo_pack.php +++ b/all_in_one_seo_pack.php @@ -4,7 +4,7 @@ Plugin Name: All In One SEO Pack Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/ 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. -Version: 2.7.2 +Version: 2.7.3 Author: Michael Torbert Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/ Text Domain: all-in-one-seo-pack @@ -32,14 +32,14 @@ * The original WordPress SEO plugin. * * @package All-in-One-SEO-Pack - * @version 2.7.2 + * @version 2.7.3 */ if ( ! defined( 'AIOSEOPPRO' ) ) { define( 'AIOSEOPPRO', false ); } if ( ! defined( 'AIOSEOP_VERSION' ) ) { - define( 'AIOSEOP_VERSION', '2.7.2' ); + define( 'AIOSEOP_VERSION', '2.7.3' ); } global $aioseop_plugin_name; $aioseop_plugin_name = 'All in One SEO Pack'; From 94a847ebb82930ba2bb38279d84c1757c3e6d141 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Wed, 15 Aug 2018 20:30:16 +0530 Subject: [PATCH 17/54] SEO News feed still attempts to access it even when disabled via screen options (#1433) * SEO News feed still attempts to access it even when disabled via screen options * codeclimate --- admin/display/dashboard_widget.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/admin/display/dashboard_widget.php b/admin/display/dashboard_widget.php index d10f8b6d1..11ac500fc 100644 --- a/admin/display/dashboard_widget.php +++ b/admin/display/dashboard_widget.php @@ -15,21 +15,18 @@ class aioseop_dashboard_widget { * Add the action to the constructor. */ function __construct() { - add_action( 'wp_dashboard_setup', array( $this, 'aioseop_add_dashboard_widget' ) ); + add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widget' ) ); } /** * @since 2.3.10 */ - function aioseop_add_dashboard_widget() { - + function add_dashboard_widget() { if ( current_user_can( 'install_plugins' ) && false !== $this->show_widget() ) { - wp_add_dashboard_widget( - 'semperplugins-rss-feed', __( 'SEO News', 'all-in-one-seo-pack' ), array( - $this, - 'aioseop_display_rss_dashboard_widget', - ) - ); + wp_add_dashboard_widget( 'semperplugins-rss-feed', __( 'SEO News', 'all-in-one-seo-pack' ), array( + $this, + 'display_rss_dashboard_widget', + ) ); } } @@ -58,7 +55,13 @@ function show_widget() { /** * @since 2.3.10 */ - function aioseop_display_rss_dashboard_widget() { + function display_rss_dashboard_widget() { + // check if the user has chosen not to display this widget through screen options. + $current_screen = get_current_screen(); + $hidden_widgets = get_user_meta( get_current_user_id(), 'metaboxhidden_' . $current_screen->id ); + if ( $hidden_widgets && count( $hidden_widgets ) > 0 && is_array( $hidden_widgets[0] ) && in_array( 'semperplugins-rss-feed', $hidden_widgets[0], true ) ) { + return; + } include_once( ABSPATH . WPINC . '/feed.php' ); From 63f8a75758c268e7710d84f30ea6aeb4a2ca005e Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Thu, 23 Aug 2018 05:58:47 +0530 Subject: [PATCH 18/54] XML Sitemap - Don't include content from trashed pages (#1425) * XML Sitemap - Don't include content from trashed pages * codeclimate * scrutinizer * scrutinizer * scrutinizer * scrutinizer * scrutinizer * scrutinizer * test case * sync with master * empty test case --- js/modules/aioseop_module.js | 2 +- modules/aioseop_sitemap.php | 13 ++++++---- tests/base/class-sitemap-test-base.php | 1 + tests/modules/sitemap/test-sitemap.php | 33 ++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/js/modules/aioseop_module.js b/js/modules/aioseop_module.js index b94c3186e..588cb2277 100644 --- a/js/modules/aioseop_module.js +++ b/js/modules/aioseop_module.js @@ -647,7 +647,6 @@ jQuery( document ).ready( }); aiospinitAll(); - aiospinitCounting(); } ); @@ -857,6 +856,7 @@ function aioseop_overflow_border( el ) { function aiospinitAll(){ aiospinitSocialMetaInPosts(jQuery); aiospinitCalendar(); + aiospinitCounting(); } function aiospinitCalendar(){ diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index c08c65312..37183d0da 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -2448,11 +2448,11 @@ function get_addl_page_links() { * Scores posts based on date and relative comment count, if any. * * @param $date - * @param int $stats + * @param mixed $stats * * @return array */ - function get_prio_calc( $date, $stats = 0 ) { + function get_prio_calc( $date, $stats ) { static $cur_time = null; if ( null === $cur_time ) { $cur_time = time(); @@ -2648,7 +2648,7 @@ function get_comment_count_stats( $posts ) { * * @return array */ - function get_prio_from_posts( $posts, $prio_override = false, $freq_override = false, $linkfunc = 'get_permalink' ) { + private function get_prio_from_posts( $posts, $prio_override = false, $freq_override = false, $linkfunc = 'get_permalink' ) { $prio = array(); $args = array( 'prio_override' => $prio_override, @@ -2664,7 +2664,6 @@ function get_prio_from_posts( $posts, $prio_override = false, $freq_override = f foreach ( $posts as $post ) { // Determine if we check the post for images. $is_single = true; - $url = ''; $post->filter = 'sample'; if ( 'get_permalink' === $linkfunc ) { $url = $this->get_permalink( $post ); @@ -2672,6 +2671,12 @@ function get_prio_from_posts( $posts, $prio_override = false, $freq_override = f $url = call_user_func( $linkfunc, $post ); $is_single = false; } + + if ( strpos( $url, '__trashed' ) !== false ) { + // excluded trashed urls. + continue; + } + $date = $post->post_modified_gmt; if ( '0000-00-00 00:00:00' === $date ) { $date = $post->post_date_gmt; diff --git a/tests/base/class-sitemap-test-base.php b/tests/base/class-sitemap-test-base.php index 74a23fc29..48a559a5a 100644 --- a/tests/base/class-sitemap-test-base.php +++ b/tests/base/class-sitemap-test-base.php @@ -179,5 +179,6 @@ protected final function count_sitemap_elements( $elements ) { // @codingStandardsIgnoreEnd return $map; + } } diff --git a/tests/modules/sitemap/test-sitemap.php b/tests/modules/sitemap/test-sitemap.php index 8aef7735a..a762d8f37 100644 --- a/tests/modules/sitemap/test-sitemap.php +++ b/tests/modules/sitemap/test-sitemap.php @@ -125,6 +125,39 @@ public function test_exclude_images() { ); } + /** + * Don't include content from trashed pages. + * + * @ticket 1423 XML Sitemap - Don't include content from trashed pages. + */ + public function test_exclude_trashed_pages() { + $posts = $this->factory->post->create_many( 2 ); + wp_trash_post( $posts[0] ); + + $custom_options = array(); + $custom_options['aiosp_sitemap_indexes'] = ''; + $custom_options['aiosp_sitemap_images'] = 'on'; + $custom_options['aiosp_sitemap_gzipped'] = ''; + $custom_options['aiosp_sitemap_posttypes'] = array( 'post' ); + + $this->_setup_options( 'sitemap', $custom_options ); + + $urls = array(); + foreach( $posts as $id ) { + $urls[] = get_permalink( $id ); + } + $xml = $this->validate_sitemap( + array( + $urls[0] => false, + $urls[1] => true, + ) + ); + + // check that the file does not contain the string __trashed because that's how trashed pages are included. + $this->assertNotContains( $xml, '__trashed' ); + } + + /** * Add WooCommerce product gallery images to XML sitemap. * From 4572e15d6e2867ba0cc7532ef55796278a5540f7 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Mon, 27 Aug 2018 23:07:32 +0530 Subject: [PATCH 19/54] Issue when using post title as description (#1421) * Issue when using post title as description * added comments * test case * test case * test case failing --- aioseop_class.php | 14 ++++++----- tests/modules/general/test-meta.php | 36 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/aioseop_class.php b/aioseop_class.php index 19745185d..60b5863dd 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -1453,7 +1453,7 @@ function get_page_snippet_info() { function get_queried_object() { static $p = null; global $wp_query, $post; - if ( null !== $p ) { + if ( null !== $p && ! defined('AIOSEOP_UNIT_TESTING') ) { return $p; } if ( is_object( $post ) ) { @@ -1589,11 +1589,13 @@ function wp_title() { /** * Gets the title that will be used by AIOSEOP for title rewrites or returns false. * - * @param $post + * @param WP_Post $post the post object + * @param bool $use_original_title_format should the original title format be used viz. post_title | blog_title. This parameter was introduced + * to resolve issue#986 * * @return bool|string */ - function get_aioseop_title( $post ) { + function get_aioseop_title( $post, $use_original_title_format = true ) { global $aioseop_options; // the_search_query() is not suitable, it cannot just return. global $s, $STagging; @@ -1739,14 +1741,14 @@ function get_aioseop_title( $post ) { $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) ); if ( ! $title ) { $title = $this->internationalize( get_post_meta( $post->ID, 'title_tag', true ) ); - if ( ! $title ) { + if ( ! $title && $use_original_title_format ) { $title = $this->internationalize( $this->get_original_title( '', false ) ); } } if ( empty( $title ) ) { $title = $post->post_title; } - if ( ! empty( $title ) ) { + if ( ! empty( $title ) && $use_original_title_format ) { $title = $this->apply_post_title_format( $title, $category, $post ); } $title = $this->paged_title( $title ); @@ -4094,7 +4096,7 @@ function apply_description_format( $description, $post = null ) { $description = str_replace( '%wp_title%', $this->get_original_title(), $description ); } if ( strpos( $description, '%post_title%' ) !== false ) { - $description = str_replace( '%post_title%', $this->get_aioseop_title( $post ), $description ); + $description = str_replace( '%post_title%', $this->get_aioseop_title( $post, false ), $description ); } if ( strpos( $description, '%current_date%' ) !== false ) { $description = str_replace( '%current_date%', date_i18n( get_option( 'date_format' ) ), $description ); diff --git a/tests/modules/general/test-meta.php b/tests/modules/general/test-meta.php index d303a3f09..a2a26d2dd 100644 --- a/tests/modules/general/test-meta.php +++ b/tests/modules/general/test-meta.php @@ -56,6 +56,42 @@ public function test_custom_field_in_meta_desc( $format, $custom_field = false ) $this->assertEquals( $meta_desc, $description ); } + /** + * Test whether the meta description contains exactly what is expected. + * + * @dataProvider metaDescProvider + */ + public function test_post_title_in_meta_desc( $title, $meta_desc, $format ) { + wp_set_current_user( 1 ); + global $aioseop_options; + $id = $this->factory->post->create( array( 'post_type' => 'post', 'post_title' => $title ) ); + // update the format. + $aioseop_options['aiosp_description_format'] = $format; + update_option( 'aioseop_options', $aioseop_options ); + $link = get_permalink( $id ); + $meta = $this->parse_html( $link, array( 'meta' ) ); + // should have atleast one meta tag. + $this->assertGreaterThan( 1, count( $meta ) ); + $description = null; + foreach ( $meta as $m ) { + if ( 'description' === $m['name'] ) { + $description = $m['content']; + break; + } + } + $this->assertEquals( $meta_desc, $description ); + } + + /** + * The data provider for meta description. + */ + public function metaDescProvider() { + return array( + array( 'heyhey', 'heyhey', '%post_title%' ), + array( 'heyhey', 'heyhey' . get_option('blogname'), '%post_title%%blog_title%' ), + ); + } + /** * Provides data to test meta with and without custom fields. */ From 404a7db1a7c57596785a629cf025570236e88efd Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Wed, 29 Aug 2018 03:27:25 +0100 Subject: [PATCH 20/54] Autogenerate Descriptions: Problem (#1322) * Autogenerate Descriptions: Problem #1308 * codeclimate * test case (incomplete, as its not working) * bug while accessing front end * fixes Open Graph Description field on the Social Settings tab https://github.com/semperfiwebdesign/all-in-one-seo-pack/pull/1322#issuecomment-410085962 * Merge branch '2.8' of https://github.com/semperfiwebdesign/all-in-one-seo-pack into #1308 --- aioseop_class.php | 22 ++++--- modules/aioseop_opengraph.php | 6 +- tests/base/class-aioseop-test-base.php | 91 ++++++++++++++------------ tests/modules/general/test-meta.php | 47 +++++++++++++ 4 files changed, 116 insertions(+), 50 deletions(-) diff --git a/aioseop_class.php b/aioseop_class.php index 60b5863dd..3e14a55d0 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -1453,7 +1453,7 @@ function get_page_snippet_info() { function get_queried_object() { static $p = null; global $wp_query, $post; - if ( null !== $p && ! defined('AIOSEOP_UNIT_TESTING') ) { + if ( null !== $p && ! defined( 'AIOSEOP_UNIT_TESTING' ) ) { return $p; } if ( is_object( $post ) ) { @@ -2490,6 +2490,10 @@ function get_main_description( $post = null ) { $description = $this->internationalize( $description ); } + // #1308 - we want to make sure we are ignoring php version only in the admin area while editing the post, so that it does not impact #932. + $screen = is_admin() ? get_current_screen() : null; + $ignore_php_version = $screen && isset( $screen->id ) && 'post' === $screen->id; + $truncate = false; $aioseop_desc = ''; if ( ! empty( $post->ID ) ) { @@ -2503,7 +2507,8 @@ function get_main_description( $post = null ) { $description = apply_filters( 'aioseop_description', $description, - $truncate + $truncate, + $ignore_php_version ); return $description; @@ -3684,7 +3689,7 @@ function add_hooks() { add_action( 'amp_post_template_head', array( $this, 'amp_head' ), 11 ); add_action( 'template_redirect', array( $this, 'template_redirect' ), 0 ); } - add_filter( 'aioseop_description', array( &$this, 'filter_description' ), 10, 2 ); + add_filter( 'aioseop_description', array( &$this, 'filter_description' ), 10, 3 ); add_filter( 'aioseop_title', array( &$this, 'filter_title' ) ); } @@ -3819,9 +3824,8 @@ function wp_head() { global $aioseop_update_checker, $wp_query, $aioseop_options, $posts; static $aioseop_dup_counter = 0; $aioseop_dup_counter ++; - - if ( ! defined('AIOSEOP_UNIT_TESTING') && $aioseop_dup_counter > 1 ) { - echo "\n\n"; + if ( ! defined( 'AIOSEOP_UNIT_TESTING' ) && $aioseop_dup_counter > 1 ) { + echo "\n\n"; if ( ! empty( $old_wp_query ) ) { // Change the query back after we've finished. $GLOBALS['wp_query'] = $old_wp_query; @@ -5000,11 +5004,13 @@ public function filter_title( $value ) { * * @param string $value Value to filter. * @param bool $truncate Flag that indicates if value should be truncated/cropped. + * @param bool $ignore_php_version Flag that indicates if the php version check should be ignored. * * @return string */ - public function filter_description( $value, $truncate = false ) { - if ( preg_match( '/5.2[\s\S]+/', PHP_VERSION ) ) { + public function filter_description( $value, $truncate = false, $ignore_php_version = false ) { + // TODO: change preg_match to version_compare someday when the reason for this condition is understood better. + if ( $ignore_php_version || preg_match( '/5.2[\s\S]+/', PHP_VERSION ) ) { $value = htmlspecialchars( wp_strip_all_tags( htmlspecialchars_decode( $value ) ) ); } // Decode entities diff --git a/modules/aioseop_opengraph.php b/modules/aioseop_opengraph.php index 4828e6a24..18c991ae8 100644 --- a/modules/aioseop_opengraph.php +++ b/modules/aioseop_opengraph.php @@ -774,8 +774,12 @@ function filter_settings( $settings, $location, $current ) { ); } + // #1308 - we want to make sure we are ignoring php version only in the admin area while editing the post, so that it does not impact #932. + $screen = get_current_screen(); + $ignore_php_version = is_admin() && isset( $screen->id ) && 'post' == $screen->id; + // Add filters - $description = apply_filters( 'aioseop_description', $description ); + $description = apply_filters( 'aioseop_description', $description, false, $ignore_php_version ); // Add placholders $settings[ "{$prefix}title" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $title ); $settings[ "{$prefix}desc" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $description ); diff --git a/tests/base/class-aioseop-test-base.php b/tests/base/class-aioseop-test-base.php index 41b125d35..132070f8c 100644 --- a/tests/base/class-aioseop-test-base.php +++ b/tests/base/class-aioseop-test-base.php @@ -4,12 +4,21 @@ */ class AIOSEOP_Test_Base extends WP_UnitTestCase { + public function _setUp() { + parent::setUp(); + // avoids error - readfile(/src/wp-includes/js/wp-emoji-loader.js): failed to open stream: No such file or directory + remove_action('wp_head', 'print_emoji_detection_script', 7); + + // reset global options. + delete_option( 'aioseop_options' ); + aioseop_initialize_options(); + } + /** * Upload an image and, optionally, attach to the post. - */ + */ protected final function upload_image_and_maybe_attach( $image, $id = 0 ) { - /* - This factory method has a bug so we have to be a little clever. + /* this factory method has a bug so we have to be a little clever. $this->factory->attachment->create( array( 'file' => $image, 'post_parent' => $id ) ); */ $attachment_id = $this->factory->attachment->create_upload_object( $image, $id ); @@ -21,31 +30,33 @@ protected final function upload_image_and_maybe_attach( $image, $id = 0 ) { /** * Create attachments, and, optionally, attach to a post. - */ + */ protected final function create_attachments( $num, $id = 0 ) { $image = str_replace( '\\', '/', AIOSEOP_UNIT_TESTING_DIR . '/resources/images/footer-logo.png' ); $ids = array(); - for ( $x = 0; $x < $num; $x++ ) { + for( $x = 0; $x < $num; $x++ ) { $ids[] = $this->factory->attachment->create_upload_object( $image, $id ); } return $ids; } - protected final function init() { + protected final function init( $call_setup = false ) { $this->clean(); + if ( $call_setup ) { + $this->_setUp(); + } } /** * Clean up the flotsam and jetsam before starting. - */ + */ protected final function clean() { - $posts = get_posts( + $posts = get_posts( array( 'post_type' => 'any', - 'fields' => 'ids', + 'fields' => 'ids', 'numberposts' => -1, - ) - ); + ) ); foreach ( $posts as $post ) { wp_delete_post( $post, true ); @@ -54,7 +65,7 @@ protected final function clean() { /** * Set up the options for the particular module. - */ + */ protected final function _setup_options( $module, $custom_options ) { // so that is_admin returns true. set_current_screen( 'edit-post' ); @@ -64,23 +75,23 @@ protected final function _setup_options( $module, $custom_options ) { // activate the sitemap module. $aioseop_options['modules'] = array( - 'aiosp_feature_manager_options' => array( - "aiosp_feature_manager_enable_$module" => 'on', + 'aiosp_feature_manager_options' => array( + "aiosp_feature_manager_enable_$module" => 'on' ), ); update_option( 'aioseop_options', $aioseop_options ); set_current_screen( 'edit-post' ); - $nonce = wp_create_nonce( 'aioseop-nonce' ); - $class = 'All_in_One_SEO_Pack_' . ucwords( $module ); - $_POST = array( - 'action' => 'aiosp_update_module', - 'Submit_All_Default' => 'blah', - 'Submit' => 'blah', - 'nonce-aioseop' => $nonce, - 'settings' => ' ', - 'options' => "aiosp_feature_manager_enable_{$module}=true&page=" . trailingslashit( AIOSEOP_PLUGIN_DIRNAME ) . "modules/aioseop_feature_manager.php&Submit=testing!&module={$class}&nonce-aioseop=" . $nonce, + $nonce = wp_create_nonce( 'aioseop-nonce' ); + $class = 'All_in_One_SEO_Pack_' . ucwords( $module ); + $_POST = array( + 'action' => 'aiosp_update_module', + 'Submit_All_Default' => 'blah', + 'Submit' => 'blah', + 'nonce-aioseop' => $nonce, + 'settings' => ' ', + 'options' => "aiosp_feature_manager_enable_{$module}=true&page=" . trailingslashit( AIOSEOP_PLUGIN_DIRNAME ) . "modules/aioseop_feature_manager.php&Submit=testing!&module={$class}&nonce-aioseop=" . $nonce, ); // so that is_admin returns true. @@ -94,38 +105,37 @@ protected final function _setup_options( $module, $custom_options ) { $aioseop_options = get_option( 'aioseop_options' ); - $module_options = $aioseop_options['modules'][ "aiosp_{$module}_options" ]; + $module_options = $aioseop_options['modules']["aiosp_{$module}_options"]; $module_options = array_merge( $module_options, $custom_options ); - $aioseop_options['modules'][ "aiosp_{$module}_options" ] = $module_options; + $aioseop_options['modules']["aiosp_{$module}_options"] = $module_options; update_option( 'aioseop_options', $aioseop_options ); $aioseop_options = get_option( 'aioseop_options' ); - // error_log("aioseop_options " . print_r($aioseop_options,true)); + //error_log("aioseop_options " . print_r($aioseop_options,true)); } /** * Set up posts of specific post type, without/without images. Use this when post attributes such as title, content etc. don't matter. - */ + */ protected final function setup_posts( $without_images = 0, $with_images = 0, $type = 'post' ) { if ( $without_images > 0 ) { $this->factory->post->create_many( $without_images, array( 'post_type' => $type, 'post_content' => 'content without image', 'post_title' => 'title without image' ) ); } if ( $with_images > 0 ) { - $ids = $this->factory->post->create_many( $with_images, array( 'post_type' => $type, 'post_content' => 'content with image', 'post_title' => 'title with image' ) ); + $ids = $this->factory->post->create_many( $with_images, array( 'post_type' => $type, 'post_content' => 'content with image', 'post_title' => 'title with image' ) ); foreach ( $ids as $id ) { $this->upload_image_and_maybe_attach( str_replace( '\\', '/', AIOSEOP_UNIT_TESTING_DIR . '/resources/images/footer-logo.png' ), $id ); } } - $posts = get_posts( + $posts = get_posts( array( 'post_type' => $type, - 'fields' => 'ids', + 'fields' => 'ids', 'numberposts' => -1, - ) - ); + ) ); // 4 posts created? $this->assertEquals( $without_images + $with_images, count( $posts ) ); @@ -134,13 +144,12 @@ protected final function setup_posts( $without_images = 0, $with_images = 0, $ty get_permalink( $id ); } - $attachments = get_posts( + $attachments = get_posts( array( 'post_type' => 'attachment', - 'fields' => 'ids', + 'fields' => 'ids', 'numberposts' => -1, - ) - ); + ) ); // 2 attachments created? $this->assertEquals( $with_images, count( $attachments ) ); @@ -148,7 +157,7 @@ protected final function setup_posts( $without_images = 0, $with_images = 0, $ty $with = array(); $without = array(); - $featured = 0; + $featured = 0; foreach ( $posts as $id ) { if ( has_post_thumbnail( $id ) ) { $featured++; @@ -162,8 +171,8 @@ protected final function setup_posts( $without_images = 0, $with_images = 0, $ty $this->assertEquals( $with_images, $featured ); return array( - 'with' => $with, - 'without' => $without, + 'with' => $with, + 'without' => $without, ); } @@ -236,8 +245,8 @@ private function get_node_as_array($node) { /* * An empty test is required otherwise tests won't run. */ - public function test_dont_remove_this_method() { - $this->assertTrue( true ); + public function test_dont_remove_this_method(){ + $this->assertTrue(true); } } diff --git a/tests/modules/general/test-meta.php b/tests/modules/general/test-meta.php index a2a26d2dd..b6861d4f7 100644 --- a/tests/modules/general/test-meta.php +++ b/tests/modules/general/test-meta.php @@ -13,6 +13,10 @@ class Test_Meta extends AIOSEOP_Test_Base { + public function setUp() { + $this->init( true ); + } + /** * Creates a custom field in the post and uses this in the meta description. * NOTE: This does not require the ACF plugin because the code uses the custom field directly if ACF is not installed. @@ -56,6 +60,34 @@ public function test_custom_field_in_meta_desc( $format, $custom_field = false ) $this->assertEquals( $meta_desc, $description ); } + /** + * Test whether the meta description is correctly auto generated given different types of content. + * @test + * @dataProvider postContentProvider + */ + public function test_auto_generate_description( $content, $meta_desc, $excerpt = '' ) { + wp_set_current_user( 1 ); + global $aioseop_options; + $id = $this->factory->post->create( array( 'post_type' => 'post', 'post_title' => 'hey' . rand(), 'post_excerpt' => $excerpt, 'post_content' => $content ) ); + // update the format. + $aioseop_options['aiosp_description_format'] = '%description%'; + $aioseop_options['aiosp_generate_descriptions'] = 'on'; + + update_option( 'aioseop_options', $aioseop_options ); + $link = get_permalink( $id ); + $meta = $this->parse_html( $link, array( 'meta' ) ); + // should have atleast one meta tag. + $this->assertGreaterThan( 1, count( $meta ) ); + $description = null; + foreach ( $meta as $m ) { + if ( 'description' === $m['name'] ) { + $description = $m['content']; + break; + } + } + $this->assertEquals( $meta_desc, $description ); + } + /** * Test whether the meta description contains exactly what is expected. * @@ -83,6 +115,21 @@ public function test_post_title_in_meta_desc( $title, $meta_desc, $format ) { } /** + * Provides the different contents to test whether auto-generated description is generated correctly. + */ + public function postContentProvider() { + return array( + array( 'content part 1 content part 2', 'content part 1 content part 2' ), + array( 'blah part 1 blahhhhhhh', 'blah part 1 content part 2', 'blah part 1 content part 2' ), + array( 'content blah 1 content part 2', 'content blah 1 content part 2' ), + array( ' content part blah content part 2', 'content part blah content part 2' ), + array( 'content part 1a content part 2 content part 3', 'content part 1a content part 2', 'content part 1a content part 2' ), + array( 'content part 10 content part 2 content part 3', 'content part 10 content part 2 content part 3' ), + array( str_repeat( 'blah', 300 ), substr( str_repeat( 'blah', 300 ), 0, 160 ) ), + ); + } + + /** * The data provider for meta description. */ public function metaDescProvider() { From cfdc4a9782779a7cc07fba66d6950dec958e3cb2 Mon Sep 17 00:00:00 2001 From: EkoJR Date: Tue, 28 Aug 2018 20:56:35 -0700 Subject: [PATCH 21/54] Add Dashicons to Welcome dashboard page (#1824) --- admin/display/welcome-content.php | 40 ++++++++++++++++++++----------- admin/display/welcome.php | 4 ++-- css/welcome.css | 39 ++++++++++-------------------- 3 files changed, 40 insertions(+), 43 deletions(-) diff --git a/admin/display/welcome-content.php b/admin/display/welcome-content.php index 392b073d3..19764a5c7 100644 --- a/admin/display/welcome-content.php +++ b/admin/display/welcome-content.php @@ -1,16 +1,16 @@ -
    +

    -

    -

    +

    +

    -

    +

    • + target="_blank" + class="welcome-icon welcome-add-page"> +
    • + target="_blank" + class="welcome-icon welcome-add-page">
    • + target="_blank" + class="welcome-icon welcome-add-page">
    • + target="_blank" + class="welcome-icon welcome-add-page">
    • + target="_blank" + class="welcome-icon welcome-add-page">
    • + target="_blank" + class="welcome-icon welcome-add-page">
    • + target="_blank" + class="welcome-icon welcome-add-page">
    @@ -49,13 +57,17 @@ class="button button-primary"

    • + target="_blank" + class="welcome-icon welcome-learn-more"> +
    • + target="_blank" + class="welcome-icon welcome-learn-more">
    • + target="_blank" + class="welcome-icon welcome-learn-more">
    diff --git a/admin/display/welcome.php b/admin/display/welcome.php index 07bddb75c..487c862f4 100644 --- a/admin/display/welcome.php +++ b/admin/display/welcome.php @@ -32,8 +32,8 @@ function welcome_screen_assets( $hook ) { if ( 'dashboard_page_aioseop-about' === $hook ) { - wp_enqueue_style( 'aioseop_welcome_css', AIOSEOP_PLUGIN_URL . '/css/welcome.css', array(), AIOSEOP_VERSION ); - wp_enqueue_script( 'aioseop_welcome_js', AIOSEOP_PLUGIN_URL . '/js/welcome.js', array( 'jquery' ), AIOSEOP_VERSION, true ); + wp_enqueue_style( 'aioseop_welcome_css', AIOSEOP_PLUGIN_URL . 'css/welcome.css', array(), AIOSEOP_VERSION ); + wp_enqueue_script( 'aioseop_welcome_js', AIOSEOP_PLUGIN_URL . 'js/welcome.js', array( 'jquery' ), AIOSEOP_VERSION, true ); } } diff --git a/css/welcome.css b/css/welcome.css index 138473ff7..d9e9fe8cf 100644 --- a/css/welcome.css +++ b/css/welcome.css @@ -53,34 +53,24 @@ section:first-child { .welcome-panel-close { z-index: 2; } -.welcome-panel .welcome-widgets-menus:before, -.welcome-panel .welcome-comments:before, -.welcome-panel .welcome-learn-more:before{ - content: ''; -} -.welcome-panel .welcome-widgets-menus { - background: url(/path/to/icon) 0 50% no-repeat; -} -.welcome-panel .welcome-comments { - background: url(/path/to/icon) 0 50% no-repeat; -} -.welcome-panel .welcome-learn-more { - background: url(/path/to/icon) 0 50% no-repeat; -} +.welcome-panel { + overflow-x: hidden; +} -/* - * Welcome Panel - */ -#welcome-panel > p { +.welcome-panel > p { margin-left: 15px; } +.welcome-panel-content { + display: inline-block; +} + .welcome-panel-column { - width: 30%; - margin-right: 3%; - display: inline-block; - vertical-align: top; + width: 30% !important; + margin-right: 3%; + display: inline-block; + vertical-align: top; } .welcome-panel-column:last-child { @@ -115,11 +105,6 @@ section:first-child { margin-left: 20px; } -.welcome-panel-column ul li { - margin-bottom: 12px; - list-style-type: square; -} - #wp-people-group-rockstars li { margin-bottom: 1.33em; } From 6a40943844702930faa44cb4cc757f3b5a44c124 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Wed, 29 Aug 2018 05:05:28 +0100 Subject: [PATCH 22/54] XML Sitemap - Add support for post type archive pages and support to exclude them as well (#1480) * XML Sitemap - Add support for post type archive pages and support to exclude them as well #155 * codeclimate * codeclimate * test case * sync with master * PR comments https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/155#issuecomment-414820257 * test case --- modules/aioseop_sitemap.php | 86 ++++++++++++++++++++++---- tests/modules/sitemap/test-sitemap.php | 72 +++++++++++++++++++-- 2 files changed, 140 insertions(+), 18 deletions(-) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index 37183d0da..38ba45e93 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -1332,7 +1332,7 @@ function get_sitemap_data( $sitemap_type, $page = 0 ) { } elseif ( 'addl' === $sitemap_type ) { $sitemap_data = $this->get_addl_pages(); } elseif ( 'archive' === $sitemap_type && $this->option_isset( 'archive' ) ) { - $sitemap_data = $this->get_archive_prio_data(); + $sitemap_data = $this->get_date_archive_prio_data(); } elseif ( 'author' === $sitemap_type && $this->option_isset( 'author' ) ) { $sitemap_data = $this->get_author_prio_data(); } elseif ( in_array( $sitemap_type, $posttypes ) ) { @@ -1939,7 +1939,7 @@ function get_simple_sitemap() { } if ( $this->option_isset( 'archive' ) ) { - $prio = array_merge( $prio, $this->get_archive_prio_data() ); + $prio = array_merge( $prio, $this->get_date_archive_prio_data() ); } if ( $this->option_isset( 'author' ) ) { $prio = array_merge( $prio, $this->get_author_prio_data() ); @@ -2507,20 +2507,21 @@ function get_prio_calc( $date, $stats ) { } /** - * Generate sitemap priority data for archives from an array of posts. + * Generate sitemap priority data for date archives from an array of posts. * * @param $posts * * @return array */ - function get_archive_prio_from_posts( $posts ) { + function get_date_archive_prio_from_posts( $posts ) { $archives = array(); if ( is_array( $posts ) ) { foreach ( $posts as $p ) { if ( 'post' !== $p->post_type ) { continue; } - $date = date( 'Y-m', mysql2date( 'U', $p->post_date ) ); + // add the post type to the date so as to support posts of different post types created on the same date. + $date = date( 'Y-m', mysql2date( 'U', $p->post_date ) ) . $p->post_type; if ( empty( $archives[ $date ] ) ) { $archives[ $date ] = $p; } else { @@ -2530,11 +2531,12 @@ function get_archive_prio_from_posts( $posts ) { } } } + if ( ! empty( $archives ) ) { return $this->get_prio_from_posts( $archives, $this->get_default_priority( 'archive', true ), $this->get_default_frequency( 'archive', true ), array( $this, - 'get_archive_link_from_post', + 'get_date_archive_link_from_post', ) ); } @@ -2543,13 +2545,68 @@ function get_archive_prio_from_posts( $posts ) { } /** - * Return an archive link from a post. + * Generate sitemap priority data for archives from an array of posts. + * + * @param $posts + * + * @return array + */ + private function get_archive_prio_from_posts( $posts ) { + $posttypes = array(); + if ( ! empty( $this->options["{$this->prefix}posttypes"] ) ) { + $posttypes = $this->options["{$this->prefix}posttypes"]; + } + + $types_supporting_archives = get_post_types( array( 'has_archive' => true, '_builtin' => false, ), 'names' ); + $types = array(); + foreach ( $posts as $p ) { + if ( array_key_exists( $p->post_type, $types ) ) { + continue; + } + $types[ $p->post_type ] = $p; + } + + $archives = array(); + $types = apply_filters( "{$this->prefix}include_post_types_archives", $types ); + if ( $types ) { + foreach ( $types as $post_type => $p ) { + if ( ! ( in_array( $post_type, $posttypes ) && in_array( $post_type, $types_supporting_archives ) ) ) { + continue; + } + $archives = array_merge( + $archives, + $this->get_prio_from_posts( + array( $p ), $this->get_default_priority( 'archive', true ), $this->get_default_frequency( 'archive', true ), array( + $this, + 'get_archive_link_from_post', + ) + ) + ); + } + } + return $archives; + } + + /** + * Return an archive link for a post. * * @param $post * * @return bool|string */ function get_archive_link_from_post( $post ) { + return get_post_type_archive_link( $post->post_type ); + } + + /** + * Return a date archive link for a post. + * + * @param $post + * + * @return bool|string + */ + function get_date_archive_link_from_post( $post ) { + $extra = array(); if ( 'post' !== $post->post_type ) { return false; } @@ -3127,16 +3184,19 @@ function set_post_args( $args ) { } /** - * Return sitemap data for archives. + * Return sitemap data for date archives. * * @return array */ - function get_archive_prio_data() { - $args = array( 'numberposts' => 50000, 'post_type' => 'post' ); + function get_date_archive_prio_data() { + $args = array( + 'numberposts' => 50000, + 'post_type' => 'post', + ); $args = $this->set_post_args( $args ); $posts = $this->get_all_post_type_data( $args ); - return $this->get_archive_prio_from_posts( $posts ); + return $this->get_date_archive_prio_from_posts( $posts ); } /** @@ -3180,7 +3240,9 @@ function get_all_post_priority_data( $include = 'any', $status = 'publish', $pag $args = $this->set_post_args( $args ); $posts = array_merge( $this->get_all_post_type_data( $args ), $posts ); - return $this->get_prio_from_posts( $posts, $this->get_default_priority( 'post', true ), $this->get_default_frequency( 'post', true ) ); + $links = $this->get_prio_from_posts( $posts, $this->get_default_priority( 'post', true ), $this->get_default_frequency( 'post', true ) ); + $links = array_merge( $links, $this->get_archive_prio_from_posts( $posts ) ); + return $links; } /** diff --git a/tests/modules/sitemap/test-sitemap.php b/tests/modules/sitemap/test-sitemap.php index a762d8f37..81911cf1e 100644 --- a/tests/modules/sitemap/test-sitemap.php +++ b/tests/modules/sitemap/test-sitemap.php @@ -158,6 +158,72 @@ public function test_exclude_trashed_pages() { } + /** + * Testing post type archive pages. + * + * @ticket 155 XML Sitemap - Add support for post type archive pages and support to exclude them as well. + * + * @access public + * @dataProvider post_type_archive_pages_provider + */ + public function test_post_type_archive_pages( $post_types, $has_archive, $exclude ) { + $tests = array(); + + foreach( $post_types as $post_type ) { + $ids = array(); + if ( ! in_array( $post_type, array( 'post', 'page' ) ) ) { + register_post_type( $post_type, array( 'has_archive' => $has_archive ) ); + } + + $ids = $this->factory->post->create_many( 2, array( 'post_type' => $post_type ) ); + foreach ( $ids as $id ) { + $tests[ get_permalink( $id ) ] = true; + } + $url = get_post_type_archive_link( $post_type ); + $tests[ $url ] = $has_archive && ! $exclude; + } + + if ( $exclude ) { + add_filter( 'aiosp_sitemap_include_post_types_archives', array( $this, 'filter_aiosp_sitemap_include_post_types_archives' ) ); + } + + $custom_options = array(); + $custom_options['aiosp_sitemap_indexes'] = ''; + $custom_options['aiosp_sitemap_images'] = 'on'; + $custom_options['aiosp_sitemap_gzipped'] = ''; + $custom_options['aiosp_sitemap_archive'] = 'on'; + $custom_options['aiosp_sitemap_posttypes'] = $post_types; + + $this->_setup_options( 'sitemap', $custom_options ); + + $this->validate_sitemap( $tests ); + } + + /** + * Implements the filter 'aiosp_sitemap_include_post_types_archives'. + */ + public function filter_aiosp_sitemap_include_post_types_archives( $types ) { + return array(); + } + + /** + * Provide the post types for testing test_post_type_archive_pages. + * + * This will enable us to test these cases: + * 1) When a CPT post type is selected that DOES NOT support archives => only CPT in the sitemap. + * 2) When a CPT post type is selected that DOES support archives => CPT and CPT archives in the sitemap. + * 3) When a CPT post type is selected that DOES support archives and we exclude this => only CPT in the sitemap. + * + * @access public + */ + public function post_type_archive_pages_provider() { + return array( + array( array( 'xxxx' ), false, false ), + array( array( 'xxxx' ), true, false ), + array( array( 'xxxx' ), true, true ), + ); + } + /** * Add WooCommerce product gallery images to XML sitemap. * @@ -213,27 +279,21 @@ public function test_only_taxonomies() { $test1 = wp_create_category( 'test1' ); $test2 = wp_create_category( 'test2' ); $test3 = wp_create_category( 'test3' ); - $ids = $this->factory->post->create_many( 10 ); - // first 3 to test1, next 3 to test2 and let others remain uncategorized. for ( $x = 0; $x < 3; $x++ ) { wp_set_post_categories( $ids[ $x ], $test1 ); } - for ( $x = 3; $x < 6; $x++ ) { wp_set_post_categories( $ids[ $x ], $test2 ); } - $custom_options = array(); $custom_options['aiosp_sitemap_indexes'] = ''; $custom_options['aiosp_sitemap_images'] = ''; $custom_options['aiosp_sitemap_gzipped'] = ''; $custom_options['aiosp_sitemap_taxonomies'] = array( 'category' ); $custom_options['aiosp_sitemap_posttypes'] = array(); - $this->_setup_options( 'sitemap', $custom_options ); - // in the sitemap, test3 should not appear as no posts have been assigned to it. $this->validate_sitemap( array( From 787dab86a3ebac54d7792e79416f817be65d25c9 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Wed, 29 Aug 2018 05:08:55 +0100 Subject: [PATCH 23/54] XML Sitemap - Add support for images in JetPack galleries (#1279) * test case * updated with changed structure * updated with changed structure * sync with master * added comments * sync with master * sync with master * resolve conflicts * merge test cases * support for PHP5.2 and below * @requires PHPUnit 5.7 * shortcode content has create_sitemap(); if ( $debug ) { - echo file_get_contents( $file ); + error_log( file_get_contents( $file ) ); } // validate file according to schema. @@ -109,6 +109,7 @@ protected final function validate_sitemap( $elements, $debug = false ) { } $contents = file_get_contents( $file ); + // @codingStandardsIgnoreStart @unlink( $file ); // @codingStandardsIgnoreEnd diff --git a/tests/modules/sitemap/test-sitemap.php b/tests/modules/sitemap/test-sitemap.php index 81911cf1e..a609c005b 100644 --- a/tests/modules/sitemap/test-sitemap.php +++ b/tests/modules/sitemap/test-sitemap.php @@ -389,6 +389,109 @@ public function test_sitemap_index_pagination( $enabled_post_type, $enabled_post $this->assertEquals( $expected, $got[''] ); } + /** + * @requires PHPUnit 5.7 + * Tests posts with and without images with dependency on jetpack gallery. + * + * @ticket 1230 XML Sitemap - Add support for images in JetPack and NextGen galleries + */ + public function test_jetpack_gallery() { + $this->markTestSkipped( 'Skipping this till actual use case is determined.' ); + + $jetpack = 'jetpack/jetpack.php'; + $file = dirname( dirname( AIOSEOP_UNIT_TESTING_DIR ) ) . '/'; + if ( ! file_exists( $file . $jetpack ) ) { + $this->markTestSkipped( 'JetPack not installed. Skipping.' ); + } + $this->plugin_to_load = $file . $jetpack; + tests_add_filter( 'muplugins_loaded', array( $this, 'filter_muplugins_loaded' ) ); + activate_plugin( $jetpack ); + if ( ! is_plugin_active( $jetpack ) ) { + $this->markTestSkipped( 'JetPack not activated. Skipping.' ); + } + $posts = $this->setup_posts( 1, 1 ); + // create 4 attachments. + $attachments = array(); + for ( $x = 0; $x < 4; $x++ ) { + $attachments[] = $this->upload_image_and_maybe_attach( str_replace( '\\', '/', AIOSEOP_UNIT_TESTING_DIR . '/resources/images/footer-logo.png' ) ); + } + $id = $this->factory->post->create( array( 'post_type' => 'post', 'post_content' => '[gallery size="medium" link="file" columns="5" type="slideshow" ids="' . implode( ',', $attachments ) . '"]', 'post_title' => 'jetpack' ) ); + $posts['with'][] = get_permalink( $id ); + $custom_options = array(); + $custom_options['aiosp_sitemap_indexes'] = ''; + $custom_options['aiosp_sitemap_images'] = ''; + $custom_options['aiosp_sitemap_gzipped'] = ''; + $custom_options['aiosp_sitemap_posttypes'] = array( 'post' ); + $this->_setup_options( 'sitemap', $custom_options ); + $with = $posts['with']; + $without = $posts['without']; + $this->validate_sitemap( + array( + $with[0] => array( + 'image' => true, + ), + $with[1] => array( + 'image' => true, + ), + $without[0] => array( + 'image' => false, + ), + ) + ); + } + + /** + * @requires PHPUnit 5.7 + * Tests posts with and without images with dependency on nextgen gallery. + * + * @ticket 1230 XML Sitemap - Add support for images in JetPack and NextGen galleries + */ + public function test_nextgen_gallery() { + wp_set_current_user( 1 ); + $nextgen = 'nextgen-gallery/nggallery.php'; + $file = dirname( dirname( AIOSEOP_UNIT_TESTING_DIR ) ) . '/'; + + if ( ! file_exists( $file . $nextgen ) ) { + $this->markTestSkipped( 'NextGen Gallery not installed. Skipping.' ); + } + $this->plugin_to_load = $file . $nextgen; + tests_add_filter( 'muplugins_loaded', array( $this, 'filter_muplugins_loaded' ) ); + activate_plugin( $nextgen ); + if ( ! is_plugin_active( $nextgen ) ) { + $this->markTestSkipped( 'NextGen Gallery not activated. Skipping.' ); + } + do_action( 'init' ); + // nextgen shortcode does not work without creating a gallery or images. So we will have to create a gallery to do this. + $nggdb = new nggdb(); + $gallery_id = nggdb::add_gallery(); + $images = array( + $nggdb->add_image( $gallery_id, 'x.png', 'x', 'x', 'eyJiYWNrdXAiOnsiZmlsZW5hbWUiOiJzYW1wbGUucG5nIiwid2lkdGgiOjI0OCwiaGVpZ2h0Ijo5OCwiZ2VuZXJhdGVkIjoiMC4wMjM3MzMwMCAxNTA3MDk1MTcwIn0sImFwZXJ0dXJlIjpmYWxzZSwiY3JlZGl0IjpmYWxzZSwiY2FtZXJhIjpmYWxzZSwiY2FwdGlvbiI6ZmFsc2UsImNyZWF0ZWRfdGltZXN0YW1wIjpmYWxzZSwiY29weXJpZ2h0IjpmYWxzZSwiZm9jYWxfbGVuZ3RoIjpmYWxzZSwiaXNvIjpmYWxzZSwic2h1dHRlcl9zcGVlZCI6ZmFsc2UsImZsYXNoIjpmYWxzZSwidGl0bGUiOmZhbHNlLCJrZXl3b3JkcyI6ZmFsc2UsIndpZHRoIjoyNDgsImhlaWdodCI6OTgsInNhdmVkIjp0cnVlLCJtZDUiOiI3ZWUyMjVjOTNkZmNhMTMyYjQzMTc5ZjJiMGYwZTc2NiIsImZ1bGwiOnsid2lkdGgiOjI0OCwiaGVpZ2h0Ijo5OCwibWQ1IjoiN2VlMjI1YzkzZGZjYTEzMmI0MzE3OWYyYjBmMGU3NjYifSwidGh1bWJuYWlsIjp7IndpZHRoIjoyNDAsImhlaWdodCI6OTgsImZpbGVuYW1lIjoidGh1bWJzX3NhbXBsZS5wbmciLCJnZW5lcmF0ZWQiOiIwLjMwNDUzNDAwIDE1MDcwOTUxNzAifSwibmdnMGR5bi0weDB4MTAwLTAwZjB3MDEwYzAxMHIxMTBmMTEwcjAxMHQwMTAiOnsid2lkdGgiOjI0OCwiaGVpZ2h0Ijo5OCwiZmlsZW5hbWUiOiJzYW1wbGUucG5nLW5nZ2lkMDE3LW5nZzBkeW4tMHgweDEwMC0wMGYwdzAxMGMwMTByMTEwZjExMHIwMTB0MDEwLnBuZyIsImdlbmVyYXRlZCI6IjAuMTgwMzI0MDAgMTUyMTAxMTI1NCJ9fQ=='), + $nggdb->add_image( $gallery_id, 'x.png', 'x', 'x', 'eyJiYWNrdXAiOnsiZmlsZW5hbWUiOiJzYW1wbGUucG5nIiwid2lkdGgiOjI0OCwiaGVpZ2h0Ijo5OCwiZ2VuZXJhdGVkIjoiMC4wMjM3MzMwMCAxNTA3MDk1MTcwIn0sImFwZXJ0dXJlIjpmYWxzZSwiY3JlZGl0IjpmYWxzZSwiY2FtZXJhIjpmYWxzZSwiY2FwdGlvbiI6ZmFsc2UsImNyZWF0ZWRfdGltZXN0YW1wIjpmYWxzZSwiY29weXJpZ2h0IjpmYWxzZSwiZm9jYWxfbGVuZ3RoIjpmYWxzZSwiaXNvIjpmYWxzZSwic2h1dHRlcl9zcGVlZCI6ZmFsc2UsImZsYXNoIjpmYWxzZSwidGl0bGUiOmZhbHNlLCJrZXl3b3JkcyI6ZmFsc2UsIndpZHRoIjoyNDgsImhlaWdodCI6OTgsInNhdmVkIjp0cnVlLCJtZDUiOiI3ZWUyMjVjOTNkZmNhMTMyYjQzMTc5ZjJiMGYwZTc2NiIsImZ1bGwiOnsid2lkdGgiOjI0OCwiaGVpZ2h0Ijo5OCwibWQ1IjoiN2VlMjI1YzkzZGZjYTEzMmI0MzE3OWYyYjBmMGU3NjYifSwidGh1bWJuYWlsIjp7IndpZHRoIjoyNDAsImhlaWdodCI6OTgsImZpbGVuYW1lIjoidGh1bWJzX3NhbXBsZS5wbmciLCJnZW5lcmF0ZWQiOiIwLjMwNDUzNDAwIDE1MDcwOTUxNzAifSwibmdnMGR5bi0weDB4MTAwLTAwZjB3MDEwYzAxMHIxMTBmMTEwcjAxMHQwMTAiOnsid2lkdGgiOjI0OCwiaGVpZ2h0Ijo5OCwiZmlsZW5hbWUiOiJzYW1wbGUucG5nLW5nZ2lkMDE3LW5nZzBkeW4tMHgweDEwMC0wMGYwdzAxMGMwMTByMTEwZjExMHIwMTB0MDEwLnBuZyIsImdlbmVyYXRlZCI6IjAuMTgwMzI0MDAgMTUyMTAxMTI1NCJ9fQ=='), + ); + $shortcode = '[ngg_images display_type="photocrati-nextgen_basic_thumbnails" image_ids="'. implode( ',', $images ) . '"]'; + $content = do_shortcode( $shortcode ); + if ( 'We cannot display this gallery' === $content ) { + $this->markTestSkipped( 'NextGen Gallery not working properly. Skipping.' ); + } + // $content will output div and img tags but the img tags have an empty src. + $this->markTestIncomplete( 'We cannot add images in such a way that the shortcode displays the "src" attribute in the image tags. Skipping.' ); + $id = $this->factory->post->create( array( 'post_type' => 'post', 'post_content' => $shortcode, 'post_title' => 'nextgen' ) ); + $url = get_permalink( $id ); + $custom_options = array(); + $custom_options['aiosp_sitemap_indexes'] = ''; + $custom_options['aiosp_sitemap_images'] = ''; + $custom_options['aiosp_sitemap_gzipped'] = ''; + $custom_options['aiosp_sitemap_posttypes'] = array( 'post' ); + $this->_setup_options( 'sitemap', $custom_options ); + $this->validate_sitemap( + array( + $url => array( + 'image' => true, + ) + ) + ); + } + /** * Add external URLs to the sitemap using the filter 'aiosp_sitemap_addl_pages_only'. * From d0aa1c475f1bc02fdb00fdd3faa60d3f95002c0e Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Thu, 30 Aug 2018 15:59:29 +0100 Subject: [PATCH 24/54] Meta descriptions aren't output when using ACF macro in Description Format (#1483) * Meta descriptions aren't output when using ACF macro in Description Format #960 * test case --- aioseop_class.php | 9 ++++--- js/modules/aioseop_module.js | 1 - tests/modules/general/test-meta.php | 42 ++++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/aioseop_class.php b/aioseop_class.php index 3e14a55d0..ae47cbb26 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -3869,9 +3869,10 @@ function wp_head() { } $posts = $save_posts; - $description = $this->get_main_description( $post ); // Get the description. // Handle the description format. - if ( isset( $description ) && ( $this->strlen( $description ) > $this->minimum_description_length ) && ! ( is_front_page() && is_paged() ) ) { + // We are not going to mandate that post description needs to be present because the content could be derived from a custom field too. + if ( ! ( is_front_page() && is_paged() ) ) { + $description = $this->get_main_description( $post ); // Get the description. $description = $this->trim_description( $description ); if ( ! isset( $meta_string ) ) { $meta_string = ''; @@ -3883,7 +3884,9 @@ function wp_head() { $desc_attr = ''; } $desc_attr = apply_filters( 'aioseop_description_attributes', $desc_attr ); - $meta_string .= sprintf( "\n", $desc_attr, $description ); + if ( ! empty( $description ) ) { + $meta_string .= sprintf( "\n", $desc_attr, $description ); + } } // Get the keywords. $togglekeywords = 0; diff --git a/js/modules/aioseop_module.js b/js/modules/aioseop_module.js index 588cb2277..95d392d4e 100644 --- a/js/modules/aioseop_module.js +++ b/js/modules/aioseop_module.js @@ -647,7 +647,6 @@ jQuery( document ).ready( }); aiospinitAll(); - } ); diff --git a/tests/modules/general/test-meta.php b/tests/modules/general/test-meta.php index b6861d4f7..76cecdbf5 100644 --- a/tests/modules/general/test-meta.php +++ b/tests/modules/general/test-meta.php @@ -2,7 +2,7 @@ /** * Class Test_Meta * - * @package + * @package */ /** @@ -28,7 +28,7 @@ public function test_custom_field_in_meta_desc( $format, $custom_field = false ) global $aioseop_options; - $meta_desc = 'heyhey'; + $meta_desc = 'heyhey'; $id = $this->factory->post->create( array( 'post_type' => 'post', 'post_title' => 'hey', 'post_content' => $meta_desc ) ); // update the AIOSEOP description to be the same as the post description. update_post_meta( $id, '_aioseop_description', $meta_desc ); @@ -37,7 +37,7 @@ public function test_custom_field_in_meta_desc( $format, $custom_field = false ) if ( $custom_field ) { $meta_desc = 'holahola'; update_post_meta( $id, $format, $meta_desc ); - $format = "cf_{$format}"; + $format = "cf_{$format}"; } // update the format. @@ -60,6 +60,40 @@ public function test_custom_field_in_meta_desc( $format, $custom_field = false ) $this->assertEquals( $meta_desc, $description ); } + /** + * Creates a custom field in the post and uses this in the meta description. + */ + public function test_custom_field_in_meta_desc_no_content() { + wp_set_current_user( 1 ); + + global $aioseop_options; + + $meta_desc = 'heyhey'; + // very, very important: post excerpt has to be empty or this will not work. + $id = $this->factory->post->create( array( 'post_type' => 'post', 'post_title' => 'hey', 'post_content' => '', 'post_excerpt' => '' ) ); + // update the AIOSEOP description. + update_post_meta( $id, 'custom_description', $meta_desc ); + + // update the format. + $aioseop_options['aiosp_description_format'] = "%cf_custom_description%"; + update_option( 'aioseop_options', $aioseop_options ); + + $link = get_permalink( $id ); + $meta = $this->parse_html( $link, array( 'meta' ) ); + + // should have atleast one meta tag. + $this->assertGreaterThan( 1, count( $meta ) ); + + $description = null; + foreach ( $meta as $m ) { + if ( 'description' === $m['name'] ) { + $description = $m['content']; + break; + } + } + $this->assertEquals( $meta_desc, $description ); + } + /** * Test whether the meta description is correctly auto generated given different types of content. * @test @@ -148,4 +182,4 @@ public function acfDataProvider() { array( 'custom_description', true ), ); } -} \ No newline at end of file +} From e2439a5a497b19f5037981ac8f338b34d8032cc2 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Fri, 31 Aug 2018 04:53:11 +0100 Subject: [PATCH 25/54] test cases (#1803) * test cases * tests for sanitization, conflicts and overridden rules * skip tests for multisite * test multisite * test multisite * @function does not work * @function get_active_blog_for_user * @function get_active_blog_for_user on method * @function does not work * multisite tests * allow failure of php 5.2 and 5.3 * Update aioseop_robots.php --- .travis.yml | 4 + modules/aioseop_robots.php | 5 + tests/base/class-aioseop-test-base.php | 170 ++++++++- .../modules/robots/test-robots-multisite.php | 94 +++++ tests/modules/robots/test-robots.php | 328 ++++++++++++++++++ tests/modules/sitemap/test-sitemap.php | 36 ++ 6 files changed, 623 insertions(+), 14 deletions(-) create mode 100644 tests/modules/robots/test-robots-multisite.php create mode 100644 tests/modules/robots/test-robots.php diff --git a/.travis.yml b/.travis.yml index 71a3e6873..607aa5ed9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,10 @@ matrix: - env: WP_MULTISITE=1 allow_failures: - env: WP_MULTISITE=1 + - php: 5.3 + dist: precise + - php: 5.2 + dist: precise notifications: email: diff --git a/modules/aioseop_robots.php b/modules/aioseop_robots.php index d645e0cef..1e320612d 100644 --- a/modules/aioseop_robots.php +++ b/modules/aioseop_robots.php @@ -104,6 +104,11 @@ function __construct() { add_action( 'wp_ajax_aioseop_ajax_delete_rule', array( $this, 'ajax_delete_rule' ) ); add_action( 'wp_ajax_aioseop_ajax_robots_physical', array( $this, 'ajax_action_physical_file' ) ); add_filter( 'robots_txt', array( $this, 'robots_txt' ), 10, 2 ); + + // We want to define this because calling admin init in the unit tests causes an error and does not call this method. + if ( defined( 'AIOSEOP_UNIT_TESTING' ) ) { + add_action( "aioseop_ut_{$this->prefix}admin_init", array( $this, 'import_default_robots' ) ); + } } function physical_file_check() { diff --git a/tests/base/class-aioseop-test-base.php b/tests/base/class-aioseop-test-base.php index 132070f8c..43192d495 100644 --- a/tests/base/class-aioseop-test-base.php +++ b/tests/base/class-aioseop-test-base.php @@ -14,6 +14,148 @@ public function _setUp() { aioseop_initialize_options(); } + /** + * Last AJAX response. This is set via echo -or- wp_die. + * @var type + */ + protected $_last_response = ''; + /** + * List of ajax actions called via POST + * @var type + */ + protected $_core_actions_get = array( 'fetch-list', 'ajax-tag-search', 'wp-compression-test', 'imgedit-preview', 'oembed_cache' ); + /** + * Saved error reporting level + * @var int + */ + protected $_error_level = 0; + /** + * List of ajax actions called via GET + * @var type + */ + protected $_core_actions_post = array( + 'oembed_cache', 'image-editor', 'delete-comment', 'delete-tag', 'delete-link', + 'delete-meta', 'delete-post', 'trash-post', 'untrash-post', 'delete-page', 'dim-comment', + 'add-link-category', 'add-tag', 'get-tagcloud', 'get-comments', 'replyto-comment', + 'edit-comment', 'add-menu-item', 'add-meta', 'add-user', 'autosave', 'closed-postboxes', + 'hidden-columns', 'update-welcome-panel', 'menu-get-metabox', 'wp-link-ajax', + 'menu-locations-save', 'menu-quick-search', 'meta-box-order', 'get-permalink', + 'sample-permalink', 'inline-save', 'inline-save-tax', 'find_posts', 'widgets-order', + 'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post', + 'wp-remove-post-lock', 'dismiss-wp-pointer', 'nopriv_autosave', + ); + + public function ajaxSetUp() { + parent::setUp(); + // Register the core actions + foreach ( array_merge( $this->_core_actions_get, $this->_core_actions_post ) as $action ) { + if ( function_exists( 'wp_ajax_' . str_replace( '-', '_', $action ) ) ) { + add_action( 'wp_ajax_' . $action, 'wp_ajax_' . str_replace( '-', '_', $action ), 1 ); + } + } + add_filter( 'wp_die_ajax_handler', array( $this, 'getDieHandler' ), 1, 1 ); + if ( ! defined( 'DOING_AJAX' ) ) { + define( 'DOING_AJAX', true ); + } + set_current_screen( 'ajax' ); + // Clear logout cookies + add_action( 'clear_auth_cookie', array( $this, 'logout' ) ); + // Suppress warnings from "Cannot modify header information - headers already sent by" + $this->_error_level = error_reporting(); + error_reporting( $this->_error_level & ~E_WARNING ); + } + + /** + * Tear down the test fixture. + * Reset $_POST, remove the wp_die() override, restore error reporting + */ + public function ajaxTearDown() { + parent::tearDown(); + $_POST = array(); + $_GET = array(); + unset( $GLOBALS['post'] ); + unset( $GLOBALS['comment'] ); + remove_filter( 'wp_die_ajax_handler', array( $this, 'getDieHandler' ), 1, 1 ); + remove_action( 'clear_auth_cookie', array( $this, 'logout' ) ); + error_reporting( $this->_error_level ); + set_current_screen( 'front' ); + } + + /** + * Return our callback handler + * @return callback + */ + public function getDieHandler() { + return array( $this, 'dieHandler' ); + } + + + /** + * Handler for wp_die() + * Save the output for analysis, stop execution by throwing an exception. + * Error conditions (no output, just die) will throw WPAjaxDieStopException( $message ) + * You can test for this with: + * + * $this->setExpectedException( 'WPAjaxDieStopException', 'something contained in $message' ); + * + * Normal program termination (wp_die called at then end of output) will throw WPAjaxDieContinueException( $message ) + * You can test for this with: + * + * $this->setExpectedException( 'WPAjaxDieContinueException', 'something contained in $message' ); + * + * @param string $message + */ + public function dieHandler( $message ) { + $this->_last_response .= ob_get_clean(); + ob_end_clean(); + if ( '' === $this->_last_response ) { + if ( is_scalar( $message ) ) { + throw new WPAjaxDieStopException( (string) $message ); + } else { + throw new WPAjaxDieStopException( '0' ); + } + } else { + throw new WPAjaxDieContinueException( $message ); + } + } + + /** + * Mimic the ajax handling of admin-ajax.php + * Capture the output via output buffering, and if there is any, store + * it in $this->_last_message. + * @param string $action + */ + protected function _handleAjax( $action ) { + // Start output buffering + ini_set( 'implicit_flush', false ); + ob_start(); + // Build the request + $_POST['action'] = $action; + $_GET['action'] = $action; + $_REQUEST = array_merge( $_POST, $_GET ); + // Call the hooks + // do_action( 'admin_init' ); + do_action( 'wp_ajax_' . $_REQUEST['action'], null ); + // Save the output + $buffer = ob_get_clean(); + if ( ! empty( $buffer ) ) { + $this->_last_response = $buffer; + } + } + + + /** + * Switch between user roles + * E.g. administrator, editor, author, contributor, subscriber + * @param string $role + */ + protected function _setRole( $role ) { + $post = $_POST; + $user_id = $this->factory->user->create( array( 'role' => $role ) ); + wp_set_current_user( $user_id ); + $_POST = array_merge( $_POST, $post ); + } + /** * Upload an image and, optionally, attach to the post. */ @@ -100,7 +242,7 @@ protected final function _setup_options( $module, $custom_options ) { // this action will also try to regenerate the sitemap, but we will not let that bother us. do_action( 'wp_ajax_aioseop_ajax_save_settings' ); - $this->go_to( admin_url( 'admin.php?page=all-in-one-seo-pack%2Fmodules%2Faioseop_sitemap.php' ) ); + $this->go_to( admin_url( 'admin.php?page=all-in-one-seo-pack%2Fmodules%2Faioseop_' . $module . '.php' ) ); do_action( 'admin_menu' ); $aioseop_options = get_option( 'aioseop_options' ); @@ -196,20 +338,20 @@ protected final function get_page_source( $link ) { /* * Parses the HTML of the given link and returns the nodes requested. */ - protected final function parse_html( $link, $tags = array(), $debug = false ){ + protected final function parse_html( $link, $tags = array(), $debug = false ) { $html = $this->get_page_source( $link ); if ( $debug ) { error_log( $html ); } - libxml_use_internal_errors(true); + libxml_use_internal_errors( true ); $dom = new DOMDocument(); $dom->loadHTML( $html ); $array = array(); foreach ( $tags as $tag ) { foreach ( $dom->getElementsByTagName( $tag ) as $node ) { - $array[] = $this->get_node_as_array($node); + $array[] = $this->get_node_as_array( $node ); } } return $array; @@ -218,22 +360,22 @@ protected final function parse_html( $link, $tags = array(), $debug = false ){ /* * Extracts the node from the HTML source. */ - private function get_node_as_array($node) { + private function get_node_as_array( $node ) { $array = false; - if ($node->hasAttributes()) { - foreach ($node->attributes as $attr) { - $array[$attr->nodeName] = $attr->nodeValue; + if ( $node->hasAttributes() ) { + foreach ( $node->attributes as $attr ) { + $array[ $attr->nodeName ] = $attr->nodeValue; } } - if ($node->hasChildNodes()) { - if ($node->childNodes->length == 1) { - $array[$node->firstChild->nodeName] = $node->firstChild->nodeValue; + if ( $node->hasChildNodes() ) { + if ( $node->childNodes->length == 1 ) { + $array[ $node->firstChild->nodeName ] = $node->firstChild->nodeValue; } else { - foreach ($node->childNodes as $childNode) { - if ($childNode->nodeType != XML_TEXT_NODE) { - $array[$childNode->nodeName][] = $this->get_node_as_array($childNode); + foreach ( $node->childNodes as $childNode ) { + if ( $childNode->nodeType != XML_TEXT_NODE ) { + $array[ $childNode->nodeName ][] = $this->get_node_as_array( $childNode ); } } } diff --git a/tests/modules/robots/test-robots-multisite.php b/tests/modules/robots/test-robots-multisite.php new file mode 100644 index 000000000..1e58c3981 --- /dev/null +++ b/tests/modules/robots/test-robots-multisite.php @@ -0,0 +1,94 @@ +markTestSkipped( 'Only for multi site' ); + } + + $this->_setRole( 'administrator' ); + + delete_transient( 'aiosp_robots_errors' . get_current_user_id() ); + + $this->_setup_options( 'robots', array() ); + + $network = get_network()->site_id; + switch_to_blog( $network ); + + $_POST = array( + 'aiosp_robots_path' => $network_rule['path'], + 'aiosp_robots_type' => $network_rule['type'], + 'aiosp_robots_agent' => $network_rule['agent'], + ); + + $options = apply_filters( 'aiosp_robots_update_options', array() ); + $aioseop_options['modules']['aiosp_robots_options']['aiosp_robots_rules'] = $options['aiosp_robots_rules']; + update_option( 'aioseop_options', $aioseop_options ); + + restore_current_blog(); + + $network = get_network()->site_id; + switch_to_blog( $network ); + + $_POST = array( + 'aiosp_robots_path' => $site_rule['path'], + 'aiosp_robots_type' => $site_rule['type'], + 'aiosp_robots_agent' => $site_rule['agent'], + ); + + $options = apply_filters( 'aiosp_robots_update_options', array() ); + + $aioseop_options['modules']['aiosp_robots_options']['aiosp_robots_rules'] = $options['aiosp_robots_rules']; + update_option( 'aioseop_options', $aioseop_options ); + + $errors = get_transient( 'aiosp_robots_errors' . get_current_user_id() ); + $this->assertGreaterThan( 0, count( $errors ) ); + $this->assertContains( $message, $errors[0] ); + } + + public function conflictingRulesProvider() { + return array( + array( + array( 'path' => 'test.txt', 'type' => 'disallow', 'agent' => '*' ), + array( 'path' => 'test.txt', 'type' => 'disallow', 'agent' => '*' ), + 'Identical rule exists', + ), + array( + array( 'path' => 'wp-content/image.jpg', 'type' => 'allow', 'agent' => '*' ), + array( 'path' => 'wp-content/image.jpg', 'type' => 'allow', 'agent' => '*' ), + 'Identical rule exists', + ), + array( + array( 'path' => 'temp.*', 'type' => 'allow', 'agent' => '*' ), + array( 'path' => 'temp.*', 'type' => 'allow', 'agent' => '*' ), + 'Identical rule exists', + ), + array( + array( 'path' => 'wp-content/*.txt', 'type' => 'disallow', 'agent' => '*' ), + array( 'path' => 'wp-content/*.txt', 'type' => 'disallow', 'agent' => '*' ), + 'Identical rule exists', + ), + array( + array( 'path' => 'wp-content/image.jpg', 'type' => 'allow', 'agent' => '*' ), + array( 'path' => 'wp-*/*.jpg', 'type' => 'disallow', 'agent' => '*' ), + 'Wild-card path cannot be overridden', + ), + ); + } +} diff --git a/tests/modules/robots/test-robots.php b/tests/modules/robots/test-robots.php new file mode 100644 index 000000000..8c9a6c126 --- /dev/null +++ b/tests/modules/robots/test-robots.php @@ -0,0 +1,328 @@ +check_file_exists() ) { + $this->delete_file(); + } + + $rule = "User-agent: Googlebot\r\nDisallow: /wow-test-folder/"; + + // create a file. + $file = fopen( ABSPATH . '/robots.txt', 'w' ); + fwrite( $file, $rule ); + fclose( $file ); + } + + private function check_file_exists() { + return file_exists( ABSPATH . '/robots.txt' ); + } + + private function delete_file() { + @unlink( ABSPATH . '/robots.txt' ); + } + + /** + * Importing a physical robots.txt file. + */ + public function test_import_physical_file() { + $this->_setRole( 'administrator' ); + + $this->create_file(); + + $this->_setup_options( 'robots', array() ); + + $_POST = array( + 'nonce-aioseop' => wp_create_nonce( 'aioseop-nonce' ), + 'settings' => ' ', + 'options' => 'import', + ); + + try { + $this->_handleAjax( 'aioseop_ajax_robots_physical' ); + } catch ( WPAjaxDieContinueException $e ) { + // We expected this, do nothing. + } catch ( WPAjaxDieStopException $ee ) { + // We expected this, do nothing. + } + + // now the file should not exist. + $this->assertFalse( $this->check_file_exists(), 'Physical robots.txt not deleted' ); + + $aioseop_options = get_option( 'aioseop_options' ); + $rules = $aioseop_options['modules']['aiosp_robots_options']['aiosp_robots_rules']; + + $this->assertEquals( 1, count( $rules ) ); + $this->assertArrayHasKey( 'path', $rules[0], 'Rules not imported from physical robots.txt' ); + $this->assertEquals( '/wow-test-folder/', $rules[0]['path'], 'Rules not imported from physical robots.txt' ); + } + + /** + * Importing a physical robots.txt file. + */ + public function test_delete_physical_file() { + $this->_setRole( 'administrator' ); + + $this->create_file(); + + $this->_setup_options( 'robots', array() ); + + $_POST = array( + 'nonce-aioseop' => wp_create_nonce( 'aioseop-nonce' ), + 'settings' => ' ', + 'options' => 'delete', + ); + + try { + $this->_handleAjax( 'aioseop_ajax_robots_physical' ); + } catch ( WPAjaxDieContinueException $e ) { + // We expected this, do nothing. + } catch ( WPAjaxDieStopException $ee ) { + // We expected this, do nothing. + } + + // now the file should not exist. + $this->assertFalse( $this->check_file_exists(), 'Physical robots.txt not deleted' ); + + $aioseop_options = get_option( 'aioseop_options' ); + $rules = $aioseop_options['modules']['aiosp_robots_options']['aiosp_robots_rules']; + + $this->assertEquals( 0, count( $rules ) ); + } + + /** + * Test if rules are sanitized before being added. + * + * @dataProvider sanitizedRulesProvider + */ + public function test_sanitize_rules( $rule ) { + $this->_setRole( 'administrator' ); + + $this->_setup_options( 'robots', array() ); + + $_POST = array( + 'aiosp_robots_path' => $rule['path'], + 'aiosp_robots_type' => $rule['type'], + 'aiosp_robots_agent' => $rule['agent'], + ); + + $path = $rule['path']; + + // if path does not have a trailing wild card (*) or does not refer to a file (with extension), add trailing slash. + if ( '*' !== substr( $path, -1 ) && false === strpos( $path, '.' ) ) { + $path = trailingslashit( $path ); + } + + // if path does not have a leading slash, add it. + if ( '/' !== substr( $path, 0, 1 ) ) { + $path = '/' . $path; + } + + // convert everything to lower case. + $path = strtolower( $path ); + + $options = apply_filters( 'aiosp_robots_update_options', array() ); + $this->assertArrayHasKey( 'aiosp_robots_rules', $options ); + $this->assertGreaterThan( 0, $options['aiosp_robots_rules'] ); + $this->assertArrayHasKey( 'type', $options['aiosp_robots_rules'][0] ); + $this->assertArrayHasKey( 'agent', $options['aiosp_robots_rules'][0] ); + $this->assertArrayHasKey( 'path', $options['aiosp_robots_rules'][0] ); + $this->assertArrayHasKey( 'id', $options['aiosp_robots_rules'][0] ); + $this->assertEquals( $path, $options['aiosp_robots_rules'][0]['path'], 'Rule not sanitized' ); + } + + public function sanitizedRulesProvider() { + return array( + array( 'path' => 'test.txt', 'type' => 'disallow', 'agent' => '*' ), + array( 'path' => 'wp-content/image.jpg', 'type' => 'allow', 'agent' => '*' ), + array( 'path' => 'temp.*', 'type' => 'allow', 'agent' => '*' ), + array( 'path' => 'wp-content/*.txt', 'type' => 'disallow', 'agent' => '*' ), + ); + } + + + /** + * Test if overriding default rules is rejected. + * + * @dataProvider defaultRulesProvider + */ + public function test_override_default_rules( $rule, $message ) { + $this->_setRole( 'administrator' ); + + delete_transient( 'aiosp_robots_errors' . get_current_user_id() ); + + $this->_setup_options( 'robots', array() ); + + // import default WP rules. + do_action( 'aioseop_ut_aiosp_robots_admin_init' ); + + $_POST = array( + 'aiosp_robots_path' => $rule['path'], + 'aiosp_robots_type' => $rule['type'], + 'aiosp_robots_agent' => $rule['agent'], + ); + + $options = apply_filters( 'aiosp_robots_update_options', array() ); + $errors = get_transient( 'aiosp_robots_errors' . get_current_user_id() ); + $this->assertGreaterThan( 0, count( $errors ) ); + $this->assertContains( $message, $errors[0], 'Default rule overriden' ); + + } + + public function defaultRulesProvider() { + return array( + array( array( 'path' => '/wp-admin/', 'type' => 'disallow', 'agent' => '*' ), 'Rule cannot be overridden' ), + array( array( 'path' => '/wp-admin/admin-ajax.php', 'type' => 'allow', 'agent' => '*' ), 'Rule cannot be overridden' ), + array( array( 'path' => '/wp-admin/', 'type' => 'allow', 'agent' => '*' ), 'Rule cannot be overridden' ), + array( array( 'path' => '/wp-admin/admin-ajax.php', 'type' => 'disallow', 'agent' => '*' ), 'Rule cannot be overridden' ), + array( array( 'path' => '/wp-*', 'type' => 'disallow', 'agent' => '*' ), 'Wild-card path cannot be overridden' ), + array( array( 'path' => '/wp-*/admin-ajax.*', 'type' => 'allow', 'agent' => '*' ), 'Wild-card path cannot be overridden' ), + array( array( 'path' => '/*-admin/', 'type' => 'allow', 'agent' => '*' ), 'Wild-card path cannot be overridden' ), + array( array( 'path' => '/*-admin/admin-ajax.*', 'type' => 'disallow', 'agent' => '*' ), 'Wild-card path cannot be overridden' ), + ); + } + + /** + * Test if conflicting rules are rejected. + * + * @dataProvider conflictingRulesProvider + */ + public function test_conflicting_rules( $existing_rules, $new_rule, $message ) { + $this->_setRole( 'administrator' ); + + delete_transient( 'aiosp_robots_errors' . get_current_user_id() ); + + $this->_setup_options( 'robots', array() ); + + global $aioseop_options; + + foreach ( $existing_rules as $rule ) { + $_POST = array( + 'aiosp_robots_path' => $rule['path'], + 'aiosp_robots_type' => $rule['type'], + 'aiosp_robots_agent' => $rule['agent'], + ); + + $options = apply_filters( 'aiosp_robots_update_options', array() ); + + $aioseop_options['modules']['aiosp_robots_options']['aiosp_robots_rules'] = $options['aiosp_robots_rules']; + update_option( 'aioseop_options', $aioseop_options ); + } + + $_POST = array( + 'aiosp_robots_path' => $new_rule['path'], + 'aiosp_robots_type' => $new_rule['type'], + 'aiosp_robots_agent' => $new_rule['agent'], + ); + + $options = apply_filters( 'aiosp_robots_update_options', array() ); + $errors = get_transient( 'aiosp_robots_errors' . get_current_user_id() ); + $this->assertGreaterThan( 0, count( $errors ) ); + $this->assertContains( $message, $errors[0] ); + + } + + public function conflictingRulesProvider() { + return array( + + // It should not be possible to add a duplicate rule for an individual file + array( + array( + array( 'path' => '/test.txt', 'type' => 'disallow', 'agent' => '*' ), + ), + array( 'path' => '/test.txt', 'type' => 'disallow', 'agent' => '*' ), + 'Identical rule exists', + ), + array( + array( + array( 'path' => '/wp-content/image.jpg', 'type' => 'allow', 'agent' => '*' ), + ), + array( 'path' => '/wp-content/image.jpg', 'type' => 'allow', 'agent' => '*' ), + 'Identical rule exists', + ), + + // It should not be possible to add a duplicate rule using wildcards for an individual file + array( + array( + array( 'path' => '/test.txt', 'type' => 'disallow', 'agent' => '*' ), + ), + array( 'path' => '/test.*', 'type' => 'disallow', 'agent' => '*' ), + 'Wild-card path cannot be overridden', + ), + + // It should not be possible to add a conflicting rule for an individual file + array( + array( + array( 'path' => '/test.txt', 'type' => 'disallow', 'agent' => '*' ), + ), + array( 'path' => '/test.txt', 'type' => 'allow', 'agent' => '*' ), + 'Rule cannot be overridden', + ), + + // It should not be possible to add a conflicting rule using wildcards for an individual file + array( + array( + array( 'path' => '/test.txt', 'type' => 'disallow', 'agent' => '*' ), + ), + array( 'path' => '/test.*', 'type' => 'allow', 'agent' => '*' ), + 'Wild-card path cannot be overridden', + ), + + // It should not be possible to add a duplicate rule for a directory + array( + array( + array( 'path' => '/wp-includes/', 'type' => 'disallow', 'agent' => '*' ), + ), + array( 'path' => '/wp-includes/', 'type' => 'disallow', 'agent' => '*' ), + 'Identical rule exists', + ), + + // It should not be possible to add a duplicate rule using wildcards for a directory + array( + array( + array( 'path' => '/wp-includes/', 'type' => 'disallow', 'agent' => '*' ), + ), + array( 'path' => '/wp-*/', 'type' => 'disallow', 'agent' => '*' ), + 'Wild-card path cannot be overridden', + ), + + // It should not be possible to add a conflicting rule for a directory + array( + array( + array( 'path' => '/wp-includes/', 'type' => 'disallow', 'agent' => '*' ), + ), + array( 'path' => '/wp-includes/', 'type' => 'allow', 'agent' => '*' ), + 'Rule cannot be overridden', + ), + + // It should not be possible to add a conflicting rule using wildcards for a directory + array( + array( + array( 'path' => '/wp-includes/', 'type' => 'disallow', 'agent' => '*' ), + ), + array( 'path' => '/wp-*/', 'type' => 'allow', 'agent' => '*' ), + 'Wild-card path cannot be overridden', + ), + ); + } +} diff --git a/tests/modules/sitemap/test-sitemap.php b/tests/modules/sitemap/test-sitemap.php index a609c005b..239e95cdd 100644 --- a/tests/modules/sitemap/test-sitemap.php +++ b/tests/modules/sitemap/test-sitemap.php @@ -32,6 +32,10 @@ public function tearDown() { * Creates posts and pages and tests whether only pages are being shown in the sitemap. */ public function test_only_pages() { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + $posts = $this->setup_posts( 2 ); $pages = $this->setup_posts( 2, 0, 'page' ); @@ -60,6 +64,10 @@ public function test_only_pages() { * 2) does not contain the image tag in the posts that do not have images attached. */ public function test_featured_image() { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + $posts = $this->setup_posts( 2, 2 ); $custom_options = array(); @@ -95,6 +103,10 @@ public function test_featured_image() { * Creates posts with and without featured images and switches OFF the images from the sitemap. Tests that the sitemap does not contain the image tag for any post. */ public function test_exclude_images() { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + $posts = $this->setup_posts( 2, 2 ); $custom_options = array(); @@ -275,6 +287,10 @@ public function test_woocommerce_gallery() { * Adds posts to taxonomies, enables only taxonomies in the sitemap. */ public function test_only_taxonomies() { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + // create 3 categories. $test1 = wp_create_category( 'test1' ); $test2 = wp_create_category( 'test2' ); @@ -317,6 +333,10 @@ public function filter_muplugins_loaded() { * Creates posts with schemeless images in the content and checks if they are being correctly included in the sitemap. */ public function test_schemeless_images() { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + $id1 = $this->factory->post->create( array( 'post_type' => 'post', 'post_content' => 'content ', 'post_title' => 'title with image' ) ); $id2 = $this->factory->post->create( array( 'post_type' => 'post', 'post_content' => 'content ', 'post_title' => 'title with image' ) ); $id3 = $this->factory->post->create( array( 'post_type' => 'post', 'post_content' => 'content ', 'post_title' => 'title with image' ) ); @@ -351,6 +371,10 @@ public function test_schemeless_images() { * @dataProvider enabledPostTypes */ public function test_sitemap_index_pagination( $enabled_post_type, $enabled_post_types_count, $cpt ) { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + // choose numbers which are not multiples of each other. $num_posts = 22; $per_xml = 7; @@ -498,6 +522,10 @@ public function test_nextgen_gallery() { * @dataProvider externalPagesProvider */ public function test_add_external_urls( $url1, $url2 ) { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + $this->_urls = array( $url1, $url2 ); $posts = $this->setup_posts( 2 ); @@ -530,6 +558,10 @@ public function test_add_external_urls( $url1, $url2 ) { * @ticket 1371 Correct tags order according to Sitemap protocol */ public function test_index() { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + $posts = $this->setup_posts( 2, 2 ); $custom_options = array(); @@ -576,6 +608,10 @@ public function externalPagesProvider() { * Creates posts with external images and uses the filter 'aioseop_images_allowed_from_hosts' to allow only a particular host's images to be included in the sitemap. */ public function test_external_images() { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + $posts = $this->setup_posts( 2 ); $id1 = $this->factory->post->create( array( 'post_type' => 'post', 'post_content' => 'content ', 'post_title' => 'title with image' ) ); From d6358e960f08b484990c9368672700e24b1c9bbd Mon Sep 17 00:00:00 2001 From: EkoJR Date: Thu, 30 Aug 2018 21:55:46 -0700 Subject: [PATCH 26/54] Fixed icon refresh effect in Admin Menu #292 (#1813) --- aioseop_class.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/aioseop_class.php b/aioseop_class.php index ae47cbb26..883fd5451 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -3010,8 +3010,8 @@ function get_all_term_data( $term_id ) { function add_page_icon() { wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) ); wp_enqueue_style( 'wp-pointer' ); - // $this->add_admin_pointers(); - wp_enqueue_style( 'aiosp_admin_style', AIOSEOP_PLUGIN_URL . 'css/aiosp_admin.css', array(), AIOSEOP_VERSION ); + //$this->add_admin_pointers(); + ?> - -END; - } - echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema ); - } - - /** - * Do / adds opengraph properties to meta. - * @since 2.3.11 - * - * @global array $aioseop_options AIOSEOP plugin options. - */ - public function do_opengraph() { - global $aioseop_options; - if ( ! empty( $aioseop_options ) - && ! empty( $aioseop_options['aiosp_schema_markup'] ) - ) { - add_filter( 'language_attributes', array( &$this, 'add_attributes' ) ); - } - if ( ! defined( 'DOING_AJAX' ) ) { - add_action( 'aioseop_modules_wp_head', array( &$this, 'add_meta' ), 5 ); - // Add social meta to AMP plugin. - if ( apply_filters( 'aioseop_enable_amp_social_meta', true ) === true ) { - add_action( 'amp_post_template_head', array( &$this, 'add_meta' ), 12 ); - } - } - } - - /** - * Set up types. - * - * @since ? - * @since 2.3.15 Change to website for homepage and blog post index page, default to object. - */ - function type_setup() { - $this->type = 'object'; // Default to type object if we don't have some other rule. - - if ( is_home() || is_front_page() ) { - $this->type = 'website'; // Home page and blog page should be website. - } elseif ( is_singular() && $this->option_isset( 'types' ) ) { - $metabox = $this->get_current_options( array(), 'settings' ); - $current_post_type = get_post_type(); - if ( ! empty( $metabox['aioseop_opengraph_settings_category'] ) ) { - $this->type = $metabox['aioseop_opengraph_settings_category']; - } elseif ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) { - $this->type = $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ]; - } - } - } - - /** - * Inits hooks and others for admin init. - * action:admin_init. - * - * @since 2.3.11 - * @since 2.4.14 Refactored function name, and new filter added for defaults and missing term metabox. - */ - function admin_init() { - add_filter( $this->prefix . 'display_settings', array( &$this, 'filter_settings' ), 10, 3 ); - add_filter( $this->prefix . 'override_options', array( &$this, 'override_options' ), 10, 3 ); - add_filter( $this->get_prefix( 'settings' ) . 'default_options', array( - &$this, - 'filter_default_options', - ), 10, 2 ); - add_filter( - $this->get_prefix( 'settings' ) . 'filter_metabox_options', array( - &$this, - 'filter_metabox_options', - ), 10, 3 - ); - add_filter( - $this->get_prefix( 'settings' ) . 'filter_term_metabox_options', array( - &$this, - 'filter_metabox_options', - ), 10, 3 - ); - $post_types = $this->get_post_type_titles(); - $rempost = array( - 'revision' => 1, - 'nav_menu_item' => 1, - 'custom_css' => 1, - 'customize_changeset' => 1, - ); - $post_types = array_diff_key( $post_types, $rempost ); - $this->default_options['types']['initial_options'] = $post_types; - foreach ( $post_types as $slug => $name ) { - $field = $slug . '_fb_object_type'; - $this->default_options[ $field ] = array( - 'name' => "$name " . __( 'Object Type', 'all-in-one-seo-pack' ) . "
    ($slug)", - 'type' => 'select', - 'style' => '', - 'initial_options' => $this->fb_object_types, - 'default' => 'article', - 'condshow' => array( 'aiosp_opengraph_types\[\]' => $slug ), - ); - $this->help_text[ $field ] = __( 'Choose a default value that best describes the content of your post type.', 'all-in-one-seo-pack' ); - $this->help_anchors[ $field ] = '#content-object-types'; - $this->locations['opengraph']['options'][] = $field; - $this->layout['facebook']['options'][] = $field; - } - $this->setting_options(); - $this->add_help_text_links(); - - } - - function get_all_images( $options = null, $p = null ) { - static $img = array(); - if ( ! is_array( $options ) ) { - $options = array(); - } - if ( ! empty( $this->options['aiosp_opengraph_meta_key'] ) ) { - $options['meta_key'] = $this->options['aiosp_opengraph_meta_key']; - } - if ( empty( $img ) ) { - $size = apply_filters( 'post_thumbnail_size', 'large' ); - $default = $this->get_the_image_by_default(); - if ( ! empty( $default ) ) { - $default = set_url_scheme( $default ); - $img[ $default ] = 0; - } - $img = array_merge( $img, parent::get_all_images( $options, null ) ); - } - - if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) { - $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg'; - } - - if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) { - $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg'; - $img[ $options['aioseop_opengraph_settings_customimg_twitter'] ] = 'customimg_twitter'; - } - - if ( $author_img = $this->get_the_image_by_author( $p ) ) { - $image['author'] = $author_img; - } - $image = array_flip( $img ); - $images = array(); - if ( ! empty( $image ) ) { - foreach ( $image as $k => $v ) { - $images[ $v ] = ''; - } - } - - return array( $image, $images ); - } - - function get_the_image_by_author( $options = null, $p = null ) { - if ( $p === null ) { - global $post; - } else { - $post = $p; - } - if ( ! empty( $post ) && ! empty( $post->post_author ) ) { - $matches = array(); - $get_avatar = get_avatar( $post->post_author, 300 ); - if ( preg_match( "/src='(.*?)'/i", $get_avatar, $matches ) ) { - return $matches[1]; - } - } - - return false; - } - - function get_the_image( $options = null, $p = null ) { - $meta_key = $this->options['aiosp_opengraph_meta_key']; - - return parent::get_the_image( array( 'meta_key' => $meta_key ), $p ); - } - - function get_the_image_by_default( $args = array() ) { - return $this->options['aiosp_opengraph_dimg']; - } - - function settings_update() { - - } - - /** - * Enqueue our file upload scripts and styles. - * @param $hook - */ - function og_admin_enqueue_scripts( $hook ) { - - if ( 'all-in-one-seo_page_aiosp_opengraph' != $hook && 'term.php' != $hook ) { - // Only enqueue if we're on the social module settings page. - return; - } - - wp_enqueue_script( 'media-upload' ); - wp_enqueue_script( 'thickbox' ); - wp_enqueue_style( 'thickbox' ); - wp_enqueue_media(); - } - - function save_tax_data( $term_id, $tt_id, $taxonomy ) { - static $update = false; - if ( $update ) { - return; - } - if ( $this->locations !== null ) { - foreach ( $this->locations as $k => $v ) { - if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) { - $opts = $this->default_options( $k ); - $options = array(); - $update = false; - foreach ( $opts as $l => $o ) { - if ( isset( $_POST[ $l ] ) ) { - $options[ $l ] = stripslashes_deep( $_POST[ $l ] ); - $options[ $l ] = esc_attr( $options[ $l ] ); - $update = true; - } - } - if ( $update ) { - $prefix = $this->get_prefix( $k ); - $options = apply_filters( $prefix . 'filter_term_metabox_options', $options, $k, $term_id ); - update_term_meta( $term_id, '_' . $prefix . $k, $options ); - } - } - } - } - } - - /** - * Returns the placeholder filtered and ready for DOM display. - * filter:aioseop_opengraph_placeholder - * @since 2.4.14 - * - * @param mixed $placeholder Placeholder to be filtered. - * @param string $type Type of the value to be filtered. - * - * @return string - */ - public function filter_placeholder( $placeholder, $type = 'text' ) { - return strip_tags( trim( $placeholder ) ); - } - - /** - * Returns filtered default options. - * filter:{prefix}default_options - * @since 2.4.13 - * - * @param array $options Default options. - * @param string $location Location. - * - * @return array - */ - public function filter_default_options( $options, $location ) { - if ( $location === 'settings' ) { - $prefix = $this->get_prefix( $location ) . $location . '_'; - // Add image checker as default - $options[ $prefix . 'customimg_checker' ] = 0; - } - return $options; - } - - /** - * Returns facebook debug script and link. - * @since 2.4.14 - * - * @return string - */ - private function get_facebook_debug() { - ob_start(); - ?> - - - name = __( 'Social Meta', 'all-in-one-seo-pack' ); // Human-readable name of the plugin + $this->prefix = 'aiosp_opengraph_'; // option prefix + $this->file = __FILE__; // the current file + $this->fb_object_types = array( + 'Activities' => array( + 'activity' => __( 'Activity', 'all-in-one-seo-pack' ), + 'sport' => __( 'Sport', 'all-in-one-seo-pack' ), + ), + 'Businesses' => array( + 'bar' => __( 'Bar', 'all-in-one-seo-pack' ), + 'company' => __( 'Company', 'all-in-one-seo-pack' ), + 'cafe' => __( 'Cafe', 'all-in-one-seo-pack' ), + 'hotel' => __( 'Hotel', 'all-in-one-seo-pack' ), + 'restaurant' => __( 'Restaurant', 'all-in-one-seo-pack' ), + ), + 'Groups' => array( + 'cause' => __( 'Cause', 'all-in-one-seo-pack' ), + 'sports_league' => __( 'Sports League', 'all-in-one-seo-pack' ), + 'sports_team' => __( 'Sports Team', 'all-in-one-seo-pack' ), + ), + 'Organizations' => array( + 'band' => __( 'Band', 'all-in-one-seo-pack' ), + 'government' => __( 'Government', 'all-in-one-seo-pack' ), + 'non_profit' => __( 'Non Profit', 'all-in-one-seo-pack' ), + 'school' => __( 'School', 'all-in-one-seo-pack' ), + 'university' => __( 'University', 'all-in-one-seo-pack' ), + ), + 'People' => array( + 'actor' => __( 'Actor', 'all-in-one-seo-pack' ), + 'athlete' => __( 'Athlete', 'all-in-one-seo-pack' ), + 'author' => __( 'Author', 'all-in-one-seo-pack' ), + 'director' => __( 'Director', 'all-in-one-seo-pack' ), + 'musician' => __( 'Musician', 'all-in-one-seo-pack' ), + 'politician' => __( 'Politician', 'all-in-one-seo-pack' ), + 'profile' => __( 'Profile', 'all-in-one-seo-pack' ), + 'public_figure' => __( 'Public Figure', 'all-in-one-seo-pack' ), + ), + 'Places' => array( + 'city' => __( 'City', 'all-in-one-seo-pack' ), + 'country' => __( 'Country', 'all-in-one-seo-pack' ), + 'landmark' => __( 'Landmark', 'all-in-one-seo-pack' ), + 'state_province' => __( 'State Province', 'all-in-one-seo-pack' ), + ), + 'Products and Entertainment' => array( + 'album' => __( 'Album', 'all-in-one-seo-pack' ), + 'book' => __( 'Book', 'all-in-one-seo-pack' ), + 'drink' => __( 'Drink', 'all-in-one-seo-pack' ), + 'food' => __( 'Food', 'all-in-one-seo-pack' ), + 'game' => __( 'Game', 'all-in-one-seo-pack' ), + 'movie' => __( 'Movie', 'all-in-one-seo-pack' ), + 'product' => __( 'Product', 'all-in-one-seo-pack' ), + 'song' => __( 'Song', 'all-in-one-seo-pack' ), + 'tv_show' => __( 'TV Show', 'all-in-one-seo-pack' ), + 'episode' => __( 'Episode', 'all-in-one-seo-pack' ), + ), + 'Websites' => array( + 'article' => __( 'Article', 'all-in-one-seo-pack' ), + 'blog' => __( 'Blog', 'all-in-one-seo-pack' ), + 'website' => __( 'Website', 'all-in-one-seo-pack' ), + ), + ); + parent::__construct(); + + $this->help_text = array( + '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' ), + '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' ), + 'appid' => __( 'Enter your Facebook App ID here. Information about how to get your Facebook App ID can be found at https://developers.facebook.com/docs/apps/register', 'all-in-one-seo-pack' ), + 'title_shortcodes' => __( 'Run shortcodes that appear in social title meta tags.', 'all-in-one-seo-pack' ), + 'description_shortcodes' => __( 'Run shortcodes that appear in social description meta tags.', 'all-in-one-seo-pack' ), + 'sitename' => __( 'The Site Name is the name that is used to identify your website.', 'all-in-one-seo-pack' ), + 'hometitle' => __( 'The Home Title is the Open Graph title for your home page.', 'all-in-one-seo-pack' ), + 'description' => __( 'The Home Description is the Open Graph description for your home page.', 'all-in-one-seo-pack' ), + 'homeimage' => __( 'The Home Image is the Open Graph image for your home page.', 'all-in-one-seo-pack' ), + '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' ), + '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' ), + 'fallback' => __( 'This option lets you fall back to the default image if no image could be found above.', 'all-in-one-seo-pack' ), + 'dimg' => __( 'This option sets a default image that can be used for the Open Graph image. You can upload an image, select an image from your Media Library or paste the URL of an image here.', 'all-in-one-seo-pack' ), + 'dimgwidth' => __( 'This option lets you set a default width for your images, where unspecified.', 'all-in-one-seo-pack' ), + 'dimgheight' => __( 'This option lets you set a default height for your images, where unspecified.', 'all-in-one-seo-pack' ), + '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' ), + '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' ), + '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' ), + 'imagewidth' => __( 'Enter the width for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ), + 'imageheight' => __( 'Enter the height for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ), + 'video' => __( 'This option lets you specify a link to the Open Graph video used on this Page or Post.', 'all-in-one-seo-pack' ), + 'videowidth' => __( 'Enter the width for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ), + 'videoheight' => __( 'Enter the height for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ), + 'defcard' => __( 'Select the default type of Twitter Card to display.', 'all-in-one-seo-pack' ), + 'setcard' => __( 'Select the Twitter Card type to use for this Page or Post, overriding the default setting.', 'all-in-one-seo-pack' ), + 'twitter_site' => __( 'Enter the Twitter username associated with your website here.', 'all-in-one-seo-pack' ), + 'twitter_creator' => __( 'Allows your authors to be identified by their Twitter usernames as content creators on the Twitter cards for their posts.', 'all-in-one-seo-pack' ), + 'twitter_domain' => __( 'Enter the name of your website here.', 'all-in-one-seo-pack' ), + 'customimg_twitter' => __( 'This option lets you upload an image to use as the Twitter image for this Page or Post.', 'all-in-one-seo-pack' ), + 'gen_tags' => __( 'Automatically generate article tags for Facebook type article when not provided.', 'all-in-one-seo-pack' ), + 'gen_keywords' => __( 'Use keywords in generated article tags.', 'all-in-one-seo-pack' ), + 'gen_categories' => __( 'Use categories in generated article tags.', 'all-in-one-seo-pack' ), + 'gen_post_tags' => __( 'Use post tags in generated article tags.', 'all-in-one-seo-pack' ), + 'types' => __( 'Select which Post Types you want to use All in One SEO Pack to set Open Graph meta values for.', 'all-in-one-seo-pack' ), + 'title' => __( 'This is the Open Graph title of this Page or Post.', 'all-in-one-seo-pack' ), + 'desc' => __( 'This is the Open Graph description of this Page or Post.', 'all-in-one-seo-pack' ), + 'category' => __( 'Select the Open Graph type that best describes the content of this Page or Post.', 'all-in-one-seo-pack' ), + 'facebook_debug' => __( 'Press this button to have Facebook re-fetch and debug this page.', 'all-in-one-seo-pack' ), + 'section' => __( 'This Open Graph meta allows you to add a general section name that best describes this content.', 'all-in-one-seo-pack' ), + 'tag' => __( 'This Open Graph meta allows you to add a list of keywords that best describe this content.', 'all-in-one-seo-pack' ), + 'facebook_publisher' => __( 'Link articles to the Facebook page associated with your website.', 'all-in-one-seo-pack' ), + 'facebook_author' => __( 'Allows your authors to be identified by their Facebook pages as content authors on the Opengraph meta for their articles.', 'all-in-one-seo-pack' ), + 'person_or_org' => __( 'Are the social profile links for your website for a person or an organization?', 'all-in-one-seo-pack' ), + 'profile_links' => __( "Add URLs for your website's social profiles here (Facebook, Twitter, Google+, Instagram, LinkedIn), one per line.", 'all-in-one-seo-pack' ), + 'social_name' => __( 'Add the name of the person or organization who owns these profiles.', 'all-in-one-seo-pack' ), + ); + + $this->help_anchors = array( + 'title_shortcodes' => '#run-shortcodes-in-title', + 'description_shortcodes' => '#run-shortcodes-in-description', + 'generate_descriptions' => '#auto-generate-og-descriptions', + 'setmeta' => '#use-aioseo-title-and-description', + 'sitename' => '#site-name', + 'hometitle' => '#home-title-and-description', + 'description' => '#home-title-and-description', + 'homeimage' => '#home-image', + 'defimg' => '#select-og-image-source', + 'fallback' => '#use-default-if-no-image-found', + 'dimg' => '#default-og-image', + 'dimgwidth' => '#default-image-width', + 'dimgheight' => '#default-image-height', + 'meta_key' => '#use-custom-field-for-image', + 'profile_links' => '#social-profile-links', + 'person_or_org' => '#social-profile-links', + 'social_name' => '#social-profile-links', + 'key' => '#facebook-admin-id', + 'appid' => '#facebook-app-id', + 'gen_tags' => '#automatically-generate-article-tags', + 'gen_keywords' => '#use-keywords-in-article-tags', + 'gen_categories' => '#use-categories-in-article-tags', + 'gen_post_tags' => '#use-post-tags-in-article-tags', + 'facebook_publisher' => '#show-facebook-publisher-on-articles', + 'facebook_author' => '#show-facebook-author-on-articles', + 'types' => '#enable-facebook-meta-for', + 'defcard' => '#default-twitter-card', + 'twitter_site' => '#twitter-site', + 'twitter_creator' => '#show-twitter-author', + 'twitter_domain' => '#twitter-domain', + 'scan_header' => '#scan-social-meta', + 'title' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#title', + 'desc' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#description', + 'image' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#image', + 'customimg' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-image', + 'imagewidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height', + 'imageheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height', + 'video' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-video', + 'videowidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height', + 'videoheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height', + 'category' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-object-type', + 'facebook_debug' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-debug', + 'section' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-section', + 'tag' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-tags', + 'setcard' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#twitter-card-type', + 'customimg_twitter' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-twitter-image', + ); + + if ( is_admin() ) { + add_action( 'admin_init', array( $this, 'admin_init' ), 5 ); + } else { + add_action( 'wp', array( $this, 'type_setup' ) ); + } + + if ( ! is_admin() || defined( 'DOING_AJAX' ) ) { + $this->do_opengraph(); + } + // Set variables after WordPress load. + add_action( 'init', array( &$this, 'init' ), 999999 ); + add_filter( 'jetpack_enable_open_graph', '__return_false' ); // Avoid having duplicate meta tags + // Force refresh of Facebook cache. + add_action( 'post_updated', array( &$this, 'force_fb_refresh_update' ), 10, 3 ); + add_action( 'transition_post_status', array( &$this, 'force_fb_refresh_transition' ), 10, 3 ); + add_action( 'edited_term', array( &$this, 'save_tax_data' ), 10, 3 ); + // Adds special filters + add_filter( 'aioseop_opengraph_placeholder', array( &$this, 'filter_placeholder' ) ); + // Call to init to generate menus + $this->init(); + } + + /** + * Hook called after WordPress has been loaded. + * + * @since 2.4.14 + */ + public function init() { + $count_desc = __( ' characters. Open Graph allows up to a maximum of %1$s chars for the %2$s.', 'all-in-one-seo-pack' ); + // Create default options + $this->default_options = array( + 'scan_header' => array( + 'name' => __( 'Scan Header', 'all-in-one-seo-pack' ), + 'type' => 'custom', + 'save' => true, + ), + 'setmeta' => array( + 'name' => __( 'Use AIOSEO Title and Description', 'all-in-one-seo-pack' ), + 'type' => 'checkbox', + ), + 'key' => array( + 'name' => __( 'Facebook Admin ID', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'text', + ), + 'appid' => array( + 'name' => __( 'Facebook App ID', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'text', + ), + 'title_shortcodes' => array( + 'name' => __( 'Run Shortcodes In Title', 'all-in-one-seo-pack' ), + ), + 'description_shortcodes' => array( + 'name' => __( 'Run Shortcodes In Description', 'all-in-one-seo-pack' ), + ), + 'sitename' => array( + 'name' => __( 'Site Name', 'all-in-one-seo-pack' ), + 'default' => get_bloginfo( 'name' ), + 'type' => 'text', + ), + 'hometitle' => array( + 'name' => __( 'Home Title', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'textarea', + 'condshow' => array( + 'aiosp_opengraph_setmeta' => array( + 'lhs' => 'aiosp_opengraph_setmeta', + 'op' => '!=', + 'rhs' => 'on', + ), + ), + ), + 'description' => array( + 'name' => __( 'Home Description', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'textarea', + 'condshow' => array( + 'aiosp_opengraph_setmeta' => array( + 'lhs' => 'aiosp_opengraph_setmeta', + 'op' => '!=', + 'rhs' => 'on', + ), + ), + ), + 'homeimage' => array( + 'name' => __( 'Home Image', 'all-in-one-seo-pack' ), + 'type' => 'image', + ), + 'generate_descriptions' => array( + 'name' => __( 'Use Content For Autogenerated OG Descriptions', 'all-in-one-seo-pack' ), + 'default' => 0, + ), + 'defimg' => array( + 'name' => __( 'Select OG:Image Source', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'initial_options' => array( + '' => __( 'Default Image' ), + 'featured' => __( 'Featured Image' ), + 'attach' => __( 'First Attached Image' ), + 'content' => __( 'First Image In Content' ), + 'custom' => __( 'Image From Custom Field' ), + 'author' => __( 'Post Author Image' ), + 'auto' => __( 'First Available Image' ), + ), + ), + 'fallback' => array( + 'name' => __( 'Use Default If No Image Found', 'all-in-one-seo-pack' ), + 'type' => 'checkbox', + ), + 'dimg' => array( + 'name' => __( 'Default OG:Image', 'all-in-one-seo-pack' ), + 'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png', + 'type' => 'image', + ), + 'dimgwidth' => array( + 'name' => __( 'Default Image Width', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'dimgheight' => array( + 'name' => __( 'Default Image Height', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'meta_key' => array( + 'name' => __( 'Use Custom Field For Image', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'image' => array( + 'name' => __( 'Image', 'all-in-one-seo-pack' ), + 'type' => 'radio', + 'initial_options' => array( + 0 => '', + ), + ), + 'customimg' => array( + 'name' => __( 'Custom Image', 'all-in-one-seo-pack' ), + 'type' => 'image', + ), + 'imagewidth' => array( + 'name' => __( 'Specify Image Width', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'imageheight' => array( + 'name' => __( 'Specify Image Height', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'video' => array( + 'name' => __( 'Custom Video', 'all-in-one-seo-pack' ), + 'type' => 'text', + ), + 'videowidth' => array( + 'name' => __( 'Specify Video Width', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => array( + 'aioseop_opengraph_settings_video' => array( + 'lhs' => 'aioseop_opengraph_settings_video', + 'op' => '!=', + 'rhs' => '', + ), + ), + ), + 'videoheight' => array( + 'name' => __( 'Specify Video Height', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => array( + 'aioseop_opengraph_settings_video' => array( + 'lhs' => 'aioseop_opengraph_settings_video', + 'op' => '!=', + 'rhs' => '', + ), + ), + ), + 'defcard' => array( + 'name' => __( 'Default Twitter Card', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'default' => 'summary', + 'initial_options' => array( + 'summary' => __( 'Summary', 'all-in-one-seo-pack' ), + 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ), + + /* + REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE + 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) + */ + ), + ), + 'setcard' => array( + 'name' => __( 'Twitter Card Type', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'initial_options' => array( + 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ), + 'summary' => __( 'Summary', 'all-in-one-seo-pack' ), + + /* + REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE + 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) + */ + ), + ), + 'twitter_site' => array( + 'name' => __( 'Twitter Site', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'twitter_creator' => array( + 'name' => __( 'Show Twitter Author', 'all-in-one-seo-pack' ), + ), + 'twitter_domain' => array( + 'name' => __( 'Twitter Domain', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'customimg_twitter' => array( + 'name' => __( 'Custom Twitter Image', 'all-in-one-seo-pack' ), + 'type' => 'image', + ), + 'gen_tags' => array( + 'name' => __( 'Automatically Generate Article Tags', 'all-in-one-seo-pack' ), + ), + 'gen_keywords' => array( + 'name' => __( 'Use Keywords In Article Tags', 'all-in-one-seo-pack' ), + 'default' => 'on', + 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), + ), + 'gen_categories' => array( + 'name' => __( 'Use Categories In Article Tags', 'all-in-one-seo-pack' ), + 'default' => 'on', + 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), + ), + 'gen_post_tags' => array( + 'name' => __( 'Use Post Tags In Article Tags', 'all-in-one-seo-pack' ), + 'default' => 'on', + 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), + ), + 'types' => array( + 'name' => __( 'Enable Facebook Meta for Post Types', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'default' => array( 'post' => 'post', 'page' => 'page' ), + 'initial_options' => $this->get_post_type_titles( array( '_builtin' => false ) ), + ), + 'title' => array( + 'name' => __( 'Title', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'text', + 'size' => 95, + 'count' => 1, + 'count_desc' => $count_desc, + ), + 'desc' => array( + 'name' => __( 'Description', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'textarea', + 'cols' => 250, + 'rows' => 4, + 'count' => 1, + 'count_desc' => $count_desc, + ), + 'category' => array( + 'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'style' => '', + 'default' => '', + 'initial_options' => $this->fb_object_types, + ), + 'facebook_debug' => array( + 'name' => __( 'Facebook Debug', 'all-in-one-seo-pack' ), + 'type' => 'html', + 'save' => false, + 'default' => $this->get_facebook_debug(), + ), + 'section' => array( + 'name' => __( 'Article Section', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ), + ), + 'tag' => array( + 'name' => __( 'Article Tags', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ), + ), + 'facebook_publisher' => array( + 'name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'facebook_author' => array( + 'name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' ), + ), + 'profile_links' => array( + 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), + 'type' => 'textarea', + 'cols' => 60, + 'rows' => 5, + ), + 'person_or_org' => array( + 'name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ), + 'type' => 'radio', + 'initial_options' => array( + 'person' => __( 'Person', 'all-in-one-seo-pack' ), + 'org' => __( 'Organization', 'all-in-one-seo-pack' ), + ), + ), + 'social_name' => array( + 'name' => __( 'Associated Name', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + ); + // load initial options / set defaults + $this->update_options(); + $display = array(); + if ( isset( $this->options['aiosp_opengraph_types'] ) && ! empty( $this->options['aiosp_opengraph_types'] ) ) { + $display = $this->options['aiosp_opengraph_types']; + } + $this->locations = array( + 'opengraph' => array( + 'name' => $this->name, + 'prefix' => 'aiosp_', + 'type' => 'settings', + 'options' => array( + 'scan_header', + 'setmeta', + 'key', + 'appid', + 'sitename', + 'title_shortcodes', + 'description_shortcodes', + 'hometitle', + 'description', + 'homeimage', + 'generate_descriptions', + 'defimg', + 'fallback', + 'dimg', + 'dimgwidth', + 'dimgheight', + 'meta_key', + 'defcard', + 'profile_links', + 'person_or_org', + 'social_name', + 'twitter_site', + 'twitter_creator', + 'twitter_domain', + 'gen_tags', + 'gen_keywords', + 'gen_categories', + 'gen_post_tags', + 'types', + 'facebook_publisher', + 'facebook_author', + ), + ), + 'settings' => array( + 'name' => __( 'Social Settings', 'all-in-one-seo-pack' ), + 'type' => 'metabox', + 'help_link' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/', + 'options' => array( + 'title', + 'desc', + 'image', + 'customimg', + 'imagewidth', + 'imageheight', + 'video', + 'videowidth', + 'videoheight', + 'category', + 'facebook_debug', + 'section', + 'tag', + 'setcard', + 'customimg_twitter', + ), + 'display' => apply_filters( 'aioseop_opengraph_display', $display ), + 'prefix' => 'aioseop_opengraph_', + ), + ); + $this->layout = array( + 'home' => array( + 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#use-aioseo-title-and-description', + 'options' => array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage' ), + ), + 'image' => array( + 'name' => __( 'Image Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#select-og-image-source', + 'options' => array( 'defimg', 'fallback', 'dimg', 'dimgwidth', 'dimgheight', 'meta_key' ), + ), + 'links' => array( + 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#social-profile-links', + 'options' => array( 'profile_links', 'person_or_org', 'social_name' ), + ), + 'facebook' => array( + 'name' => __( 'Facebook Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#facebook-settings', + 'options' => array( + 'key', + 'appid', + 'types', + 'gen_tags', + 'gen_keywords', + 'gen_categories', + 'gen_post_tags', + 'facebook_publisher', + 'facebook_author', + ), + ), + 'twitter' => array( + 'name' => __( 'Twitter Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#default-twitter-card', + 'options' => array( 'defcard', 'setcard', 'twitter_site', 'twitter_creator', 'twitter_domain' ), + ), + 'default' => array( + 'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/', + 'options' => array(), // this is set below, to the remaining options -- pdb + ), + 'scan_meta' => array( + 'name' => __( 'Scan Social Meta', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#scan_meta', + 'options' => array( 'scan_header' ), + ), + ); + $other_options = array(); + foreach ( $this->layout as $k => $v ) { + $other_options = array_merge( $other_options, $v['options'] ); + } + + $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options ); + } + + /** + * Forces FaceBook OpenGraph to refresh its cache when a post is changed to + * + * @param $new_status + * @param $old_status + * @param $post + * + * @todo this and force_fb_refresh_update can probably have the remote POST extracted out. + * + * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update + * @since 2.3.11 + */ + function force_fb_refresh_transition( $new_status, $old_status, $post ) { + if ( 'publish' !== $new_status ) { + return; + } + if ( 'future' !== $old_status ) { + return; + } + + $current_post_type = get_post_type(); + + // Only ping Facebook if Social SEO is enabled on this post type. + if ( $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) { + $post_url = aioseop_get_permalink( $post->ID ); + $endpoint = sprintf( + 'https://graph.facebook.com/?%s', http_build_query( + array( + 'id' => $post_url, + 'scrape' => true, + ) + ) + ); + wp_remote_post( $endpoint, array( 'blocking' => false ) ); + } + } + + /** + * Forces FaceBook OpenGraph refresh on update. + * + * @param $post_id + * @param $post_after + * + * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update + * @since 2.3.11 + */ + function force_fb_refresh_update( $post_id, $post_after ) { + + $current_post_type = get_post_type(); + + // Only ping Facebook if Social SEO is enabled on this post type. + if ( 'publish' === $post_after->post_status && $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) { + $post_url = aioseop_get_permalink( $post_id ); + $endpoint = sprintf( + 'https://graph.facebook.com/?%s', http_build_query( + array( + 'id' => $post_url, + 'scrape' => true, + ) + ) + ); + wp_remote_post( $endpoint, array( 'blocking' => false ) ); + } + } + + function settings_page_init() { + add_filter( 'aiosp_output_option', array( $this, 'display_custom_options' ), 10, 2 ); + } + + function filter_options( $options, $location ) { + if ( $location == 'settings' ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + list( $legacy, $images ) = $this->get_all_images( $options ); + if ( isset( $options ) && isset( $options["{$prefix}image"] ) ) { + $thumbnail = $options["{$prefix}image"]; + if ( ctype_digit( (string) $thumbnail ) || ( $thumbnail == 'post' ) ) { + if ( $thumbnail == 'post' ) { + $thumbnail = $images['post1']; + } elseif ( ! empty( $legacy[ $thumbnail ] ) ) { + $thumbnail = $legacy[ $thumbnail ]; + } + } + $options["{$prefix}image"] = $thumbnail; + } + if ( empty( $options[ $prefix . 'image' ] ) ) { + $img = array_keys( $images ); + if ( ! empty( $img ) && ! empty( $img[1] ) ) { + $options[ $prefix . 'image' ] = $img[1]; + } + } + } + + return $options; + } + + /** + * Applies filter to module settings. + * + * @since 2.3.11 + * @since 2.4.14 Added filter for description and title placeholders. + * @since 2.3.15 do_shortcode on description. + * + * @see [plugin]\admin\aioseop_module_class.php > display_options() + */ + function filter_settings( $settings, $location, $current ) { + global $aiosp, $post; + if ( $location == 'opengraph' || $location == 'settings' ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + if ( $location == 'opengraph' ) { + return $settings; + } + if ( $location == 'settings' ) { + list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current ); + $opts = array( 'title', 'desc' ); + $current_post_type = get_post_type(); + if ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) { + $flat_type_list = array(); + foreach ( $this->fb_object_types as $k => $v ) { + if ( is_array( $v ) ) { + $flat_type_list = array_merge( $flat_type_list, $v ); + } else { + $flat_type_list[ $k ] = $v; + } + } + $settings[ $prefix . 'category' ]['initial_options'] = array_merge( + array( + $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] => __( 'Default ', 'all-in-one-seo-pack' ) . ' - ' + . $flat_type_list[ $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ], + ), + $settings[ $prefix . 'category' ]['initial_options'] + ); + } + if ( isset( $this->options['aiosp_opengraph_defcard'] ) ) { + $settings[ $prefix . 'setcard' ]['default'] = $this->options['aiosp_opengraph_defcard']; + } + $info = $aiosp->get_page_snippet_info(); + $title = $info['title']; + $description = $info['description']; + + // Description options + if ( is_object( $post ) ) { + // Always show excerpt + $description = empty( $this->options['aiosp_opengraph_generate_descriptions'] ) + ? $aiosp->trim_excerpt_without_filters( + $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ), + 1000 + ) + : $aiosp->trim_excerpt_without_filters( + $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), + 1000 + ); + } + + // #1308 - we want to make sure we are ignoring php version only in the admin area while editing the post, so that it does not impact #932. + $screen = get_current_screen(); + $ignore_php_version = is_admin() && isset( $screen->id ) && 'post' == $screen->id; + + // Add filters + $description = apply_filters( 'aioseop_description', $description, false, $ignore_php_version ); + // Add placholders + $settings[ "{$prefix}title" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $title ); + $settings[ "{$prefix}desc" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $description ); + } + if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) { + foreach ( $opts as $opt ) { + if ( isset( $settings[ $prefix . $opt ] ) ) { + $settings[ $prefix . $opt ]['type'] = 'hidden'; + $settings[ $prefix . $opt ]['label'] = 'none'; + $settings[ $prefix . $opt ]['help_text'] = ''; + unset( $settings[ $prefix . $opt ]['count'] ); + } + } + } + } + + return $settings; + } + + /** + * Applies filter to module options. + * These will display in the "Social Settings" object tab. + * filter:{prefix}override_options + * + * @since 2.3.11 + * @since 2.4.14 Overrides empty og:type values. + * + * @see [plugin]\admin\aioseop_module_class.php > display_options() + * + * @global array $aioseop_options Plugin options. + * + * @param array $options Current options. + * @param string $location Location where filter is called. + * @param array $settings Settings. + * + * @return array + */ + function override_options( $options, $location, $settings ) { + global $aioseop_options; + // Prepare default and prefix + $prefix = $this->get_prefix( $location ) . $location . '_'; + $opts = array(); + + foreach ( $settings as $k => $v ) { + if ( $v['save'] ) { + $opts[ $k ] = $v['default']; + } + } + foreach ( $options as $k => $v ) { + switch ( $k ) { + case $prefix . 'category': + if ( empty( $v ) ) { + // Get post type + $type = isset( get_current_screen()->post_type ) + ? get_current_screen()->post_type + : null; + // Assign default from plugin options + if ( ! empty( $type ) + && isset( $aioseop_options['modules'] ) + && isset( $aioseop_options['modules']['aiosp_opengraph_options'] ) + && isset( $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ] ) + ) { + $options[ $prefix . 'category' ] = + $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ]; + } + continue; + } + break; + } + if ( $v === null ) { + unset( $options[ $k ] ); + } + } + $options = wp_parse_args( $options, $opts ); + + return $options; + } + + /** + * Applies filter to metabox settings before they are saved. + * Sets custom as default if a custom image is uploaded. + * filter:{prefix}filter_metabox_options + * filter:{prefix}filter_term_metabox_options + * + * @since 2.3.11 + * @since 2.4.14 Fixes for aioseop-pro #67 and other bugs found. + * + * @see [plugin]\admin\aioseop_module_class.php > save_post_data() + * @see [this file] > save_tax_data() + * + * @param array $options List of current options. + * @param string $location Location where filter is called. + * @param int $id Either post_id or term_id. + * + * @return array + */ + function filter_metabox_options( $options, $location, $post_id ) { + if ( $location == 'settings' ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + if ( isset( $options[ $prefix . 'customimg_checker' ] ) + && $options[ $prefix . 'customimg_checker' ] + ) { + $options[ $prefix . 'image' ] = $options[ $prefix . 'customimg' ]; + } + } + return $options; + } + + /** Custom settings **/ + function display_custom_options( $buf, $args ) { + if ( $args['name'] == 'aiosp_opengraph_scan_header' ) { + $buf .= '
    '; + $args['options']['type'] = 'submit'; + $args['attr'] = " class='button-primary' "; + $args['value'] = $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' ); + $buf .= __( 'Scan your site for duplicate social meta tags.', 'all-in-one-seo-pack' ); + $buf .= '

    ' . $this->get_option_html( $args ); + $buf .= '
    '; + } + + return $buf; + } + + function add_attributes( $output ) { + // avoid having duplicate meta tags + $type = $this->type; + if ( empty( $type ) ) { + $type = 'website'; + } + + $schema_types = array( + 'album' => 'MusicAlbum', + 'article' => 'Article', + 'bar' => 'BarOrPub', + 'blog' => 'Blog', + 'book' => 'Book', + 'cafe' => 'CafeOrCoffeeShop', + 'city' => 'City', + 'country' => 'Country', + 'episode' => 'Episode', + 'food' => 'FoodEvent', + 'game' => 'Game', + 'hotel' => 'Hotel', + 'landmark' => 'LandmarksOrHistoricalBuildings', + 'movie' => 'Movie', + 'product' => 'Product', + 'profile' => 'ProfilePage', + 'restaurant' => 'Restaurant', + 'school' => 'School', + 'sport' => 'SportsEvent', + 'website' => 'WebSite', + ); + + if ( ! empty( $schema_types[ $type ] ) ) { + $type = $schema_types[ $type ]; + } else { + $type = 'WebSite'; + } + + $attributes = apply_filters( + $this->prefix . 'attributes', array( + 'itemscope', + 'itemtype="http://schema.org/' . ucfirst( $type ) . '"', + 'prefix="og: http://ogp.me/ns#"', + ) + ); + + foreach ( $attributes as $attr ) { + if ( strpos( $output, $attr ) === false ) { + $output .= "\n\t$attr "; + } + } + + return $output; + } + + /** + * Add our social meta. + * + * @since 1.0.0 + * @since 2.3.11.5 Support for multiple fb_admins. + * @since 2.3.13 Adds filter:aioseop_description on description. + * @since 2.4.14 Fixes for aioseop-pro #67. + * @since 2.3.15 Always do_shortcode on descriptions, removed for titles. + * + * @global object $post Current WP_Post object. + * @global object $aiosp All in one seo plugin object. + * @global array $aioseop_options All in one seo plugin options. + * @global object $wp_query WP_Query global instance. + */ + function add_meta() { + global $post, $aiosp, $aioseop_options, $wp_query; + $metabox = $this->get_current_options( array(), 'settings' ); + $key = $this->options['aiosp_opengraph_key']; + $dimg = $this->options['aiosp_opengraph_dimg']; + $current_post_type = get_post_type(); + $title = $description = $image = $video = ''; + $type = $this->type; + $sitename = $this->options['aiosp_opengraph_sitename']; + + $appid = isset( $this->options['aiosp_opengraph_appid'] ) ? $this->options['aiosp_opengraph_appid'] : ''; + + if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) { + $first_page = false; + if ( $aiosp->get_page_number() < 2 ) { + $first_page = true; + } + } else { + $first_page = true; + } + $url = $aiosp->aiosp_mrt_get_url( $wp_query ); + $url = apply_filters( 'aioseop_canonical_url', $url ); + + $setmeta = $this->options['aiosp_opengraph_setmeta']; + $social_links = ''; + if ( is_front_page() ) { + $title = $this->options['aiosp_opengraph_hometitle']; + if ( $first_page ) { + $description = $this->options['aiosp_opengraph_description']; + if ( empty( $description ) ) { + $description = get_bloginfo( 'description' ); + } + } + if ( ! empty( $this->options['aiosp_opengraph_homeimage'] ) ) { + $thumbnail = $this->options['aiosp_opengraph_homeimage']; + } else { + $thumbnail = $this->options['aiosp_opengraph_dimg']; + } + + /* If Use AIOSEO Title and Desc Selected */ + if ( $setmeta ) { + $title = $aiosp->wp_title(); + if ( $first_page ) { + $description = $aiosp->get_aioseop_description( $post ); + } + } + + /* Add some defaults */ + if ( empty( $title ) ) { + $title = get_bloginfo( 'name' ); + } + if ( empty( $sitename ) ) { + $sitename = get_bloginfo( 'name' ); + } + + if ( empty( $description ) && $first_page && ! empty( $post ) && ! post_password_required( $post ) ) { + + if ( ! empty( $post->post_content ) || ! empty( $post->post_excerpt ) ) { + $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ), 1000 ); + + if ( ! empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) { + $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 ); + } + } + } + + if ( empty( $description ) && $first_page ) { + $description = get_bloginfo( 'description' ); + } + if ( ! empty( $this->options['aiosp_opengraph_profile_links'] ) ) { + $social_links = $this->options['aiosp_opengraph_profile_links']; + if ( ! empty( $this->options['aiosp_opengraph_social_name'] ) ) { + $social_name = $this->options['aiosp_opengraph_social_name']; + } else { + $social_name = ''; + } + if ( $this->options['aiosp_opengraph_person_or_org'] == 'person' ) { + $social_type = 'Person'; + } else { + $social_type = 'Organization'; + } + } + } elseif ( is_singular() && $this->option_isset( 'types' ) + && is_array( $this->options['aiosp_opengraph_types'] ) + && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) + ) { + + if ( $type == 'article' ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) { + $section = $metabox['aioseop_opengraph_settings_section']; + } + if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) { + $tag = $metabox['aioseop_opengraph_settings_tag']; + } + if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) { + $publisher = $this->options['aiosp_opengraph_facebook_publisher']; + } + } + + if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { + $domain = $this->options['aiosp_opengraph_twitter_domain']; + } + + if ( $type == 'article' && ! empty( $post ) ) { + if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) { + $author = get_the_author_meta( 'facebook', $post->post_author ); + } + + if ( isset( $post->post_date_gmt ) ) { + $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date_gmt ) ); + } + + if ( isset( $post->post_modified_gmt ) ) { + $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified_gmt ) ); + } + } + + $image = $metabox['aioseop_opengraph_settings_image']; + $video = $metabox['aioseop_opengraph_settings_video']; + $title = $metabox['aioseop_opengraph_settings_title']; + $description = $metabox['aioseop_opengraph_settings_desc']; + + /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */ + global $aiosp; + if ( empty( $title ) ) { + $title = $aiosp->wp_title(); + } + if ( empty( $description ) ) { + $description = trim( strip_tags( get_post_meta( $post->ID, '_aioseop_description', true ) ) ); + } + + /* Add default title */ + if ( empty( $title ) ) { + $title = get_the_title(); + } + + // Add default description. + if ( empty( $description ) && ! post_password_required( $post ) ) { + + $description = $post->post_excerpt; + + if ( $this->options['aiosp_opengraph_generate_descriptions'] || empty( $description ) ) { + $description = $post->post_content; + } + } + if ( empty( $type ) ) { + $type = 'article'; + } + } elseif ( AIOSEOPPRO && ( is_category() || is_tag() || is_tax() ) ) { + if ( isset( $this->options['aioseop_opengraph_settings_category'] ) ) { + $type = $this->options['aioseop_opengraph_settings_category']; + } + if ( isset( $metabox['aioseop_opengraph_settings_category'] ) ) { + $type = $metabox['aioseop_opengraph_settings_category']; + } + if ( $type == 'article' ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) { + $section = $metabox['aioseop_opengraph_settings_section']; + } + if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) { + $tag = $metabox['aioseop_opengraph_settings_tag']; + } + if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) { + $publisher = $this->options['aiosp_opengraph_facebook_publisher']; + } + } + if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { + $domain = $this->options['aiosp_opengraph_twitter_domain']; + } + if ( $type == 'article' && ! empty( $post ) ) { + if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) { + $author = get_the_author_meta( 'facebook', $post->post_author ); + } + + if ( isset( $post->post_date_gmt ) ) { + $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date_gmt ) ); + } + if ( isset( $post->post_modified_gmt ) ) { + $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified_gmt ) ); + } + } + $image = $metabox['aioseop_opengraph_settings_image']; + $video = $metabox['aioseop_opengraph_settings_video']; + $title = $metabox['aioseop_opengraph_settings_title']; + $description = $metabox['aioseop_opengraph_settings_desc']; + /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */ + global $aiosp; + if ( empty( $title ) ) { + $title = $aiosp->wp_title(); + } + if ( empty( $description ) ) { + $term_id = isset( $_GET['tag_ID'] ) ? (int) $_GET['tag_ID'] : 0; + $term_id = $term_id ? $term_id : get_queried_object()->term_id; + $description = trim( strip_tags( get_term_meta( $term_id, '_aioseop_description', true ) ) ); + } + // Add default title + if ( empty( $title ) ) { + $title = get_the_title(); + } + // Add default description. + if ( empty( $description ) && ! post_password_required( $post ) ) { + $description = get_queried_object()->description; + } + if ( empty( $type ) ) { + $type = 'website'; + } + } elseif ( is_home() && ! is_front_page() ) { + // This is the blog page but not the homepage. + global $aiosp; + $image = $metabox['aioseop_opengraph_settings_image']; + $video = $metabox['aioseop_opengraph_settings_video']; + $title = $metabox['aioseop_opengraph_settings_title']; + $description = $metabox['aioseop_opengraph_settings_desc']; + + if ( empty( $description ) ) { + // If there's not social description, fall back to the SEO description. + $description = trim( strip_tags( get_post_meta( get_option( 'page_for_posts' ), '_aioseop_description', true ) ) ); + } + if ( empty( $title ) ) { + $title = $aiosp->wp_title(); + } + } else { + return; + } + + if ( $type === 'article' && ! empty( $post ) && is_singular() ) { + if ( ! empty( $this->options['aiosp_opengraph_gen_tags'] ) ) { + if ( ! empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) { + $keywords = $aiosp->get_main_keywords(); + $keywords = $this->apply_cf_fields( $keywords ); + $keywords = apply_filters( 'aioseop_keywords', $keywords ); + if ( ! empty( $keywords ) && ! empty( $tag ) ) { + $tag .= ',' . $keywords; + } elseif ( empty( $tag ) ) { + $tag = $keywords; + } + } + $tag = $aiosp->keyword_string_to_list( $tag ); + if ( ! empty( $this->options['aiosp_opengraph_gen_categories'] ) ) { + $tag = array_merge( $tag, $aiosp->get_all_categories( $post->ID ) ); + } + if ( ! empty( $this->options['aiosp_opengraph_gen_post_tags'] ) ) { + $tag = array_merge( $tag, $aiosp->get_all_tags( $post->ID ) ); + } + } + if ( ! empty( $tag ) ) { + $tag = $aiosp->clean_keyword_list( $tag ); + } + } + + if ( ! empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) { + $title = do_shortcode( $title ); + } + if ( ! empty( $description ) ) { + $description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) ); + if ( ! empty( $this->options['aiosp_opengraph_description_shortcodes'] ) ) { + $description = do_shortcode( $description ); + } + $description = $aiosp->trim_excerpt_without_filters( $description, 1000 ); + } + + $title = $this->apply_cf_fields( $title ); + $description = $this->apply_cf_fields( $description ); + + /* Data Validation */ + $title = strip_tags( esc_attr( $title ) ); + $sitename = strip_tags( esc_attr( $sitename ) ); + $description = strip_tags( esc_attr( $description ) ); + + if ( empty( $thumbnail ) && ! empty( $image ) ) { + $thumbnail = $image; + } + + // Add user supplied default image. + if ( empty( $thumbnail ) ) { + if ( empty( $this->options['aiosp_opengraph_defimg'] ) ) { + $thumbnail = $this->options['aiosp_opengraph_dimg']; + } else { + switch ( $this->options['aiosp_opengraph_defimg'] ) { + case 'featured': + $thumbnail = $this->get_the_image_by_post_thumbnail(); + break; + case 'attach': + $thumbnail = $this->get_the_image_by_attachment(); + break; + case 'content': + $thumbnail = $this->get_the_image_by_scan(); + break; + case 'custom': + $meta_key = $this->options['aiosp_opengraph_meta_key']; + if ( ! empty( $meta_key ) && ! empty( $post ) ) { + $meta_key = explode( ',', $meta_key ); + $thumbnail = $this->get_the_image_by_meta_key( + array( + 'post_id' => $post->ID, + 'meta_key' => $meta_key, + ) + ); + } + break; + case 'auto': + $thumbnail = $this->get_the_image(); + break; + case 'author': + $thumbnail = $this->get_the_image_by_author(); + break; + default: + $thumbnail = $this->options['aiosp_opengraph_dimg']; + } + } + } + + if ( ( empty( $thumbnail ) && ! empty( $this->options['aiosp_opengraph_fallback'] ) ) ) { + $thumbnail = $this->options['aiosp_opengraph_dimg']; + } + + if ( ! empty( $thumbnail ) ) { + $thumbnail = esc_url( $thumbnail ); + $thumbnail = set_url_scheme( $thumbnail ); + } + + $width = $height = ''; + if ( ! empty( $thumbnail ) ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) ) { + $width = $metabox['aioseop_opengraph_settings_imagewidth']; + } + if ( ! empty( $metabox['aioseop_opengraph_settings_imageheight'] ) ) { + $height = $metabox['aioseop_opengraph_settings_imageheight']; + } + if ( empty( $width ) && ! empty( $this->options['aiosp_opengraph_dimgwidth'] ) ) { + $width = $this->options['aiosp_opengraph_dimgwidth']; + } + if ( empty( $height ) && ! empty( $this->options['aiosp_opengraph_dimgheight'] ) ) { + $height = $this->options['aiosp_opengraph_dimgheight']; + } + } + + if ( ! empty( $video ) ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_videowidth'] ) ) { + $videowidth = $metabox['aioseop_opengraph_settings_videowidth']; + } + if ( ! empty( $metabox['aioseop_opengraph_settings_videoheight'] ) ) { + $videoheight = $metabox['aioseop_opengraph_settings_videoheight']; + } + } + + $card = 'summary'; + if ( ! empty( $this->options['aiosp_opengraph_defcard'] ) ) { + $card = $this->options['aiosp_opengraph_defcard']; + } + + if ( ! empty( $metabox['aioseop_opengraph_settings_setcard'] ) ) { + $card = $metabox['aioseop_opengraph_settings_setcard']; + } + + // support for changing legacy twitter cardtype-photo to summary large image + if ( $card == 'photo' ) { + $card = 'summary_large_image'; + } + + $site = $domain = $creator = ''; + + if ( ! empty( $this->options['aiosp_opengraph_twitter_site'] ) ) { + $site = $this->options['aiosp_opengraph_twitter_site']; + $site = AIOSEOP_Opengraph_Public::prepare_twitter_username( $site ); + } + + if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { + $domain = $this->options['aiosp_opengraph_twitter_domain']; + } + + if ( ! empty( $post ) && isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_twitter_creator'] ) ) { + $creator = get_the_author_meta( 'twitter', $post->post_author ); + $creator = AIOSEOP_Opengraph_Public::prepare_twitter_username( $creator ); + } + + if ( ! empty( $thumbnail ) ) { + $twitter_thumbnail = $thumbnail; // Default Twitter image if custom isn't set. + } + + if ( isset( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) && ! empty( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) ) { + // Set Twitter image from custom. + $twitter_thumbnail = set_url_scheme( $metabox['aioseop_opengraph_settings_customimg_twitter'] ); + } + + // Apply last filters. + $description = apply_filters( 'aioseop_description', $description ); + + $meta = array( + 'facebook' => array( + 'title' => 'og:title', + 'type' => 'og:type', + 'url' => 'og:url', + 'thumbnail' => 'og:image', + 'width' => 'og:image:width', + 'height' => 'og:image:height', + 'video' => 'og:video', + 'videowidth' => 'og:video:width', + 'videoheight' => 'og:video:height', + 'sitename' => 'og:site_name', + 'key' => 'fb:admins', + 'appid' => 'fb:app_id', + 'description' => 'og:description', + 'section' => 'article:section', + 'tag' => 'article:tag', + 'publisher' => 'article:publisher', + 'author' => 'article:author', + 'published_time' => 'article:published_time', + 'modified_time' => 'article:modified_time', + ), + 'twitter' => array( + 'card' => 'twitter:card', + 'site' => 'twitter:site', + 'creator' => 'twitter:creator', + 'domain' => 'twitter:domain', + 'title' => 'twitter:title', + 'description' => 'twitter:description', + 'twitter_thumbnail' => 'twitter:image', + ), + ); + + // Only show if "use schema.org markup is checked". + if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) { + $meta['google+'] = array( 'thumbnail' => 'image' ); + } + + $tags = array( + 'facebook' => array( 'name' => 'property', 'value' => 'content' ), + 'twitter' => array( 'name' => 'name', 'value' => 'content' ), + 'google+' => array( 'name' => 'itemprop', 'value' => 'content' ), + ); + + foreach ( $meta as $t => $data ) { + foreach ( $data as $k => $v ) { + if ( empty( $$k ) ) { + $$k = ''; + } + $filtered_value = $$k; + $filtered_value = apply_filters( $this->prefix . 'meta', $filtered_value, $t, $k ); + if ( ! empty( $filtered_value ) ) { + if ( ! is_array( $filtered_value ) ) { + $filtered_value = array( $filtered_value ); + } + + /** + * This is to accomodate multiple fb:admins on separate lines. + * @TODO Eventually we'll want to put this in its own function so things like images work too. + */ + if ( 'key' === $k ) { + $fbadmins = explode( ',', str_replace( ' ', '', $filtered_value[0] ) ); // Trim spaces then turn comma-separated values into an array. + foreach ( $fbadmins as $fbadmin ) { + echo '' . "\n"; + } + } else { + // For everything else. + foreach ( $filtered_value as $f ) { + echo '' . "\n"; + } + } + } + } + } + $social_link_schema = ''; + if ( ! empty( $social_links ) ) { + $home_url = esc_url( get_home_url() ); + $social_links = explode( "\n", $social_links ); + foreach ( $social_links as $k => $v ) { + $v = trim( $v ); + if ( empty( $v ) ) { + unset( $social_links[ $k ] ); + } else { + $v = esc_url( $v ); + $social_links[ $k ] = $v; + } + } + $social_links = join( '","', $social_links ); + $social_link_schema = << +{ "@context" : "http://schema.org", + "@type" : "{$social_type}", + "name" : "{$social_name}", + "url" : "{$home_url}", + "sameAs" : ["{$social_links}"] +} + + +END; + } + echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema ); + } + + /** + * Do / adds opengraph properties to meta. + * @since 2.3.11 + * + * @global array $aioseop_options AIOSEOP plugin options. + */ + public function do_opengraph() { + global $aioseop_options; + if ( ! empty( $aioseop_options ) + && ! empty( $aioseop_options['aiosp_schema_markup'] ) + ) { + add_filter( 'language_attributes', array( &$this, 'add_attributes' ) ); + } + if ( ! defined( 'DOING_AJAX' ) ) { + add_action( 'aioseop_modules_wp_head', array( &$this, 'add_meta' ), 5 ); + // Add social meta to AMP plugin. + if ( apply_filters( 'aioseop_enable_amp_social_meta', true ) === true ) { + add_action( 'amp_post_template_head', array( &$this, 'add_meta' ), 12 ); + } + } + } + + /** + * Set up types. + * + * @since ? + * @since 2.3.15 Change to website for homepage and blog post index page, default to object. + */ + function type_setup() { + $this->type = 'object'; // Default to type object if we don't have some other rule. + + if ( is_home() || is_front_page() ) { + $this->type = 'website'; // Home page and blog page should be website. + } elseif ( is_singular() && $this->option_isset( 'types' ) ) { + $metabox = $this->get_current_options( array(), 'settings' ); + $current_post_type = get_post_type(); + if ( ! empty( $metabox['aioseop_opengraph_settings_category'] ) ) { + $this->type = $metabox['aioseop_opengraph_settings_category']; + } elseif ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) { + $this->type = $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ]; + } + } + } + + /** + * Inits hooks and others for admin init. + * action:admin_init. + * + * @since 2.3.11 + * @since 2.4.14 Refactored function name, and new filter added for defaults and missing term metabox. + */ + function admin_init() { + add_filter( $this->prefix . 'display_settings', array( &$this, 'filter_settings' ), 10, 3 ); + add_filter( $this->prefix . 'override_options', array( &$this, 'override_options' ), 10, 3 ); + add_filter( $this->get_prefix( 'settings' ) . 'default_options', array( + &$this, + 'filter_default_options', + ), 10, 2 ); + add_filter( + $this->get_prefix( 'settings' ) . 'filter_metabox_options', array( + &$this, + 'filter_metabox_options', + ), 10, 3 + ); + add_filter( + $this->get_prefix( 'settings' ) . 'filter_term_metabox_options', array( + &$this, + 'filter_metabox_options', + ), 10, 3 + ); + $post_types = $this->get_post_type_titles(); + $rempost = array( + 'revision' => 1, + 'nav_menu_item' => 1, + 'custom_css' => 1, + 'customize_changeset' => 1, + ); + $post_types = array_diff_key( $post_types, $rempost ); + $this->default_options['types']['initial_options'] = $post_types; + foreach ( $post_types as $slug => $name ) { + $field = $slug . '_fb_object_type'; + $this->default_options[ $field ] = array( + 'name' => "$name " . __( 'Object Type', 'all-in-one-seo-pack' ) . "
    ($slug)", + 'type' => 'select', + 'style' => '', + 'initial_options' => $this->fb_object_types, + 'default' => 'article', + 'condshow' => array( 'aiosp_opengraph_types\[\]' => $slug ), + ); + $this->help_text[ $field ] = __( 'Choose a default value that best describes the content of your post type.', 'all-in-one-seo-pack' ); + $this->help_anchors[ $field ] = '#content-object-types'; + $this->locations['opengraph']['options'][] = $field; + $this->layout['facebook']['options'][] = $field; + } + $this->setting_options(); + $this->add_help_text_links(); + + } + + function get_all_images( $options = null, $p = null ) { + static $img = array(); + if ( ! is_array( $options ) ) { + $options = array(); + } + if ( ! empty( $this->options['aiosp_opengraph_meta_key'] ) ) { + $options['meta_key'] = $this->options['aiosp_opengraph_meta_key']; + } + if ( empty( $img ) ) { + $size = apply_filters( 'post_thumbnail_size', 'large' ); + $default = $this->get_the_image_by_default(); + if ( ! empty( $default ) ) { + $default = set_url_scheme( $default ); + $img[ $default ] = 0; + } + $img = array_merge( $img, parent::get_all_images( $options, null ) ); + } + + if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) { + $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg'; + } + + if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) { + $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg'; + $img[ $options['aioseop_opengraph_settings_customimg_twitter'] ] = 'customimg_twitter'; + } + + if ( $author_img = $this->get_the_image_by_author( $p ) ) { + $image['author'] = $author_img; + } + $image = array_flip( $img ); + $images = array(); + if ( ! empty( $image ) ) { + foreach ( $image as $k => $v ) { + $images[ $v ] = ''; + } + } + + return array( $image, $images ); + } + + function get_the_image_by_author( $options = null, $p = null ) { + if ( $p === null ) { + global $post; + } else { + $post = $p; + } + if ( ! empty( $post ) && ! empty( $post->post_author ) ) { + $matches = array(); + $get_avatar = get_avatar( $post->post_author, 300 ); + if ( preg_match( "/src='(.*?)'/i", $get_avatar, $matches ) ) { + return $matches[1]; + } + } + + return false; + } + + function get_the_image( $options = null, $p = null ) { + $meta_key = $this->options['aiosp_opengraph_meta_key']; + + return parent::get_the_image( array( 'meta_key' => $meta_key ), $p ); + } + + function get_the_image_by_default( $args = array() ) { + return $this->options['aiosp_opengraph_dimg']; + } + + function settings_update() { + + } + + /** + * Enqueue our file upload scripts and styles. + * @param $hook + */ + function og_admin_enqueue_scripts( $hook ) { + + if ( 'all-in-one-seo_page_aiosp_opengraph' != $hook && 'term.php' != $hook ) { + // Only enqueue if we're on the social module settings page. + return; + } + + wp_enqueue_script( 'media-upload' ); + wp_enqueue_script( 'thickbox' ); + wp_enqueue_style( 'thickbox' ); + wp_enqueue_media(); + } + + function save_tax_data( $term_id, $tt_id, $taxonomy ) { + static $update = false; + if ( $update ) { + return; + } + if ( $this->locations !== null ) { + foreach ( $this->locations as $k => $v ) { + if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) { + $opts = $this->default_options( $k ); + $options = array(); + $update = false; + foreach ( $opts as $l => $o ) { + if ( isset( $_POST[ $l ] ) ) { + $options[ $l ] = stripslashes_deep( $_POST[ $l ] ); + $options[ $l ] = esc_attr( $options[ $l ] ); + $update = true; + } + } + if ( $update ) { + $prefix = $this->get_prefix( $k ); + $options = apply_filters( $prefix . 'filter_term_metabox_options', $options, $k, $term_id ); + update_term_meta( $term_id, '_' . $prefix . $k, $options ); + } + } + } + } + } + + /** + * Returns the placeholder filtered and ready for DOM display. + * filter:aioseop_opengraph_placeholder + * @since 2.4.14 + * + * @param mixed $placeholder Placeholder to be filtered. + * @param string $type Type of the value to be filtered. + * + * @return string + */ + public function filter_placeholder( $placeholder, $type = 'text' ) { + return strip_tags( trim( $placeholder ) ); + } + + /** + * Returns filtered default options. + * filter:{prefix}default_options + * @since 2.4.13 + * + * @param array $options Default options. + * @param string $location Location. + * + * @return array + */ + public function filter_default_options( $options, $location ) { + if ( $location === 'settings' ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + // Add image checker as default + $options[ $prefix . 'customimg_checker' ] = 0; + } + return $options; + } + + /** + * Returns facebook debug script and link. + * @since 2.4.14 + * + * @return string + */ + private function get_facebook_debug() { + ob_start(); + ?> + + + array( 'name' => __( 'Page URL', 'all-in-one-seo-pack' ), - 'type' => 'text', + 'type' => 'url', 'label' => 'top', 'save' => false, ), @@ -502,7 +502,7 @@ function display_custom_options( $buf, $args ) { if ( is_object( $v ) ) { $v = (Array) $v; } - $buf .= "\t {$k}{$v['prio']}{$v['freq']}{$v['mod']}\n"; + $buf .= "\t {$k}{$v['prio']}{$v['freq']}{$v['mod']}\n"; } $buf .= "\n"; } @@ -775,6 +775,7 @@ function filter_options( $options ) { if ( isset( $options[ $this->prefix . 'addl_pages' ][0] ) ) { unset( $options[ $this->prefix . 'addl_pages' ][0] ); } + // TODO Refactor all these... use a nonce, dump the incoming _Post into an array and use that. if ( ! empty( $_POST[ $this->prefix . 'addl_url' ] ) ) { foreach ( array( 'addl_url', 'addl_prio', 'addl_freq', 'addl_mod' ) as $field ) { @@ -787,11 +788,14 @@ function filter_options( $options ) { if ( ! is_array( $options[ $this->prefix . 'addl_pages' ] ) ) { $options[ $this->prefix . 'addl_pages' ] = array(); } - $options[ $this->prefix . 'addl_pages' ][ $_POST[ $this->prefix . 'addl_url' ] ] = array( - 'prio' => $_POST[ $this->prefix . 'addl_prio' ], - 'freq' => $_POST[ $this->prefix . 'addl_freq' ], - 'mod' => $_POST[ $this->prefix . 'addl_mod' ], - ); + + if ( aiosp_common::is_url_valid( $_POST[ $this->prefix . 'addl_url' ] ) ) { + $options[ $this->prefix . 'addl_pages' ][ $_POST[ $this->prefix . 'addl_url' ] ] = array( + 'prio' => $_POST[ $this->prefix . 'addl_prio' ], + 'freq' => $_POST[ $this->prefix . 'addl_freq' ], + 'mod' => $_POST[ $this->prefix . 'addl_mod' ], + ); + } } return $options; @@ -2347,10 +2351,8 @@ function get_addl_pages_only() { if ( ! empty( $this->options[ $this->prefix . 'addl_pages' ] ) ) { $siteurl = parse_url( aioseop_home_url() ); foreach ( $this->options[ $this->prefix . 'addl_pages' ] as $k => $v ) { + $k = aiosp_common::make_url_valid_smartly( $k ); $url = parse_url( $k ); - if ( empty( $url['scheme'] ) ) { - $url['scheme'] = $siteurl['scheme']; - } if ( empty( $url['host'] ) ) { $url['host'] = $siteurl['host']; } diff --git a/tests/modules/sitemap/test-sitemap.php b/tests/modules/sitemap/test-sitemap.php index 239e95cdd..a4a63fc78 100644 --- a/tests/modules/sitemap/test-sitemap.php +++ b/tests/modules/sitemap/test-sitemap.php @@ -670,4 +670,100 @@ public function enabledPostTypes() { array( array( 'all', 'post', 'page', 'attachment', 'product' ), 4, 'product' ), ); } + + /** + * Add invalid external URLs to the sitemap and see if they are shown as valid in the sitemap. + * + * @dataProvider invalidExternalPagesProvider + */ + public function test_make_external_urls_valid( $urls ) { + $posts = $this->setup_posts( 2 ); + + $pages = array(); + foreach ( $urls as $url ) { + $pages[ $url['loc'] ] = array( + 'prio' => $url['priority'], + 'freq' => $url['changefreq'], + 'mod' => $url['lastmod'], + ); + } + + $custom_options = array(); + $custom_options['aiosp_sitemap_indexes'] = ''; + $custom_options['aiosp_sitemap_images'] = ''; + $custom_options['aiosp_sitemap_gzipped'] = ''; + $custom_options['aiosp_sitemap_posttypes'] = array( 'post' ); + $custom_options['aiosp_sitemap_addl_pages'] = $pages; + + $this->_setup_options( 'sitemap', $custom_options ); + + $validate_urls = array(); + foreach ( $urls as $url ) { + // the ones with http should be present and the ones without http should not be present. + $validate_urls[ $url['loc'] ] = strpos( $url['loc'], 'http' ) !== false; + if ( strpos( $url['loc'], 'absolute' ) !== false ) { + // the ones with absolute should be absolute. + $validate_urls[ 'http://' . str_replace( array( 'http', '://' ), '', ltrim( $url['loc'], '/' ) ) ] = true; + } else { + // the ones without absolute should be relative. + $validate_urls[ home_url( ltrim( $url['loc'], '/' ) ) ] = true; + } + } + + $without = $posts['without']; + $this->validate_sitemap( + array_merge( + array( + $without[0] => true, + $without[1] => true, + ), + $validate_urls + ) + ); + + // so all urls + } + + + /** + * Provides the invalid external pages that need to be added to the sitemap. + */ + public function invalidExternalPagesProvider() { + return array( + array( + array( + array( + 'loc' => 'http://www.absolute.com', + 'lastmod' => '2018-01-18T21:46:44Z', + 'changefreq' => 'daily', + 'priority' => '1.0', + ), + array( + 'loc' => 'http://www.absolute.com/', + 'lastmod' => '2018-01-18T21:46:44Z', + 'changefreq' => 'daily', + 'priority' => '1.0', + ), + array( + 'loc' => 'www.absolute.com/page1', + 'lastmod' => '2018-01-18T21:46:44Z', + 'changefreq' => 'daily', + 'priority' => '1.0', + ), + array( + 'loc' => '//www.absolute.com/page2', + 'lastmod' => '2018-01-18T21:46:44Z', + 'changefreq' => 'daily', + 'priority' => '1.0', + ), + array( + 'loc' => '/five/page', + 'lastmod' => '2018-01-18T21:46:44Z', + 'changefreq' => 'daily', + 'priority' => '1.0', + ), + ), + ), + ); + } } \ No newline at end of file From 8accffc0d765f9d28fdec01aabecd6be51d2e119 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Fri, 7 Sep 2018 01:45:13 +0100 Subject: [PATCH 28/54] Video XML Sitemap - Add column for video count to sitemap (#1448) * Video XML Sitemap - Add column for video count to sitemap * remove video thumbnails from url column --- inc/sitemap-xsl.php | 59 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/inc/sitemap-xsl.php b/inc/sitemap-xsl.php index 8388d25bf..7f081d070 100644 --- a/inc/sitemap-xsl.php +++ b/inc/sitemap-xsl.php @@ -139,6 +139,16 @@ + + + + + video + + + + + @@ -150,6 +160,16 @@ + + + + + + @@ -170,17 +190,6 @@ - - - - - - - - - - - + + + + + +
    VideosVideo Thumbnails Priority Change Frequency Last Change + + + + + + + + + + + +
    + +
    +
    +
    +
    +
    From 19f768571b51a070b33daeae99b9681219867d84 Mon Sep 17 00:00:00 2001 From: Srdjan Jocic Date: Fri, 7 Sep 2018 21:14:25 +0200 Subject: [PATCH 29/54] Fixed option filtering (#1876) * Use `rewrite_rules_array` as a filter * Update readme.txt * version bump to 2.7.3 * Fixed option filtering. * Update compat-wpml.php * Update compat-wpml.php --- all_in_one_seo_pack.php | 6 +++--- inc/compatability/compat-wpml.php | 1 + modules/aioseop_sitemap.php | 2 +- readme.txt | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/all_in_one_seo_pack.php b/all_in_one_seo_pack.php index 6c7a992ab..68039c696 100644 --- a/all_in_one_seo_pack.php +++ b/all_in_one_seo_pack.php @@ -4,7 +4,7 @@ Plugin Name: All In One SEO Pack Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/ 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. -Version: 2.7.2 +Version: 2.7.3 Author: Michael Torbert Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/ Text Domain: all-in-one-seo-pack @@ -32,14 +32,14 @@ * The original WordPress SEO plugin. * * @package All-in-One-SEO-Pack - * @version 2.7.2 + * @version 2.7.3 */ if ( ! defined( 'AIOSEOPPRO' ) ) { define( 'AIOSEOPPRO', false ); } if ( ! defined( 'AIOSEOP_VERSION' ) ) { - define( 'AIOSEOP_VERSION', '2.7.2' ); + define( 'AIOSEOP_VERSION', '2.7.3' ); } global $aioseop_plugin_name; $aioseop_plugin_name = 'All in One SEO Pack'; diff --git a/inc/compatability/compat-wpml.php b/inc/compatability/compat-wpml.php index 01135c724..49ef22557 100644 --- a/inc/compatability/compat-wpml.php +++ b/inc/compatability/compat-wpml.php @@ -29,6 +29,7 @@ public function exists() { public function hooks() { add_filter( 'aioseop_home_url', array( &$this, 'aioseop_home_url' ) ); add_filter( 'aioseop_sitemap_xsl_url', array( &$this, 'aioseop_sitemap_xsl_url' ) ); + add_action( 'init', 'aioseop_get_options' ); // #1761 Options are otherwise called too early to work with WPML. } /** diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index 54b54de01..9c1fe6fcd 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -1140,7 +1140,7 @@ function debug_message( $msg ) { * Set up hooks for rewrite rules for dynamic sitemap generation. */ function setup_rewrites() { - add_action( 'rewrite_rules_array', array( $this, 'rewrite_hook' ) ); + add_filter( 'rewrite_rules_array', array( $this, 'rewrite_hook' ) ); add_filter( 'query_vars', array( $this, 'query_var_hook' ) ); add_action( 'parse_query', array( $this, 'sitemap_output_hook' ) ); if ( ! get_transient( "{$this->prefix}rules_flushed" ) ) { diff --git a/readme.txt b/readme.txt index a36db0d39..8c9e4272b 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtor Tags: SEO, all in one seo, WordPress SEO, Google Search Console, XML Sitemap, image seo Requires at least: 4.4 Tested up to: 4.9 -Stable tag: 2.7.1 +Stable tag: 2.7.3 License: GPLv2 or later Requires PHP: 5.2.4 From 38e6675377df7be43bab758327bac4a4d0f9fe44 Mon Sep 17 00:00:00 2001 From: Ashish Ravi Date: Fri, 7 Sep 2018 22:27:36 +0100 Subject: [PATCH 30/54] Video XML Sitemap - Filename is deleted on update #424 --- modules/aioseop_sitemap.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index 9c1fe6fcd..55ec424e9 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -679,6 +679,8 @@ private function get_filename() { if ( ! empty( $this->options["{$this->prefix}filename"] ) ) { $filename = $this->options["{$this->prefix}filename"]; $filename = str_replace( '/', '', $filename ); + } else if ( 'aiosp_video_sitemap_' === $this->prefix ) { + $filename = 'video-sitemap'; } return $filename; } From bbe708b9caed25b65e4d16bcb3b6416f3951da31 Mon Sep 17 00:00:00 2001 From: Gennady Kovshenin Date: Mon, 10 Sep 2018 01:44:08 +0500 Subject: [PATCH 31/54] Fix/optimize sitemap generation (#1828) * Preheat and cache calls to `get_post_thumbnail_id` `All_in_One_SEO_Pack_Sitemap::get_images_from_post` calls `get_the_post_thumbnail_url` which is pretty expensive on large sites because `get_post_thumbnail_id` does too much for what it is (see https://core.trac.wordpress.org/ticket/44772). Since this generates the sitemap for all posts there is no need to fetch the meta for each post separately, rather fetch all the thumbnail IDs and cache them statically. This yields a 2 second improvement (3 seconds down from 5 seconds) with 1000 posts on the latest WordPress version. * Defer `All_in_One_SEO_Pack_Sitemap::do_sitemaps` `transition_post_status` is called for every modified post. When deleting posts in bulk, the `All_in_One_SEO_Pack_Sitemap::do_sitemaps` is called for every post. This is not optimal. A site with 20k posts takes 10 minutes to delete 10 posts in bulk, because it takes 1 minute to generate the sitemaps for each of the deleted posts. Call the `All_in_One_SEO_Pack_Sitemap::do_sitemaps` method on the `shutdown` action instead, and only once. This has the added benefit of making sure that the sitemap generation process does not run out of resources mid-save and does not interfere with callbacks that are called on the same saving hooks. * PHP 5.2 and 5.3 compatibility for 393d96 `array_combine` does not like empty arrays, only use when the database returns results, otherwise leave as empty array. --- modules/aioseop_sitemap.php | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index 9c1fe6fcd..e38ee9fea 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -400,7 +400,15 @@ function update_sitemap_from_posts( $new_status, $old_status, $post ) { return; } - $this->do_sitemaps(); + if ( defined( 'AIOSEOP_UNIT_TESTING' ) ) { + $this->do_sitemaps(); + } elseif ( ! has_action( 'shutdown', $callback = array( $this, 'do_sitemaps' ) ) ) { + /** + * Defer do_sitemaps until after everything is done. + * And run it only once regardless of posts updated. + */ + add_action( 'shutdown', $callback ); + } } /** @@ -2864,9 +2872,29 @@ private function get_images_from_post( $post ) { return $images; } - $attached_url = get_the_post_thumbnail_url( $post->ID ); - if ( $attached_url ) { - $images[] = $attached_url; + /** + * Static attachment cache, 1 query vs. n posts. + */ + static $post_thumbnails; + + if ( is_null( $post_thumbnails ) || defined( 'AIOSEOP_UNIT_TESTING' ) ) { + global $wpdb; + + $post_thumbnails = $wpdb->get_results( "SELECT post_ID, meta_value FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id'", ARRAY_A ); + + if ( $post_thumbnails ) { + $post_thumbnails = array_combine( + wp_list_pluck( $post_thumbnails, 'post_ID' ), + wp_list_pluck( $post_thumbnails, 'meta_value' ) + ); + } + } + + if ( isset( $post_thumbnails[ $post->ID ] ) ) { + $attachment_url = wp_get_attachment_image_url( $post_thumbnails[ $post->ID ], 'post-thumbnail' ); + if ( $attachment_url ) { + $images[] = $attachment_url; + } } $content = ''; From 55930f0bbc55306fed227f052230ddf68cf2aebc Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Sun, 9 Sep 2018 19:26:48 -0400 Subject: [PATCH 32/54] add Ben to contributors --- admin/display/credits-content.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/admin/display/credits-content.php b/admin/display/credits-content.php index 13e77efd6..d91632cff 100644 --- a/admin/display/credits-content.php +++ b/admin/display/credits-content.php @@ -62,6 +62,10 @@ Stanislav Samoilenko +
  • + + Stanislav Samoilenko +
  • From fd4138e7d6fd57911c3407c6276426d2afa0ede0 Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Sun, 9 Sep 2018 20:12:58 -0400 Subject: [PATCH 33/54] adding missing contributors #1707 --- admin/display/credits-content.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/admin/display/credits-content.php b/admin/display/credits-content.php index d91632cff..21826357a 100644 --- a/admin/display/credits-content.php +++ b/admin/display/credits-content.php @@ -66,6 +66,34 @@ Stanislav Samoilenko +
  • + + Ross McKay +
  • +
  • + + Adam Silverstein +
  • +
  • + + Vinicius Schettino +
  • +
  • + + Srdjan Jocic +
  • +
  • + + Gennady Kovshenin +
  • From e8d3f33dbe1ec771a96509c243ca3f5d94269600 Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Mon, 10 Sep 2018 13:02:31 -0400 Subject: [PATCH 34/54] version bump to 2.8 --- all_in_one_seo_pack.php | 6 +++--- readme.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/all_in_one_seo_pack.php b/all_in_one_seo_pack.php index 68039c696..64de67e96 100644 --- a/all_in_one_seo_pack.php +++ b/all_in_one_seo_pack.php @@ -4,7 +4,7 @@ Plugin Name: All In One SEO Pack Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/ 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. -Version: 2.7.3 +Version: 2.8 Author: Michael Torbert Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/ Text Domain: all-in-one-seo-pack @@ -32,14 +32,14 @@ * The original WordPress SEO plugin. * * @package All-in-One-SEO-Pack - * @version 2.7.3 + * @version 2.8 */ if ( ! defined( 'AIOSEOPPRO' ) ) { define( 'AIOSEOPPRO', false ); } if ( ! defined( 'AIOSEOP_VERSION' ) ) { - define( 'AIOSEOP_VERSION', '2.7.3' ); + define( 'AIOSEOP_VERSION', '2.8' ); } global $aioseop_plugin_name; $aioseop_plugin_name = 'All in One SEO Pack'; diff --git a/readme.txt b/readme.txt index 8c9e4272b..1e9263025 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtor Tags: SEO, all in one seo, WordPress SEO, Google Search Console, XML Sitemap, image seo Requires at least: 4.4 Tested up to: 4.9 -Stable tag: 2.7.3 +Stable tag: 2.8 License: GPLv2 or later Requires PHP: 5.2.4 From ebdd73b55831a2031fe4cf779f3bf1b32408b833 Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Tue, 11 Sep 2018 09:03:33 -0400 Subject: [PATCH 35/54] Applying fix for #1888 from #1898 --- aioseop_class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aioseop_class.php b/aioseop_class.php index 7f2289dd8..55eec80dd 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -123,7 +123,7 @@ function __construct() { __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '
  • ' . __( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '
  • ' . __( '%category_title% - The (main) category of the post', 'all-in-one-seo-pack' ) . '
  • ' . - __( '%%1$scategory% - Alias for %%2$scategory_title%', 'all-in-one-seo-pack' ) . '
  • ' . + __( '%category% - Alias for %category_title%', 'all-in-one-seo-pack' ) . '
  • ' . __( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '
  • ' . __( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '
  • ' . __( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '
  • ' . From 2dbc550a641153865f52578ff7a1f69e7676ff77 Mon Sep 17 00:00:00 2001 From: Ashish Ravi Date: Tue, 11 Sep 2018 20:21:35 +0530 Subject: [PATCH 36/54] updated profile and gravatar link --- admin/display/credits-content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/display/credits-content.php b/admin/display/credits-content.php index 13e77efd6..367ede2fa 100644 --- a/admin/display/credits-content.php +++ b/admin/display/credits-content.php @@ -55,7 +55,7 @@ Alejandro Mostajo
  • - + Ashish Ravi
  • From 717677d60a3fbdd35ebd95c84dada84f800d3a33 Mon Sep 17 00:00:00 2001 From: Ashish Ravi Date: Sat, 15 Sep 2018 11:46:59 +0530 Subject: [PATCH 37/54] XML Sitemap - add title and caption for images #1753 --- modules/aioseop_sitemap.php | 30 ++++++++++++++++++++++++-- tests/base/class-sitemap-test-base.php | 18 ++++++++++++++-- tests/modules/sitemap/test-sitemap.php | 4 ++++ 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index b2534c262..5a721074b 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -2826,6 +2826,8 @@ private function get_images_from_term( $term ) { if ( $image ) { $images['image:image'] = array( 'image:loc' => $image, + 'image:caption' => wp_get_attachment_caption( $thumbnail_id ), + 'image:title' => get_the_title( $thumbnail_id ), ); } } @@ -2868,6 +2870,8 @@ private function get_images_from_post( $post ) { if ( $attributes ) { $images[] = array( 'image:loc' => $this->clean_url( $attributes[0] ), + 'image:caption' => wp_get_attachment_caption( $post->ID ), + 'image:title' => get_the_title( $post->ID ), ); } @@ -2917,8 +2921,12 @@ private function get_images_from_post( $post ) { $tmp = array_filter( $images, array( $this, 'is_image_valid' ) ); $images = array(); foreach ( $tmp as $image ) { - $images[] = array( - 'image:loc' => $this->clean_url( $image ), + $image_attributes = $this->get_image_attributes( $image ); + $images[] = array_merge( + array( + 'image:loc' => $this->clean_url( $image ), + ), + $image_attributes ); } } @@ -2926,6 +2934,24 @@ private function get_images_from_post( $post ) { return $images; } + /** + * Fetch image attributes such as title and caption given the image URL. + * + * @param string $url The image URL. + */ + private function get_image_attributes( $url ) { + $attributes = array(); + global $wpdb; + $attachment = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $url ) ); + if ( $attachment && is_array( $attachment ) && is_numeric( $attachment[0] ) ) { + $attributes = array( + 'image:caption' => wp_get_attachment_caption( $attachment[0] ), + 'image:title' => get_the_title( $attachment[0] ), + ); + } + return $attributes; + } + /** * Fetch images from WP, Jetpack and WooCommerce galleries. * diff --git a/tests/base/class-sitemap-test-base.php b/tests/base/class-sitemap-test-base.php index e568a3059..0d960fc4c 100644 --- a/tests/base/class-sitemap-test-base.php +++ b/tests/base/class-sitemap-test-base.php @@ -59,13 +59,27 @@ protected final function validate_sitemap( $elements, $debug = false ) { $sitemap = array(); foreach ( $xml->url as $url ) { + // this array will contain an array of arrays, each element corresponding to one "image:*". + // Each item will have its corresponding array of values. $element = array(); if ( array_key_exists( 'image', $ns ) && count( $url->children( $ns['image'] ) ) > 0 ) { $images = array(); foreach ( $url->children( $ns['image'] ) as $image ) { - $images[] = (string) $image->loc; + $images['loc'][] = (string) $image->loc; + if ( property_exists( $image, 'title' ) ) { + $images['title'][] = (string) $image->title; + } + if ( property_exists( $image, 'caption' ) ) { + $images['caption'][] = (string) $image->caption; + } + } + $element['image'] = $images['loc']; + if ( array_key_exists( 'title', $images ) ) { + $element['image:title'] = $images['title']; + } + if ( array_key_exists( 'caption', $images ) ) { + $element['image:caption'] = $images['caption']; } - $element['image'] = $images; } $sitemap[ (string) $url->loc ] = $element; } diff --git a/tests/modules/sitemap/test-sitemap.php b/tests/modules/sitemap/test-sitemap.php index a4a63fc78..00bda97ae 100644 --- a/tests/modules/sitemap/test-sitemap.php +++ b/tests/modules/sitemap/test-sitemap.php @@ -84,9 +84,13 @@ public function test_featured_image() { array( $with[0] => array( 'image' => true, + 'image:title' => true, + 'image:caption' => true, ), $with[1] => array( 'image' => true, + 'image:title' => true, + 'image:caption' => true, ), $without[0] => array( 'image' => false, From 6df2edc841ec0ab6baf8fcd044a2f3a88eb7e0fe Mon Sep 17 00:00:00 2001 From: Ashish Ravi Date: Thu, 13 Sep 2018 21:58:30 +0530 Subject: [PATCH 38/54] Not possible to override OG data when page contains global Fusion Builder container #1804 --- admin/aioseop_module_class.php | 47 ++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/admin/aioseop_module_class.php b/admin/aioseop_module_class.php index d10884978..d22494cb5 100644 --- a/admin/aioseop_module_class.php +++ b/admin/aioseop_module_class.php @@ -2021,12 +2021,7 @@ function add_menu( $parent_slug ) { add_action( "load-{$hookname}", array( $this, 'add_page_hooks' ) ); } elseif ( $v['type'] === 'metabox' ) { $this->setting_options( $k ); // hack -- make sure this runs anyhow, for now -- pdb - add_action( 'edit_post', array( $this, 'save_post_data' ) ); - add_action( 'publish_post', array( $this, 'save_post_data' ) ); - add_action( 'add_attachment', array( $this, 'save_post_data' ) ); - add_action( 'edit_attachment', array( $this, 'save_post_data' ) ); - add_action( 'save_post', array( $this, 'save_post_data' ) ); - add_action( 'edit_page_form', array( $this, 'save_post_data' ) ); + $this->toggle_save_post_hooks( true ); if ( isset( $v['display'] ) && ! empty( $v['display'] ) ) { add_action( 'admin_print_scripts', array( $this, 'enqueue_metabox_scripts' ), 5 ); if ( $this->tabbed_metaboxes ) { @@ -2086,37 +2081,55 @@ function add_menu( $parent_slug ) { } } + /** + * Adds or removes hooks that could be called while editing a post. + * + * TODO: Review if all these hooks are really required (save_post should be enough vs. edit_post and publish_post). + */ + private function toggle_save_post_hooks( $add ) { + if ( $add ) { + add_action( 'edit_post', array( $this, 'save_post_data' ) ); + add_action( 'publish_post', array( $this, 'save_post_data' ) ); + add_action( 'add_attachment', array( $this, 'save_post_data' ) ); + add_action( 'edit_attachment', array( $this, 'save_post_data' ) ); + add_action( 'save_post', array( $this, 'save_post_data' ) ); + add_action( 'edit_page_form', array( $this, 'save_post_data' ) ); + } else { + remove_action( 'edit_post', array( $this, 'save_post_data' ) ); + remove_action( 'publish_post', array( $this, 'save_post_data' ) ); + remove_action( 'add_attachment', array( $this, 'save_post_data' ) ); + remove_action( 'edit_attachment', array( $this, 'save_post_data' ) ); + remove_action( 'save_post', array( $this, 'save_post_data' ) ); + remove_action( 'edit_page_form', array( $this, 'save_post_data' ) ); + } + } + /** * Update postmeta for metabox. * * @param $post_id */ function save_post_data( $post_id ) { - static $update = false; - if ( $update ) { - return; - } + $this->toggle_save_post_hooks( false ); if ( $this->locations !== null ) { foreach ( $this->locations as $k => $v ) { if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) { $opts = $this->default_options( $k ); $options = array(); - $update = false; foreach ( $opts as $l => $o ) { if ( isset( $_POST[ $l ] ) ) { $options[ $l ] = stripslashes_deep( $_POST[ $l ] ); $options[ $l ] = esc_attr( $options[ $l ] ); - $update = true; } } - if ( $update ) { - $prefix = $this->get_prefix( $k ); - $options = apply_filters( $prefix . 'filter_metabox_options', $options, $k, $post_id ); - update_post_meta( $post_id, '_' . $prefix . $k, $options ); - } + $prefix = $this->get_prefix( $k ); + $options = apply_filters( $prefix . 'filter_metabox_options', $options, $k, $post_id ); + update_post_meta( $post_id, '_' . $prefix . $k, $options ); } } } + + $this->toggle_save_post_hooks( true ); } /** From cc7c8b0bf5fddfea34e8231aea0fec73b15a8faa Mon Sep 17 00:00:00 2001 From: Ashish Ravi Date: Tue, 11 Sep 2018 09:25:29 +0100 Subject: [PATCH 39/54] Fix 1$ to %1$s --- aioseop_class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aioseop_class.php b/aioseop_class.php index 883fd5451..192dd09c6 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -124,7 +124,7 @@ function __construct() { __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '
  • ' . __( '%post_title% - The original title of the post', 'all-in-one-seo-pack' ) . '
  • ' . __( '%category_title% - The (main) category of the post', 'all-in-one-seo-pack' ) . '
  • ' . - __( '%1$category% - Alias for %2$category_title%', 'all-in-one-seo-pack' ) . '
  • ' . + __( '%category% - Alias for %category_title%', 'all-in-one-seo-pack' ) . '
  • ' . __( "%post_author_login% - This post's author' login", 'all-in-one-seo-pack' ) . '
  • ' . __( "%post_author_nicename% - This post's author' nicename", 'all-in-one-seo-pack' ) . '
  • ' . __( "%post_author_firstname% - This post's author' first name (capitalized)", 'all-in-one-seo-pack' ) . '
  • ' . From 54d0f6db049478fe42d5d6cef42f53ee58f6354a Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Wed, 19 Sep 2018 21:27:16 -0400 Subject: [PATCH 40/54] add Shohei Tanaka --- admin/display/credits-content.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/admin/display/credits-content.php b/admin/display/credits-content.php index 367ede2fa..29a792c37 100644 --- a/admin/display/credits-content.php +++ b/admin/display/credits-content.php @@ -62,6 +62,10 @@ Stanislav Samoilenko
  • +
  • + + Shohei Tanaka +
  • From 360267c220754295b3cf9bd256145315e1edde06 Mon Sep 17 00:00:00 2001 From: Ashish Ravi Date: Mon, 17 Sep 2018 16:02:24 +0530 Subject: [PATCH 41/54] Remove our current Schema.org markup #413 --- modules/aioseop_opengraph.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/aioseop_opengraph.php b/modules/aioseop_opengraph.php index 10ae463f7..1acc243c3 100644 --- a/modules/aioseop_opengraph.php +++ b/modules/aioseop_opengraph.php @@ -941,8 +941,6 @@ function add_attributes( $output ) { $attributes = apply_filters( $this->prefix . 'attributes', array( - 'itemscope', - 'itemtype="http://schema.org/' . ucfirst( $type ) . '"', 'prefix="og: http://ogp.me/ns#"', ) ); From f21c797b5d10429acb72011fd4ad250444a13da6 Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Mon, 24 Sep 2018 12:40:14 -0400 Subject: [PATCH 42/54] remove repeated word in string #1938 --- modules/aioseop_feature_manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/aioseop_feature_manager.php b/modules/aioseop_feature_manager.php index 9d085119f..3fe22e86e 100644 --- a/modules/aioseop_feature_manager.php +++ b/modules/aioseop_feature_manager.php @@ -48,7 +48,7 @@ function __construct( $mod ) { 'file_editor' => array( /* translators: the File Editor module allows users to edit the robots.txt file or .htaccess file on their site. */ 'name' => __( 'File Editor', 'all-in-one-seo-pack' ), - 'description' => __( 'Edit your your .htaccess file to fine-tune your site.', 'all-in-one-seo-pack' ), + 'description' => __( 'Edit your .htaccess file to fine-tune your site.', 'all-in-one-seo-pack' ), ), 'importer_exporter' => array( /* translators: the Importer & Exporter module allows users to import/export their All in One SEO Pack From 4af3db6ba27def2a1bd0fdb4300ad68d03b15ad2 Mon Sep 17 00:00:00 2001 From: EkoJR Date: Tue, 25 Sep 2018 00:04:59 -0700 Subject: [PATCH 43/54] Fix nofollow not applied when SEO isn't active on post type --- aioseop_class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aioseop_class.php b/aioseop_class.php index 883fd5451..a0208b7b0 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -3543,7 +3543,12 @@ function is_page_included() { return false; } } else { - if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() ) { + $cp_nofollow_active = false; + if ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) && is_array( $aioseop_options['aiosp_cpostnofollow'] ) ) { + $cp_nofollow_active = in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ); + } + + if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() && ! $cp_nofollow_active ) { return false; } if ( is_post_type_archive() && ! is_post_type_archive( $wp_post_types ) ) { From 2e2c25a86e0751caf644d5c81ae904e502ec1faa Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Tue, 9 Oct 2018 00:09:23 +0530 Subject: [PATCH 44/54] Add api filter hook to change sitemap filename #1703 (#1903) * Add api filter hook to change sitemap filename #1703 * added comments --- modules/aioseop_sitemap.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index 5a721074b..f6a421f14 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -690,7 +690,12 @@ private function get_filename() { } else if ( 'aiosp_video_sitemap_' === $this->prefix ) { $filename = 'video-sitemap'; } - return $filename; + /** + * Filters the filename: aiosp_sitemap_filename OR aiosp_video_sitemap_filename. + * + * @param string $filename The file name. + */ + return apply_filters( "{$this->prefix}filename", $filename ); } /** From d30f4a9e4d88e03e07d7cab3349f3e4e405d55eb Mon Sep 17 00:00:00 2001 From: EkoJR Date: Sun, 23 Sep 2018 00:09:57 -0700 Subject: [PATCH 45/54] Fix WC Product Type issue with dropdown menu --- js/modules/aioseop_module.js | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/js/modules/aioseop_module.js b/js/modules/aioseop_module.js index 95d392d4e..1b14799a2 100644 --- a/js/modules/aioseop_module.js +++ b/js/modules/aioseop_module.js @@ -283,34 +283,6 @@ jQuery( document ).ready( } ); - /** - * @summary workaround for bug that causes radio inputs to lose settings when meta box is dragged. - * - * props to commentluv for this fix - * @author commentluv. - * @link https://core.trac.wordpress.org/ticket/16972 - * @since 1.0.0 - */ - jQuery(document).ready( - function () { - // listen for drag drop of metaboxes , bind mousedown to .hndle so it only fires when starting to drag - jQuery('.hndle').mousedown( - function () { - - // set live event listener for mouse up on the content .wrap and wait a tick to give the dragged div time to settle before firing the reclick function - jQuery('.wrap').mouseup( - function () { - aiosp_store_radio(); - setTimeout(function () { - aiosp_reclick_radio(); - }, 50); - } - ); - } - ); - } - ); - /** * @summary Javascript for using WP media uploader. Indentifies which DOM should use custom uploader plugin. * From f766a36a91ef14b1d89775dc108ead92bbb8c997 Mon Sep 17 00:00:00 2001 From: EkoJR Date: Mon, 8 Oct 2018 13:44:11 -0700 Subject: [PATCH 46/54] Fix noindex not applied when SEO isn't active on post type (#1942) * Fix noindex not applied when SEO isn't active on post type * add comment to #1797 --- aioseop_class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aioseop_class.php b/aioseop_class.php index 192dd09c6..47d7d4858 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -3543,7 +3543,13 @@ function is_page_included() { return false; } } else { - if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() ) { + $cp_noindex_active = false; + // Make sure noindex works even of SEO is turned off for that post type. + if ( ! empty( $aioseop_options['aiosp_cpostnoindex'] ) && is_array( $aioseop_options['aiosp_cpostnoindex'] ) ) { + $cp_noindex_active = in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ); + } + + if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() && ! $cp_noindex_active ) { return false; } if ( is_post_type_archive() && ! is_post_type_archive( $wp_post_types ) ) { From 6c8fb1d24416894bc3fb0f57b468655e1d3d5c35 Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Mon, 8 Oct 2018 16:51:07 -0400 Subject: [PATCH 47/54] Update aioseop_class.php --- aioseop_class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/aioseop_class.php b/aioseop_class.php index 47d7d4858..005f83db7 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -3555,6 +3555,18 @@ function is_page_included() { if ( is_post_type_archive() && ! is_post_type_archive( $wp_post_types ) ) { return false; } + } else { + $cp_nofollow_active = false; + // Make sure nofollow works even of SEO is turned off for that post type. + if ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) && is_array( $aioseop_options['aiosp_cpostnofollow'] ) ) { + $cp_nofollow_active = in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ); + } + if ( is_singular() && ! in_array( $post_type, $wp_post_types ) && ! is_front_page() && ! $cp_nofollow_active ) { + return false; + } + if ( is_post_type_archive() && ! is_post_type_archive( $wp_post_types ) ) { + return false; + } } } From 2f50ff347e6cd808280450adce3c37364f50e5bf Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Mon, 8 Oct 2018 17:04:41 -0400 Subject: [PATCH 48/54] fix for broken else --- aioseop_class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/aioseop_class.php b/aioseop_class.php index 005f83db7..eb62a442a 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -3543,8 +3543,9 @@ function is_page_included() { return false; } } else { - $cp_noindex_active = false; + // Make sure noindex works even of SEO is turned off for that post type. + $cp_noindex_active = false; if ( ! empty( $aioseop_options['aiosp_cpostnoindex'] ) && is_array( $aioseop_options['aiosp_cpostnoindex'] ) ) { $cp_noindex_active = in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ); } @@ -3555,9 +3556,9 @@ function is_page_included() { if ( is_post_type_archive() && ! is_post_type_archive( $wp_post_types ) ) { return false; } - } else { - $cp_nofollow_active = false; + // Make sure nofollow works even of SEO is turned off for that post type. + $cp_nofollow_active = false; if ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) && is_array( $aioseop_options['aiosp_cpostnofollow'] ) ) { $cp_nofollow_active = in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ); } From 0d2b5e1859ac776e767ad27a733eb8e862572fc0 Mon Sep 17 00:00:00 2001 From: Arnaud Broes Date: Tue, 9 Oct 2018 03:41:59 +0200 Subject: [PATCH 49/54] Remove SEMRush from bot blocklist (#1960) * Remove SEMRush from bot blocklist #1769 * Remove second SEMRush entry from bot blocklist #1769 --- admin/aioseop_module_class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/admin/aioseop_module_class.php b/admin/aioseop_module_class.php index d22494cb5..758c3d733 100644 --- a/admin/aioseop_module_class.php +++ b/admin/aioseop_module_class.php @@ -622,7 +622,6 @@ function default_bad_bots() { 'Python-urllib', 'QueryN Metasearch', 'RepoMonkey', - 'SemrushBot', 'SISTRIX', 'sitecheck.Internetseer.com', 'SiteSnagger', @@ -673,7 +672,6 @@ function default_bad_bots() { 'Incutio', 'lmspider', 'memoryBot', - 'SemrushBot', 'serf', 'Unknown', 'uptime files', From ab5cd9680e950bcef6d0b0adb45f9439c2107d29 Mon Sep 17 00:00:00 2001 From: Arnaud Broes Date: Tue, 9 Oct 2018 01:01:13 +0200 Subject: [PATCH 50/54] Remove unneeded quotation mark in inline documentation #1941 --- aioseop_class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aioseop_class.php b/aioseop_class.php index eb62a442a..9dcebfc5f 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -182,7 +182,7 @@ function __construct() { __( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '
  • ' . __( '%request_url% - The original URL path, like "/url-that-does-not-exist/"', 'all-in-one-seo-pack' ) . '
  • ' . __( '%request_words% - The URL path in human readable form, like "Url That Does Not Exist"', 'all-in-one-seo-pack' ) . '
  • ' . - __( '%404_title% - Additional 404 title input"', 'all-in-one-seo-pack' ) . '
  • ', + __( '%404_title% - Additional 404 title input', 'all-in-one-seo-pack' ) . '', 'paged_format' => __( 'This string gets appended/prepended to titles of paged index pages (like home or archive pages).', 'all-in-one-seo-pack' ) . __( 'The following macros are supported:', 'all-in-one-seo-pack' ) . '
    • ' . __( '%page% - The page number', 'all-in-one-seo-pack' ) . '
    ', From b3ff2d7c8f1f35f7489a783dc45dbd176b63609c Mon Sep 17 00:00:00 2001 From: Ashish Ravi Date: Fri, 7 Sep 2018 17:41:51 +0100 Subject: [PATCH 51/54] Video XML Sitemap - Remove the Scan button #225 --- aioseop_class.php | 27 +++++++++++++++++++++++++++ all_in_one_seo_pack.php | 3 --- inc/aioseop_functions.php | 4 ---- inc/commonstrings.php | 6 ------ 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/aioseop_class.php b/aioseop_class.php index 9dcebfc5f..02fa09991 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -4803,6 +4803,7 @@ function save_category_metaboxes( $id ) { } function admin_menu() { + $this->check_recently_activated_modules( $_POST ); $file = plugin_basename( __FILE__ ); $menu_name = __( 'All in One SEO', 'all-in-one-seo-pack' ); @@ -4977,6 +4978,32 @@ function admin_menu() { } } + /** + * Checks which module(s) have been (de)activated just now and fires a corresponding action. + * + * @param array $post Duplicate of $_POST. + */ + private function check_recently_activated_modules( $post ) { + global $aioseop_options; + $modules = array(); + if ( array_key_exists( 'modules', $aioseop_options ) && array_key_exists( 'aiosp_feature_manager_options', $aioseop_options['modules'] ) ) { + $modules = array_keys( $aioseop_options['modules']['aiosp_feature_manager_options'] ); + } + + if ( $modules ) { + foreach ( $modules as $module ) { + $name = str_replace( 'aiosp_feature_manager_enable_', '', $module ); + if ( empty( $aioseop_options['modules']['aiosp_feature_manager_options'][ $module ] ) && ! empty( $post[ $module ] ) ) { + // this module was activated. + do_action( $this->prefix . 'activate_' . $name ); + } else if ( ! empty( $aioseop_options['modules']['aiosp_feature_manager_options'][ $module ] ) && ! isset( $post[ $module ] ) ) { + // this module was deactivated. This action should be registered NOT in the specific module but elsewhere because that module is not going to be loaded. + do_action( $this->prefix . 'deactivate_' . $name ); + } + } + } + } + /** * @param $menu_order * diff --git a/all_in_one_seo_pack.php b/all_in_one_seo_pack.php index 64de67e96..1efe48ac3 100644 --- a/all_in_one_seo_pack.php +++ b/all_in_one_seo_pack.php @@ -480,9 +480,6 @@ function aioseop_welcome() { add_action( 'wp_ajax_aioseo_dismiss_visibility_notice', 'aioseop_update_user_visibilitynotice' ); add_action( 'wp_ajax_aioseo_dismiss_woo_upgrade_notice', 'aioseop_woo_upgrade_notice_dismissed' ); add_action( 'wp_ajax_aioseo_dismiss_sitemap_max_url_notice', 'aioseop_sitemap_max_url_notice_dismissed' ); - if ( AIOSEOPPRO ) { - add_action( 'wp_ajax_aioseop_ajax_update_oembed', 'aioseop_ajax_update_oembed' ); - } } if ( ! function_exists( 'aioseop_scan_post_header' ) ) { diff --git a/inc/aioseop_functions.php b/inc/aioseop_functions.php index 9d1b7af30..52dcd726d 100644 --- a/inc/aioseop_functions.php +++ b/inc/aioseop_functions.php @@ -420,10 +420,6 @@ function aioseop_embed_handler_html( $return, $url, $attr ) { return AIO_ProGeneral::aioseop_embed_handler_html(); } -function aioseop_ajax_update_oembed() { - AIO_ProGeneral::aioseop_ajax_update_oembed(); -} - if ( ! function_exists( 'aioseop_ajax_save_url' ) ) { function aioseop_ajax_save_url() { diff --git a/inc/commonstrings.php b/inc/commonstrings.php index fff191735..c9eeeec1d 100644 --- a/inc/commonstrings.php +++ b/inc/commonstrings.php @@ -20,16 +20,10 @@ private function __construct() { // Video sitemap strings. __( 'Video Sitemap', 'all-in-one-seo-pack' ); __( 'Show Only Posts With Videos', 'all-in-one-seo-pack' ); - __( 'Scan Posts For Videos', 'all-in-one-seo-pack' ); __( 'Restrict Access to Video Sitemap', 'all-in-one-seo-pack' ); - __( 'Press the Scan button to scan your posts for videos! Do this if video content from a post or posts is not showing up in your sitemap.', 'all-in-one-seo-pack' ); __( 'If checked, only posts that have videos in them will be displayed on the sitemap.', 'all-in-one-seo-pack' ); __( 'Enable this option to only allow access to your sitemap by site administrators and major search engines.', 'all-in-one-seo-pack' ); __( 'You do not have access to this page; try logging in as an administrator.', 'all-in-one-seo-pack' ); - __( 'Scan', 'all-in-one-seo-pack' ); - - // These are functions_class strings. - __( 'Finished scanning posts', 'all-in-one-seo-pack' ); // Update checker strings (incomplete... need to separate out html). __( 'Purchase one now', 'all-in-one-seo-pack' ); From 4012f3963f9854fad0475eaf974eb1eee62598f9 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Tue, 9 Oct 2018 22:20:27 +0530 Subject: [PATCH 52/54] SEO meta is output when SEO for Custom Post Types is disabled (#1379) * SEO meta is output when SEO for Custom Post Types is disabled #1069 * codeclimate * exclude meta from AMP pages * PR comments https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/1069#issuecomment-391158471 * test case --- aioseop_class.php | 24 ++++++++++- tests/modules/general/test-meta.php | 67 +++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/aioseop_class.php b/aioseop_class.php index 02fa09991..7060a8c7f 100644 --- a/aioseop_class.php +++ b/aioseop_class.php @@ -1571,6 +1571,10 @@ function internationalize( $in ) { /*** Used to filter wp_title(), get our title. ***/ function wp_title() { + if ( ! $this->is_seo_enabled_for_cpt() ) { + return; + } + global $aioseop_options; $title = false; $post = $this->get_queried_object(); @@ -3802,6 +3806,10 @@ function make_unique_att_desc( $description ) { * @since 2.3.11.5 */ function amp_head() { + if ( ! $this->is_seo_enabled_for_cpt() ) { + return; + } + $post = $this->get_queried_object(); $description = apply_filters( 'aioseop_amp_description', $this->get_main_description( $post ) ); // Get the description. @@ -3810,6 +3818,8 @@ function amp_head() { return; } + global $aioseop_options; + // Handle the description format. if ( isset( $description ) && ( $this->strlen( $description ) > $this->minimum_description_length ) && ! ( is_front_page() && is_paged() ) ) { $description = $this->trim_description( $description ); @@ -3830,11 +3840,21 @@ function amp_head() { } } + /** + * Checks whether the current CPT should show the SEO tags. + */ + private function is_seo_enabled_for_cpt() { + global $aioseop_options; + return 'on' === $aioseop_options['aiosp_enablecpost'] && in_array( get_post_type(), $aioseop_options['aiosp_cpostactive'], true ); + } + /** * @since 2.3.14 #932 Removes filter "aioseop_description". */ function wp_head() { - + if ( ! $this->is_seo_enabled_for_cpt() ) { + return; + } // Check if we're in the main query to support bad themes and plugins. global $wp_query; $old_wp_query = null; @@ -3954,7 +3974,7 @@ function wp_head() { ) as $k => $v ) { if ( ! empty( $aioseop_options[ "aiosp_{$k}_verify" ] ) ) { - $meta_string .= '' . "\n"; + $meta_string .= '' . "\n"; } } diff --git a/tests/modules/general/test-meta.php b/tests/modules/general/test-meta.php index 76cecdbf5..95db91471 100644 --- a/tests/modules/general/test-meta.php +++ b/tests/modules/general/test-meta.php @@ -182,4 +182,71 @@ public function acfDataProvider() { array( 'custom_description', true ), ); } + + /** + * Test whether the given post type's SEO tags are included/excluded in the source if SEO is enabled/disabled. + * + * @dataProvider postTypeEnabledProvider + */ + public function test_cpt_seo( $type, $enabled ) { + wp_set_current_user( 1 ); + global $aioseop_options; + + $id = $this->factory->post->create( array( 'post_type' => $type, 'post_title' => 'heyhey' ) ); + + // remove the default action so that canonical is not included by default. + remove_action( 'wp_head', 'rel_canonical' ); + + $aioseop_options['aiosp_can'] = 'on'; + $aioseop_options['aiosp_enablecpost'] = $enabled ? 'on' : 0; + $aioseop_options['aiosp_cpostadvanced'] = $enabled ? 'on' : 0; + $aioseop_options['aiosp_cpostactive'] = $enabled ? array( $type ) : array(); + $aioseop_options['aiosp_description_format'] = '---- desc desc'; + update_option( 'aioseop_options', $aioseop_options ); + + $url = get_permalink( $id ); + $meta = $this->parse_html( $url, array( 'meta' ) ); + $links = $this->parse_html( $url, array( 'link' ) ); + + $canonical = wp_list_pluck( $links, 'rel' ); + + if ( $enabled ) { + // should have atleast one meta tag. + $this->assertGreaterThan( 1, count( $meta ) ); + $this->assertGreaterThan( 1, count( $links ) ); + $this->assertContains( 'canonical', $canonical, 'Does not contain link for canonical' ); + } else { + $this->assertNotContains( 'canonical', $canonical, 'Contains link for canonical' ); + } + + $canonical = null; + if ( $links ) { + foreach ( $links as $link ) { + if ( isset( $link['rel'] ) && 'canonical' === $link['rel'] ) { + $canonical = $link['href']; + break; + } + } + } + + $meta_content = wp_list_pluck( $meta, 'content' ); + if ( $enabled ) { + $this->assertContains( '---- desc desc', $meta_content ); + $this->assertEquals( $url, $canonical ); + } else { + $this->assertNotContains( '---- desc desc', $meta_content ); + $this->assertEmpty( $canonical ); + } + + } + + /** + * Provides the post types and whether they are enabled/disabled for SEO. + */ + public function postTypeEnabledProvider() { + return array( + array( 'post', true ), + array( 'post', false ), + ); + } } From a30674c21703057bb514202e392a8a9b0c867590 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Tue, 9 Oct 2018 22:38:23 +0530 Subject: [PATCH 53/54] Full size image for sitemap (#1350) * Full size image for sitemap #1202 * codeclimate * PR comments https://github.com/semperfiwebdesign/all-in-one-seo-pack/pull/1350#issuecomment-375428371 * test case * redeclared function * moved common functions to aiosp_common * removed during merge * support for < WP4.6.0 --- css/modules/aioseop_module.css | 3008 ++++++++++---------- inc/aiosp_common.php | 388 +++ modules/aioseop_opengraph.php | 3482 +++++++++++------------ modules/aioseop_sitemap.php | 174 +- tests/base/class-aioseop-test-base.php | 14 +- tests/modules/sitemap/test-sitemap.php | 81 + tests/resources/images/large-square.png | Bin 0 -> 9882 bytes 7 files changed, 3732 insertions(+), 3415 deletions(-) create mode 100644 tests/resources/images/large-square.png diff --git a/css/modules/aioseop_module.css b/css/modules/aioseop_module.css index 67c8bb3a3..44cd9fcca 100644 --- a/css/modules/aioseop_module.css +++ b/css/modules/aioseop_module.css @@ -1,1505 +1,1505 @@ -/** - * Controls all the styling of the plugin. - * - * @author Michael Torbert. - * @author Semper Fi Web Design. - * @copyright http://semperplugins.com - * @package All-in-One-SEO-Pack. - */ - -.form-table.aioseop { - clear: none; -} - -.form-table.aioseop td { - vertical-align: top; - padding: 16px 0 10px 0; - line-height: 20px; - font-size: 12px; -} - -.form-table.aioseop th { - width: 200px; - padding: 10px 0 12px 9px; -} - -.aioseop_help_text_link, -.aioseop_help_text_link:active { - text-align: left; - float: left; - max-width: 300px; - min-width: 1px; - padding-top: 2px; - outline: none; - color: #888; - font-family: sans-serif; -} - -.aioseop_help_text_link span { - font-size: 14px; -} - -.aioseop_help_text_link:before { - content: "\f223"; - font-size: 27px; - font-family: dashicons; - vertical-align: middle; -} - -#aioseop-support .aioseop_metabox_text, -#aioseop-support a { - font-size: 14px; - color: #000; - text-decoration: none; -} - -.aioseop_icon { - display: inline-block; - width: 40px; - height: 40px; - background-repeat: no-repeat; - background-size: 100%; - vertical-align: middle; - margin: 10px; -} - -.aioseop_book_icon { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAKlBMVEUAAAAAn+cAneEAnuABnuEBnuEAnuEAn+QAn+QAneAAnuEAneAAnuAAneFPI9ocAAAADnRSTlMAII/P/wCQMADwANDvnyPbz6kAAAB9SURBVHgB7c+xCQMgEIVhZwiSSRzhkRBImsA5gVUmuBGcJbUDxlhY6T2wvh/sPvBd+HdJWCSj0N8bsEEiIIOAyEBhIDGAcwA4cDBy4MDBTeuqCR5abXCvBHy+6ybQrs2R0jsH/As+srEzC55qggi81AIZ+waQxkBmQK5tD34LnXJVZf9y5gAAAABJRU5ErkJggg==); -} - -.aioseop_cog_icon { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAeFBMVEUAAAAAn+MAnOIAn+cAneIAneEAn+MAnuEAneIAnuAAnuAAneEAn+cAn+QAn98AnuEAn98AneAAneEAneAAnOIAnuAAnuEAnuAAneEAn+EAnuEAnuAAneEAneAAneAAn+QAnuEAnuABnuEAneAAn+EAnuIAnuMBnuHeY3dlAAAAJ3RSTlMAQFAAYIAAkADP3wAgMACgEACfrwC/X++PbwAAcODwALDAANAATz8hP00ZAAACHklEQVR4Xq3XbWObIBAHcPAJJRjJVmtso4vL2vv+33AzJO2J/LuE9PfGFyR4HHiAgCQxyRMiYEtGTL5BBGzJiVEviIAtFTH6FRGowdBC/QsQqKGhhebeIdTkqe+LwFbkqew2SGyDftDKz12Q2AXYlhgeA46AD/G5oyD9zJO0zIEhvXd91L0mSPcmnZlek0nPhHu4mKu2ov+q2rZzOWE5kBRBFjNRzDRFqD6X8oGiHK5fo+0oSmcv06goknLfQk3RzHkaWwIGlUhrZaIGAto5iQn6uyw+yAFOpSgUTDEHJqqZc5DR2rgqw8lIa7mbRkkMLOOBoWZlWYrynwzGzx1C/3cdlEcvf7sgL5MTq8rGz22QNwjDP+cGBYBDOC6qcnLTNqQCeRbuYdEU4In47YjL84RSwEk+Tq8qT7xvhMc5eXsj78Buga866O4dQrXs4OEk3jaNTWC1Cfc43nSa0MQ0fCFFLWXL9saWFjQMgFOfEUR+zsl1KWeRBaWr3e7c01q3Lmld+FfiSVFQ/2ehp6B8IzaorGvJ8q8Jl/ViIkDv396tfX/bawKm81J+eGtLH91cX+xIUUZ7XYmPHTBmA0U4feMh6zqVwzTe8ubQvmBoUJeDphoIGtT5tVaq0Ttopvyom4M4xqz8YGXhiCLAnIKhg8N2iA30cLzrxmJH/H4cASejrjzcFHXpwrcukwIiRQZv2QICtjQP352/9fYuC+Qv593CTVvcgwkAAAAASUVORK5CYII=); -} - -.aioseop_file_icon { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAPFBMVEUAAAAAneAAn98AneIAneEAnuAAn+QAnuAAnuAAnuEAn+MAnuEAneAAnuEAn+EAneEAnOIAnuEAnuABnuG5yOaaAAAAE3RSTlMA0BBgn88wv++gQLCvX2+PUJDAyp/15gAAALdJREFUeF7t1z2ygzAMhVFJjm0C5Ff732uaMCSWCVzTJO/paz1zRsVtTM/OUT+Wx5PQchJ1Q2O/CETdVk51IOjWugAeYLvUAEU6rAO4oLhQB2bSvh+NAAKU2AgYQGIEDHgXbjhQCFcYKIQuoUApZBQwQg8CRhhAwArSBlCagNAI0LTqAQCq3fcC+jOA7e8DDuhK/wDwHfgOfAe+A98B2BcC3Aaw+XiCBdp3AtOcNAgs9FoACZ7ufwCe6pfMGb29UwAAAABJRU5ErkJggg==); -} - -.aioseop_help_icon { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAflBMVEUAAAAAn98AnuIAn+EAneAAnuAAnuAAn+QAn+QAneEAnuAAnuAAn+EAnuAAnuEAneAAn+cAneAAnuAAn98AnOIAnuEAneIAn+MAnuEAnuEAn+EAneIAneEAneEAnuEAn+MAneAAneEAnuMAnOIAn+cAneEBnuEAneAAnuMBnuEoGewkAAAAKXRSTlMAEE9/r7/fADCPzwBv718AIPDAAFCwYEAAoAAAn4CQAOAAPwAAcADQAFP96WQAAAMNSURBVHhelZcNc5swDIatBghpoCGEj9Jij2XLMv3/P7glkoNtZJo+d+0lhBOveSXZUjHgZZOkGf4nS5PNC5wiKPFqvnvFgNddvpVQy0tQZCiSFfCEAtiUGKXcwFcB3kpcpXx791HetypFn2NdH9EnrX67KPdL46g/tl3PeqHvWidM2fxyUM7n3fzgof8R0A9zjN3PGTV/HB+6teg66EeIUQqQIGOiSQMGmeRgUQfGPn/Ktyv0k9UQKrCxWzitAq3V6dvYIDG8f8mAROO6ULF/3ecTaHazcvIgjTw/PxfFeVFErCHd31C3fx2v39cKGy6qLKyA1tGr/v8BLWDyb3OLqiw+XGCiq8DFxIvypMKIHqMXvaeLmmyEkn1xSTCAjWcMS7gruFD+eo/QuEC7AYCy+nJXkC1/r5A4Gq2NrQCvjMnL7OZCLggY3KoAI5jMEvKt2hohBYK3wiveuwx8i3qn/uvVf0O2Hh5MnLwOZMTrXgGt4OCi7RuyXNg1F1oDqEZIQh2K6oUALalSWqgiIwUIM4VVqZZvdlkE7QQFFLRVNS3l5NLZarMkgkx6ebWiNPqzSu9nEkM2KDZhjbykh+19KKri3+LkIxLhVlE/E4CaAjsd4AYo9zJkR9huGF7CtPYSX9FyXG4XFHe2UQIt9fIGa6NNJBErX2r35O0wp7KEbZYSNpVtMYngSpbZYoI1G9YClFzOp+vKS6jviLFJ+fWgDralfZO5peW2xX8LKB9NdTtxsQuc7/wV0OTv/YRyiUuIugCls7FwizffsXHgzcRurjEjYgH8zdVKyODZJUDGAuxZubNnt5BIgMQ7YNyowy2c0XfCqyNX6HzE2Ve8A28+nmDDHaJyD9sNChpkxvCYRxgkEjitAkl40AzPjxm7KdNnSAzLgaNFZhcVATtkBmliGaTJSJ6mBnnkMWgpx+XAMZZoMbGZqXEHm6Q4sxA4F4k7DEkjD1PVGJCmGFDLQ5elO+Iqx7B/q88A0FKI+DSlBLMuE4pMF3h6+DZXDLia6PAtA41u67uUqW51E02uf46zvXx+HY4YAAAAAElFTkSuQmCC); -} - -.aioseop_support_icon { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAe1BMVEUAAAAAn98AnuIAn+EAneAAnuAAnuABnuEAn98An+QAneEAnuAAn+QAn+EAnuAAnuEAneAAnuEAneIAn+MAn+cAn+cAnuEAnuEAnOIAneEAneEAnOIAnuAAneEAn+MAneAAneEAneIAnuEAnuIAneAAnuAAneABnuEAnuPdwDkgAAAAKXRSTlMAEE9/r7/f/wAwj88Ab+9f0JBgQCAAALBQcAAAAJ8AAIAAoADgwPAAP4Dl7rAAAALsSURBVHgBtdcBc6I6EAfwRCH/KjUSTCW2eHK8kHff/xM+Dg5NlsTTOu830xmc0BhJdtllKXy1znKBgciz9Yq/JbC3mM22AFFsN+8x7H2B7wSixI4/sAK+lkiSa/63CfbXfy9VddAfA32oVHmdYn8MsaNP55jUhpOFmRqTXH/4mP/BSExOnxEnTKT58jDveouZaCIEZltvWna7POPm8GPhgJtzbIIMnvq4UMOTXWZsvjgjoD8IjcCZrkAh1H4SLUIq3EYDQjSEBGH8XdASVPUzUIGS2jsHORbyJpC8gzWDChGaPsL4ItnwxyUiuuPqnBdAkW9X/3SIkPxPMLWIkZJcL7XTNnKJb5J8XMEJ33YaVyCQYJUZ0tjGKIsE8XsXNuNUFpStvFMQGR4Xvhlyoppi51AjUAcZhdPRIVzr8UCzYzEfS91afxOJDle2Hc9IBaBoGMdg/raq/3s49/NPm/6TGQDl5Up3DoCN5G9uAbjOO6AlAMPa8Zd4JI0kP55k41EAWlaT+w0Ae4mytyAenQDUrCcZsCMr8igydADQM0ECrydf4zEA+uZGAygYBv96ivF4RG3GffNgsJiAfr439v9MUN7/CeXFgwGzrz1Eu9hG9eQ2Rg+SaKJE5CB1y6Ps7h1ld/FMR9mEm6vPEoCIBZMAIM/e8xoTQRjO+5y8fT0ZJvlc5PwJ57fymlDWMloBLKoHsb4mlPLCLnNKyxDIwpRGR72UtsEgUhoKrx7bR4Z3c1J9Tyft7ep3Wl9t04l/rFBefrFwh29y/N7L1TlynXy5JpbQHY3qS6Dslfnq4guYa+UXC4xBj4W+CSTvYFMEuOeLLKf9Ytssd5hw6TJv9FKhOeqeK3W7ZcNRP1Nsd7GOpXu83O/iLY8ij5CwmKlUz2TcIy2PIy2PT/eYZLRV5fsMk542XaHK3VrV/a+p7fu1uzWyjiZs9pPgrUOSa6ONJ8FPFlH2xB9uvlUJolTJ5juOm7buLQa2r1uvkSX+A/xd+1xZLxG0AAAAAElFTkSuQmCC); -} - -.aioseop_youtube_icon { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAARVBMVEUAAAAAn+cAn+EAneAAnuABnuEAn+cAn98AneEAn98AnOIAnuAAnOIAneIAneIAnuEAnuEAneEAnuEBnuEAn+QAneAAneCXjc90AAAAF3RSTlMAIG+vz/8AEJ8AUO8AYACgAHCwADDw0E/SOHoAAAEBSURBVHgB7dbBjsIgGATgH+UvCAso3fL+j7rDYZMerGGZQ5NNv8TrREZLRy47F3O7Wx1m7zezAMjSOa9/5t2jkweEqBNi+ALBJ+mklHOWnINOC/0buKjTokMHRQnlKUYpRl5HBQ32KFXfW783HVDFHgWsrg0EWNEDK4z0+yEAEhuAIsgAFMEFQOECILEBKIIMQBFcABQuABIbgCLIABTBBUBhAzx5BEuWGM/9GT35V7bkwxTPfZw9eaVZ8lKN517rI8NHmr43cPyufXi5Rh1Q+dc7PTAWduI83abTNteHJjvz6KEJYeoU2+/UBVcm+tuNbTCv2nRYq2k/9ylXwL8I+AGj+lzlceKDYQAAAABJRU5ErkJggg==); -} - -.aioseop_meta_box_help > label { - position: absolute; - margin-left: 8px; -} - -div.aioseop_tip_icon { - font-size: 14px; - border: 1px solid #888; - width: 1em; - text-align: center; - padding: 0 4px; - -webkit-border-radius: 12px; - -moz-border-radius: 12px; - -webkit-box-shadow: 1px 1px 1px #888; - -moz-box-shadow: 1px 1px 1px #888; - box-shadow: 1px 1px 1px #888; - border-radius: 12px; -} - -div.aioseop_tip_icon:before { - content: '?'; -} - -.aioseop_help_text_link img { - width: 40px; - float: left; -} - -.aioseop_meta_box_help, -.aioseop_meta_box_help:active { - float: right; - padding-left: 0; - width: 16px; - margin-right: 32px; - text-decoration: none; - height: 15px; - padding-top: 1px; - position: relative; -} - -.aioseop_tabs .aioseop_meta_box_help, -.aioseop_tabs .aioseop_meta_box_help:active { - margin-top: 4px; - margin-right: 45px; -} - -.aioseop_label { - color: #5F5F5F; - font-weight: bold; - line-height: 19px; - display: inline-block; - text-align: left; - position: absolute; - font-family: 'Open Sans', sans-serif; - width: 26%; - min-width: 120px; - max-width: 230px; -} - -.aioseop_option_div { - max-height: 360px; - min-height: 37px; - width: 95%; - overflow-y: auto; -} - -.aioseop_overflowed { - border: 1px solid #e1e1e1; -} - -.aioseop input[type="text"], .aioseop input[type="url"] { - color: #515151; - height: 35px; - padding: 10px 0 10px 10px; - font-size: 14px; - width: 95%; - max-width: 600px; -} - -.aioseop textarea { - color: #515151; - padding: 10px 0 0 10px; - margin: 0; - font-size: 14px; - line-height: 25px; - width: 95%; - max-width: 600px; -} - -.aioseop_help_text_div { - text-align: left; - width: 100%; - margin: 0; -} - -.aioseop_help_text { - font-size: 12px; - float: left; - clear: left; - color: #797979; - line-height: 15px; - font-style: italic; -} - -.aioseop_head_tagline { - color: #5F5F5F; - font-size: 13px; -} - -.aioseop_head_nav { - float: left; - font-size: 18px; - margin: 0 0 16px 0; - font-family: "HelveticaNeue-Light", - "Helvetica Neue Light", - "Helvetica Neue", - sans-serif; - border-bottom: 1px solid #CCC; - width: 100%; -} - -.aioseop_head_nav_tab { - padding: 10px 15px 10px 15px; - margin: 0 0 0 15px; - border-radius: 4px 4px 0 0; - border: 1px solid #CCC; - border-bottom: 0 white; - float: left; - opacity: 0.5; - color: black; - text-shadow: white 0 1px 0; - text-decoration: none; -} - -.aioseop_head_nav_tab.aioseop_head_nav_active { - opacity: 1; - margin-bottom: -1px; - border-width: 1px; -} - -.aioseop_head_nav_tab:first-child { - margin-left: 0; -} - -.aioseop_head_nav_tab:hover { - opacity: 1; -} - -.aioseop_header { - float: left; - clear: left; -} - -.aioseop_advert { - padding: 10px; - margin-bottom: 30px; - border: 1px solid #DDD; - height: 200px; - width: 423px; -} - -.aioseop_nopad { - padding-left: 0; - padding-top: 0; -} - -.aioseop_nopad_all { - padding: 0; - height: 220px; - width: 445px; - margin-bottom: 20px; - border: none; -} - -.aioseop_adverts { - float: right; -} - -.wincherad { - width: 100%; - height: 100%; - background-size: 100%; - background-repeat: no-repeat; - margin-bottom: 0; - border: none; -} - -#wincher21 { - background-image: url(../../modules/images/banner21.jpg); -} - -#wincher22 { - background-image: url(../../modules/images/banner22.jpg); -} - -.aioseop_content { - min-width: 760px; - clear: left; -} - -.aioseop_options_wrapper .hndle { - font-size: 15px; - font-family: Georgia, - "Times New Roman", - "Bitstream Charter", - Times, - serif; - font-weight: normal; - padding: 7px 10px; - margin: 0; - line-height: 1; -} - -.aioseop_options_wrapper .submit input.button-primary { - margin-bottom: 5px; -} - -#aiosp_feature_manager_metabox.postbox { - margin-top: 20px; - float: left; -} - -.aioseop_advert p { - margin: 25px 0 25px 0; -} - -.aioseop_options_wrapper .postarea { - border-color: #DFDFDF; - -moz-box-shadow: inset 0 1px 0 #fff; - -webkit-box-shadow: inset 0 1px 0 #fff; - box-shadow: inset 0 1px 0 #fff; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; -} - -.aioseop_advert h3 { - padding: 0; - margin-top: 6px; -} - -.aioseop_metabox_text p { - margin: 0 0 0 0; - width: 101%; -} - -.aioseop_sidebar { - width: 457px; - margin-left: 10px; -} - -.aioseop_metabox_text { - margin-bottom: 0; -} - -.aioseop_metabox_wrapper { - padding: 0; -} - -.aioseop_metabox_text *:last-child { - margin: 0; -} - -.aioseop_metabox_feature { - margin-top: 20px; -} - -.aioseop_translations { - margin-top: 15px; -} - -.aioseop_option_label { - float: left; - margin: 0; - min-width: 150px; - width: 37%; - max-width: 270px; - padding-top: 3px; - padding-bottom: 3px; - height: 67px !important; /*added for certain language support*/ -} - -.aioseop_metabox_text h2 { - font-size: 14px; - padding: 0; - font-weight: bold; - line-height: 29px; -} - -#aioseop-about { - width: 443px; - margin-bottom: 20px; -} - -#aioseop-about .aioseop_metabox_text #mc-embedded-subscribe-form h2 { - font-size: 13px; -} - -.aioseop_sidebar #mc-embedded-subscribe-form { - margin: 0 0 10px 0; - background: white; - padding: 10px 10px; - border: 1px solid #DDD; -} - -#aioseop-about .aioseop_metabox_text ul { - list-style-type: disc; - padding-left: 15px; -} - -.aioseop input[readonly] { - background-color: #EEE; - margin: 5px 0 5px 0 !important; -} - -.aioseop_settings_left { - float: left; - padding: 0; - margin: 0; - width: 100%; -} - -body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_settings_left { - margin-top: 20px; -} - -body.all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager .aioseop_settings_left { - margin-top: 20px; -} - -#aioseop_top_button { - margin-top: 5px; - height: 30px; -} - -#aioseop-list #mce-EMAIL { - margin-top: 5px; - width: 250px; -} - -.aioseop_top { - margin: 10px 10px 0 0; - /* margin: 10px 477px 0px 0px; */ -} - -.aioseop_top #aioseop-list { - margin-bottom: 0; -} - -.aioseop_top #aioseop-list.postbox.closed { - overflow: hidden; -} - -.aioseop_right_sidebar { - float: right; - margin-top: 35px; -} - -#aiosp_settings_form .button-primary.hidden { - display: none; -} - -form#edittag div#aiosp_titleatr_wrapper, -form#edittag div#aiosp_menulabel_wrapper, -form#edittag div#aiosp_sitemap_exclude_wrapper { - display: none; -} - -.All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > #aioseop_top_button { - height: 5px; - position: absolute; - top: 0; - width: 97%; -} - -.All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > .aioseop_settings_left { - margin-top: 10px; -} - -.All_in_One_SEO_Pack_Feature_Manager > .aioseop_right_sidebar.aioseop_options_wrapper { - margin-top: 10px; -} - -div#aiosp_feature_manager_metabox .inside { - padding: 8px; -} - -div.aioseop_feature { - position: relative; - display: inline-block; - float: left; - vertical-align: top; - width: 240px; - height: 288px; - margin: 8px; - border: 1px solid #DEDEDE; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - background: white; - padding: 10px 0 0; - -webkit-box-shadow: inset 0 1px 0 #fff, - inset 0 0 20px rgba(0, 0, 0, 0.05), - 0 1px 2px rgba(0, 0, 0, 0.1); - -moz-box-shadow: inset 0 1px 0 #fff, - inset 0 0 20px rgba(0, 0, 0, 0.05), - 0 1px 2px rgba(0, 0, 0, 0.1); - box-shadow: inset 0 1px 0 #fff, - inset 0 0 20px rgba(0, 0, 0, 0.05), - 0 1px 2px rgba(0, 0, 0, 0.1); - -webkit-transition-duration: .4s; - -moz-transition-duration: .4s; -} - -.aioseop_feature .flag { - float: right; - margin-right: -7px; - background: none repeat scroll 0 0 #D23D46; - color: #FFFFFF; - padding: 5px 12px 6px 5px; - position: relative; -} - -.aioseop_feature .flag:before { - border-color: #D23D46 #D23D46 #D23D46 transparent; - border-style: solid; - border-width: 14px 4px 15px 10px; - content: ""; - left: -14px; - position: absolute; - top: 0; -} - -.aioseop_feature .flag:after { - border-color: #892026 transparent transparent; - border-style: solid; - border-width: 6px 6px 6px 0; - bottom: -12px; - content: ""; - position: absolute; - right: 0; -} - -.aioseop_feature .flag.pro { - display: none; -} - -#aioseop_coming_soon .free.flag, -.all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager .aioseop_feature .free.flag { - display: none; -} - -#aioseop_coming_soon .flag.pro { - display: block; - margin-top: -30px; -} - -.all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager #aioseop_coming_soon .flag.pro { - display: none; -} - -.aioseop_feature h3 { - font-size: 17px; - margin: 0; - padding: 0 10px 5px 10px; - font-weight: normal; - font-style: normal; - font-family: "Helvetica Neue", - Helvetica, - Arial, - "Lucida Grande", - Verdana, - "Bitstream Vera Sans", - sans-serif; -} - -.aioseop_feature p { - line-height: 150%; - font-size: 12px; - font-family: Georgia, - "Times New Roman", - "Bitstream Charter", - Times, serif; - margin-bottom: 20px; - color: #666; - padding: 0 10px; -} - -.aioseop_feature p.aioseop_desc { - min-height: 80px; -} - -.aioseop_feature .feature_button { - float: right; - margin-bottom: 10px; - margin-right: 10px; - min-width: 80px; - text-align: center; -} - -.aioseop_feature .feature_button:before { - content: "Activate"; -} - -.aioseop_feature .active.feature_button:before { - content: "Deactivate"; -} - -div.aioseop_feature .aioseop_featured_image { - min-height: 100px; - background-repeat: no-repeat; - display: block; - margin: 0 auto; - width: 133px; -} - -div.aioseop_feature .aioseop_featured_image { - background-image: url(../../modules/images/Default-BW-Standard.png); -} - -div.aioseop_feature .aioseop_featured_image.active { - background-image: url(../../modules/images/Default-Color-Standard.png); -} - -div.aioseop_feature#aioseop_sitemap .aioseop_featured_image { - background-image: url(../../modules/images/XMLSitemaps-BW-Standard.png); -} - -div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active { - background-image: url(../../modules/images/XMLSitemaps-Color-Standard.png); -} - -div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image { - background-image: url(../../modules/images/VideoSitemap-BW-Standard.png); -} - -div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active { - background-image: url(../../modules/images/VideoSitemap-Color-Standard.png); -} - -div.aioseop_feature#aioseop_opengraph .aioseop_featured_image { - background-image: url(../../modules/images/SocialMeta-BW-Standard.png); -} - -div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active { - background-image: url(../../modules/images/SocialMeta-Color-Standard.png); -} - -div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image { - background-image: url(../../modules/images/Robots-BW-Standard.png); -} - -div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active { - background-image: url(../../modules/images/Robots-Color-Standard.png); -} - -div.aioseop_feature#aioseop_file_editor .aioseop_featured_image { - background-image: url(../../modules/images/FileEditor-BW-Standard.png); -} - -div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active { - background-image: url(../../modules/images/FileEditor-Color-Standard.png); -} - -div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image { - background-image: url(../../modules/images/ImporterExporter-BW-Standard.png); -} - -div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active { - background-image: url(../../modules/images/ImporterExporter-Color-Standard.png); -} - -div.aioseop_feature#aioseop_performance .aioseop_featured_image { - background-image: url(../../modules/images/Performance-BW-Standard.png); -} - -div.aioseop_feature#aioseop_performance .aioseop_featured_image.active { - background-image: url(../../modules/images/Performance-Color-Standard.png); -} - -div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image { - background-image: url(../../modules/images/Default-Color-Standard.png); -} - -div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image { - background-image: url(../../modules/images/Default-Color-Standard.png); -} - -.All_in_One_SEO_Pack_Sitemap > form > .wrap > .form-table, -.All_in_One_SEO_Pack_Video_Sitemap > form > .wrap > .form-table { - max-width: 500px; - clear: none; -} - -.aioseop_follow_button { - min-height: 50px; - background-repeat: no-repeat; - display: inline-block; - width: 100px; - background-size: auto 50px !important; - margin-right: 0; -} - -.aioseop_facebook_follow { - background-image: url(../../modules/images/facebook-follow-standard.png); -} - -.aioseop_twitter_follow { - background-image: url(../../modules/images/twitter-follow-standard.png); -} - -@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and ( min--moz-device-pixel-ratio: 1.5), only screen and ( -o-min-device-pixel-ratio: 3/2), only screen and ( min-device-pixel-ratio: 1.5), only screen and ( min-resolution: 1.5dppx) { - div.aioseop_feature .aioseop_featured_image { - background-size: auto 100px !important; - } - - div.aioseop_feature .aioseop_featured_image.active { - background-image: url(../../modules/images/Default-Color-Retina.png); - } - - div.aioseop_feature .aioseop_featured_image { - background-image: url(../../modules/images/Default-BW-Retina.png); - } - - div.aioseop_feature#aioseop_sitemap .aioseop_featured_image { - background-image: url(../../modules/images/XMLSitemaps-BW-Retina.png); - } - - div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active { - background-image: url(../../modules/images/XMLSitemaps-Color-Retina.png); - } - - div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image { - background-image: url(../../modules/images/VideoSitemap-BW-Retina.png); - } - - div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active { - background-image: url(../../modules/images/VideoSitemap-Color-Retina.png); - } - - div.aioseop_feature#aioseop_opengraph .aioseop_featured_image { - background-image: url(../../modules/images/SocialMeta-BW-Retina.png); - } - - div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active { - background-image: url(../../modules/images/SocialMeta-Color-Retina.png); - } - - div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image { - background-image: url(../../modules/images/Robots-BW-Retina.png); - } - - div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active { - background-image: url(../../modules/images/Robots-Color-Retina.png); - } - - div.aioseop_feature#aioseop_file_editor .aioseop_featured_image { - background-image: url(../../modules/images/FileEditor-BW-Retina.png); - } - - div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active { - background-image: url(../../modules/images/FileEditor-Color-Retina.png); - } - - div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image { - background-image: url(../../modules/images/ImporterExporter-BW-Retina.png); - } - - div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active { - background-image: url(../../modules/images/ImporterExporter-Color-Retina.png); - } - - div.aioseop_feature#aioseop_performance .aioseop_featured_image { - background-image: url(../../modules/images/Performance-BW-Retina.png); - } - - div.aioseop_feature#aioseop_performance .aioseop_featured_image.active { - background-image: url(../../modules/images/Performance-Color-Retina.png); - } - - div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image { - background-image: url(../../modules/images/Default-BW-Retina.png); - } - - div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image { - background-image: url(../../modules/images/Default-BW-Retina.png); - } - - .aioseop_facebook_follow { - background-image: url(../../modules/images/facebook-follow-retina.png); - } - - .aioseop_twitter_follow { - background-image: url(../../modules/images/twitter-follow-retina.png); - } -} - -.aioseop_options { - width: 100%; - margin: 18px 0 10px 0; -} - -.aioseop_wrapper { - width: 100%; - padding-left: 5px; -} - -.aioseop_input { - clear: left; - width: 100%; - padding: 5px; - display: inline; -} - -.aioseop_option_input { - float: left; - width: 61%; - margin: 0; - padding-left: 1px; - min-width: 160px; - /* max-width: 900px; */ -} - -/*** Sitemap Additional Pages section ***/ -#aiosp_sitemap_addl_pages_metabox .aioseop_options, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_options { - width: 97%; - margin: 5px; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_sitemap_addl_instructions_wrapper, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_video_sitemap_addl_instructions_wrapper { - display: block; - width: 100%; - float: none; - margin: 0; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_sitemap_addl_instructions_wrapper .aioseop_input, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_video_sitemap_addl_instructions_wrapper .aioseop_input { - display: block; - width: 100%; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper { - padding: 0; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_input, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_input { - display: inline-block; - vertical-align: middle; - width: 25%; - min-width: 120px; - height: 70px; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_top_label, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_top_label { - width: 70%; - margin: 0; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_option_label, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_option_label { - height: 30px !important; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_sitemap_addl_mod_wrapper input.aiseop-date, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_video_sitemap_addl_mod_wrapper input.aiseop-date { - height: 36px; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type { - margin: 0; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type input.button-primary, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type input.button-primary { - margin-left: 0 !important; -} - -#aiosp_sitemap_addl_pages_metabox .aioseop_help_text_div, -#aiosp_video_sitemap_addl_pages_metabox .aioseop_help_text_div { - position: absolute; - width: auto; - margin: 5px 0 10px 0; -} - -#aiosp_sitemap_addl_pages_metabox table.aioseop_table, -#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table { - width: 96%; - border: 1px solid #CCC; - margin: 5px 5px 10px; -} - -table.aioseop_table tr:nth-child(odd) { - background-color: #EEE; -} - -.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr:nth-child(odd) { - background-color: rgba(238, 238, 238, 0.5); -} - -table.aioseop_table td { - width: 23%; -} - -.All_in_One_SEO_Pack_Opengraph table.aioseop_table { - width: 80%; - max-width: 800px; - display: block; - border-top: 1px solid #dfdfdf; - border-left: 1px solid #dfdfdf; -} - -.All_in_One_SEO_Pack_Opengraph table.aioseop_table th { - width: 18%; - border-right: 1px solid #dfdfdf; - border-bottom: 1px solid #dfdfdf; -} - -.All_in_One_SEO_Pack_Opengraph div.aioseop_meta_info { - margin-top: 10px; - border: 1px solid #dfdfdf; - width: 80%; - max-width: 800px; -} - -.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr.aioseop_table_header th { - background: #f1f1f1; - background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9)); - background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9); - background-image: -moz-linear-gradient(bottom, #ececec, #f9f9f9); - background-image: -o-linear-gradient(bottom, #ececec, #f9f9f9); - background-image: linear-gradient(to top, #ececec, #f9f9f9); - padding: 5px; - border-bottom-color: #dfdfdf; - text-shadow: #fff 0 1px 0; - -webkit-box-shadow: 0 1px 0 #fff; - -moz-box-shadow: 0 1px 0 #fff; - box-shadow: 0 1px 0 #fff; -} - -.All_in_One_SEO_Pack_Opengraph table.aioseop_table td { - border-right: 1px solid #dfdfdf; - border-bottom: 1px solid #dfdfdf; -} - -#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item { - display: inline-block; - width: 30%; - vertical-align: top; -} - -#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(even) { - font-weight: bold; -} - -#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(odd) { - width: 70%; -} - -#aiosp_sitemap_addl_pages_metabox table.aioseop_table td, -#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td { - width: 27%; - padding-left: 5%; -} - -#aiosp_sitemap_addl_pages_metabox table.aioseop_table td:first-child, -#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td:first-child { - padding-left: 2%; -} - -table.aioseop_table td, table.aioseop_table th { - padding: 3px; -} - -.aioseop_top_label .aioseop_option_input, -.aioseop_no_label .aioseop_option_input { - width: 100%; -} - -#aiosp_settings_form .postbox { - margin: 0 0 20px 0; -} - -.aioseop_settings_left .postbox { - float: left; - width: 100%; -} - -.aioseop_option_setting_label { - min-height: 35px; - display: inline-block; - white-space: nowrap; - overflow: hidden; - padding-left: 1px; - max-width: 229px; - min-width: 160px; - width: 33%; -} - -.aioseop_settings_left .postbox .inside { - padding: 0; - margin: 0; - clear: right; -} - -#aiosp_robots_rules { - clear: left; - margin-left: 20px; - max-width: 1072px; -} - -#aiosp_robots_default_metabox .aioseop_wrapper { - width: 31%; - min-width: 165px; - display: inline-block; - max-width: 265px; -} - -#aiosp_robots_default_metabox .aioseop_help_text_div { - position: absolute; - margin: 5px 0 10px 0; -} - -#aiosp_robots_default_metabox .aioseop_option_input { - width: 94%; - min-width: 94%; -} - -#aiosp_robots_default_metabox table.aioseop_table { - width: 96%; - border: 1px solid #CCC; - margin: 5px 0 10px 0; -} - -#aiosp_robots_default_metabox table.aioseop_table td { - width: 25%; - padding-left: 5%; -} - -#aiosp_settings_form .aioseop_no_label, .aioseop_no_label { - float: left; - width: 92%; - max-width: 100%; - margin: 0 23px 0 13px; -} - -#aiosp_sitemap_status_metabox .handlediv.button-link { - display: none; -} - -#aiosp_sitemap_status_metabox.closed .inside { - display: block; -} - -.aioseop_top_label { - width: 96%; - margin: 0 10px; -} - -.aioseop_hidden_type { - margin: 0; - padding: 0; - height: 0; -} - -#aiosp_title_metabox #aiosp_force_rewrites_wrapper { - display: none; - height: 0; -} - -.aioseop_module.error.below-h2 { - padding: 5px 0; - margin: 0 477px 15px 0 !important; -} - -#aioseop_opengraph_settings .inside { - margin: 0; -} - -#aioseop_opengraph_settings_image_wrapper img { - width: auto; - height: 75px; -} - -#aioseop_opengraph_settings_image_wrapper .aioseop_option_setting_label { - max-width: 160px; - min-width: 100px; - width: 30%; -} - -.aioseop_input input[type="checkbox"], -.aioseop_input input[type="radio"] { - vertical-align: text-bottom; - margin-top: 8px; -} - -#aiosp_importer_exporter_import_export_help_wrapper .aioseop_option_div { - max-height: initial; -} - -#aiosp { - width: auto; -} - -.aioseop_input.aioseop_top_label .aioseop_option_input { - margin: 0 0 10px 0; -} - -.aiosp_file_editor_settings > .aioseop_textarea_type .aioseop_option_div { - max-height: none; -} - -/* Robots.txt styling */ -#aiosp_robots_generator_robotgen_wrapper .aioseop_option_div, -#aiosp_robots_generator_robothtml_wrapper .aioseop_option_div { - max-height: none; -} - -.aioseop_option_input .widefat td { - vertical-align: middle; -} - -.entry-row.robots.quirks { - font-weight: bold; - opacity: 1; -} - -.entry-row.robots { - opacity: 0.8; -} - -.entry-row.robots.invalid { - opacity: 1; - font-weight: bold; -} - -.invalid .entry_label { - font-weight: bold; -} - -.aioseop .aioseop_option_input tbody { - background: #FCFCFC; -} - -.All_in_One_SEO_Pack_Robots .aioseop .aioseop_option_input tbody { - background: transparent; -} - -.entry-row.robots div { - height: 20px; - vertical-align: middle; - width: 90%; - margin: 0 0 4px 0; -} - -.robots img { - margin: 0 0 0 2px; - opacity: 0.6; -} - -.aioseop_option_docs { - width: 98%; - display: none; - border: 1px solid #D3D3D3; - margin-top: 20px; - padding: 1%; - background-color: #EEE; -} - -.aioseop_option_docs h3 { - background: none; -} - -div.aioseop_notice { - position: relative; -} - -div.aioseop_notice a.aioseop_dismiss_link { - position: absolute; - top: 10px; - right: 10px; -} - -.aioseop_error_notice { - color: #f00; - font-weight: bold; -} - -.aioseop_input select { - margin: 7px 0; -} - -.aioseop_help_text ul { - margin: 15px 0 0 20px; -} - -.aioseop_help_text ul li { - line-height: 20px; - margin: 0; -} - -.aioseop_sidebar #side-sortables { - width: 98%; -} - -#aioseop_opengraph_settings .aioseop_option_label { - width: 30%; -} - -.aioseop_tabs { - padding-top: 6px; -} - -.aioseop_tabs.hide, -.aioseop_header_tabs.hide { - display: block !important; -} - -.aioseop_header_tabs li { - display: inline; - padding: 0; - margin: 0; -} - -.aioseop_header_tabs { - margin: 0; -} - -.aioseop_header_nav { - margin: 0; -} - -.aioseop_header_tabs li a.aioseop_header_tab.active { - background-color: rgb(255, 255, 255); - border-bottom-color: rgba(255, 255, 255, 0.5); - font-weight: bold; -} - -.aioseop_header_tabs li a.aioseop_header_tab { - font-size: 14px; - line-height: 37px; - text-decoration: none; - margin: 5px 5px 0 0; - padding: 10px; - cursor: pointer; - -webkit-border-top-right-radius: 3px; - -webkit-border-top-left-radius: 3px; - border-top-right-radius: 3px; - border-top-left-radius: 3px; - background-color: #e5e5e5; - border: 1px solid #ccc; - color: #5F5F5F; -} - -.aioseop_header_tabs li:first-child a.aioseop_header_tab { - border-left: solid 1px #CCC; - margin-left: 5px; -} - -.aioseop_tab { - border: solid 1px #CCC; - background-color: rgb(255, 255, 255); - background-color: rgba(255, 255, 255, 0.5); - padding: 10px; -} - -.aioseop_loading { - background-image: url('../../images/activity.gif'); - display: inline-block; - width: 24px; - height: 24px; - margin: 0; - padding: 0; - vertical-align: bottom; -} - -.aiosp_delete { - background-image: url('../../images/delete.png'); - display: inline-block; - width: 16px; - height: 16px; - margin: 0; - padding: 0; - vertical-align: bottom; -} - -form#aiosp_settings_form, -.aioseop_tabs_div { - padding-right: 477px; -} - -.aioseop_tabs_div { - margin-top: 10px; -} - -#aiosp_settings_form ul.sfwd_debug_settings li strong { - display: block; - float: left; - text-align: right; - background-color: #DDD; - margin-right: 8px; - padding: 1px 8px 1px 1px; - overflow: auto; - width: 200px; - min-height: 16px; -} - -#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n+1) strong { - background-color: #CCC; -} - -#aiosp_settings_form ul.sfwd_debug_settings li { - clear: left; - margin: 0; - padding: 0; - background-color: #EEE; - overflow: auto; - max-width: 75%; - min-width: 800px; -} - -#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n) { - background-color: #DDD; -} - -div.sfwd_debug_mail_sent { - background-color: #080; - border: 1px solid #0A0; - margin: 10px 0 10px 0; - width: 598px; - color: #FFF; - text-align: center; -} - -div.sfwd_debug_error { - background-color: #F00; - color: #FFF; - border: 1px solid #A00; - margin: 10px 0 10px 0; - width: 598px; - text-align: center; - font-weight: bolder; -} - -#aiosp_performance_status_wrapper .aioseop_option_div { - max-height: 420px; -} - -#aioseop_coming_soon, #aioseop_coming_soon2 { - padding-top: 40px; - text-align: center; - height: 258px; - font-size: 16px; -} - -.MRL { - margin-left: 20px !important; - margin-bottom: 10px !important; -} - -/** -* Edit Post screen specific styling -* -*/ -.postbox-container .aioseop_option_div { - width: 100%; -} - -.postbox-container .aioseop_option_div input[type="text"], -.postbox-container .aioseop_option_div textarea { - width: 99%; - max-width: 900px; -} - -.postbox-container .aioseop_option_label { - max-width: none; - height: auto !important; -} - -.postbox-container .aioseop_wrapper { - padding: 0; -} - -.postbox-container .aioseop_input { - display: block; - margin-bottom: 10px; - padding: 0; -} - -.postbox-container .aioseop_option_input { - width: 63%; - padding: 0; -} - -.postbox-container div#aiosp_upgrade_wrapper { - float: none; - width: auto; - margin: 0; - padding: 0; -} - -.postbox-container div#aiosp_upgrade_wrapper .aioseop_input { - display: block; - padding: 0; -} - -.postbox-container div#aiosp_upgrade_wrapper .aioseop_input .aioseop_option_input { - float: none; - width: auto; - padding: 0; -} - -.postbox-container div#aiosp_upgrade_wrapper .aioseop_input .aioseop_option_input .aioseop_option_div { - width: auto; - min-height: 0; - padding: 10px 0; -} - -.aioseop_tabs .aioseop_options { - margin: 0; -} - -#aioseop_opengraph_settings .aioseop_options { - clear: both; - margin-top: 35px; -} - -#aioseop_opengraph_settings .aioseop_option_input { - width: 70%; -} - -/** -* Preview Snippet styling -* -*/ -div#aiosp_snippet_wrapper { - border: 1px solid #888; - clear: both; - padding: 10px 10px 0; - max-width: 97%; - margin-bottom: 15px; -} - -div#aiosp_snippet_wrapper .aioseop_option_label { - height: auto !important; -} - -div#aiosp_snippet_wrapper .aioseop_input.aioseop_top_label .aioseop_option_input { - margin: 0; -} - -div#aioseop_snippet { - font-family: arial, sans-serif; - font-size: 13px; -} - -div#aioseop_snippet > h3 { - margin: 10px 0 5px; - font-size: 18px; - border: 0; - background: inherit; - font-weight: normal; -} - -div#aioseop_snippet > h3 > a { - color: #12c; - text-decoration: none; - cursor: pointer; -} - -div#aioseop_snippet > div { - color: #545454; - max-width: 48em; -} - -div#aioseop_snippet > div > div { - display: block; - margin-bottom: 1px; -} - -div#aioseop_snippet > div > div > cite { - color: #093; - font-style: normal; -} - -div#aioseop_snippet > div > span { - margin: 0; - padding: 0; - border: 0; -} - -/* the good, the bad and the ugly character counts */ -.aioseop_count_good { - color: #515151 !important; - background-color: #eee !important; -} -.aioseop_count_bad { - color: #515151 !important; - background-color: #ff0 !important; -} -.aioseop_count_ugly { - color: #fff !important; - background-color: #f00 !important; -} - -textarea.robots-text { - background-color: #eee; - width: 100%; - height: 100%; +/** + * Controls all the styling of the plugin. + * + * @author Michael Torbert. + * @author Semper Fi Web Design. + * @copyright http://semperplugins.com + * @package All-in-One-SEO-Pack. + */ + +.form-table.aioseop { + clear: none; +} + +.form-table.aioseop td { + vertical-align: top; + padding: 16px 0 10px 0; + line-height: 20px; + font-size: 12px; +} + +.form-table.aioseop th { + width: 200px; + padding: 10px 0 12px 9px; +} + +.aioseop_help_text_link, +.aioseop_help_text_link:active { + text-align: left; + float: left; + max-width: 300px; + min-width: 1px; + padding-top: 2px; + outline: none; + color: #888; + font-family: sans-serif; +} + +.aioseop_help_text_link span { + font-size: 14px; +} + +.aioseop_help_text_link:before { + content: "\f223"; + font-size: 27px; + font-family: dashicons; + vertical-align: middle; +} + +#aioseop-support .aioseop_metabox_text, +#aioseop-support a { + font-size: 14px; + color: #000; + text-decoration: none; +} + +.aioseop_icon { + display: inline-block; + width: 40px; + height: 40px; + background-repeat: no-repeat; + background-size: 100%; + vertical-align: middle; + margin: 10px; +} + +.aioseop_book_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAKlBMVEUAAAAAn+cAneEAnuABnuEBnuEAnuEAn+QAn+QAneAAnuEAneAAnuAAneFPI9ocAAAADnRSTlMAII/P/wCQMADwANDvnyPbz6kAAAB9SURBVHgB7c+xCQMgEIVhZwiSSRzhkRBImsA5gVUmuBGcJbUDxlhY6T2wvh/sPvBd+HdJWCSj0N8bsEEiIIOAyEBhIDGAcwA4cDBy4MDBTeuqCR5abXCvBHy+6ybQrs2R0jsH/As+srEzC55qggi81AIZ+waQxkBmQK5tD34LnXJVZf9y5gAAAABJRU5ErkJggg==); +} + +.aioseop_cog_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAeFBMVEUAAAAAn+MAnOIAn+cAneIAneEAn+MAnuEAneIAnuAAnuAAneEAn+cAn+QAn98AnuEAn98AneAAneEAneAAnOIAnuAAnuEAnuAAneEAn+EAnuEAnuAAneEAneAAneAAn+QAnuEAnuABnuEAneAAn+EAnuIAnuMBnuHeY3dlAAAAJ3RSTlMAQFAAYIAAkADP3wAgMACgEACfrwC/X++PbwAAcODwALDAANAATz8hP00ZAAACHklEQVR4Xq3XbWObIBAHcPAJJRjJVmtso4vL2vv+33AzJO2J/LuE9PfGFyR4HHiAgCQxyRMiYEtGTL5BBGzJiVEviIAtFTH6FRGowdBC/QsQqKGhhebeIdTkqe+LwFbkqew2SGyDftDKz12Q2AXYlhgeA46AD/G5oyD9zJO0zIEhvXd91L0mSPcmnZlek0nPhHu4mKu2ov+q2rZzOWE5kBRBFjNRzDRFqD6X8oGiHK5fo+0oSmcv06goknLfQk3RzHkaWwIGlUhrZaIGAto5iQn6uyw+yAFOpSgUTDEHJqqZc5DR2rgqw8lIa7mbRkkMLOOBoWZlWYrynwzGzx1C/3cdlEcvf7sgL5MTq8rGz22QNwjDP+cGBYBDOC6qcnLTNqQCeRbuYdEU4In47YjL84RSwEk+Tq8qT7xvhMc5eXsj78Buga866O4dQrXs4OEk3jaNTWC1Cfc43nSa0MQ0fCFFLWXL9saWFjQMgFOfEUR+zsl1KWeRBaWr3e7c01q3Lmld+FfiSVFQ/2ehp6B8IzaorGvJ8q8Jl/ViIkDv396tfX/bawKm81J+eGtLH91cX+xIUUZ7XYmPHTBmA0U4feMh6zqVwzTe8ubQvmBoUJeDphoIGtT5tVaq0Ttopvyom4M4xqz8YGXhiCLAnIKhg8N2iA30cLzrxmJH/H4cASejrjzcFHXpwrcukwIiRQZv2QICtjQP352/9fYuC+Qv593CTVvcgwkAAAAASUVORK5CYII=); +} + +.aioseop_file_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAPFBMVEUAAAAAneAAn98AneIAneEAnuAAn+QAnuAAnuAAnuEAn+MAnuEAneAAnuEAn+EAneEAnOIAnuEAnuABnuG5yOaaAAAAE3RSTlMA0BBgn88wv++gQLCvX2+PUJDAyp/15gAAALdJREFUeF7t1z2ygzAMhVFJjm0C5Ff732uaMCSWCVzTJO/paz1zRsVtTM/OUT+Wx5PQchJ1Q2O/CETdVk51IOjWugAeYLvUAEU6rAO4oLhQB2bSvh+NAAKU2AgYQGIEDHgXbjhQCFcYKIQuoUApZBQwQg8CRhhAwArSBlCagNAI0LTqAQCq3fcC+jOA7e8DDuhK/wDwHfgOfAe+A98B2BcC3Aaw+XiCBdp3AtOcNAgs9FoACZ7ufwCe6pfMGb29UwAAAABJRU5ErkJggg==); +} + +.aioseop_help_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAflBMVEUAAAAAn98AnuIAn+EAneAAnuAAnuAAn+QAn+QAneEAnuAAnuAAn+EAnuAAnuEAneAAn+cAneAAnuAAn98AnOIAnuEAneIAn+MAnuEAnuEAn+EAneIAneEAneEAnuEAn+MAneAAneEAnuMAnOIAn+cAneEBnuEAneAAnuMBnuEoGewkAAAAKXRSTlMAEE9/r7/fADCPzwBv718AIPDAAFCwYEAAoAAAn4CQAOAAPwAAcADQAFP96WQAAAMNSURBVHhelZcNc5swDIatBghpoCGEj9Jij2XLMv3/P7glkoNtZJo+d+0lhBOveSXZUjHgZZOkGf4nS5PNC5wiKPFqvnvFgNddvpVQy0tQZCiSFfCEAtiUGKXcwFcB3kpcpXx791HetypFn2NdH9EnrX67KPdL46g/tl3PeqHvWidM2fxyUM7n3fzgof8R0A9zjN3PGTV/HB+6teg66EeIUQqQIGOiSQMGmeRgUQfGPn/Ktyv0k9UQKrCxWzitAq3V6dvYIDG8f8mAROO6ULF/3ecTaHazcvIgjTw/PxfFeVFErCHd31C3fx2v39cKGy6qLKyA1tGr/v8BLWDyb3OLqiw+XGCiq8DFxIvypMKIHqMXvaeLmmyEkn1xSTCAjWcMS7gruFD+eo/QuEC7AYCy+nJXkC1/r5A4Gq2NrQCvjMnL7OZCLggY3KoAI5jMEvKt2hohBYK3wiveuwx8i3qn/uvVf0O2Hh5MnLwOZMTrXgGt4OCi7RuyXNg1F1oDqEZIQh2K6oUALalSWqgiIwUIM4VVqZZvdlkE7QQFFLRVNS3l5NLZarMkgkx6ebWiNPqzSu9nEkM2KDZhjbykh+19KKri3+LkIxLhVlE/E4CaAjsd4AYo9zJkR9huGF7CtPYSX9FyXG4XFHe2UQIt9fIGa6NNJBErX2r35O0wp7KEbZYSNpVtMYngSpbZYoI1G9YClFzOp+vKS6jviLFJ+fWgDralfZO5peW2xX8LKB9NdTtxsQuc7/wV0OTv/YRyiUuIugCls7FwizffsXHgzcRurjEjYgH8zdVKyODZJUDGAuxZubNnt5BIgMQ7YNyowy2c0XfCqyNX6HzE2Ve8A28+nmDDHaJyD9sNChpkxvCYRxgkEjitAkl40AzPjxm7KdNnSAzLgaNFZhcVATtkBmliGaTJSJ6mBnnkMWgpx+XAMZZoMbGZqXEHm6Q4sxA4F4k7DEkjD1PVGJCmGFDLQ5elO+Iqx7B/q88A0FKI+DSlBLMuE4pMF3h6+DZXDLia6PAtA41u67uUqW51E02uf46zvXx+HY4YAAAAAElFTkSuQmCC); +} + +.aioseop_support_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAe1BMVEUAAAAAn98AnuIAn+EAneAAnuAAnuABnuEAn98An+QAneEAnuAAn+QAn+EAnuAAnuEAneAAnuEAneIAn+MAn+cAn+cAnuEAnuEAnOIAneEAneEAnOIAnuAAneEAn+MAneAAneEAneIAnuEAnuIAneAAnuAAneABnuEAnuPdwDkgAAAAKXRSTlMAEE9/r7/f/wAwj88Ab+9f0JBgQCAAALBQcAAAAJ8AAIAAoADgwPAAP4Dl7rAAAALsSURBVHgBtdcBc6I6EAfwRCH/KjUSTCW2eHK8kHff/xM+Dg5NlsTTOu830xmc0BhJdtllKXy1znKBgciz9Yq/JbC3mM22AFFsN+8x7H2B7wSixI4/sAK+lkiSa/63CfbXfy9VddAfA32oVHmdYn8MsaNP55jUhpOFmRqTXH/4mP/BSExOnxEnTKT58jDveouZaCIEZltvWna7POPm8GPhgJtzbIIMnvq4UMOTXWZsvjgjoD8IjcCZrkAh1H4SLUIq3EYDQjSEBGH8XdASVPUzUIGS2jsHORbyJpC8gzWDChGaPsL4ItnwxyUiuuPqnBdAkW9X/3SIkPxPMLWIkZJcL7XTNnKJb5J8XMEJ33YaVyCQYJUZ0tjGKIsE8XsXNuNUFpStvFMQGR4Xvhlyoppi51AjUAcZhdPRIVzr8UCzYzEfS91afxOJDle2Hc9IBaBoGMdg/raq/3s49/NPm/6TGQDl5Up3DoCN5G9uAbjOO6AlAMPa8Zd4JI0kP55k41EAWlaT+w0Ae4mytyAenQDUrCcZsCMr8igydADQM0ECrydf4zEA+uZGAygYBv96ivF4RG3GffNgsJiAfr439v9MUN7/CeXFgwGzrz1Eu9hG9eQ2Rg+SaKJE5CB1y6Ps7h1ld/FMR9mEm6vPEoCIBZMAIM/e8xoTQRjO+5y8fT0ZJvlc5PwJ57fymlDWMloBLKoHsb4mlPLCLnNKyxDIwpRGR72UtsEgUhoKrx7bR4Z3c1J9Tyft7ep3Wl9t04l/rFBefrFwh29y/N7L1TlynXy5JpbQHY3qS6Dslfnq4guYa+UXC4xBj4W+CSTvYFMEuOeLLKf9Ytssd5hw6TJv9FKhOeqeK3W7ZcNRP1Nsd7GOpXu83O/iLY8ij5CwmKlUz2TcIy2PIy2PT/eYZLRV5fsMk542XaHK3VrV/a+p7fu1uzWyjiZs9pPgrUOSa6ONJ8FPFlH2xB9uvlUJolTJ5juOm7buLQa2r1uvkSX+A/xd+1xZLxG0AAAAAElFTkSuQmCC); +} + +.aioseop_youtube_icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAARVBMVEUAAAAAn+cAn+EAneAAnuABnuEAn+cAn98AneEAn98AnOIAnuAAnOIAneIAneIAnuEAnuEAneEAnuEBnuEAn+QAneAAneCXjc90AAAAF3RSTlMAIG+vz/8AEJ8AUO8AYACgAHCwADDw0E/SOHoAAAEBSURBVHgB7dbBjsIgGATgH+UvCAso3fL+j7rDYZMerGGZQ5NNv8TrREZLRy47F3O7Wx1m7zezAMjSOa9/5t2jkweEqBNi+ALBJ+mklHOWnINOC/0buKjTokMHRQnlKUYpRl5HBQ32KFXfW783HVDFHgWsrg0EWNEDK4z0+yEAEhuAIsgAFMEFQOECILEBKIIMQBFcABQuABIbgCLIABTBBUBhAzx5BEuWGM/9GT35V7bkwxTPfZw9eaVZ8lKN517rI8NHmr43cPyufXi5Rh1Q+dc7PTAWduI83abTNteHJjvz6KEJYeoU2+/UBVcm+tuNbTCv2nRYq2k/9ylXwL8I+AGj+lzlceKDYQAAAABJRU5ErkJggg==); +} + +.aioseop_meta_box_help > label { + position: absolute; + margin-left: 8px; +} + +div.aioseop_tip_icon { + font-size: 14px; + border: 1px solid #888; + width: 1em; + text-align: center; + padding: 0 4px; + -webkit-border-radius: 12px; + -moz-border-radius: 12px; + -webkit-box-shadow: 1px 1px 1px #888; + -moz-box-shadow: 1px 1px 1px #888; + box-shadow: 1px 1px 1px #888; + border-radius: 12px; +} + +div.aioseop_tip_icon:before { + content: '?'; +} + +.aioseop_help_text_link img { + width: 40px; + float: left; +} + +.aioseop_meta_box_help, +.aioseop_meta_box_help:active { + float: right; + padding-left: 0; + width: 16px; + margin-right: 32px; + text-decoration: none; + height: 15px; + padding-top: 1px; + position: relative; +} + +.aioseop_tabs .aioseop_meta_box_help, +.aioseop_tabs .aioseop_meta_box_help:active { + margin-top: 4px; + margin-right: 45px; +} + +.aioseop_label { + color: #5F5F5F; + font-weight: bold; + line-height: 19px; + display: inline-block; + text-align: left; + position: absolute; + font-family: 'Open Sans', sans-serif; + width: 26%; + min-width: 120px; + max-width: 230px; +} + +.aioseop_option_div { + max-height: 360px; + min-height: 37px; + width: 95%; + overflow-y: auto; +} + +.aioseop_overflowed { + border: 1px solid #e1e1e1; +} + +.aioseop input[type="text"], .aioseop input[type="url"] { + color: #515151; + height: 35px; + padding: 10px 0 10px 10px; + font-size: 14px; + width: 95%; + max-width: 600px; +} + +.aioseop textarea { + color: #515151; + padding: 10px 0 0 10px; + margin: 0; + font-size: 14px; + line-height: 25px; + width: 95%; + max-width: 600px; +} + +.aioseop_help_text_div { + text-align: left; + width: 100%; + margin: 0; +} + +.aioseop_help_text { + font-size: 12px; + float: left; + clear: left; + color: #797979; + line-height: 15px; + font-style: italic; +} + +.aioseop_head_tagline { + color: #5F5F5F; + font-size: 13px; +} + +.aioseop_head_nav { + float: left; + font-size: 18px; + margin: 0 0 16px 0; + font-family: "HelveticaNeue-Light", + "Helvetica Neue Light", + "Helvetica Neue", + sans-serif; + border-bottom: 1px solid #CCC; + width: 100%; +} + +.aioseop_head_nav_tab { + padding: 10px 15px 10px 15px; + margin: 0 0 0 15px; + border-radius: 4px 4px 0 0; + border: 1px solid #CCC; + border-bottom: 0 white; + float: left; + opacity: 0.5; + color: black; + text-shadow: white 0 1px 0; + text-decoration: none; +} + +.aioseop_head_nav_tab.aioseop_head_nav_active { + opacity: 1; + margin-bottom: -1px; + border-width: 1px; +} + +.aioseop_head_nav_tab:first-child { + margin-left: 0; +} + +.aioseop_head_nav_tab:hover { + opacity: 1; +} + +.aioseop_header { + float: left; + clear: left; +} + +.aioseop_advert { + padding: 10px; + margin-bottom: 30px; + border: 1px solid #DDD; + height: 200px; + width: 423px; +} + +.aioseop_nopad { + padding-left: 0; + padding-top: 0; +} + +.aioseop_nopad_all { + padding: 0; + height: 220px; + width: 445px; + margin-bottom: 20px; + border: none; +} + +.aioseop_adverts { + float: right; +} + +.wincherad { + width: 100%; + height: 100%; + background-size: 100%; + background-repeat: no-repeat; + margin-bottom: 0; + border: none; +} + +#wincher21 { + background-image: url(../../modules/images/banner21.jpg); +} + +#wincher22 { + background-image: url(../../modules/images/banner22.jpg); +} + +.aioseop_content { + min-width: 760px; + clear: left; +} + +.aioseop_options_wrapper .hndle { + font-size: 15px; + font-family: Georgia, + "Times New Roman", + "Bitstream Charter", + Times, + serif; + font-weight: normal; + padding: 7px 10px; + margin: 0; + line-height: 1; +} + +.aioseop_options_wrapper .submit input.button-primary { + margin-bottom: 5px; +} + +#aiosp_feature_manager_metabox.postbox { + margin-top: 20px; + float: left; +} + +.aioseop_advert p { + margin: 25px 0 25px 0; +} + +.aioseop_options_wrapper .postarea { + border-color: #DFDFDF; + -moz-box-shadow: inset 0 1px 0 #fff; + -webkit-box-shadow: inset 0 1px 0 #fff; + box-shadow: inset 0 1px 0 #fff; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.aioseop_advert h3 { + padding: 0; + margin-top: 6px; +} + +.aioseop_metabox_text p { + margin: 0 0 0 0; + width: 101%; +} + +.aioseop_sidebar { + width: 457px; + margin-left: 10px; +} + +.aioseop_metabox_text { + margin-bottom: 0; +} + +.aioseop_metabox_wrapper { + padding: 0; +} + +.aioseop_metabox_text *:last-child { + margin: 0; +} + +.aioseop_metabox_feature { + margin-top: 20px; +} + +.aioseop_translations { + margin-top: 15px; +} + +.aioseop_option_label { + float: left; + margin: 0; + min-width: 150px; + width: 37%; + max-width: 270px; + padding-top: 3px; + padding-bottom: 3px; + height: 67px !important; /*added for certain language support*/ +} + +.aioseop_metabox_text h2 { + font-size: 14px; + padding: 0; + font-weight: bold; + line-height: 29px; +} + +#aioseop-about { + width: 443px; + margin-bottom: 20px; +} + +#aioseop-about .aioseop_metabox_text #mc-embedded-subscribe-form h2 { + font-size: 13px; +} + +.aioseop_sidebar #mc-embedded-subscribe-form { + margin: 0 0 10px 0; + background: white; + padding: 10px 10px; + border: 1px solid #DDD; +} + +#aioseop-about .aioseop_metabox_text ul { + list-style-type: disc; + padding-left: 15px; +} + +.aioseop input[readonly] { + background-color: #EEE; + margin: 5px 0 5px 0 !important; +} + +.aioseop_settings_left { + float: left; + padding: 0; + margin: 0; + width: 100%; +} + +body.all-in-one-seo_page_all-in-one-seo-pack-aioseop_feature_manager .aioseop_settings_left { + margin-top: 20px; +} + +body.all-in-one-seo_page_all-in-one-seo-pack-pro-aioseop_feature_manager .aioseop_settings_left { + margin-top: 20px; +} + +#aioseop_top_button { + margin-top: 5px; + height: 30px; +} + +#aioseop-list #mce-EMAIL { + margin-top: 5px; + width: 250px; +} + +.aioseop_top { + margin: 10px 10px 0 0; + /* margin: 10px 477px 0px 0px; */ +} + +.aioseop_top #aioseop-list { + margin-bottom: 0; +} + +.aioseop_top #aioseop-list.postbox.closed { + overflow: hidden; +} + +.aioseop_right_sidebar { + float: right; + margin-top: 35px; +} + +#aiosp_settings_form .button-primary.hidden { + display: none; +} + +form#edittag div#aiosp_titleatr_wrapper, +form#edittag div#aiosp_menulabel_wrapper, +form#edittag div#aiosp_sitemap_exclude_wrapper { + display: none; +} + +.All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > #aioseop_top_button { + height: 5px; + position: absolute; + top: 0; + width: 97%; +} + +.All_in_One_SEO_Pack_Feature_Manager > #aiosp_settings_form > .aioseop_settings_left { + margin-top: 10px; +} + +.All_in_One_SEO_Pack_Feature_Manager > .aioseop_right_sidebar.aioseop_options_wrapper { + margin-top: 10px; +} + +div#aiosp_feature_manager_metabox .inside { + padding: 8px; +} + +div.aioseop_feature { + position: relative; + display: inline-block; + float: left; + vertical-align: top; + width: 240px; + height: 288px; + margin: 8px; + border: 1px solid #DEDEDE; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + background: white; + padding: 10px 0 0; + -webkit-box-shadow: inset 0 1px 0 #fff, + inset 0 0 20px rgba(0, 0, 0, 0.05), + 0 1px 2px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0 1px 0 #fff, + inset 0 0 20px rgba(0, 0, 0, 0.05), + 0 1px 2px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 0 #fff, + inset 0 0 20px rgba(0, 0, 0, 0.05), + 0 1px 2px rgba(0, 0, 0, 0.1); + -webkit-transition-duration: .4s; + -moz-transition-duration: .4s; +} + +.aioseop_feature .flag { + float: right; + margin-right: -7px; + background: none repeat scroll 0 0 #D23D46; + color: #FFFFFF; + padding: 5px 12px 6px 5px; + position: relative; +} + +.aioseop_feature .flag:before { + border-color: #D23D46 #D23D46 #D23D46 transparent; + border-style: solid; + border-width: 14px 4px 15px 10px; + content: ""; + left: -14px; + position: absolute; + top: 0; +} + +.aioseop_feature .flag:after { + border-color: #892026 transparent transparent; + border-style: solid; + border-width: 6px 6px 6px 0; + bottom: -12px; + content: ""; + position: absolute; + right: 0; +} + +.aioseop_feature .flag.pro { + display: none; +} + +#aioseop_coming_soon .free.flag, +.all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager .aioseop_feature .free.flag { + display: none; +} + +#aioseop_coming_soon .flag.pro { + display: block; + margin-top: -30px; +} + +.all-in-one-seo_page_all-in-one-seo-pack-pro-modules-aioseop_feature_manager #aioseop_coming_soon .flag.pro { + display: none; +} + +.aioseop_feature h3 { + font-size: 17px; + margin: 0; + padding: 0 10px 5px 10px; + font-weight: normal; + font-style: normal; + font-family: "Helvetica Neue", + Helvetica, + Arial, + "Lucida Grande", + Verdana, + "Bitstream Vera Sans", + sans-serif; +} + +.aioseop_feature p { + line-height: 150%; + font-size: 12px; + font-family: Georgia, + "Times New Roman", + "Bitstream Charter", + Times, serif; + margin-bottom: 20px; + color: #666; + padding: 0 10px; +} + +.aioseop_feature p.aioseop_desc { + min-height: 80px; +} + +.aioseop_feature .feature_button { + float: right; + margin-bottom: 10px; + margin-right: 10px; + min-width: 80px; + text-align: center; +} + +.aioseop_feature .feature_button:before { + content: "Activate"; +} + +.aioseop_feature .active.feature_button:before { + content: "Deactivate"; +} + +div.aioseop_feature .aioseop_featured_image { + min-height: 100px; + background-repeat: no-repeat; + display: block; + margin: 0 auto; + width: 133px; +} + +div.aioseop_feature .aioseop_featured_image { + background-image: url(../../modules/images/Default-BW-Standard.png); +} + +div.aioseop_feature .aioseop_featured_image.active { + background-image: url(../../modules/images/Default-Color-Standard.png); +} + +div.aioseop_feature#aioseop_sitemap .aioseop_featured_image { + background-image: url(../../modules/images/XMLSitemaps-BW-Standard.png); +} + +div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active { + background-image: url(../../modules/images/XMLSitemaps-Color-Standard.png); +} + +div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image { + background-image: url(../../modules/images/VideoSitemap-BW-Standard.png); +} + +div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active { + background-image: url(../../modules/images/VideoSitemap-Color-Standard.png); +} + +div.aioseop_feature#aioseop_opengraph .aioseop_featured_image { + background-image: url(../../modules/images/SocialMeta-BW-Standard.png); +} + +div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active { + background-image: url(../../modules/images/SocialMeta-Color-Standard.png); +} + +div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image { + background-image: url(../../modules/images/Robots-BW-Standard.png); +} + +div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active { + background-image: url(../../modules/images/Robots-Color-Standard.png); +} + +div.aioseop_feature#aioseop_file_editor .aioseop_featured_image { + background-image: url(../../modules/images/FileEditor-BW-Standard.png); +} + +div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active { + background-image: url(../../modules/images/FileEditor-Color-Standard.png); +} + +div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image { + background-image: url(../../modules/images/ImporterExporter-BW-Standard.png); +} + +div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active { + background-image: url(../../modules/images/ImporterExporter-Color-Standard.png); +} + +div.aioseop_feature#aioseop_performance .aioseop_featured_image { + background-image: url(../../modules/images/Performance-BW-Standard.png); +} + +div.aioseop_feature#aioseop_performance .aioseop_featured_image.active { + background-image: url(../../modules/images/Performance-Color-Standard.png); +} + +div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image { + background-image: url(../../modules/images/Default-Color-Standard.png); +} + +div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image { + background-image: url(../../modules/images/Default-Color-Standard.png); +} + +.All_in_One_SEO_Pack_Sitemap > form > .wrap > .form-table, +.All_in_One_SEO_Pack_Video_Sitemap > form > .wrap > .form-table { + max-width: 500px; + clear: none; +} + +.aioseop_follow_button { + min-height: 50px; + background-repeat: no-repeat; + display: inline-block; + width: 100px; + background-size: auto 50px !important; + margin-right: 0; +} + +.aioseop_facebook_follow { + background-image: url(../../modules/images/facebook-follow-standard.png); +} + +.aioseop_twitter_follow { + background-image: url(../../modules/images/twitter-follow-standard.png); +} + +@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and ( min--moz-device-pixel-ratio: 1.5), only screen and ( -o-min-device-pixel-ratio: 3/2), only screen and ( min-device-pixel-ratio: 1.5), only screen and ( min-resolution: 1.5dppx) { + div.aioseop_feature .aioseop_featured_image { + background-size: auto 100px !important; + } + + div.aioseop_feature .aioseop_featured_image.active { + background-image: url(../../modules/images/Default-Color-Retina.png); + } + + div.aioseop_feature .aioseop_featured_image { + background-image: url(../../modules/images/Default-BW-Retina.png); + } + + div.aioseop_feature#aioseop_sitemap .aioseop_featured_image { + background-image: url(../../modules/images/XMLSitemaps-BW-Retina.png); + } + + div.aioseop_feature#aioseop_sitemap .aioseop_featured_image.active { + background-image: url(../../modules/images/XMLSitemaps-Color-Retina.png); + } + + div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image { + background-image: url(../../modules/images/VideoSitemap-BW-Retina.png); + } + + div.aioseop_feature#aioseop_video_sitemap .aioseop_featured_image.active { + background-image: url(../../modules/images/VideoSitemap-Color-Retina.png); + } + + div.aioseop_feature#aioseop_opengraph .aioseop_featured_image { + background-image: url(../../modules/images/SocialMeta-BW-Retina.png); + } + + div.aioseop_feature#aioseop_opengraph .aioseop_featured_image.active { + background-image: url(../../modules/images/SocialMeta-Color-Retina.png); + } + + div.aioseop_feature#aioseop_robots .aioseop_featured_image, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image { + background-image: url(../../modules/images/Robots-BW-Retina.png); + } + + div.aioseop_feature#aioseop_robots .aioseop_featured_image.active, div.aioseop_feature#aioseop_bad_robots .aioseop_featured_image.active { + background-image: url(../../modules/images/Robots-Color-Retina.png); + } + + div.aioseop_feature#aioseop_file_editor .aioseop_featured_image { + background-image: url(../../modules/images/FileEditor-BW-Retina.png); + } + + div.aioseop_feature#aioseop_file_editor .aioseop_featured_image.active { + background-image: url(../../modules/images/FileEditor-Color-Retina.png); + } + + div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image { + background-image: url(../../modules/images/ImporterExporter-BW-Retina.png); + } + + div.aioseop_feature#aioseop_importer_exporter .aioseop_featured_image.active { + background-image: url(../../modules/images/ImporterExporter-Color-Retina.png); + } + + div.aioseop_feature#aioseop_performance .aioseop_featured_image { + background-image: url(../../modules/images/Performance-BW-Retina.png); + } + + div.aioseop_feature#aioseop_performance .aioseop_featured_image.active { + background-image: url(../../modules/images/Performance-Color-Retina.png); + } + + div.aioseop_feature#aioseop_coming_soon .aioseop_featured_image { + background-image: url(../../modules/images/Default-BW-Retina.png); + } + + div.aioseop_feature#aioseop_coming_soon2 .aioseop_featured_image { + background-image: url(../../modules/images/Default-BW-Retina.png); + } + + .aioseop_facebook_follow { + background-image: url(../../modules/images/facebook-follow-retina.png); + } + + .aioseop_twitter_follow { + background-image: url(../../modules/images/twitter-follow-retina.png); + } +} + +.aioseop_options { + width: 100%; + margin: 18px 0 10px 0; +} + +.aioseop_wrapper { + width: 100%; + padding-left: 5px; +} + +.aioseop_input { + clear: left; + width: 100%; + padding: 5px; + display: inline; +} + +.aioseop_option_input { + float: left; + width: 61%; + margin: 0; + padding-left: 1px; + min-width: 160px; + /* max-width: 900px; */ +} + +/*** Sitemap Additional Pages section ***/ +#aiosp_sitemap_addl_pages_metabox .aioseop_options, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_options { + width: 97%; + margin: 5px; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_sitemap_addl_instructions_wrapper, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_video_sitemap_addl_instructions_wrapper { + display: block; + width: 100%; + float: none; + margin: 0; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_sitemap_addl_instructions_wrapper .aioseop_input, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_video_sitemap_addl_instructions_wrapper .aioseop_input { + display: block; + width: 100%; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper { + padding: 0; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_input, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_input { + display: inline-block; + vertical-align: middle; + width: 25%; + min-width: 120px; + height: 70px; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_top_label, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_top_label { + width: 70%; + margin: 0; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_option_label, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper .aioseop_option_label { + height: 30px !important; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_sitemap_addl_mod_wrapper input.aiseop-date, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_wrapper#aiosp_video_sitemap_addl_mod_wrapper input.aiseop-date { + height: 36px; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type { + margin: 0; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type input.button-primary, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_options .aioseop_submit_type input.button-primary { + margin-left: 0 !important; +} + +#aiosp_sitemap_addl_pages_metabox .aioseop_help_text_div, +#aiosp_video_sitemap_addl_pages_metabox .aioseop_help_text_div { + position: absolute; + width: auto; + margin: 5px 0 10px 0; +} + +#aiosp_sitemap_addl_pages_metabox table.aioseop_table, +#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table { + width: 96%; + border: 1px solid #CCC; + margin: 5px 5px 10px; +} + +table.aioseop_table tr:nth-child(odd) { + background-color: #EEE; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr:nth-child(odd) { + background-color: rgba(238, 238, 238, 0.5); +} + +table.aioseop_table td { + width: 23%; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table { + width: 80%; + max-width: 800px; + display: block; + border-top: 1px solid #dfdfdf; + border-left: 1px solid #dfdfdf; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table th { + width: 18%; + border-right: 1px solid #dfdfdf; + border-bottom: 1px solid #dfdfdf; +} + +.All_in_One_SEO_Pack_Opengraph div.aioseop_meta_info { + margin-top: 10px; + border: 1px solid #dfdfdf; + width: 80%; + max-width: 800px; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table tr.aioseop_table_header th { + background: #f1f1f1; + background-image: -webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9)); + background-image: -webkit-linear-gradient(bottom, #ececec, #f9f9f9); + background-image: -moz-linear-gradient(bottom, #ececec, #f9f9f9); + background-image: -o-linear-gradient(bottom, #ececec, #f9f9f9); + background-image: linear-gradient(to top, #ececec, #f9f9f9); + padding: 5px; + border-bottom-color: #dfdfdf; + text-shadow: #fff 0 1px 0; + -webkit-box-shadow: 0 1px 0 #fff; + -moz-box-shadow: 0 1px 0 #fff; + box-shadow: 0 1px 0 #fff; +} + +.All_in_One_SEO_Pack_Opengraph table.aioseop_table td { + border-right: 1px solid #dfdfdf; + border-bottom: 1px solid #dfdfdf; +} + +#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item { + display: inline-block; + width: 30%; + vertical-align: top; +} + +#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(even) { + font-weight: bold; +} + +#aioseop_opengraph_settings_facebook_debug_result li.aioseop_opengraph_settings_facebook_debug_item:nth-child(odd) { + width: 70%; +} + +#aiosp_sitemap_addl_pages_metabox table.aioseop_table td, +#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td { + width: 27%; + padding-left: 5%; +} + +#aiosp_sitemap_addl_pages_metabox table.aioseop_table td:first-child, +#aiosp_video_sitemap_addl_pages_metabox table.aioseop_table td:first-child { + padding-left: 2%; +} + +table.aioseop_table td, table.aioseop_table th { + padding: 3px; +} + +.aioseop_top_label .aioseop_option_input, +.aioseop_no_label .aioseop_option_input { + width: 100%; +} + +#aiosp_settings_form .postbox { + margin: 0 0 20px 0; +} + +.aioseop_settings_left .postbox { + float: left; + width: 100%; +} + +.aioseop_option_setting_label { + min-height: 35px; + display: inline-block; + white-space: nowrap; + overflow: hidden; + padding-left: 1px; + max-width: 229px; + min-width: 160px; + width: 33%; +} + +.aioseop_settings_left .postbox .inside { + padding: 0; + margin: 0; + clear: right; +} + +#aiosp_robots_rules { + clear: left; + margin-left: 20px; + max-width: 1072px; +} + +#aiosp_robots_default_metabox .aioseop_wrapper { + width: 31%; + min-width: 165px; + display: inline-block; + max-width: 265px; +} + +#aiosp_robots_default_metabox .aioseop_help_text_div { + position: absolute; + margin: 5px 0 10px 0; +} + +#aiosp_robots_default_metabox .aioseop_option_input { + width: 94%; + min-width: 94%; +} + +#aiosp_robots_default_metabox table.aioseop_table { + width: 96%; + border: 1px solid #CCC; + margin: 5px 0 10px 0; +} + +#aiosp_robots_default_metabox table.aioseop_table td { + width: 25%; + padding-left: 5%; +} + +#aiosp_settings_form .aioseop_no_label, .aioseop_no_label { + float: left; + width: 92%; + max-width: 100%; + margin: 0 23px 0 13px; +} + +#aiosp_sitemap_status_metabox .handlediv.button-link { + display: none; +} + +#aiosp_sitemap_status_metabox.closed .inside { + display: block; +} + +.aioseop_top_label { + width: 96%; + margin: 0 10px; +} + +.aioseop_hidden_type { + margin: 0; + padding: 0; + height: 0; +} + +#aiosp_title_metabox #aiosp_force_rewrites_wrapper { + display: none; + height: 0; +} + +.aioseop_module.error.below-h2 { + padding: 5px 0; + margin: 0 477px 15px 0 !important; +} + +#aioseop_opengraph_settings .inside { + margin: 0; +} + +#aioseop_opengraph_settings_image_wrapper img { + width: auto; + height: 75px; +} + +#aioseop_opengraph_settings_image_wrapper .aioseop_option_setting_label { + max-width: 160px; + min-width: 100px; + width: 30%; +} + +.aioseop_input input[type="checkbox"], +.aioseop_input input[type="radio"] { + vertical-align: text-bottom; + margin-top: 8px; +} + +#aiosp_importer_exporter_import_export_help_wrapper .aioseop_option_div { + max-height: initial; +} + +#aiosp { + width: auto; +} + +.aioseop_input.aioseop_top_label .aioseop_option_input { + margin: 0 0 10px 0; +} + +.aiosp_file_editor_settings > .aioseop_textarea_type .aioseop_option_div { + max-height: none; +} + +/* Robots.txt styling */ +#aiosp_robots_generator_robotgen_wrapper .aioseop_option_div, +#aiosp_robots_generator_robothtml_wrapper .aioseop_option_div { + max-height: none; +} + +.aioseop_option_input .widefat td { + vertical-align: middle; +} + +.entry-row.robots.quirks { + font-weight: bold; + opacity: 1; +} + +.entry-row.robots { + opacity: 0.8; +} + +.entry-row.robots.invalid { + opacity: 1; + font-weight: bold; +} + +.invalid .entry_label { + font-weight: bold; +} + +.aioseop .aioseop_option_input tbody { + background: #FCFCFC; +} + +.All_in_One_SEO_Pack_Robots .aioseop .aioseop_option_input tbody { + background: transparent; +} + +.entry-row.robots div { + height: 20px; + vertical-align: middle; + width: 90%; + margin: 0 0 4px 0; +} + +.robots img { + margin: 0 0 0 2px; + opacity: 0.6; +} + +.aioseop_option_docs { + width: 98%; + display: none; + border: 1px solid #D3D3D3; + margin-top: 20px; + padding: 1%; + background-color: #EEE; +} + +.aioseop_option_docs h3 { + background: none; +} + +div.aioseop_notice { + position: relative; +} + +div.aioseop_notice a.aioseop_dismiss_link { + position: absolute; + top: 10px; + right: 10px; +} + +.aioseop_error_notice { + color: #f00; + font-weight: bold; +} + +.aioseop_input select { + margin: 7px 0; +} + +.aioseop_help_text ul { + margin: 15px 0 0 20px; +} + +.aioseop_help_text ul li { + line-height: 20px; + margin: 0; +} + +.aioseop_sidebar #side-sortables { + width: 98%; +} + +#aioseop_opengraph_settings .aioseop_option_label { + width: 30%; +} + +.aioseop_tabs { + padding-top: 6px; +} + +.aioseop_tabs.hide, +.aioseop_header_tabs.hide { + display: block !important; +} + +.aioseop_header_tabs li { + display: inline; + padding: 0; + margin: 0; +} + +.aioseop_header_tabs { + margin: 0; +} + +.aioseop_header_nav { + margin: 0; +} + +.aioseop_header_tabs li a.aioseop_header_tab.active { + background-color: rgb(255, 255, 255); + border-bottom-color: rgba(255, 255, 255, 0.5); + font-weight: bold; +} + +.aioseop_header_tabs li a.aioseop_header_tab { + font-size: 14px; + line-height: 37px; + text-decoration: none; + margin: 5px 5px 0 0; + padding: 10px; + cursor: pointer; + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; + background-color: #e5e5e5; + border: 1px solid #ccc; + color: #5F5F5F; +} + +.aioseop_header_tabs li:first-child a.aioseop_header_tab { + border-left: solid 1px #CCC; + margin-left: 5px; +} + +.aioseop_tab { + border: solid 1px #CCC; + background-color: rgb(255, 255, 255); + background-color: rgba(255, 255, 255, 0.5); + padding: 10px; +} + +.aioseop_loading { + background-image: url('../../images/activity.gif'); + display: inline-block; + width: 24px; + height: 24px; + margin: 0; + padding: 0; + vertical-align: bottom; +} + +.aiosp_delete { + background-image: url('../../images/delete.png'); + display: inline-block; + width: 16px; + height: 16px; + margin: 0; + padding: 0; + vertical-align: bottom; +} + +form#aiosp_settings_form, +.aioseop_tabs_div { + padding-right: 477px; +} + +.aioseop_tabs_div { + margin-top: 10px; +} + +#aiosp_settings_form ul.sfwd_debug_settings li strong { + display: block; + float: left; + text-align: right; + background-color: #DDD; + margin-right: 8px; + padding: 1px 8px 1px 1px; + overflow: auto; + width: 200px; + min-height: 16px; +} + +#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n+1) strong { + background-color: #CCC; +} + +#aiosp_settings_form ul.sfwd_debug_settings li { + clear: left; + margin: 0; + padding: 0; + background-color: #EEE; + overflow: auto; + max-width: 75%; + min-width: 800px; +} + +#aiosp_settings_form ul.sfwd_debug_settings li:nth-child(2n) { + background-color: #DDD; +} + +div.sfwd_debug_mail_sent { + background-color: #080; + border: 1px solid #0A0; + margin: 10px 0 10px 0; + width: 598px; + color: #FFF; + text-align: center; +} + +div.sfwd_debug_error { + background-color: #F00; + color: #FFF; + border: 1px solid #A00; + margin: 10px 0 10px 0; + width: 598px; + text-align: center; + font-weight: bolder; +} + +#aiosp_performance_status_wrapper .aioseop_option_div { + max-height: 420px; +} + +#aioseop_coming_soon, #aioseop_coming_soon2 { + padding-top: 40px; + text-align: center; + height: 258px; + font-size: 16px; +} + +.MRL { + margin-left: 20px !important; + margin-bottom: 10px !important; +} + +/** +* Edit Post screen specific styling +* +*/ +.postbox-container .aioseop_option_div { + width: 100%; +} + +.postbox-container .aioseop_option_div input[type="text"], +.postbox-container .aioseop_option_div textarea { + width: 99%; + max-width: 900px; +} + +.postbox-container .aioseop_option_label { + max-width: none; + height: auto !important; +} + +.postbox-container .aioseop_wrapper { + padding: 0; +} + +.postbox-container .aioseop_input { + display: block; + margin-bottom: 10px; + padding: 0; +} + +.postbox-container .aioseop_option_input { + width: 63%; + padding: 0; +} + +.postbox-container div#aiosp_upgrade_wrapper { + float: none; + width: auto; + margin: 0; + padding: 0; +} + +.postbox-container div#aiosp_upgrade_wrapper .aioseop_input { + display: block; + padding: 0; +} + +.postbox-container div#aiosp_upgrade_wrapper .aioseop_input .aioseop_option_input { + float: none; + width: auto; + padding: 0; +} + +.postbox-container div#aiosp_upgrade_wrapper .aioseop_input .aioseop_option_input .aioseop_option_div { + width: auto; + min-height: 0; + padding: 10px 0; +} + +.aioseop_tabs .aioseop_options { + margin: 0; +} + +#aioseop_opengraph_settings .aioseop_options { + clear: both; + margin-top: 35px; +} + +#aioseop_opengraph_settings .aioseop_option_input { + width: 70%; +} + +/** +* Preview Snippet styling +* +*/ +div#aiosp_snippet_wrapper { + border: 1px solid #888; + clear: both; + padding: 10px 10px 0; + max-width: 97%; + margin-bottom: 15px; +} + +div#aiosp_snippet_wrapper .aioseop_option_label { + height: auto !important; +} + +div#aiosp_snippet_wrapper .aioseop_input.aioseop_top_label .aioseop_option_input { + margin: 0; +} + +div#aioseop_snippet { + font-family: arial, sans-serif; + font-size: 13px; +} + +div#aioseop_snippet > h3 { + margin: 10px 0 5px; + font-size: 18px; + border: 0; + background: inherit; + font-weight: normal; +} + +div#aioseop_snippet > h3 > a { + color: #12c; + text-decoration: none; + cursor: pointer; +} + +div#aioseop_snippet > div { + color: #545454; + max-width: 48em; +} + +div#aioseop_snippet > div > div { + display: block; + margin-bottom: 1px; +} + +div#aioseop_snippet > div > div > cite { + color: #093; + font-style: normal; +} + +div#aioseop_snippet > div > span { + margin: 0; + padding: 0; + border: 0; +} + +/* the good, the bad and the ugly character counts */ +.aioseop_count_good { + color: #515151 !important; + background-color: #eee !important; +} +.aioseop_count_bad { + color: #515151 !important; + background-color: #ff0 !important; +} +.aioseop_count_ugly { + color: #fff !important; + background-color: #f00 !important; +} + +textarea.robots-text { + background-color: #eee; + width: 100%; + height: 100%; } \ No newline at end of file diff --git a/inc/aiosp_common.php b/inc/aiosp_common.php index e2ff2a8d8..b7ba26d34 100644 --- a/inc/aiosp_common.php +++ b/inc/aiosp_common.php @@ -14,6 +14,18 @@ class aiosp_common { // @codingStandardsIgnoreEnd + /** + * The allowed image extensions. + * + * @var array $image_extensions The allowed image extensions. + */ + private static $image_extensions = array( + 'jpg', + 'jpeg', + 'png', + 'gif', + ); + /** * aiosp_common constructor. * @@ -159,6 +171,382 @@ static function make_url_valid_smartly( $url ) { return $url; } + /** + * Determines if the given image URL is an attachment and, if it is, gets the correct image URL according to the requested size. + * + * @param string $url The url of the image. + * @param string $size The size of the image to return. + * + * @return string + */ + public static function get_image_src_for_url( $url, $size = 'thumbnail' ) { + // let's check if this image is an attachment. + $dir = wp_get_upload_dir(); + $path = $url; + + $site_url = parse_url( $dir['url'] ); + $image_path = parse_url( $path ); + + //force the protocols to match if needed + if ( isset( $image_path['scheme'] ) && ( $image_path['scheme'] !== $site_url['scheme'] ) ) { + $path = str_replace( $image_path['scheme'], $site_url['scheme'], $path ); + } + + if ( 0 === strpos( $path, $dir['baseurl'] . '/' ) ) { + $path = substr( $path, strlen( $dir['baseurl'] . '/' ) ); + } + + + global $wpdb; + $attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s", '%' . basename( $path ) . '%' ) ); + + if ( $attachment_id ) { + // if this is a valid attachment, get the correct size. + $image = wp_get_attachment_image_src( $attachment_id, $size ); + if ( $image ) { + $url = $image[0]; + } + } + + return $url; + } + + /** + * Fetch images from WP, Jetpack and WooCommerce galleries. + * + * @param string $post The post. + * @param array $images the array of images. + * + * @return void + * @since 2.4.2 + */ + public static function get_gallery_images( $post, &$images ) { + if ( false === apply_filters( 'aioseo_include_images_in_wp_gallery', true ) ) { + return; + } + + // Check images galleries in the content. DO NOT run the_content filter here as it might cause issues with other shortcodes. + if ( has_shortcode( $post->post_content, 'gallery' ) ) { + // Get the jetpack gallery images. + if ( class_exists( 'Jetpack_PostImages' ) ) { + // the method specifies default width and height so we need to provide these values to override the defaults. + // since there is no way to determine the original image's dimensions, we will fetch the 'large' size image here. + $jetpack = Jetpack_PostImages::get_images( $post->ID, self::get_dimensions_for_image_size( 'large' ) ); + if ( $jetpack ) { + foreach ( $jetpack as $jetpack_image ) { + $images[] = $jetpack_image['src']; + } + } + } + + // Get the default WP gallery images. + $galleries = get_post_galleries( $post, false ); + if ( $galleries ) { + foreach ( $galleries as $gallery ) { + $images = array_merge( $images, $gallery['src'] ); + } + } + } + + // Check WooCommerce product gallery. + if ( class_exists( 'WooCommerce' ) ) { + $woo_images = get_post_meta( $post->ID, '_product_image_gallery', true ); + if ( ! empty( $woo_images ) ) { + $woo_images = array_filter( explode( ',', $woo_images ) ); + if ( is_array( $woo_images ) ) { + foreach ( $woo_images as $id ) { + $images[] = wp_get_attachment_url( $id ); + } + } + } + } + + $images = array_unique( $images ); + } + + /** + * Fetch the width and height for the specified image size. + * + * @param string $size The image size e.g. 'large', 'medium' etc. + * + * @since 2.4.3 + */ + private function get_dimensions_for_image_size( $size ) { + $sizes = get_intermediate_image_sizes(); + if ( ! in_array( $size, $sizes, true ) ) { + // our specified size does not exist in the registered sizes, so let's use the largest one available. + $size = end( $sizes ); + } + + if ( $size ) { + return array( + 'width' => get_option( "{$size}_size_w" ), + 'height' => get_option( "{$size}_size_h" ), + ); + } + return null; + } + + /** + * Parses the content to find out if specified images galleries exist and if they do, parse them for images. + * Supports NextGen. + * + * @param string $content The post content. + * + * @since 2.4.2 + * + * @return string + */ + public static function get_content_from_galleries( $content ) { + // Support for NextGen Gallery. + static $gallery_types = array( 'ngg_images' ); + $types = apply_filters( 'aioseop_gallery_shortcodes', $gallery_types ); + + $gallery_content = ''; + + if ( ! $types ) { + return $gallery_content; + } + + $found = array(); + if ( $types ) { + foreach ( $types as $type ) { + if ( has_shortcode( $content, $type ) ) { + $found[] = $type; + } + } + } + + // If none of the shortcodes-of-interest are found, bail. + if ( empty( $found ) ) { + return $gallery_content; + } + + $galleries = array(); + + if ( ! preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) { + return $gallery_content; + } + + // Collect the shortcodes and their attributes. + foreach ( $found as $type ) { + foreach ( $matches as $shortcode ) { + if ( $type === $shortcode[2] ) { + + $attributes = shortcode_parse_atts( $shortcode[3] ); + + if ( '' === $attributes ) { // Valid shortcode without any attributes. + $attributes = array(); + } + + $galleries[ $shortcode[2] ] = $attributes; + } + } + } + + // Recreate the shortcodes and then render them to get the HTML content. + if ( $galleries ) { + foreach ( $galleries as $shortcode => $attributes ) { + $code = '[' . $shortcode; + foreach ( $attributes as $key => $value ) { + $code .= " $key=$value"; + } + $code .= ']'; + $gallery_content .= do_shortcode( $code ); + } + } + + return $gallery_content; + } + + /** + * Parses the content of the post provided for images and galleries. + * + * @param WP_Post $post The post to parse. + * @return array + */ + public static function parse_content_for_images( WP_Post $post ) { + $images = array(); + $content = $post->post_content; + + self::get_gallery_images( $post, $images ); + + $content .= self::get_content_from_galleries( $content ); + + self::parse_dom_for_images( $content, $images ); + + return $images; + } + + /** + * Parse the post for images. + * + * @param string $content the post content. + * @param array $images the array of images. + * + * @return void + */ + public static function parse_dom_for_images( $content, &$images ) { + // These tags should be WITHOUT trailing space because some plugins such as the nextgen gallery put newlines immediately after loadHTML( $content ); + libxml_clear_errors(); + $dom->preserveWhiteSpace = false; + $matches = $dom->getElementsByTagName( 'img' ); + foreach ( $matches as $match ) { + $images[] = $match->getAttribute( 'src' ); + } + } else { + // Fall back to regex, but also report an error. + global $img_err_msg; + if ( ! isset( $img_err_msg ) ) { + // we will log this error message only once, not per post. + $img_err_msg = true; + aiosp_log( 'DOMDocument not found; using REGEX' ); + } + preg_match_all( '/get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $url ) ); + if ( $attachment && is_array( $attachment ) && is_numeric( $attachment[0] ) ) { + $attributes = array( + 'image:caption' => self::get_image_caption( $attachment[0] ), + 'image:title' => get_the_title( $attachment[0] ), + ); + } + return $attributes; + } + + /** + * Wrapper around `wp_get_attachment_caption` because it was introduced only in WP 4.6.0. + * + * @param int $attachment_id The attachment ID. + */ + public static function get_image_caption( $attachment_id ) { + global $wp_version; + if ( version_compare( $wp_version, '4.6.0', '<' ) ) { + $post_id = (int) $attachment_id; + if ( ! $post = get_post( $post_id ) ) { + return false; + } + + if ( 'attachment' !== $post->post_type ) { + return false; + } + + $caption = $post->post_excerpt; + return apply_filters( 'wp_get_attachment_caption', $caption, $post->ID ); + } + + return wp_get_attachment_caption( $attachment_id ); + } + + /** + * Cleans the URL so that its acceptable in the sitemap. + * + * @param string $url The image url. + * + * @since 2.4.1 + * + * @return string + */ + public static function clean_url( $url ) { + // remove the query string. + $url = strtok( $url, '?' ); + // make the url XML-safe. + $url = htmlspecialchars( $url ); + // Make the url absolute, if its relative. + $url = aiosp_common::absolutize_url( $url ); + return apply_filters( 'aioseop_clean_url', $url ); + } + + /** + * Validate the image. + * NOTE: We will use parse_url here instead of wp_parse_url as we will correct the URLs beforehand and + * this saves us the need to check PHP version support. + * + * @param string $image The image src. + * + * @since 2.4.1 + * @since 2.4.3 Compatibility with Pre v4.7 wp_parse_url(). + * + * @return bool + */ + public static function is_image_valid( $image ) { + global $wp_version; + + // Bail if empty image. + if ( empty( $image ) ) { + return false; + } + + global $wp_version; + if ( version_compare( $wp_version, '4.4', '<' ) ) { + $p_url = parse_url( $image ); + $url = $p_url['scheme'] . $p_url['host'] . $p_url['path']; + } elseif ( version_compare( $wp_version, '4.7', '<' ) ) { + // Compatability for older WP version that don't have 4.7 changes. + // @link https://core.trac.wordpress.org/changeset/38726 + $p_url = wp_parse_url( $image ); + $url = $p_url['scheme'] . $p_url['host'] . $p_url['path']; + } else { + $component = PHP_URL_PATH; + $url = wp_parse_url( $image, $component ); + } + + // make the url absolute, if its relative. + $image = aiosp_common::absolutize_url( $image ); + + $extn = pathinfo( parse_url( $image, PHP_URL_PATH ), PATHINFO_EXTENSION ); + $allowed = apply_filters( 'aioseop_allowed_image_extensions', self::$image_extensions ); + // Bail if image does not refer to an image file otherwise google webmaster tools might reject the sitemap. + if ( ! in_array( $extn, $allowed, true ) ) { + return false; + } + + $image_host = parse_url( $image, PHP_URL_HOST ); + $host = parse_url( home_url(), PHP_URL_HOST ); + + if ( $image_host !== $host ) { + // Allowed hosts will be provided in a wildcard format i.e. img.yahoo.* or *.akamai.*. + // And we will convert that into a regular expression for matching. + $whitelist = apply_filters( 'aioseop_images_allowed_from_hosts', array() ); + $allowed = false; + if ( $whitelist ) { + foreach ( $whitelist as $pattern ) { + if ( preg_match( '/' . str_replace( '*', '.*', $pattern ) . '/', $image_host ) === 1 ) { + $allowed = true; + break; + } + } + } + return $allowed; + + } + return true; + } + /** * Check whether a url is valid. * diff --git a/modules/aioseop_opengraph.php b/modules/aioseop_opengraph.php index 1acc243c3..12460aadc 100644 --- a/modules/aioseop_opengraph.php +++ b/modules/aioseop_opengraph.php @@ -1,1742 +1,1742 @@ -name = __( 'Social Meta', 'all-in-one-seo-pack' ); // Human-readable name of the plugin - $this->prefix = 'aiosp_opengraph_'; // option prefix - $this->file = __FILE__; // the current file - $this->fb_object_types = array( - 'Activities' => array( - 'activity' => __( 'Activity', 'all-in-one-seo-pack' ), - 'sport' => __( 'Sport', 'all-in-one-seo-pack' ), - ), - 'Businesses' => array( - 'bar' => __( 'Bar', 'all-in-one-seo-pack' ), - 'company' => __( 'Company', 'all-in-one-seo-pack' ), - 'cafe' => __( 'Cafe', 'all-in-one-seo-pack' ), - 'hotel' => __( 'Hotel', 'all-in-one-seo-pack' ), - 'restaurant' => __( 'Restaurant', 'all-in-one-seo-pack' ), - ), - 'Groups' => array( - 'cause' => __( 'Cause', 'all-in-one-seo-pack' ), - 'sports_league' => __( 'Sports League', 'all-in-one-seo-pack' ), - 'sports_team' => __( 'Sports Team', 'all-in-one-seo-pack' ), - ), - 'Organizations' => array( - 'band' => __( 'Band', 'all-in-one-seo-pack' ), - 'government' => __( 'Government', 'all-in-one-seo-pack' ), - 'non_profit' => __( 'Non Profit', 'all-in-one-seo-pack' ), - 'school' => __( 'School', 'all-in-one-seo-pack' ), - 'university' => __( 'University', 'all-in-one-seo-pack' ), - ), - 'People' => array( - 'actor' => __( 'Actor', 'all-in-one-seo-pack' ), - 'athlete' => __( 'Athlete', 'all-in-one-seo-pack' ), - 'author' => __( 'Author', 'all-in-one-seo-pack' ), - 'director' => __( 'Director', 'all-in-one-seo-pack' ), - 'musician' => __( 'Musician', 'all-in-one-seo-pack' ), - 'politician' => __( 'Politician', 'all-in-one-seo-pack' ), - 'profile' => __( 'Profile', 'all-in-one-seo-pack' ), - 'public_figure' => __( 'Public Figure', 'all-in-one-seo-pack' ), - ), - 'Places' => array( - 'city' => __( 'City', 'all-in-one-seo-pack' ), - 'country' => __( 'Country', 'all-in-one-seo-pack' ), - 'landmark' => __( 'Landmark', 'all-in-one-seo-pack' ), - 'state_province' => __( 'State Province', 'all-in-one-seo-pack' ), - ), - 'Products and Entertainment' => array( - 'album' => __( 'Album', 'all-in-one-seo-pack' ), - 'book' => __( 'Book', 'all-in-one-seo-pack' ), - 'drink' => __( 'Drink', 'all-in-one-seo-pack' ), - 'food' => __( 'Food', 'all-in-one-seo-pack' ), - 'game' => __( 'Game', 'all-in-one-seo-pack' ), - 'movie' => __( 'Movie', 'all-in-one-seo-pack' ), - 'product' => __( 'Product', 'all-in-one-seo-pack' ), - 'song' => __( 'Song', 'all-in-one-seo-pack' ), - 'tv_show' => __( 'TV Show', 'all-in-one-seo-pack' ), - 'episode' => __( 'Episode', 'all-in-one-seo-pack' ), - ), - 'Websites' => array( - 'article' => __( 'Article', 'all-in-one-seo-pack' ), - 'blog' => __( 'Blog', 'all-in-one-seo-pack' ), - 'website' => __( 'Website', 'all-in-one-seo-pack' ), - ), - ); - parent::__construct(); - - $this->help_text = array( - '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' ), - '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' ), - 'appid' => __( 'Enter your Facebook App ID here. Information about how to get your Facebook App ID can be found at https://developers.facebook.com/docs/apps/register', 'all-in-one-seo-pack' ), - 'title_shortcodes' => __( 'Run shortcodes that appear in social title meta tags.', 'all-in-one-seo-pack' ), - 'description_shortcodes' => __( 'Run shortcodes that appear in social description meta tags.', 'all-in-one-seo-pack' ), - 'sitename' => __( 'The Site Name is the name that is used to identify your website.', 'all-in-one-seo-pack' ), - 'hometitle' => __( 'The Home Title is the Open Graph title for your home page.', 'all-in-one-seo-pack' ), - 'description' => __( 'The Home Description is the Open Graph description for your home page.', 'all-in-one-seo-pack' ), - 'homeimage' => __( 'The Home Image is the Open Graph image for your home page.', 'all-in-one-seo-pack' ), - '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' ), - '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' ), - 'fallback' => __( 'This option lets you fall back to the default image if no image could be found above.', 'all-in-one-seo-pack' ), - 'dimg' => __( 'This option sets a default image that can be used for the Open Graph image. You can upload an image, select an image from your Media Library or paste the URL of an image here.', 'all-in-one-seo-pack' ), - 'dimgwidth' => __( 'This option lets you set a default width for your images, where unspecified.', 'all-in-one-seo-pack' ), - 'dimgheight' => __( 'This option lets you set a default height for your images, where unspecified.', 'all-in-one-seo-pack' ), - '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' ), - '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' ), - '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' ), - 'imagewidth' => __( 'Enter the width for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ), - 'imageheight' => __( 'Enter the height for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ), - 'video' => __( 'This option lets you specify a link to the Open Graph video used on this Page or Post.', 'all-in-one-seo-pack' ), - 'videowidth' => __( 'Enter the width for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ), - 'videoheight' => __( 'Enter the height for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ), - 'defcard' => __( 'Select the default type of Twitter Card to display.', 'all-in-one-seo-pack' ), - 'setcard' => __( 'Select the Twitter Card type to use for this Page or Post, overriding the default setting.', 'all-in-one-seo-pack' ), - 'twitter_site' => __( 'Enter the Twitter username associated with your website here.', 'all-in-one-seo-pack' ), - 'twitter_creator' => __( 'Allows your authors to be identified by their Twitter usernames as content creators on the Twitter cards for their posts.', 'all-in-one-seo-pack' ), - 'twitter_domain' => __( 'Enter the name of your website here.', 'all-in-one-seo-pack' ), - 'customimg_twitter' => __( 'This option lets you upload an image to use as the Twitter image for this Page or Post.', 'all-in-one-seo-pack' ), - 'gen_tags' => __( 'Automatically generate article tags for Facebook type article when not provided.', 'all-in-one-seo-pack' ), - 'gen_keywords' => __( 'Use keywords in generated article tags.', 'all-in-one-seo-pack' ), - 'gen_categories' => __( 'Use categories in generated article tags.', 'all-in-one-seo-pack' ), - 'gen_post_tags' => __( 'Use post tags in generated article tags.', 'all-in-one-seo-pack' ), - 'types' => __( 'Select which Post Types you want to use All in One SEO Pack to set Open Graph meta values for.', 'all-in-one-seo-pack' ), - 'title' => __( 'This is the Open Graph title of this Page or Post.', 'all-in-one-seo-pack' ), - 'desc' => __( 'This is the Open Graph description of this Page or Post.', 'all-in-one-seo-pack' ), - 'category' => __( 'Select the Open Graph type that best describes the content of this Page or Post.', 'all-in-one-seo-pack' ), - 'facebook_debug' => __( 'Press this button to have Facebook re-fetch and debug this page.', 'all-in-one-seo-pack' ), - 'section' => __( 'This Open Graph meta allows you to add a general section name that best describes this content.', 'all-in-one-seo-pack' ), - 'tag' => __( 'This Open Graph meta allows you to add a list of keywords that best describe this content.', 'all-in-one-seo-pack' ), - 'facebook_publisher' => __( 'Link articles to the Facebook page associated with your website.', 'all-in-one-seo-pack' ), - 'facebook_author' => __( 'Allows your authors to be identified by their Facebook pages as content authors on the Opengraph meta for their articles.', 'all-in-one-seo-pack' ), - 'person_or_org' => __( 'Are the social profile links for your website for a person or an organization?', 'all-in-one-seo-pack' ), - 'profile_links' => __( "Add URLs for your website's social profiles here (Facebook, Twitter, Google+, Instagram, LinkedIn), one per line.", 'all-in-one-seo-pack' ), - 'social_name' => __( 'Add the name of the person or organization who owns these profiles.', 'all-in-one-seo-pack' ), - ); - - $this->help_anchors = array( - 'title_shortcodes' => '#run-shortcodes-in-title', - 'description_shortcodes' => '#run-shortcodes-in-description', - 'generate_descriptions' => '#auto-generate-og-descriptions', - 'setmeta' => '#use-aioseo-title-and-description', - 'sitename' => '#site-name', - 'hometitle' => '#home-title-and-description', - 'description' => '#home-title-and-description', - 'homeimage' => '#home-image', - 'defimg' => '#select-og-image-source', - 'fallback' => '#use-default-if-no-image-found', - 'dimg' => '#default-og-image', - 'dimgwidth' => '#default-image-width', - 'dimgheight' => '#default-image-height', - 'meta_key' => '#use-custom-field-for-image', - 'profile_links' => '#social-profile-links', - 'person_or_org' => '#social-profile-links', - 'social_name' => '#social-profile-links', - 'key' => '#facebook-admin-id', - 'appid' => '#facebook-app-id', - 'gen_tags' => '#automatically-generate-article-tags', - 'gen_keywords' => '#use-keywords-in-article-tags', - 'gen_categories' => '#use-categories-in-article-tags', - 'gen_post_tags' => '#use-post-tags-in-article-tags', - 'facebook_publisher' => '#show-facebook-publisher-on-articles', - 'facebook_author' => '#show-facebook-author-on-articles', - 'types' => '#enable-facebook-meta-for', - 'defcard' => '#default-twitter-card', - 'twitter_site' => '#twitter-site', - 'twitter_creator' => '#show-twitter-author', - 'twitter_domain' => '#twitter-domain', - 'scan_header' => '#scan-social-meta', - 'title' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#title', - 'desc' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#description', - 'image' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#image', - 'customimg' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-image', - 'imagewidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height', - 'imageheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height', - 'video' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-video', - 'videowidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height', - 'videoheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height', - 'category' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-object-type', - 'facebook_debug' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-debug', - 'section' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-section', - 'tag' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-tags', - 'setcard' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#twitter-card-type', - 'customimg_twitter' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-twitter-image', - ); - - if ( is_admin() ) { - add_action( 'admin_init', array( $this, 'admin_init' ), 5 ); - } else { - add_action( 'wp', array( $this, 'type_setup' ) ); - } - - if ( ! is_admin() || defined( 'DOING_AJAX' ) ) { - $this->do_opengraph(); - } - // Set variables after WordPress load. - add_action( 'init', array( &$this, 'init' ), 999999 ); - add_filter( 'jetpack_enable_open_graph', '__return_false' ); // Avoid having duplicate meta tags - // Force refresh of Facebook cache. - add_action( 'post_updated', array( &$this, 'force_fb_refresh_update' ), 10, 3 ); - add_action( 'transition_post_status', array( &$this, 'force_fb_refresh_transition' ), 10, 3 ); - add_action( 'edited_term', array( &$this, 'save_tax_data' ), 10, 3 ); - // Adds special filters - add_filter( 'aioseop_opengraph_placeholder', array( &$this, 'filter_placeholder' ) ); - // Call to init to generate menus - $this->init(); - } - - /** - * Hook called after WordPress has been loaded. - * - * @since 2.4.14 - */ - public function init() { - $count_desc = __( ' characters. Open Graph allows up to a maximum of %1$s chars for the %2$s.', 'all-in-one-seo-pack' ); - // Create default options - $this->default_options = array( - 'scan_header' => array( - 'name' => __( 'Scan Header', 'all-in-one-seo-pack' ), - 'type' => 'custom', - 'save' => true, - ), - 'setmeta' => array( - 'name' => __( 'Use AIOSEO Title and Description', 'all-in-one-seo-pack' ), - 'type' => 'checkbox', - ), - 'key' => array( - 'name' => __( 'Facebook Admin ID', 'all-in-one-seo-pack' ), - 'default' => '', - 'type' => 'text', - ), - 'appid' => array( - 'name' => __( 'Facebook App ID', 'all-in-one-seo-pack' ), - 'default' => '', - 'type' => 'text', - ), - 'title_shortcodes' => array( - 'name' => __( 'Run Shortcodes In Title', 'all-in-one-seo-pack' ), - ), - 'description_shortcodes' => array( - 'name' => __( 'Run Shortcodes In Description', 'all-in-one-seo-pack' ), - ), - 'sitename' => array( - 'name' => __( 'Site Name', 'all-in-one-seo-pack' ), - 'default' => get_bloginfo( 'name' ), - 'type' => 'text', - ), - 'hometitle' => array( - 'name' => __( 'Home Title', 'all-in-one-seo-pack' ), - 'default' => '', - 'type' => 'textarea', - 'condshow' => array( - 'aiosp_opengraph_setmeta' => array( - 'lhs' => 'aiosp_opengraph_setmeta', - 'op' => '!=', - 'rhs' => 'on', - ), - ), - ), - 'description' => array( - 'name' => __( 'Home Description', 'all-in-one-seo-pack' ), - 'default' => '', - 'type' => 'textarea', - 'condshow' => array( - 'aiosp_opengraph_setmeta' => array( - 'lhs' => 'aiosp_opengraph_setmeta', - 'op' => '!=', - 'rhs' => 'on', - ), - ), - ), - 'homeimage' => array( - 'name' => __( 'Home Image', 'all-in-one-seo-pack' ), - 'type' => 'image', - ), - 'generate_descriptions' => array( - 'name' => __( 'Use Content For Autogenerated OG Descriptions', 'all-in-one-seo-pack' ), - 'default' => 0, - ), - 'defimg' => array( - 'name' => __( 'Select OG:Image Source', 'all-in-one-seo-pack' ), - 'type' => 'select', - 'initial_options' => array( - '' => __( 'Default Image' ), - 'featured' => __( 'Featured Image' ), - 'attach' => __( 'First Attached Image' ), - 'content' => __( 'First Image In Content' ), - 'custom' => __( 'Image From Custom Field' ), - 'author' => __( 'Post Author Image' ), - 'auto' => __( 'First Available Image' ), - ), - ), - 'fallback' => array( - 'name' => __( 'Use Default If No Image Found', 'all-in-one-seo-pack' ), - 'type' => 'checkbox', - ), - 'dimg' => array( - 'name' => __( 'Default OG:Image', 'all-in-one-seo-pack' ), - 'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png', - 'type' => 'image', - ), - 'dimgwidth' => array( - 'name' => __( 'Default Image Width', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'dimgheight' => array( - 'name' => __( 'Default Image Height', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'meta_key' => array( - 'name' => __( 'Use Custom Field For Image', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'image' => array( - 'name' => __( 'Image', 'all-in-one-seo-pack' ), - 'type' => 'radio', - 'initial_options' => array( - 0 => '', - ), - ), - 'customimg' => array( - 'name' => __( 'Custom Image', 'all-in-one-seo-pack' ), - 'type' => 'image', - ), - 'imagewidth' => array( - 'name' => __( 'Specify Image Width', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'imageheight' => array( - 'name' => __( 'Specify Image Height', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'video' => array( - 'name' => __( 'Custom Video', 'all-in-one-seo-pack' ), - 'type' => 'text', - ), - 'videowidth' => array( - 'name' => __( 'Specify Video Width', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - 'condshow' => array( - 'aioseop_opengraph_settings_video' => array( - 'lhs' => 'aioseop_opengraph_settings_video', - 'op' => '!=', - 'rhs' => '', - ), - ), - ), - 'videoheight' => array( - 'name' => __( 'Specify Video Height', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - 'condshow' => array( - 'aioseop_opengraph_settings_video' => array( - 'lhs' => 'aioseop_opengraph_settings_video', - 'op' => '!=', - 'rhs' => '', - ), - ), - ), - 'defcard' => array( - 'name' => __( 'Default Twitter Card', 'all-in-one-seo-pack' ), - 'type' => 'select', - 'default' => 'summary', - 'initial_options' => array( - 'summary' => __( 'Summary', 'all-in-one-seo-pack' ), - 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ), - - /* - REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE - 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) - */ - ), - ), - 'setcard' => array( - 'name' => __( 'Twitter Card Type', 'all-in-one-seo-pack' ), - 'type' => 'select', - 'initial_options' => array( - 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ), - 'summary' => __( 'Summary', 'all-in-one-seo-pack' ), - - /* - REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE - 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) - */ - ), - ), - 'twitter_site' => array( - 'name' => __( 'Twitter Site', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'twitter_creator' => array( - 'name' => __( 'Show Twitter Author', 'all-in-one-seo-pack' ), - ), - 'twitter_domain' => array( - 'name' => __( 'Twitter Domain', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'customimg_twitter' => array( - 'name' => __( 'Custom Twitter Image', 'all-in-one-seo-pack' ), - 'type' => 'image', - ), - 'gen_tags' => array( - 'name' => __( 'Automatically Generate Article Tags', 'all-in-one-seo-pack' ), - ), - 'gen_keywords' => array( - 'name' => __( 'Use Keywords In Article Tags', 'all-in-one-seo-pack' ), - 'default' => 'on', - 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), - ), - 'gen_categories' => array( - 'name' => __( 'Use Categories In Article Tags', 'all-in-one-seo-pack' ), - 'default' => 'on', - 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), - ), - 'gen_post_tags' => array( - 'name' => __( 'Use Post Tags In Article Tags', 'all-in-one-seo-pack' ), - 'default' => 'on', - 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), - ), - 'types' => array( - 'name' => __( 'Enable Facebook Meta for Post Types', 'all-in-one-seo-pack' ), - 'type' => 'multicheckbox', - 'default' => array( 'post' => 'post', 'page' => 'page' ), - 'initial_options' => $this->get_post_type_titles( array( '_builtin' => false ) ), - ), - 'title' => array( - 'name' => __( 'Title', 'all-in-one-seo-pack' ), - 'default' => '', - 'type' => 'text', - 'size' => 95, - 'count' => 1, - 'count_desc' => $count_desc, - ), - 'desc' => array( - 'name' => __( 'Description', 'all-in-one-seo-pack' ), - 'default' => '', - 'type' => 'textarea', - 'cols' => 250, - 'rows' => 4, - 'count' => 1, - 'count_desc' => $count_desc, - ), - 'category' => array( - 'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ), - 'type' => 'select', - 'style' => '', - 'default' => '', - 'initial_options' => $this->fb_object_types, - ), - 'facebook_debug' => array( - 'name' => __( 'Facebook Debug', 'all-in-one-seo-pack' ), - 'type' => 'html', - 'save' => false, - 'default' => $this->get_facebook_debug(), - ), - 'section' => array( - 'name' => __( 'Article Section', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ), - ), - 'tag' => array( - 'name' => __( 'Article Tags', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ), - ), - 'facebook_publisher' => array( - 'name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - 'facebook_author' => array( - 'name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' ), - ), - 'profile_links' => array( - 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), - 'type' => 'textarea', - 'cols' => 60, - 'rows' => 5, - ), - 'person_or_org' => array( - 'name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ), - 'type' => 'radio', - 'initial_options' => array( - 'person' => __( 'Person', 'all-in-one-seo-pack' ), - 'org' => __( 'Organization', 'all-in-one-seo-pack' ), - ), - ), - 'social_name' => array( - 'name' => __( 'Associated Name', 'all-in-one-seo-pack' ), - 'type' => 'text', - 'default' => '', - ), - ); - // load initial options / set defaults - $this->update_options(); - $display = array(); - if ( isset( $this->options['aiosp_opengraph_types'] ) && ! empty( $this->options['aiosp_opengraph_types'] ) ) { - $display = $this->options['aiosp_opengraph_types']; - } - $this->locations = array( - 'opengraph' => array( - 'name' => $this->name, - 'prefix' => 'aiosp_', - 'type' => 'settings', - 'options' => array( - 'scan_header', - 'setmeta', - 'key', - 'appid', - 'sitename', - 'title_shortcodes', - 'description_shortcodes', - 'hometitle', - 'description', - 'homeimage', - 'generate_descriptions', - 'defimg', - 'fallback', - 'dimg', - 'dimgwidth', - 'dimgheight', - 'meta_key', - 'defcard', - 'profile_links', - 'person_or_org', - 'social_name', - 'twitter_site', - 'twitter_creator', - 'twitter_domain', - 'gen_tags', - 'gen_keywords', - 'gen_categories', - 'gen_post_tags', - 'types', - 'facebook_publisher', - 'facebook_author', - ), - ), - 'settings' => array( - 'name' => __( 'Social Settings', 'all-in-one-seo-pack' ), - 'type' => 'metabox', - 'help_link' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/', - 'options' => array( - 'title', - 'desc', - 'image', - 'customimg', - 'imagewidth', - 'imageheight', - 'video', - 'videowidth', - 'videoheight', - 'category', - 'facebook_debug', - 'section', - 'tag', - 'setcard', - 'customimg_twitter', - ), - 'display' => apply_filters( 'aioseop_opengraph_display', $display ), - 'prefix' => 'aioseop_opengraph_', - ), - ); - $this->layout = array( - 'home' => array( - 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#use-aioseo-title-and-description', - 'options' => array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage' ), - ), - 'image' => array( - 'name' => __( 'Image Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#select-og-image-source', - 'options' => array( 'defimg', 'fallback', 'dimg', 'dimgwidth', 'dimgheight', 'meta_key' ), - ), - 'links' => array( - 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#social-profile-links', - 'options' => array( 'profile_links', 'person_or_org', 'social_name' ), - ), - 'facebook' => array( - 'name' => __( 'Facebook Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#facebook-settings', - 'options' => array( - 'key', - 'appid', - 'types', - 'gen_tags', - 'gen_keywords', - 'gen_categories', - 'gen_post_tags', - 'facebook_publisher', - 'facebook_author', - ), - ), - 'twitter' => array( - 'name' => __( 'Twitter Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#default-twitter-card', - 'options' => array( 'defcard', 'setcard', 'twitter_site', 'twitter_creator', 'twitter_domain' ), - ), - 'default' => array( - 'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/', - 'options' => array(), // this is set below, to the remaining options -- pdb - ), - 'scan_meta' => array( - 'name' => __( 'Scan Social Meta', 'all-in-one-seo-pack' ), - 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#scan_meta', - 'options' => array( 'scan_header' ), - ), - ); - $other_options = array(); - foreach ( $this->layout as $k => $v ) { - $other_options = array_merge( $other_options, $v['options'] ); - } - - $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options ); - } - - /** - * Forces FaceBook OpenGraph to refresh its cache when a post is changed to - * - * @param $new_status - * @param $old_status - * @param $post - * - * @todo this and force_fb_refresh_update can probably have the remote POST extracted out. - * - * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update - * @since 2.3.11 - */ - function force_fb_refresh_transition( $new_status, $old_status, $post ) { - if ( 'publish' !== $new_status ) { - return; - } - if ( 'future' !== $old_status ) { - return; - } - - $current_post_type = get_post_type(); - - // Only ping Facebook if Social SEO is enabled on this post type. - if ( $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) { - $post_url = aioseop_get_permalink( $post->ID ); - $endpoint = sprintf( - 'https://graph.facebook.com/?%s', http_build_query( - array( - 'id' => $post_url, - 'scrape' => true, - ) - ) - ); - wp_remote_post( $endpoint, array( 'blocking' => false ) ); - } - } - - /** - * Forces FaceBook OpenGraph refresh on update. - * - * @param $post_id - * @param $post_after - * - * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update - * @since 2.3.11 - */ - function force_fb_refresh_update( $post_id, $post_after ) { - - $current_post_type = get_post_type(); - - // Only ping Facebook if Social SEO is enabled on this post type. - if ( 'publish' === $post_after->post_status && $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) { - $post_url = aioseop_get_permalink( $post_id ); - $endpoint = sprintf( - 'https://graph.facebook.com/?%s', http_build_query( - array( - 'id' => $post_url, - 'scrape' => true, - ) - ) - ); - wp_remote_post( $endpoint, array( 'blocking' => false ) ); - } - } - - function settings_page_init() { - add_filter( 'aiosp_output_option', array( $this, 'display_custom_options' ), 10, 2 ); - } - - function filter_options( $options, $location ) { - if ( $location == 'settings' ) { - $prefix = $this->get_prefix( $location ) . $location . '_'; - list( $legacy, $images ) = $this->get_all_images( $options ); - if ( isset( $options ) && isset( $options["{$prefix}image"] ) ) { - $thumbnail = $options["{$prefix}image"]; - if ( ctype_digit( (string) $thumbnail ) || ( $thumbnail == 'post' ) ) { - if ( $thumbnail == 'post' ) { - $thumbnail = $images['post1']; - } elseif ( ! empty( $legacy[ $thumbnail ] ) ) { - $thumbnail = $legacy[ $thumbnail ]; - } - } - $options["{$prefix}image"] = $thumbnail; - } - if ( empty( $options[ $prefix . 'image' ] ) ) { - $img = array_keys( $images ); - if ( ! empty( $img ) && ! empty( $img[1] ) ) { - $options[ $prefix . 'image' ] = $img[1]; - } - } - } - - return $options; - } - - /** - * Applies filter to module settings. - * - * @since 2.3.11 - * @since 2.4.14 Added filter for description and title placeholders. - * @since 2.3.15 do_shortcode on description. - * - * @see [plugin]\admin\aioseop_module_class.php > display_options() - */ - function filter_settings( $settings, $location, $current ) { - global $aiosp, $post; - if ( $location == 'opengraph' || $location == 'settings' ) { - $prefix = $this->get_prefix( $location ) . $location . '_'; - if ( $location == 'opengraph' ) { - return $settings; - } - if ( $location == 'settings' ) { - list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current ); - $opts = array( 'title', 'desc' ); - $current_post_type = get_post_type(); - if ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) { - $flat_type_list = array(); - foreach ( $this->fb_object_types as $k => $v ) { - if ( is_array( $v ) ) { - $flat_type_list = array_merge( $flat_type_list, $v ); - } else { - $flat_type_list[ $k ] = $v; - } - } - $settings[ $prefix . 'category' ]['initial_options'] = array_merge( - array( - $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] => __( 'Default ', 'all-in-one-seo-pack' ) . ' - ' - . $flat_type_list[ $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ], - ), - $settings[ $prefix . 'category' ]['initial_options'] - ); - } - if ( isset( $this->options['aiosp_opengraph_defcard'] ) ) { - $settings[ $prefix . 'setcard' ]['default'] = $this->options['aiosp_opengraph_defcard']; - } - $info = $aiosp->get_page_snippet_info(); - $title = $info['title']; - $description = $info['description']; - - // Description options - if ( is_object( $post ) ) { - // Always show excerpt - $description = empty( $this->options['aiosp_opengraph_generate_descriptions'] ) - ? $aiosp->trim_excerpt_without_filters( - $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ), - 1000 - ) - : $aiosp->trim_excerpt_without_filters( - $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), - 1000 - ); - } - - // #1308 - we want to make sure we are ignoring php version only in the admin area while editing the post, so that it does not impact #932. - $screen = get_current_screen(); - $ignore_php_version = is_admin() && isset( $screen->id ) && 'post' == $screen->id; - - // Add filters - $description = apply_filters( 'aioseop_description', $description, false, $ignore_php_version ); - // Add placholders - $settings[ "{$prefix}title" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $title ); - $settings[ "{$prefix}desc" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $description ); - } - if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) { - foreach ( $opts as $opt ) { - if ( isset( $settings[ $prefix . $opt ] ) ) { - $settings[ $prefix . $opt ]['type'] = 'hidden'; - $settings[ $prefix . $opt ]['label'] = 'none'; - $settings[ $prefix . $opt ]['help_text'] = ''; - unset( $settings[ $prefix . $opt ]['count'] ); - } - } - } - } - - return $settings; - } - - /** - * Applies filter to module options. - * These will display in the "Social Settings" object tab. - * filter:{prefix}override_options - * - * @since 2.3.11 - * @since 2.4.14 Overrides empty og:type values. - * - * @see [plugin]\admin\aioseop_module_class.php > display_options() - * - * @global array $aioseop_options Plugin options. - * - * @param array $options Current options. - * @param string $location Location where filter is called. - * @param array $settings Settings. - * - * @return array - */ - function override_options( $options, $location, $settings ) { - global $aioseop_options; - // Prepare default and prefix - $prefix = $this->get_prefix( $location ) . $location . '_'; - $opts = array(); - - foreach ( $settings as $k => $v ) { - if ( $v['save'] ) { - $opts[ $k ] = $v['default']; - } - } - foreach ( $options as $k => $v ) { - switch ( $k ) { - case $prefix . 'category': - if ( empty( $v ) ) { - // Get post type - $type = isset( get_current_screen()->post_type ) - ? get_current_screen()->post_type - : null; - // Assign default from plugin options - if ( ! empty( $type ) - && isset( $aioseop_options['modules'] ) - && isset( $aioseop_options['modules']['aiosp_opengraph_options'] ) - && isset( $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ] ) - ) { - $options[ $prefix . 'category' ] = - $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ]; - } - continue; - } - break; - } - if ( $v === null ) { - unset( $options[ $k ] ); - } - } - $options = wp_parse_args( $options, $opts ); - - return $options; - } - - /** - * Applies filter to metabox settings before they are saved. - * Sets custom as default if a custom image is uploaded. - * filter:{prefix}filter_metabox_options - * filter:{prefix}filter_term_metabox_options - * - * @since 2.3.11 - * @since 2.4.14 Fixes for aioseop-pro #67 and other bugs found. - * - * @see [plugin]\admin\aioseop_module_class.php > save_post_data() - * @see [this file] > save_tax_data() - * - * @param array $options List of current options. - * @param string $location Location where filter is called. - * @param int $id Either post_id or term_id. - * - * @return array - */ - function filter_metabox_options( $options, $location, $post_id ) { - if ( $location == 'settings' ) { - $prefix = $this->get_prefix( $location ) . $location . '_'; - if ( isset( $options[ $prefix . 'customimg_checker' ] ) - && $options[ $prefix . 'customimg_checker' ] - ) { - $options[ $prefix . 'image' ] = $options[ $prefix . 'customimg' ]; - } - } - return $options; - } - - /** Custom settings **/ - function display_custom_options( $buf, $args ) { - if ( $args['name'] == 'aiosp_opengraph_scan_header' ) { - $buf .= '
    '; - $args['options']['type'] = 'submit'; - $args['attr'] = " class='button-primary' "; - $args['value'] = $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' ); - $buf .= __( 'Scan your site for duplicate social meta tags.', 'all-in-one-seo-pack' ); - $buf .= '

    ' . $this->get_option_html( $args ); - $buf .= '
    '; - } - - return $buf; - } - - function add_attributes( $output ) { - // avoid having duplicate meta tags - $type = $this->type; - if ( empty( $type ) ) { - $type = 'website'; - } - - $schema_types = array( - 'album' => 'MusicAlbum', - 'article' => 'Article', - 'bar' => 'BarOrPub', - 'blog' => 'Blog', - 'book' => 'Book', - 'cafe' => 'CafeOrCoffeeShop', - 'city' => 'City', - 'country' => 'Country', - 'episode' => 'Episode', - 'food' => 'FoodEvent', - 'game' => 'Game', - 'hotel' => 'Hotel', - 'landmark' => 'LandmarksOrHistoricalBuildings', - 'movie' => 'Movie', - 'product' => 'Product', - 'profile' => 'ProfilePage', - 'restaurant' => 'Restaurant', - 'school' => 'School', - 'sport' => 'SportsEvent', - 'website' => 'WebSite', - ); - - if ( ! empty( $schema_types[ $type ] ) ) { - $type = $schema_types[ $type ]; - } else { - $type = 'WebSite'; - } - - $attributes = apply_filters( - $this->prefix . 'attributes', array( - 'prefix="og: http://ogp.me/ns#"', - ) - ); - - foreach ( $attributes as $attr ) { - if ( strpos( $output, $attr ) === false ) { - $output .= "\n\t$attr "; - } - } - - return $output; - } - - /** - * Add our social meta. - * - * @since 1.0.0 - * @since 2.3.11.5 Support for multiple fb_admins. - * @since 2.3.13 Adds filter:aioseop_description on description. - * @since 2.4.14 Fixes for aioseop-pro #67. - * @since 2.3.15 Always do_shortcode on descriptions, removed for titles. - * - * @global object $post Current WP_Post object. - * @global object $aiosp All in one seo plugin object. - * @global array $aioseop_options All in one seo plugin options. - * @global object $wp_query WP_Query global instance. - */ - function add_meta() { - global $post, $aiosp, $aioseop_options, $wp_query; - $metabox = $this->get_current_options( array(), 'settings' ); - $key = $this->options['aiosp_opengraph_key']; - $dimg = $this->options['aiosp_opengraph_dimg']; - $current_post_type = get_post_type(); - $title = $description = $image = $video = ''; - $type = $this->type; - $sitename = $this->options['aiosp_opengraph_sitename']; - - $appid = isset( $this->options['aiosp_opengraph_appid'] ) ? $this->options['aiosp_opengraph_appid'] : ''; - - if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) { - $first_page = false; - if ( $aiosp->get_page_number() < 2 ) { - $first_page = true; - } - } else { - $first_page = true; - } - $url = $aiosp->aiosp_mrt_get_url( $wp_query ); - $url = apply_filters( 'aioseop_canonical_url', $url ); - - $setmeta = $this->options['aiosp_opengraph_setmeta']; - $social_links = ''; - if ( is_front_page() ) { - $title = $this->options['aiosp_opengraph_hometitle']; - if ( $first_page ) { - $description = $this->options['aiosp_opengraph_description']; - if ( empty( $description ) ) { - $description = get_bloginfo( 'description' ); - } - } - if ( ! empty( $this->options['aiosp_opengraph_homeimage'] ) ) { - $thumbnail = $this->options['aiosp_opengraph_homeimage']; - } else { - $thumbnail = $this->options['aiosp_opengraph_dimg']; - } - - /* If Use AIOSEO Title and Desc Selected */ - if ( $setmeta ) { - $title = $aiosp->wp_title(); - if ( $first_page ) { - $description = $aiosp->get_aioseop_description( $post ); - } - } - - /* Add some defaults */ - if ( empty( $title ) ) { - $title = get_bloginfo( 'name' ); - } - if ( empty( $sitename ) ) { - $sitename = get_bloginfo( 'name' ); - } - - if ( empty( $description ) && $first_page && ! empty( $post ) && ! post_password_required( $post ) ) { - - if ( ! empty( $post->post_content ) || ! empty( $post->post_excerpt ) ) { - $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ), 1000 ); - - if ( ! empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) { - $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 ); - } - } - } - - if ( empty( $description ) && $first_page ) { - $description = get_bloginfo( 'description' ); - } - if ( ! empty( $this->options['aiosp_opengraph_profile_links'] ) ) { - $social_links = $this->options['aiosp_opengraph_profile_links']; - if ( ! empty( $this->options['aiosp_opengraph_social_name'] ) ) { - $social_name = $this->options['aiosp_opengraph_social_name']; - } else { - $social_name = ''; - } - if ( $this->options['aiosp_opengraph_person_or_org'] == 'person' ) { - $social_type = 'Person'; - } else { - $social_type = 'Organization'; - } - } - } elseif ( is_singular() && $this->option_isset( 'types' ) - && is_array( $this->options['aiosp_opengraph_types'] ) - && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) - ) { - - if ( $type == 'article' ) { - if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) { - $section = $metabox['aioseop_opengraph_settings_section']; - } - if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) { - $tag = $metabox['aioseop_opengraph_settings_tag']; - } - if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) { - $publisher = $this->options['aiosp_opengraph_facebook_publisher']; - } - } - - if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { - $domain = $this->options['aiosp_opengraph_twitter_domain']; - } - - if ( $type == 'article' && ! empty( $post ) ) { - if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) { - $author = get_the_author_meta( 'facebook', $post->post_author ); - } - - if ( isset( $post->post_date_gmt ) ) { - $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date_gmt ) ); - } - - if ( isset( $post->post_modified_gmt ) ) { - $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified_gmt ) ); - } - } - - $image = $metabox['aioseop_opengraph_settings_image']; - $video = $metabox['aioseop_opengraph_settings_video']; - $title = $metabox['aioseop_opengraph_settings_title']; - $description = $metabox['aioseop_opengraph_settings_desc']; - - /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */ - global $aiosp; - if ( empty( $title ) ) { - $title = $aiosp->wp_title(); - } - if ( empty( $description ) ) { - $description = trim( strip_tags( get_post_meta( $post->ID, '_aioseop_description', true ) ) ); - } - - /* Add default title */ - if ( empty( $title ) ) { - $title = get_the_title(); - } - - // Add default description. - if ( empty( $description ) && ! post_password_required( $post ) ) { - - $description = $post->post_excerpt; - - if ( $this->options['aiosp_opengraph_generate_descriptions'] || empty( $description ) ) { - $description = $post->post_content; - } - } - if ( empty( $type ) ) { - $type = 'article'; - } - } elseif ( AIOSEOPPRO && ( is_category() || is_tag() || is_tax() ) ) { - if ( isset( $this->options['aioseop_opengraph_settings_category'] ) ) { - $type = $this->options['aioseop_opengraph_settings_category']; - } - if ( isset( $metabox['aioseop_opengraph_settings_category'] ) ) { - $type = $metabox['aioseop_opengraph_settings_category']; - } - if ( $type == 'article' ) { - if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) { - $section = $metabox['aioseop_opengraph_settings_section']; - } - if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) { - $tag = $metabox['aioseop_opengraph_settings_tag']; - } - if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) { - $publisher = $this->options['aiosp_opengraph_facebook_publisher']; - } - } - if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { - $domain = $this->options['aiosp_opengraph_twitter_domain']; - } - if ( $type == 'article' && ! empty( $post ) ) { - if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) { - $author = get_the_author_meta( 'facebook', $post->post_author ); - } - - if ( isset( $post->post_date_gmt ) ) { - $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date_gmt ) ); - } - if ( isset( $post->post_modified_gmt ) ) { - $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified_gmt ) ); - } - } - $image = $metabox['aioseop_opengraph_settings_image']; - $video = $metabox['aioseop_opengraph_settings_video']; - $title = $metabox['aioseop_opengraph_settings_title']; - $description = $metabox['aioseop_opengraph_settings_desc']; - /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */ - global $aiosp; - if ( empty( $title ) ) { - $title = $aiosp->wp_title(); - } - if ( empty( $description ) ) { - $term_id = isset( $_GET['tag_ID'] ) ? (int) $_GET['tag_ID'] : 0; - $term_id = $term_id ? $term_id : get_queried_object()->term_id; - $description = trim( strip_tags( get_term_meta( $term_id, '_aioseop_description', true ) ) ); - } - // Add default title - if ( empty( $title ) ) { - $title = get_the_title(); - } - // Add default description. - if ( empty( $description ) && ! post_password_required( $post ) ) { - $description = get_queried_object()->description; - } - if ( empty( $type ) ) { - $type = 'website'; - } - } elseif ( is_home() && ! is_front_page() ) { - // This is the blog page but not the homepage. - global $aiosp; - $image = $metabox['aioseop_opengraph_settings_image']; - $video = $metabox['aioseop_opengraph_settings_video']; - $title = $metabox['aioseop_opengraph_settings_title']; - $description = $metabox['aioseop_opengraph_settings_desc']; - - if ( empty( $description ) ) { - // If there's not social description, fall back to the SEO description. - $description = trim( strip_tags( get_post_meta( get_option( 'page_for_posts' ), '_aioseop_description', true ) ) ); - } - if ( empty( $title ) ) { - $title = $aiosp->wp_title(); - } - } else { - return; - } - - if ( $type === 'article' && ! empty( $post ) && is_singular() ) { - if ( ! empty( $this->options['aiosp_opengraph_gen_tags'] ) ) { - if ( ! empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) { - $keywords = $aiosp->get_main_keywords(); - $keywords = $this->apply_cf_fields( $keywords ); - $keywords = apply_filters( 'aioseop_keywords', $keywords ); - if ( ! empty( $keywords ) && ! empty( $tag ) ) { - $tag .= ',' . $keywords; - } elseif ( empty( $tag ) ) { - $tag = $keywords; - } - } - $tag = $aiosp->keyword_string_to_list( $tag ); - if ( ! empty( $this->options['aiosp_opengraph_gen_categories'] ) ) { - $tag = array_merge( $tag, $aiosp->get_all_categories( $post->ID ) ); - } - if ( ! empty( $this->options['aiosp_opengraph_gen_post_tags'] ) ) { - $tag = array_merge( $tag, $aiosp->get_all_tags( $post->ID ) ); - } - } - if ( ! empty( $tag ) ) { - $tag = $aiosp->clean_keyword_list( $tag ); - } - } - - if ( ! empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) { - $title = do_shortcode( $title ); - } - if ( ! empty( $description ) ) { - $description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) ); - if ( ! empty( $this->options['aiosp_opengraph_description_shortcodes'] ) ) { - $description = do_shortcode( $description ); - } - $description = $aiosp->trim_excerpt_without_filters( $description, 1000 ); - } - - $title = $this->apply_cf_fields( $title ); - $description = $this->apply_cf_fields( $description ); - - /* Data Validation */ - $title = strip_tags( esc_attr( $title ) ); - $sitename = strip_tags( esc_attr( $sitename ) ); - $description = strip_tags( esc_attr( $description ) ); - - if ( empty( $thumbnail ) && ! empty( $image ) ) { - $thumbnail = $image; - } - - // Add user supplied default image. - if ( empty( $thumbnail ) ) { - if ( empty( $this->options['aiosp_opengraph_defimg'] ) ) { - $thumbnail = $this->options['aiosp_opengraph_dimg']; - } else { - switch ( $this->options['aiosp_opengraph_defimg'] ) { - case 'featured': - $thumbnail = $this->get_the_image_by_post_thumbnail(); - break; - case 'attach': - $thumbnail = $this->get_the_image_by_attachment(); - break; - case 'content': - $thumbnail = $this->get_the_image_by_scan(); - break; - case 'custom': - $meta_key = $this->options['aiosp_opengraph_meta_key']; - if ( ! empty( $meta_key ) && ! empty( $post ) ) { - $meta_key = explode( ',', $meta_key ); - $thumbnail = $this->get_the_image_by_meta_key( - array( - 'post_id' => $post->ID, - 'meta_key' => $meta_key, - ) - ); - } - break; - case 'auto': - $thumbnail = $this->get_the_image(); - break; - case 'author': - $thumbnail = $this->get_the_image_by_author(); - break; - default: - $thumbnail = $this->options['aiosp_opengraph_dimg']; - } - } - } - - if ( ( empty( $thumbnail ) && ! empty( $this->options['aiosp_opengraph_fallback'] ) ) ) { - $thumbnail = $this->options['aiosp_opengraph_dimg']; - } - - if ( ! empty( $thumbnail ) ) { - $thumbnail = esc_url( $thumbnail ); - $thumbnail = set_url_scheme( $thumbnail ); - } - - $width = $height = ''; - if ( ! empty( $thumbnail ) ) { - if ( ! empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) ) { - $width = $metabox['aioseop_opengraph_settings_imagewidth']; - } - if ( ! empty( $metabox['aioseop_opengraph_settings_imageheight'] ) ) { - $height = $metabox['aioseop_opengraph_settings_imageheight']; - } - if ( empty( $width ) && ! empty( $this->options['aiosp_opengraph_dimgwidth'] ) ) { - $width = $this->options['aiosp_opengraph_dimgwidth']; - } - if ( empty( $height ) && ! empty( $this->options['aiosp_opengraph_dimgheight'] ) ) { - $height = $this->options['aiosp_opengraph_dimgheight']; - } - } - - if ( ! empty( $video ) ) { - if ( ! empty( $metabox['aioseop_opengraph_settings_videowidth'] ) ) { - $videowidth = $metabox['aioseop_opengraph_settings_videowidth']; - } - if ( ! empty( $metabox['aioseop_opengraph_settings_videoheight'] ) ) { - $videoheight = $metabox['aioseop_opengraph_settings_videoheight']; - } - } - - $card = 'summary'; - if ( ! empty( $this->options['aiosp_opengraph_defcard'] ) ) { - $card = $this->options['aiosp_opengraph_defcard']; - } - - if ( ! empty( $metabox['aioseop_opengraph_settings_setcard'] ) ) { - $card = $metabox['aioseop_opengraph_settings_setcard']; - } - - // support for changing legacy twitter cardtype-photo to summary large image - if ( $card == 'photo' ) { - $card = 'summary_large_image'; - } - - $site = $domain = $creator = ''; - - if ( ! empty( $this->options['aiosp_opengraph_twitter_site'] ) ) { - $site = $this->options['aiosp_opengraph_twitter_site']; - $site = AIOSEOP_Opengraph_Public::prepare_twitter_username( $site ); - } - - if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { - $domain = $this->options['aiosp_opengraph_twitter_domain']; - } - - if ( ! empty( $post ) && isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_twitter_creator'] ) ) { - $creator = get_the_author_meta( 'twitter', $post->post_author ); - $creator = AIOSEOP_Opengraph_Public::prepare_twitter_username( $creator ); - } - - if ( ! empty( $thumbnail ) ) { - $twitter_thumbnail = $thumbnail; // Default Twitter image if custom isn't set. - } - - if ( isset( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) && ! empty( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) ) { - // Set Twitter image from custom. - $twitter_thumbnail = set_url_scheme( $metabox['aioseop_opengraph_settings_customimg_twitter'] ); - } - - // Apply last filters. - $description = apply_filters( 'aioseop_description', $description ); - - $meta = array( - 'facebook' => array( - 'title' => 'og:title', - 'type' => 'og:type', - 'url' => 'og:url', - 'thumbnail' => 'og:image', - 'width' => 'og:image:width', - 'height' => 'og:image:height', - 'video' => 'og:video', - 'videowidth' => 'og:video:width', - 'videoheight' => 'og:video:height', - 'sitename' => 'og:site_name', - 'key' => 'fb:admins', - 'appid' => 'fb:app_id', - 'description' => 'og:description', - 'section' => 'article:section', - 'tag' => 'article:tag', - 'publisher' => 'article:publisher', - 'author' => 'article:author', - 'published_time' => 'article:published_time', - 'modified_time' => 'article:modified_time', - ), - 'twitter' => array( - 'card' => 'twitter:card', - 'site' => 'twitter:site', - 'creator' => 'twitter:creator', - 'domain' => 'twitter:domain', - 'title' => 'twitter:title', - 'description' => 'twitter:description', - 'twitter_thumbnail' => 'twitter:image', - ), - ); - - // Only show if "use schema.org markup is checked". - if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) { - $meta['google+'] = array( 'thumbnail' => 'image' ); - } - - $tags = array( - 'facebook' => array( 'name' => 'property', 'value' => 'content' ), - 'twitter' => array( 'name' => 'name', 'value' => 'content' ), - 'google+' => array( 'name' => 'itemprop', 'value' => 'content' ), - ); - - foreach ( $meta as $t => $data ) { - foreach ( $data as $k => $v ) { - if ( empty( $$k ) ) { - $$k = ''; - } - $filtered_value = $$k; - $filtered_value = apply_filters( $this->prefix . 'meta', $filtered_value, $t, $k ); - if ( ! empty( $filtered_value ) ) { - if ( ! is_array( $filtered_value ) ) { - $filtered_value = array( $filtered_value ); - } - - /** - * This is to accomodate multiple fb:admins on separate lines. - * @TODO Eventually we'll want to put this in its own function so things like images work too. - */ - if ( 'key' === $k ) { - $fbadmins = explode( ',', str_replace( ' ', '', $filtered_value[0] ) ); // Trim spaces then turn comma-separated values into an array. - foreach ( $fbadmins as $fbadmin ) { - echo '' . "\n"; - } - } else { - // For everything else. - foreach ( $filtered_value as $f ) { - echo '' . "\n"; - } - } - } - } - } - $social_link_schema = ''; - if ( ! empty( $social_links ) ) { - $home_url = esc_url( get_home_url() ); - $social_links = explode( "\n", $social_links ); - foreach ( $social_links as $k => $v ) { - $v = trim( $v ); - if ( empty( $v ) ) { - unset( $social_links[ $k ] ); - } else { - $v = esc_url( $v ); - $social_links[ $k ] = $v; - } - } - $social_links = join( '","', $social_links ); - $social_link_schema = << -{ "@context" : "http://schema.org", - "@type" : "{$social_type}", - "name" : "{$social_name}", - "url" : "{$home_url}", - "sameAs" : ["{$social_links}"] -} - - -END; - } - echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema ); - } - - /** - * Do / adds opengraph properties to meta. - * @since 2.3.11 - * - * @global array $aioseop_options AIOSEOP plugin options. - */ - public function do_opengraph() { - global $aioseop_options; - if ( ! empty( $aioseop_options ) - && ! empty( $aioseop_options['aiosp_schema_markup'] ) - ) { - add_filter( 'language_attributes', array( &$this, 'add_attributes' ) ); - } - if ( ! defined( 'DOING_AJAX' ) ) { - add_action( 'aioseop_modules_wp_head', array( &$this, 'add_meta' ), 5 ); - // Add social meta to AMP plugin. - if ( apply_filters( 'aioseop_enable_amp_social_meta', true ) === true ) { - add_action( 'amp_post_template_head', array( &$this, 'add_meta' ), 12 ); - } - } - } - - /** - * Set up types. - * - * @since ? - * @since 2.3.15 Change to website for homepage and blog post index page, default to object. - */ - function type_setup() { - $this->type = 'object'; // Default to type object if we don't have some other rule. - - if ( is_home() || is_front_page() ) { - $this->type = 'website'; // Home page and blog page should be website. - } elseif ( is_singular() && $this->option_isset( 'types' ) ) { - $metabox = $this->get_current_options( array(), 'settings' ); - $current_post_type = get_post_type(); - if ( ! empty( $metabox['aioseop_opengraph_settings_category'] ) ) { - $this->type = $metabox['aioseop_opengraph_settings_category']; - } elseif ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) { - $this->type = $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ]; - } - } - } - - /** - * Inits hooks and others for admin init. - * action:admin_init. - * - * @since 2.3.11 - * @since 2.4.14 Refactored function name, and new filter added for defaults and missing term metabox. - */ - function admin_init() { - add_filter( $this->prefix . 'display_settings', array( &$this, 'filter_settings' ), 10, 3 ); - add_filter( $this->prefix . 'override_options', array( &$this, 'override_options' ), 10, 3 ); - add_filter( $this->get_prefix( 'settings' ) . 'default_options', array( - &$this, - 'filter_default_options', - ), 10, 2 ); - add_filter( - $this->get_prefix( 'settings' ) . 'filter_metabox_options', array( - &$this, - 'filter_metabox_options', - ), 10, 3 - ); - add_filter( - $this->get_prefix( 'settings' ) . 'filter_term_metabox_options', array( - &$this, - 'filter_metabox_options', - ), 10, 3 - ); - $post_types = $this->get_post_type_titles(); - $rempost = array( - 'revision' => 1, - 'nav_menu_item' => 1, - 'custom_css' => 1, - 'customize_changeset' => 1, - ); - $post_types = array_diff_key( $post_types, $rempost ); - $this->default_options['types']['initial_options'] = $post_types; - foreach ( $post_types as $slug => $name ) { - $field = $slug . '_fb_object_type'; - $this->default_options[ $field ] = array( - 'name' => "$name " . __( 'Object Type', 'all-in-one-seo-pack' ) . "
    ($slug)", - 'type' => 'select', - 'style' => '', - 'initial_options' => $this->fb_object_types, - 'default' => 'article', - 'condshow' => array( 'aiosp_opengraph_types\[\]' => $slug ), - ); - $this->help_text[ $field ] = __( 'Choose a default value that best describes the content of your post type.', 'all-in-one-seo-pack' ); - $this->help_anchors[ $field ] = '#content-object-types'; - $this->locations['opengraph']['options'][] = $field; - $this->layout['facebook']['options'][] = $field; - } - $this->setting_options(); - $this->add_help_text_links(); - - } - - function get_all_images( $options = null, $p = null ) { - static $img = array(); - if ( ! is_array( $options ) ) { - $options = array(); - } - if ( ! empty( $this->options['aiosp_opengraph_meta_key'] ) ) { - $options['meta_key'] = $this->options['aiosp_opengraph_meta_key']; - } - if ( empty( $img ) ) { - $size = apply_filters( 'post_thumbnail_size', 'large' ); - $default = $this->get_the_image_by_default(); - if ( ! empty( $default ) ) { - $default = set_url_scheme( $default ); - $img[ $default ] = 0; - } - $img = array_merge( $img, parent::get_all_images( $options, null ) ); - } - - if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) { - $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg'; - } - - if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) { - $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg'; - $img[ $options['aioseop_opengraph_settings_customimg_twitter'] ] = 'customimg_twitter'; - } - - if ( $author_img = $this->get_the_image_by_author( $p ) ) { - $image['author'] = $author_img; - } - $image = array_flip( $img ); - $images = array(); - if ( ! empty( $image ) ) { - foreach ( $image as $k => $v ) { - $images[ $v ] = ''; - } - } - - return array( $image, $images ); - } - - function get_the_image_by_author( $options = null, $p = null ) { - if ( $p === null ) { - global $post; - } else { - $post = $p; - } - if ( ! empty( $post ) && ! empty( $post->post_author ) ) { - $matches = array(); - $get_avatar = get_avatar( $post->post_author, 300 ); - if ( preg_match( "/src='(.*?)'/i", $get_avatar, $matches ) ) { - return $matches[1]; - } - } - - return false; - } - - function get_the_image( $options = null, $p = null ) { - $meta_key = $this->options['aiosp_opengraph_meta_key']; - - return parent::get_the_image( array( 'meta_key' => $meta_key ), $p ); - } - - function get_the_image_by_default( $args = array() ) { - return $this->options['aiosp_opengraph_dimg']; - } - - function settings_update() { - - } - - /** - * Enqueue our file upload scripts and styles. - * @param $hook - */ - function og_admin_enqueue_scripts( $hook ) { - - if ( 'all-in-one-seo_page_aiosp_opengraph' != $hook && 'term.php' != $hook ) { - // Only enqueue if we're on the social module settings page. - return; - } - - wp_enqueue_script( 'media-upload' ); - wp_enqueue_script( 'thickbox' ); - wp_enqueue_style( 'thickbox' ); - wp_enqueue_media(); - } - - function save_tax_data( $term_id, $tt_id, $taxonomy ) { - static $update = false; - if ( $update ) { - return; - } - if ( $this->locations !== null ) { - foreach ( $this->locations as $k => $v ) { - if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) { - $opts = $this->default_options( $k ); - $options = array(); - $update = false; - foreach ( $opts as $l => $o ) { - if ( isset( $_POST[ $l ] ) ) { - $options[ $l ] = stripslashes_deep( $_POST[ $l ] ); - $options[ $l ] = esc_attr( $options[ $l ] ); - $update = true; - } - } - if ( $update ) { - $prefix = $this->get_prefix( $k ); - $options = apply_filters( $prefix . 'filter_term_metabox_options', $options, $k, $term_id ); - update_term_meta( $term_id, '_' . $prefix . $k, $options ); - } - } - } - } - } - - /** - * Returns the placeholder filtered and ready for DOM display. - * filter:aioseop_opengraph_placeholder - * @since 2.4.14 - * - * @param mixed $placeholder Placeholder to be filtered. - * @param string $type Type of the value to be filtered. - * - * @return string - */ - public function filter_placeholder( $placeholder, $type = 'text' ) { - return strip_tags( trim( $placeholder ) ); - } - - /** - * Returns filtered default options. - * filter:{prefix}default_options - * @since 2.4.13 - * - * @param array $options Default options. - * @param string $location Location. - * - * @return array - */ - public function filter_default_options( $options, $location ) { - if ( $location === 'settings' ) { - $prefix = $this->get_prefix( $location ) . $location . '_'; - // Add image checker as default - $options[ $prefix . 'customimg_checker' ] = 0; - } - return $options; - } - - /** - * Returns facebook debug script and link. - * @since 2.4.14 - * - * @return string - */ - private function get_facebook_debug() { - ob_start(); - ?> - - - name = __( 'Social Meta', 'all-in-one-seo-pack' ); // Human-readable name of the plugin + $this->prefix = 'aiosp_opengraph_'; // option prefix + $this->file = __FILE__; // the current file + $this->fb_object_types = array( + 'Activities' => array( + 'activity' => __( 'Activity', 'all-in-one-seo-pack' ), + 'sport' => __( 'Sport', 'all-in-one-seo-pack' ), + ), + 'Businesses' => array( + 'bar' => __( 'Bar', 'all-in-one-seo-pack' ), + 'company' => __( 'Company', 'all-in-one-seo-pack' ), + 'cafe' => __( 'Cafe', 'all-in-one-seo-pack' ), + 'hotel' => __( 'Hotel', 'all-in-one-seo-pack' ), + 'restaurant' => __( 'Restaurant', 'all-in-one-seo-pack' ), + ), + 'Groups' => array( + 'cause' => __( 'Cause', 'all-in-one-seo-pack' ), + 'sports_league' => __( 'Sports League', 'all-in-one-seo-pack' ), + 'sports_team' => __( 'Sports Team', 'all-in-one-seo-pack' ), + ), + 'Organizations' => array( + 'band' => __( 'Band', 'all-in-one-seo-pack' ), + 'government' => __( 'Government', 'all-in-one-seo-pack' ), + 'non_profit' => __( 'Non Profit', 'all-in-one-seo-pack' ), + 'school' => __( 'School', 'all-in-one-seo-pack' ), + 'university' => __( 'University', 'all-in-one-seo-pack' ), + ), + 'People' => array( + 'actor' => __( 'Actor', 'all-in-one-seo-pack' ), + 'athlete' => __( 'Athlete', 'all-in-one-seo-pack' ), + 'author' => __( 'Author', 'all-in-one-seo-pack' ), + 'director' => __( 'Director', 'all-in-one-seo-pack' ), + 'musician' => __( 'Musician', 'all-in-one-seo-pack' ), + 'politician' => __( 'Politician', 'all-in-one-seo-pack' ), + 'profile' => __( 'Profile', 'all-in-one-seo-pack' ), + 'public_figure' => __( 'Public Figure', 'all-in-one-seo-pack' ), + ), + 'Places' => array( + 'city' => __( 'City', 'all-in-one-seo-pack' ), + 'country' => __( 'Country', 'all-in-one-seo-pack' ), + 'landmark' => __( 'Landmark', 'all-in-one-seo-pack' ), + 'state_province' => __( 'State Province', 'all-in-one-seo-pack' ), + ), + 'Products and Entertainment' => array( + 'album' => __( 'Album', 'all-in-one-seo-pack' ), + 'book' => __( 'Book', 'all-in-one-seo-pack' ), + 'drink' => __( 'Drink', 'all-in-one-seo-pack' ), + 'food' => __( 'Food', 'all-in-one-seo-pack' ), + 'game' => __( 'Game', 'all-in-one-seo-pack' ), + 'movie' => __( 'Movie', 'all-in-one-seo-pack' ), + 'product' => __( 'Product', 'all-in-one-seo-pack' ), + 'song' => __( 'Song', 'all-in-one-seo-pack' ), + 'tv_show' => __( 'TV Show', 'all-in-one-seo-pack' ), + 'episode' => __( 'Episode', 'all-in-one-seo-pack' ), + ), + 'Websites' => array( + 'article' => __( 'Article', 'all-in-one-seo-pack' ), + 'blog' => __( 'Blog', 'all-in-one-seo-pack' ), + 'website' => __( 'Website', 'all-in-one-seo-pack' ), + ), + ); + parent::__construct(); + + $this->help_text = array( + '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' ), + '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' ), + 'appid' => __( 'Enter your Facebook App ID here. Information about how to get your Facebook App ID can be found at https://developers.facebook.com/docs/apps/register', 'all-in-one-seo-pack' ), + 'title_shortcodes' => __( 'Run shortcodes that appear in social title meta tags.', 'all-in-one-seo-pack' ), + 'description_shortcodes' => __( 'Run shortcodes that appear in social description meta tags.', 'all-in-one-seo-pack' ), + 'sitename' => __( 'The Site Name is the name that is used to identify your website.', 'all-in-one-seo-pack' ), + 'hometitle' => __( 'The Home Title is the Open Graph title for your home page.', 'all-in-one-seo-pack' ), + 'description' => __( 'The Home Description is the Open Graph description for your home page.', 'all-in-one-seo-pack' ), + 'homeimage' => __( 'The Home Image is the Open Graph image for your home page.', 'all-in-one-seo-pack' ), + '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' ), + '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' ), + 'fallback' => __( 'This option lets you fall back to the default image if no image could be found above.', 'all-in-one-seo-pack' ), + 'dimg' => __( 'This option sets a default image that can be used for the Open Graph image. You can upload an image, select an image from your Media Library or paste the URL of an image here.', 'all-in-one-seo-pack' ), + 'dimgwidth' => __( 'This option lets you set a default width for your images, where unspecified.', 'all-in-one-seo-pack' ), + 'dimgheight' => __( 'This option lets you set a default height for your images, where unspecified.', 'all-in-one-seo-pack' ), + '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' ), + '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' ), + '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' ), + 'imagewidth' => __( 'Enter the width for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ), + 'imageheight' => __( 'Enter the height for your Open Graph image in pixels (i.e. 600).', 'all-in-one-seo-pack' ), + 'video' => __( 'This option lets you specify a link to the Open Graph video used on this Page or Post.', 'all-in-one-seo-pack' ), + 'videowidth' => __( 'Enter the width for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ), + 'videoheight' => __( 'Enter the height for your Open Graph video in pixels (i.e. 600).', 'all-in-one-seo-pack' ), + 'defcard' => __( 'Select the default type of Twitter Card to display.', 'all-in-one-seo-pack' ), + 'setcard' => __( 'Select the Twitter Card type to use for this Page or Post, overriding the default setting.', 'all-in-one-seo-pack' ), + 'twitter_site' => __( 'Enter the Twitter username associated with your website here.', 'all-in-one-seo-pack' ), + 'twitter_creator' => __( 'Allows your authors to be identified by their Twitter usernames as content creators on the Twitter cards for their posts.', 'all-in-one-seo-pack' ), + 'twitter_domain' => __( 'Enter the name of your website here.', 'all-in-one-seo-pack' ), + 'customimg_twitter' => __( 'This option lets you upload an image to use as the Twitter image for this Page or Post.', 'all-in-one-seo-pack' ), + 'gen_tags' => __( 'Automatically generate article tags for Facebook type article when not provided.', 'all-in-one-seo-pack' ), + 'gen_keywords' => __( 'Use keywords in generated article tags.', 'all-in-one-seo-pack' ), + 'gen_categories' => __( 'Use categories in generated article tags.', 'all-in-one-seo-pack' ), + 'gen_post_tags' => __( 'Use post tags in generated article tags.', 'all-in-one-seo-pack' ), + 'types' => __( 'Select which Post Types you want to use All in One SEO Pack to set Open Graph meta values for.', 'all-in-one-seo-pack' ), + 'title' => __( 'This is the Open Graph title of this Page or Post.', 'all-in-one-seo-pack' ), + 'desc' => __( 'This is the Open Graph description of this Page or Post.', 'all-in-one-seo-pack' ), + 'category' => __( 'Select the Open Graph type that best describes the content of this Page or Post.', 'all-in-one-seo-pack' ), + 'facebook_debug' => __( 'Press this button to have Facebook re-fetch and debug this page.', 'all-in-one-seo-pack' ), + 'section' => __( 'This Open Graph meta allows you to add a general section name that best describes this content.', 'all-in-one-seo-pack' ), + 'tag' => __( 'This Open Graph meta allows you to add a list of keywords that best describe this content.', 'all-in-one-seo-pack' ), + 'facebook_publisher' => __( 'Link articles to the Facebook page associated with your website.', 'all-in-one-seo-pack' ), + 'facebook_author' => __( 'Allows your authors to be identified by their Facebook pages as content authors on the Opengraph meta for their articles.', 'all-in-one-seo-pack' ), + 'person_or_org' => __( 'Are the social profile links for your website for a person or an organization?', 'all-in-one-seo-pack' ), + 'profile_links' => __( "Add URLs for your website's social profiles here (Facebook, Twitter, Google+, Instagram, LinkedIn), one per line.", 'all-in-one-seo-pack' ), + 'social_name' => __( 'Add the name of the person or organization who owns these profiles.', 'all-in-one-seo-pack' ), + ); + + $this->help_anchors = array( + 'title_shortcodes' => '#run-shortcodes-in-title', + 'description_shortcodes' => '#run-shortcodes-in-description', + 'generate_descriptions' => '#auto-generate-og-descriptions', + 'setmeta' => '#use-aioseo-title-and-description', + 'sitename' => '#site-name', + 'hometitle' => '#home-title-and-description', + 'description' => '#home-title-and-description', + 'homeimage' => '#home-image', + 'defimg' => '#select-og-image-source', + 'fallback' => '#use-default-if-no-image-found', + 'dimg' => '#default-og-image', + 'dimgwidth' => '#default-image-width', + 'dimgheight' => '#default-image-height', + 'meta_key' => '#use-custom-field-for-image', + 'profile_links' => '#social-profile-links', + 'person_or_org' => '#social-profile-links', + 'social_name' => '#social-profile-links', + 'key' => '#facebook-admin-id', + 'appid' => '#facebook-app-id', + 'gen_tags' => '#automatically-generate-article-tags', + 'gen_keywords' => '#use-keywords-in-article-tags', + 'gen_categories' => '#use-categories-in-article-tags', + 'gen_post_tags' => '#use-post-tags-in-article-tags', + 'facebook_publisher' => '#show-facebook-publisher-on-articles', + 'facebook_author' => '#show-facebook-author-on-articles', + 'types' => '#enable-facebook-meta-for', + 'defcard' => '#default-twitter-card', + 'twitter_site' => '#twitter-site', + 'twitter_creator' => '#show-twitter-author', + 'twitter_domain' => '#twitter-domain', + 'scan_header' => '#scan-social-meta', + 'title' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#title', + 'desc' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#description', + 'image' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#image', + 'customimg' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-image', + 'imagewidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height', + 'imageheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-image-width-height', + 'video' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-video', + 'videowidth' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height', + 'videoheight' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#specify-video-width-height', + 'category' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-object-type', + 'facebook_debug' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#facebook-debug', + 'section' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-section', + 'tag' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#article-tags', + 'setcard' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#twitter-card-type', + 'customimg_twitter' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/#custom-twitter-image', + ); + + if ( is_admin() ) { + add_action( 'admin_init', array( $this, 'admin_init' ), 5 ); + } else { + add_action( 'wp', array( $this, 'type_setup' ) ); + } + + if ( ! is_admin() || defined( 'DOING_AJAX' ) ) { + $this->do_opengraph(); + } + // Set variables after WordPress load. + add_action( 'init', array( &$this, 'init' ), 999999 ); + add_filter( 'jetpack_enable_open_graph', '__return_false' ); // Avoid having duplicate meta tags + // Force refresh of Facebook cache. + add_action( 'post_updated', array( &$this, 'force_fb_refresh_update' ), 10, 3 ); + add_action( 'transition_post_status', array( &$this, 'force_fb_refresh_transition' ), 10, 3 ); + add_action( 'edited_term', array( &$this, 'save_tax_data' ), 10, 3 ); + // Adds special filters + add_filter( 'aioseop_opengraph_placeholder', array( &$this, 'filter_placeholder' ) ); + // Call to init to generate menus + $this->init(); + } + + /** + * Hook called after WordPress has been loaded. + * + * @since 2.4.14 + */ + public function init() { + $count_desc = __( ' characters. Open Graph allows up to a maximum of %1$s chars for the %2$s.', 'all-in-one-seo-pack' ); + // Create default options + $this->default_options = array( + 'scan_header' => array( + 'name' => __( 'Scan Header', 'all-in-one-seo-pack' ), + 'type' => 'custom', + 'save' => true, + ), + 'setmeta' => array( + 'name' => __( 'Use AIOSEO Title and Description', 'all-in-one-seo-pack' ), + 'type' => 'checkbox', + ), + 'key' => array( + 'name' => __( 'Facebook Admin ID', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'text', + ), + 'appid' => array( + 'name' => __( 'Facebook App ID', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'text', + ), + 'title_shortcodes' => array( + 'name' => __( 'Run Shortcodes In Title', 'all-in-one-seo-pack' ), + ), + 'description_shortcodes' => array( + 'name' => __( 'Run Shortcodes In Description', 'all-in-one-seo-pack' ), + ), + 'sitename' => array( + 'name' => __( 'Site Name', 'all-in-one-seo-pack' ), + 'default' => get_bloginfo( 'name' ), + 'type' => 'text', + ), + 'hometitle' => array( + 'name' => __( 'Home Title', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'textarea', + 'condshow' => array( + 'aiosp_opengraph_setmeta' => array( + 'lhs' => 'aiosp_opengraph_setmeta', + 'op' => '!=', + 'rhs' => 'on', + ), + ), + ), + 'description' => array( + 'name' => __( 'Home Description', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'textarea', + 'condshow' => array( + 'aiosp_opengraph_setmeta' => array( + 'lhs' => 'aiosp_opengraph_setmeta', + 'op' => '!=', + 'rhs' => 'on', + ), + ), + ), + 'homeimage' => array( + 'name' => __( 'Home Image', 'all-in-one-seo-pack' ), + 'type' => 'image', + ), + 'generate_descriptions' => array( + 'name' => __( 'Use Content For Autogenerated OG Descriptions', 'all-in-one-seo-pack' ), + 'default' => 0, + ), + 'defimg' => array( + 'name' => __( 'Select OG:Image Source', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'initial_options' => array( + '' => __( 'Default Image' ), + 'featured' => __( 'Featured Image' ), + 'attach' => __( 'First Attached Image' ), + 'content' => __( 'First Image In Content' ), + 'custom' => __( 'Image From Custom Field' ), + 'author' => __( 'Post Author Image' ), + 'auto' => __( 'First Available Image' ), + ), + ), + 'fallback' => array( + 'name' => __( 'Use Default If No Image Found', 'all-in-one-seo-pack' ), + 'type' => 'checkbox', + ), + 'dimg' => array( + 'name' => __( 'Default OG:Image', 'all-in-one-seo-pack' ), + 'default' => AIOSEOP_PLUGIN_IMAGES_URL . 'default-user-image.png', + 'type' => 'image', + ), + 'dimgwidth' => array( + 'name' => __( 'Default Image Width', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'dimgheight' => array( + 'name' => __( 'Default Image Height', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'meta_key' => array( + 'name' => __( 'Use Custom Field For Image', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'image' => array( + 'name' => __( 'Image', 'all-in-one-seo-pack' ), + 'type' => 'radio', + 'initial_options' => array( + 0 => '', + ), + ), + 'customimg' => array( + 'name' => __( 'Custom Image', 'all-in-one-seo-pack' ), + 'type' => 'image', + ), + 'imagewidth' => array( + 'name' => __( 'Specify Image Width', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'imageheight' => array( + 'name' => __( 'Specify Image Height', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'video' => array( + 'name' => __( 'Custom Video', 'all-in-one-seo-pack' ), + 'type' => 'text', + ), + 'videowidth' => array( + 'name' => __( 'Specify Video Width', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => array( + 'aioseop_opengraph_settings_video' => array( + 'lhs' => 'aioseop_opengraph_settings_video', + 'op' => '!=', + 'rhs' => '', + ), + ), + ), + 'videoheight' => array( + 'name' => __( 'Specify Video Height', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => array( + 'aioseop_opengraph_settings_video' => array( + 'lhs' => 'aioseop_opengraph_settings_video', + 'op' => '!=', + 'rhs' => '', + ), + ), + ), + 'defcard' => array( + 'name' => __( 'Default Twitter Card', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'default' => 'summary', + 'initial_options' => array( + 'summary' => __( 'Summary', 'all-in-one-seo-pack' ), + 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ), + + /* + REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE + 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) + */ + ), + ), + 'setcard' => array( + 'name' => __( 'Twitter Card Type', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'initial_options' => array( + 'summary_large_image' => __( 'Summary Large Image', 'all-in-one-seo-pack' ), + 'summary' => __( 'Summary', 'all-in-one-seo-pack' ), + + /* + REMOVING THIS TWITTER CARD TYPE FROM SOCIAL META MODULE + 'photo' => __( 'Photo', 'all-in-one-seo-pack' ) + */ + ), + ), + 'twitter_site' => array( + 'name' => __( 'Twitter Site', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'twitter_creator' => array( + 'name' => __( 'Show Twitter Author', 'all-in-one-seo-pack' ), + ), + 'twitter_domain' => array( + 'name' => __( 'Twitter Domain', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'customimg_twitter' => array( + 'name' => __( 'Custom Twitter Image', 'all-in-one-seo-pack' ), + 'type' => 'image', + ), + 'gen_tags' => array( + 'name' => __( 'Automatically Generate Article Tags', 'all-in-one-seo-pack' ), + ), + 'gen_keywords' => array( + 'name' => __( 'Use Keywords In Article Tags', 'all-in-one-seo-pack' ), + 'default' => 'on', + 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), + ), + 'gen_categories' => array( + 'name' => __( 'Use Categories In Article Tags', 'all-in-one-seo-pack' ), + 'default' => 'on', + 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), + ), + 'gen_post_tags' => array( + 'name' => __( 'Use Post Tags In Article Tags', 'all-in-one-seo-pack' ), + 'default' => 'on', + 'condshow' => array( 'aiosp_opengraph_gen_tags' => 'on' ), + ), + 'types' => array( + 'name' => __( 'Enable Facebook Meta for Post Types', 'all-in-one-seo-pack' ), + 'type' => 'multicheckbox', + 'default' => array( 'post' => 'post', 'page' => 'page' ), + 'initial_options' => $this->get_post_type_titles( array( '_builtin' => false ) ), + ), + 'title' => array( + 'name' => __( 'Title', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'text', + 'size' => 95, + 'count' => 1, + 'count_desc' => $count_desc, + ), + 'desc' => array( + 'name' => __( 'Description', 'all-in-one-seo-pack' ), + 'default' => '', + 'type' => 'textarea', + 'cols' => 250, + 'rows' => 4, + 'count' => 1, + 'count_desc' => $count_desc, + ), + 'category' => array( + 'name' => __( 'Facebook Object Type', 'all-in-one-seo-pack' ), + 'type' => 'select', + 'style' => '', + 'default' => '', + 'initial_options' => $this->fb_object_types, + ), + 'facebook_debug' => array( + 'name' => __( 'Facebook Debug', 'all-in-one-seo-pack' ), + 'type' => 'html', + 'save' => false, + 'default' => $this->get_facebook_debug(), + ), + 'section' => array( + 'name' => __( 'Article Section', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ), + ), + 'tag' => array( + 'name' => __( 'Article Tags', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + 'condshow' => array( 'aioseop_opengraph_settings_category' => 'article' ), + ), + 'facebook_publisher' => array( + 'name' => __( 'Show Facebook Publisher on Articles', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + 'facebook_author' => array( + 'name' => __( 'Show Facebook Author on Articles', 'all-in-one-seo-pack' ), + ), + 'profile_links' => array( + 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), + 'type' => 'textarea', + 'cols' => 60, + 'rows' => 5, + ), + 'person_or_org' => array( + 'name' => __( 'Person or Organization?', 'all-in-one-seo-pack' ), + 'type' => 'radio', + 'initial_options' => array( + 'person' => __( 'Person', 'all-in-one-seo-pack' ), + 'org' => __( 'Organization', 'all-in-one-seo-pack' ), + ), + ), + 'social_name' => array( + 'name' => __( 'Associated Name', 'all-in-one-seo-pack' ), + 'type' => 'text', + 'default' => '', + ), + ); + // load initial options / set defaults + $this->update_options(); + $display = array(); + if ( isset( $this->options['aiosp_opengraph_types'] ) && ! empty( $this->options['aiosp_opengraph_types'] ) ) { + $display = $this->options['aiosp_opengraph_types']; + } + $this->locations = array( + 'opengraph' => array( + 'name' => $this->name, + 'prefix' => 'aiosp_', + 'type' => 'settings', + 'options' => array( + 'scan_header', + 'setmeta', + 'key', + 'appid', + 'sitename', + 'title_shortcodes', + 'description_shortcodes', + 'hometitle', + 'description', + 'homeimage', + 'generate_descriptions', + 'defimg', + 'fallback', + 'dimg', + 'dimgwidth', + 'dimgheight', + 'meta_key', + 'defcard', + 'profile_links', + 'person_or_org', + 'social_name', + 'twitter_site', + 'twitter_creator', + 'twitter_domain', + 'gen_tags', + 'gen_keywords', + 'gen_categories', + 'gen_post_tags', + 'types', + 'facebook_publisher', + 'facebook_author', + ), + ), + 'settings' => array( + 'name' => __( 'Social Settings', 'all-in-one-seo-pack' ), + 'type' => 'metabox', + 'help_link' => 'https://semperplugins.com/documentation/social-meta-settings-individual-pagepost-settings/', + 'options' => array( + 'title', + 'desc', + 'image', + 'customimg', + 'imagewidth', + 'imageheight', + 'video', + 'videowidth', + 'videoheight', + 'category', + 'facebook_debug', + 'section', + 'tag', + 'setcard', + 'customimg_twitter', + ), + 'display' => apply_filters( 'aioseop_opengraph_display', $display ), + 'prefix' => 'aioseop_opengraph_', + ), + ); + $this->layout = array( + 'home' => array( + 'name' => __( 'Home Page Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#use-aioseo-title-and-description', + 'options' => array( 'setmeta', 'sitename', 'hometitle', 'description', 'homeimage' ), + ), + 'image' => array( + 'name' => __( 'Image Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#select-og-image-source', + 'options' => array( 'defimg', 'fallback', 'dimg', 'dimgwidth', 'dimgheight', 'meta_key' ), + ), + 'links' => array( + 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#social-profile-links', + 'options' => array( 'profile_links', 'person_or_org', 'social_name' ), + ), + 'facebook' => array( + 'name' => __( 'Facebook Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#facebook-settings', + 'options' => array( + 'key', + 'appid', + 'types', + 'gen_tags', + 'gen_keywords', + 'gen_categories', + 'gen_post_tags', + 'facebook_publisher', + 'facebook_author', + ), + ), + 'twitter' => array( + 'name' => __( 'Twitter Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#default-twitter-card', + 'options' => array( 'defcard', 'setcard', 'twitter_site', 'twitter_creator', 'twitter_domain' ), + ), + 'default' => array( + 'name' => __( 'Advanced Settings', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/', + 'options' => array(), // this is set below, to the remaining options -- pdb + ), + 'scan_meta' => array( + 'name' => __( 'Scan Social Meta', 'all-in-one-seo-pack' ), + 'help_link' => 'https://semperplugins.com/documentation/social-meta-module/#scan_meta', + 'options' => array( 'scan_header' ), + ), + ); + $other_options = array(); + foreach ( $this->layout as $k => $v ) { + $other_options = array_merge( $other_options, $v['options'] ); + } + + $this->layout['default']['options'] = array_diff( array_keys( $this->default_options ), $other_options ); + } + + /** + * Forces FaceBook OpenGraph to refresh its cache when a post is changed to + * + * @param $new_status + * @param $old_status + * @param $post + * + * @todo this and force_fb_refresh_update can probably have the remote POST extracted out. + * + * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update + * @since 2.3.11 + */ + function force_fb_refresh_transition( $new_status, $old_status, $post ) { + if ( 'publish' !== $new_status ) { + return; + } + if ( 'future' !== $old_status ) { + return; + } + + $current_post_type = get_post_type(); + + // Only ping Facebook if Social SEO is enabled on this post type. + if ( $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) { + $post_url = aioseop_get_permalink( $post->ID ); + $endpoint = sprintf( + 'https://graph.facebook.com/?%s', http_build_query( + array( + 'id' => $post_url, + 'scrape' => true, + ) + ) + ); + wp_remote_post( $endpoint, array( 'blocking' => false ) ); + } + } + + /** + * Forces FaceBook OpenGraph refresh on update. + * + * @param $post_id + * @param $post_after + * + * @see https://developers.facebook.com/docs/sharing/opengraph/using-objects#update + * @since 2.3.11 + */ + function force_fb_refresh_update( $post_id, $post_after ) { + + $current_post_type = get_post_type(); + + // Only ping Facebook if Social SEO is enabled on this post type. + if ( 'publish' === $post_after->post_status && $this->option_isset( 'types' ) && is_array( $this->options['aiosp_opengraph_types'] ) && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) ) { + $post_url = aioseop_get_permalink( $post_id ); + $endpoint = sprintf( + 'https://graph.facebook.com/?%s', http_build_query( + array( + 'id' => $post_url, + 'scrape' => true, + ) + ) + ); + wp_remote_post( $endpoint, array( 'blocking' => false ) ); + } + } + + function settings_page_init() { + add_filter( 'aiosp_output_option', array( $this, 'display_custom_options' ), 10, 2 ); + } + + function filter_options( $options, $location ) { + if ( $location == 'settings' ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + list( $legacy, $images ) = $this->get_all_images( $options ); + if ( isset( $options ) && isset( $options["{$prefix}image"] ) ) { + $thumbnail = $options["{$prefix}image"]; + if ( ctype_digit( (string) $thumbnail ) || ( $thumbnail == 'post' ) ) { + if ( $thumbnail == 'post' ) { + $thumbnail = $images['post1']; + } elseif ( ! empty( $legacy[ $thumbnail ] ) ) { + $thumbnail = $legacy[ $thumbnail ]; + } + } + $options["{$prefix}image"] = $thumbnail; + } + if ( empty( $options[ $prefix . 'image' ] ) ) { + $img = array_keys( $images ); + if ( ! empty( $img ) && ! empty( $img[1] ) ) { + $options[ $prefix . 'image' ] = $img[1]; + } + } + } + + return $options; + } + + /** + * Applies filter to module settings. + * + * @since 2.3.11 + * @since 2.4.14 Added filter for description and title placeholders. + * @since 2.3.15 do_shortcode on description. + * + * @see [plugin]\admin\aioseop_module_class.php > display_options() + */ + function filter_settings( $settings, $location, $current ) { + global $aiosp, $post; + if ( $location == 'opengraph' || $location == 'settings' ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + if ( $location == 'opengraph' ) { + return $settings; + } + if ( $location == 'settings' ) { + list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current ); + $opts = array( 'title', 'desc' ); + $current_post_type = get_post_type(); + if ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) { + $flat_type_list = array(); + foreach ( $this->fb_object_types as $k => $v ) { + if ( is_array( $v ) ) { + $flat_type_list = array_merge( $flat_type_list, $v ); + } else { + $flat_type_list[ $k ] = $v; + } + } + $settings[ $prefix . 'category' ]['initial_options'] = array_merge( + array( + $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] => __( 'Default ', 'all-in-one-seo-pack' ) . ' - ' + . $flat_type_list[ $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ], + ), + $settings[ $prefix . 'category' ]['initial_options'] + ); + } + if ( isset( $this->options['aiosp_opengraph_defcard'] ) ) { + $settings[ $prefix . 'setcard' ]['default'] = $this->options['aiosp_opengraph_defcard']; + } + $info = $aiosp->get_page_snippet_info(); + $title = $info['title']; + $description = $info['description']; + + // Description options + if ( is_object( $post ) ) { + // Always show excerpt + $description = empty( $this->options['aiosp_opengraph_generate_descriptions'] ) + ? $aiosp->trim_excerpt_without_filters( + $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ), + 1000 + ) + : $aiosp->trim_excerpt_without_filters( + $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), + 1000 + ); + } + + // #1308 - we want to make sure we are ignoring php version only in the admin area while editing the post, so that it does not impact #932. + $screen = get_current_screen(); + $ignore_php_version = is_admin() && isset( $screen->id ) && 'post' == $screen->id; + + // Add filters + $description = apply_filters( 'aioseop_description', $description, false, $ignore_php_version ); + // Add placholders + $settings[ "{$prefix}title" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $title ); + $settings[ "{$prefix}desc" ]['placeholder'] = apply_filters( 'aioseop_opengraph_placeholder', $description ); + } + if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) { + foreach ( $opts as $opt ) { + if ( isset( $settings[ $prefix . $opt ] ) ) { + $settings[ $prefix . $opt ]['type'] = 'hidden'; + $settings[ $prefix . $opt ]['label'] = 'none'; + $settings[ $prefix . $opt ]['help_text'] = ''; + unset( $settings[ $prefix . $opt ]['count'] ); + } + } + } + } + + return $settings; + } + + /** + * Applies filter to module options. + * These will display in the "Social Settings" object tab. + * filter:{prefix}override_options + * + * @since 2.3.11 + * @since 2.4.14 Overrides empty og:type values. + * + * @see [plugin]\admin\aioseop_module_class.php > display_options() + * + * @global array $aioseop_options Plugin options. + * + * @param array $options Current options. + * @param string $location Location where filter is called. + * @param array $settings Settings. + * + * @return array + */ + function override_options( $options, $location, $settings ) { + global $aioseop_options; + // Prepare default and prefix + $prefix = $this->get_prefix( $location ) . $location . '_'; + $opts = array(); + + foreach ( $settings as $k => $v ) { + if ( $v['save'] ) { + $opts[ $k ] = $v['default']; + } + } + foreach ( $options as $k => $v ) { + switch ( $k ) { + case $prefix . 'category': + if ( empty( $v ) ) { + // Get post type + $type = isset( get_current_screen()->post_type ) + ? get_current_screen()->post_type + : null; + // Assign default from plugin options + if ( ! empty( $type ) + && isset( $aioseop_options['modules'] ) + && isset( $aioseop_options['modules']['aiosp_opengraph_options'] ) + && isset( $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ] ) + ) { + $options[ $prefix . 'category' ] = + $aioseop_options['modules']['aiosp_opengraph_options'][ 'aiosp_opengraph_' . $type . '_fb_object_type' ]; + } + continue; + } + break; + } + if ( $v === null ) { + unset( $options[ $k ] ); + } + } + $options = wp_parse_args( $options, $opts ); + + return $options; + } + + /** + * Applies filter to metabox settings before they are saved. + * Sets custom as default if a custom image is uploaded. + * filter:{prefix}filter_metabox_options + * filter:{prefix}filter_term_metabox_options + * + * @since 2.3.11 + * @since 2.4.14 Fixes for aioseop-pro #67 and other bugs found. + * + * @see [plugin]\admin\aioseop_module_class.php > save_post_data() + * @see [this file] > save_tax_data() + * + * @param array $options List of current options. + * @param string $location Location where filter is called. + * @param int $id Either post_id or term_id. + * + * @return array + */ + function filter_metabox_options( $options, $location, $post_id ) { + if ( $location == 'settings' ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + if ( isset( $options[ $prefix . 'customimg_checker' ] ) + && $options[ $prefix . 'customimg_checker' ] + ) { + $options[ $prefix . 'image' ] = $options[ $prefix . 'customimg' ]; + } + } + return $options; + } + + /** Custom settings **/ + function display_custom_options( $buf, $args ) { + if ( $args['name'] == 'aiosp_opengraph_scan_header' ) { + $buf .= '
    '; + $args['options']['type'] = 'submit'; + $args['attr'] = " class='button-primary' "; + $args['value'] = $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' ); + $buf .= __( 'Scan your site for duplicate social meta tags.', 'all-in-one-seo-pack' ); + $buf .= '

    ' . $this->get_option_html( $args ); + $buf .= '
    '; + } + + return $buf; + } + + function add_attributes( $output ) { + // avoid having duplicate meta tags + $type = $this->type; + if ( empty( $type ) ) { + $type = 'website'; + } + + $schema_types = array( + 'album' => 'MusicAlbum', + 'article' => 'Article', + 'bar' => 'BarOrPub', + 'blog' => 'Blog', + 'book' => 'Book', + 'cafe' => 'CafeOrCoffeeShop', + 'city' => 'City', + 'country' => 'Country', + 'episode' => 'Episode', + 'food' => 'FoodEvent', + 'game' => 'Game', + 'hotel' => 'Hotel', + 'landmark' => 'LandmarksOrHistoricalBuildings', + 'movie' => 'Movie', + 'product' => 'Product', + 'profile' => 'ProfilePage', + 'restaurant' => 'Restaurant', + 'school' => 'School', + 'sport' => 'SportsEvent', + 'website' => 'WebSite', + ); + + if ( ! empty( $schema_types[ $type ] ) ) { + $type = $schema_types[ $type ]; + } else { + $type = 'WebSite'; + } + + $attributes = apply_filters( + $this->prefix . 'attributes', array( + 'prefix="og: http://ogp.me/ns#"', + ) + ); + + foreach ( $attributes as $attr ) { + if ( strpos( $output, $attr ) === false ) { + $output .= "\n\t$attr "; + } + } + + return $output; + } + + /** + * Add our social meta. + * + * @since 1.0.0 + * @since 2.3.11.5 Support for multiple fb_admins. + * @since 2.3.13 Adds filter:aioseop_description on description. + * @since 2.4.14 Fixes for aioseop-pro #67. + * @since 2.3.15 Always do_shortcode on descriptions, removed for titles. + * + * @global object $post Current WP_Post object. + * @global object $aiosp All in one seo plugin object. + * @global array $aioseop_options All in one seo plugin options. + * @global object $wp_query WP_Query global instance. + */ + function add_meta() { + global $post, $aiosp, $aioseop_options, $wp_query; + $metabox = $this->get_current_options( array(), 'settings' ); + $key = $this->options['aiosp_opengraph_key']; + $dimg = $this->options['aiosp_opengraph_dimg']; + $current_post_type = get_post_type(); + $title = $description = $image = $video = ''; + $type = $this->type; + $sitename = $this->options['aiosp_opengraph_sitename']; + + $appid = isset( $this->options['aiosp_opengraph_appid'] ) ? $this->options['aiosp_opengraph_appid'] : ''; + + if ( ! empty( $aioseop_options['aiosp_hide_paginated_descriptions'] ) ) { + $first_page = false; + if ( $aiosp->get_page_number() < 2 ) { + $first_page = true; + } + } else { + $first_page = true; + } + $url = $aiosp->aiosp_mrt_get_url( $wp_query ); + $url = apply_filters( 'aioseop_canonical_url', $url ); + + $setmeta = $this->options['aiosp_opengraph_setmeta']; + $social_links = ''; + if ( is_front_page() ) { + $title = $this->options['aiosp_opengraph_hometitle']; + if ( $first_page ) { + $description = $this->options['aiosp_opengraph_description']; + if ( empty( $description ) ) { + $description = get_bloginfo( 'description' ); + } + } + if ( ! empty( $this->options['aiosp_opengraph_homeimage'] ) ) { + $thumbnail = $this->options['aiosp_opengraph_homeimage']; + } else { + $thumbnail = $this->options['aiosp_opengraph_dimg']; + } + + /* If Use AIOSEO Title and Desc Selected */ + if ( $setmeta ) { + $title = $aiosp->wp_title(); + if ( $first_page ) { + $description = $aiosp->get_aioseop_description( $post ); + } + } + + /* Add some defaults */ + if ( empty( $title ) ) { + $title = get_bloginfo( 'name' ); + } + if ( empty( $sitename ) ) { + $sitename = get_bloginfo( 'name' ); + } + + if ( empty( $description ) && $first_page && ! empty( $post ) && ! post_password_required( $post ) ) { + + if ( ! empty( $post->post_content ) || ! empty( $post->post_excerpt ) ) { + $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_excerpt ) ), 1000 ); + + if ( ! empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) { + $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 ); + } + } + } + + if ( empty( $description ) && $first_page ) { + $description = get_bloginfo( 'description' ); + } + if ( ! empty( $this->options['aiosp_opengraph_profile_links'] ) ) { + $social_links = $this->options['aiosp_opengraph_profile_links']; + if ( ! empty( $this->options['aiosp_opengraph_social_name'] ) ) { + $social_name = $this->options['aiosp_opengraph_social_name']; + } else { + $social_name = ''; + } + if ( $this->options['aiosp_opengraph_person_or_org'] == 'person' ) { + $social_type = 'Person'; + } else { + $social_type = 'Organization'; + } + } + } elseif ( is_singular() && $this->option_isset( 'types' ) + && is_array( $this->options['aiosp_opengraph_types'] ) + && in_array( $current_post_type, $this->options['aiosp_opengraph_types'] ) + ) { + + if ( $type == 'article' ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) { + $section = $metabox['aioseop_opengraph_settings_section']; + } + if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) { + $tag = $metabox['aioseop_opengraph_settings_tag']; + } + if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) { + $publisher = $this->options['aiosp_opengraph_facebook_publisher']; + } + } + + if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { + $domain = $this->options['aiosp_opengraph_twitter_domain']; + } + + if ( $type == 'article' && ! empty( $post ) ) { + if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) { + $author = get_the_author_meta( 'facebook', $post->post_author ); + } + + if ( isset( $post->post_date_gmt ) ) { + $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date_gmt ) ); + } + + if ( isset( $post->post_modified_gmt ) ) { + $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified_gmt ) ); + } + } + + $image = $metabox['aioseop_opengraph_settings_image']; + $video = $metabox['aioseop_opengraph_settings_video']; + $title = $metabox['aioseop_opengraph_settings_title']; + $description = $metabox['aioseop_opengraph_settings_desc']; + + /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */ + global $aiosp; + if ( empty( $title ) ) { + $title = $aiosp->wp_title(); + } + if ( empty( $description ) ) { + $description = trim( strip_tags( get_post_meta( $post->ID, '_aioseop_description', true ) ) ); + } + + /* Add default title */ + if ( empty( $title ) ) { + $title = get_the_title(); + } + + // Add default description. + if ( empty( $description ) && ! post_password_required( $post ) ) { + + $description = $post->post_excerpt; + + if ( $this->options['aiosp_opengraph_generate_descriptions'] || empty( $description ) ) { + $description = $post->post_content; + } + } + if ( empty( $type ) ) { + $type = 'article'; + } + } elseif ( AIOSEOPPRO && ( is_category() || is_tag() || is_tax() ) ) { + if ( isset( $this->options['aioseop_opengraph_settings_category'] ) ) { + $type = $this->options['aioseop_opengraph_settings_category']; + } + if ( isset( $metabox['aioseop_opengraph_settings_category'] ) ) { + $type = $metabox['aioseop_opengraph_settings_category']; + } + if ( $type == 'article' ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) { + $section = $metabox['aioseop_opengraph_settings_section']; + } + if ( ! empty( $metabox['aioseop_opengraph_settings_tag'] ) ) { + $tag = $metabox['aioseop_opengraph_settings_tag']; + } + if ( ! empty( $this->options['aiosp_opengraph_facebook_publisher'] ) ) { + $publisher = $this->options['aiosp_opengraph_facebook_publisher']; + } + } + if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { + $domain = $this->options['aiosp_opengraph_twitter_domain']; + } + if ( $type == 'article' && ! empty( $post ) ) { + if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) { + $author = get_the_author_meta( 'facebook', $post->post_author ); + } + + if ( isset( $post->post_date_gmt ) ) { + $published_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_date_gmt ) ); + } + if ( isset( $post->post_modified_gmt ) ) { + $modified_time = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $post->post_modified_gmt ) ); + } + } + $image = $metabox['aioseop_opengraph_settings_image']; + $video = $metabox['aioseop_opengraph_settings_video']; + $title = $metabox['aioseop_opengraph_settings_title']; + $description = $metabox['aioseop_opengraph_settings_desc']; + /* Add AIOSEO variables if Site Title and Desc from AIOSEOP not selected */ + global $aiosp; + if ( empty( $title ) ) { + $title = $aiosp->wp_title(); + } + if ( empty( $description ) ) { + $term_id = isset( $_GET['tag_ID'] ) ? (int) $_GET['tag_ID'] : 0; + $term_id = $term_id ? $term_id : get_queried_object()->term_id; + $description = trim( strip_tags( get_term_meta( $term_id, '_aioseop_description', true ) ) ); + } + // Add default title + if ( empty( $title ) ) { + $title = get_the_title(); + } + // Add default description. + if ( empty( $description ) && ! post_password_required( $post ) ) { + $description = get_queried_object()->description; + } + if ( empty( $type ) ) { + $type = 'website'; + } + } elseif ( is_home() && ! is_front_page() ) { + // This is the blog page but not the homepage. + global $aiosp; + $image = $metabox['aioseop_opengraph_settings_image']; + $video = $metabox['aioseop_opengraph_settings_video']; + $title = $metabox['aioseop_opengraph_settings_title']; + $description = $metabox['aioseop_opengraph_settings_desc']; + + if ( empty( $description ) ) { + // If there's not social description, fall back to the SEO description. + $description = trim( strip_tags( get_post_meta( get_option( 'page_for_posts' ), '_aioseop_description', true ) ) ); + } + if ( empty( $title ) ) { + $title = $aiosp->wp_title(); + } + } else { + return; + } + + if ( $type === 'article' && ! empty( $post ) && is_singular() ) { + if ( ! empty( $this->options['aiosp_opengraph_gen_tags'] ) ) { + if ( ! empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) { + $keywords = $aiosp->get_main_keywords(); + $keywords = $this->apply_cf_fields( $keywords ); + $keywords = apply_filters( 'aioseop_keywords', $keywords ); + if ( ! empty( $keywords ) && ! empty( $tag ) ) { + $tag .= ',' . $keywords; + } elseif ( empty( $tag ) ) { + $tag = $keywords; + } + } + $tag = $aiosp->keyword_string_to_list( $tag ); + if ( ! empty( $this->options['aiosp_opengraph_gen_categories'] ) ) { + $tag = array_merge( $tag, $aiosp->get_all_categories( $post->ID ) ); + } + if ( ! empty( $this->options['aiosp_opengraph_gen_post_tags'] ) ) { + $tag = array_merge( $tag, $aiosp->get_all_tags( $post->ID ) ); + } + } + if ( ! empty( $tag ) ) { + $tag = $aiosp->clean_keyword_list( $tag ); + } + } + + if ( ! empty( $this->options['aiosp_opengraph_title_shortcodes'] ) ) { + $title = do_shortcode( $title ); + } + if ( ! empty( $description ) ) { + $description = $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) ); + if ( ! empty( $this->options['aiosp_opengraph_description_shortcodes'] ) ) { + $description = do_shortcode( $description ); + } + $description = $aiosp->trim_excerpt_without_filters( $description, 1000 ); + } + + $title = $this->apply_cf_fields( $title ); + $description = $this->apply_cf_fields( $description ); + + /* Data Validation */ + $title = strip_tags( esc_attr( $title ) ); + $sitename = strip_tags( esc_attr( $sitename ) ); + $description = strip_tags( esc_attr( $description ) ); + + if ( empty( $thumbnail ) && ! empty( $image ) ) { + $thumbnail = $image; + } + + // Add user supplied default image. + if ( empty( $thumbnail ) ) { + if ( empty( $this->options['aiosp_opengraph_defimg'] ) ) { + $thumbnail = $this->options['aiosp_opengraph_dimg']; + } else { + switch ( $this->options['aiosp_opengraph_defimg'] ) { + case 'featured': + $thumbnail = $this->get_the_image_by_post_thumbnail(); + break; + case 'attach': + $thumbnail = $this->get_the_image_by_attachment(); + break; + case 'content': + $thumbnail = $this->get_the_image_by_scan(); + break; + case 'custom': + $meta_key = $this->options['aiosp_opengraph_meta_key']; + if ( ! empty( $meta_key ) && ! empty( $post ) ) { + $meta_key = explode( ',', $meta_key ); + $thumbnail = $this->get_the_image_by_meta_key( + array( + 'post_id' => $post->ID, + 'meta_key' => $meta_key, + ) + ); + } + break; + case 'auto': + $thumbnail = $this->get_the_image(); + break; + case 'author': + $thumbnail = $this->get_the_image_by_author(); + break; + default: + $thumbnail = $this->options['aiosp_opengraph_dimg']; + } + } + } + + if ( ( empty( $thumbnail ) && ! empty( $this->options['aiosp_opengraph_fallback'] ) ) ) { + $thumbnail = $this->options['aiosp_opengraph_dimg']; + } + + if ( ! empty( $thumbnail ) ) { + $thumbnail = esc_url( $thumbnail ); + $thumbnail = set_url_scheme( $thumbnail ); + } + + $width = $height = ''; + if ( ! empty( $thumbnail ) ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) ) { + $width = $metabox['aioseop_opengraph_settings_imagewidth']; + } + if ( ! empty( $metabox['aioseop_opengraph_settings_imageheight'] ) ) { + $height = $metabox['aioseop_opengraph_settings_imageheight']; + } + if ( empty( $width ) && ! empty( $this->options['aiosp_opengraph_dimgwidth'] ) ) { + $width = $this->options['aiosp_opengraph_dimgwidth']; + } + if ( empty( $height ) && ! empty( $this->options['aiosp_opengraph_dimgheight'] ) ) { + $height = $this->options['aiosp_opengraph_dimgheight']; + } + } + + if ( ! empty( $video ) ) { + if ( ! empty( $metabox['aioseop_opengraph_settings_videowidth'] ) ) { + $videowidth = $metabox['aioseop_opengraph_settings_videowidth']; + } + if ( ! empty( $metabox['aioseop_opengraph_settings_videoheight'] ) ) { + $videoheight = $metabox['aioseop_opengraph_settings_videoheight']; + } + } + + $card = 'summary'; + if ( ! empty( $this->options['aiosp_opengraph_defcard'] ) ) { + $card = $this->options['aiosp_opengraph_defcard']; + } + + if ( ! empty( $metabox['aioseop_opengraph_settings_setcard'] ) ) { + $card = $metabox['aioseop_opengraph_settings_setcard']; + } + + // support for changing legacy twitter cardtype-photo to summary large image + if ( $card == 'photo' ) { + $card = 'summary_large_image'; + } + + $site = $domain = $creator = ''; + + if ( ! empty( $this->options['aiosp_opengraph_twitter_site'] ) ) { + $site = $this->options['aiosp_opengraph_twitter_site']; + $site = AIOSEOP_Opengraph_Public::prepare_twitter_username( $site ); + } + + if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) { + $domain = $this->options['aiosp_opengraph_twitter_domain']; + } + + if ( ! empty( $post ) && isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_twitter_creator'] ) ) { + $creator = get_the_author_meta( 'twitter', $post->post_author ); + $creator = AIOSEOP_Opengraph_Public::prepare_twitter_username( $creator ); + } + + if ( ! empty( $thumbnail ) ) { + $twitter_thumbnail = $thumbnail; // Default Twitter image if custom isn't set. + } + + if ( isset( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) && ! empty( $metabox['aioseop_opengraph_settings_customimg_twitter'] ) ) { + // Set Twitter image from custom. + $twitter_thumbnail = set_url_scheme( $metabox['aioseop_opengraph_settings_customimg_twitter'] ); + } + + // Apply last filters. + $description = apply_filters( 'aioseop_description', $description ); + + $meta = array( + 'facebook' => array( + 'title' => 'og:title', + 'type' => 'og:type', + 'url' => 'og:url', + 'thumbnail' => 'og:image', + 'width' => 'og:image:width', + 'height' => 'og:image:height', + 'video' => 'og:video', + 'videowidth' => 'og:video:width', + 'videoheight' => 'og:video:height', + 'sitename' => 'og:site_name', + 'key' => 'fb:admins', + 'appid' => 'fb:app_id', + 'description' => 'og:description', + 'section' => 'article:section', + 'tag' => 'article:tag', + 'publisher' => 'article:publisher', + 'author' => 'article:author', + 'published_time' => 'article:published_time', + 'modified_time' => 'article:modified_time', + ), + 'twitter' => array( + 'card' => 'twitter:card', + 'site' => 'twitter:site', + 'creator' => 'twitter:creator', + 'domain' => 'twitter:domain', + 'title' => 'twitter:title', + 'description' => 'twitter:description', + 'twitter_thumbnail' => 'twitter:image', + ), + ); + + // Only show if "use schema.org markup is checked". + if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) { + $meta['google+'] = array( 'thumbnail' => 'image' ); + } + + $tags = array( + 'facebook' => array( 'name' => 'property', 'value' => 'content' ), + 'twitter' => array( 'name' => 'name', 'value' => 'content' ), + 'google+' => array( 'name' => 'itemprop', 'value' => 'content' ), + ); + + foreach ( $meta as $t => $data ) { + foreach ( $data as $k => $v ) { + if ( empty( $$k ) ) { + $$k = ''; + } + $filtered_value = $$k; + $filtered_value = apply_filters( $this->prefix . 'meta', $filtered_value, $t, $k ); + if ( ! empty( $filtered_value ) ) { + if ( ! is_array( $filtered_value ) ) { + $filtered_value = array( $filtered_value ); + } + + /** + * This is to accomodate multiple fb:admins on separate lines. + * @TODO Eventually we'll want to put this in its own function so things like images work too. + */ + if ( 'key' === $k ) { + $fbadmins = explode( ',', str_replace( ' ', '', $filtered_value[0] ) ); // Trim spaces then turn comma-separated values into an array. + foreach ( $fbadmins as $fbadmin ) { + echo '' . "\n"; + } + } else { + // For everything else. + foreach ( $filtered_value as $f ) { + echo '' . "\n"; + } + } + } + } + } + $social_link_schema = ''; + if ( ! empty( $social_links ) ) { + $home_url = esc_url( get_home_url() ); + $social_links = explode( "\n", $social_links ); + foreach ( $social_links as $k => $v ) { + $v = trim( $v ); + if ( empty( $v ) ) { + unset( $social_links[ $k ] ); + } else { + $v = esc_url( $v ); + $social_links[ $k ] = $v; + } + } + $social_links = join( '","', $social_links ); + $social_link_schema = << +{ "@context" : "http://schema.org", + "@type" : "{$social_type}", + "name" : "{$social_name}", + "url" : "{$home_url}", + "sameAs" : ["{$social_links}"] +} + + +END; + } + echo apply_filters( 'aiosp_opengraph_social_link_schema', $social_link_schema ); + } + + /** + * Do / adds opengraph properties to meta. + * @since 2.3.11 + * + * @global array $aioseop_options AIOSEOP plugin options. + */ + public function do_opengraph() { + global $aioseop_options; + if ( ! empty( $aioseop_options ) + && ! empty( $aioseop_options['aiosp_schema_markup'] ) + ) { + add_filter( 'language_attributes', array( &$this, 'add_attributes' ) ); + } + if ( ! defined( 'DOING_AJAX' ) ) { + add_action( 'aioseop_modules_wp_head', array( &$this, 'add_meta' ), 5 ); + // Add social meta to AMP plugin. + if ( apply_filters( 'aioseop_enable_amp_social_meta', true ) === true ) { + add_action( 'amp_post_template_head', array( &$this, 'add_meta' ), 12 ); + } + } + } + + /** + * Set up types. + * + * @since ? + * @since 2.3.15 Change to website for homepage and blog post index page, default to object. + */ + function type_setup() { + $this->type = 'object'; // Default to type object if we don't have some other rule. + + if ( is_home() || is_front_page() ) { + $this->type = 'website'; // Home page and blog page should be website. + } elseif ( is_singular() && $this->option_isset( 'types' ) ) { + $metabox = $this->get_current_options( array(), 'settings' ); + $current_post_type = get_post_type(); + if ( ! empty( $metabox['aioseop_opengraph_settings_category'] ) ) { + $this->type = $metabox['aioseop_opengraph_settings_category']; + } elseif ( isset( $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ] ) ) { + $this->type = $this->options[ "aiosp_opengraph_{$current_post_type}_fb_object_type" ]; + } + } + } + + /** + * Inits hooks and others for admin init. + * action:admin_init. + * + * @since 2.3.11 + * @since 2.4.14 Refactored function name, and new filter added for defaults and missing term metabox. + */ + function admin_init() { + add_filter( $this->prefix . 'display_settings', array( &$this, 'filter_settings' ), 10, 3 ); + add_filter( $this->prefix . 'override_options', array( &$this, 'override_options' ), 10, 3 ); + add_filter( $this->get_prefix( 'settings' ) . 'default_options', array( + &$this, + 'filter_default_options', + ), 10, 2 ); + add_filter( + $this->get_prefix( 'settings' ) . 'filter_metabox_options', array( + &$this, + 'filter_metabox_options', + ), 10, 3 + ); + add_filter( + $this->get_prefix( 'settings' ) . 'filter_term_metabox_options', array( + &$this, + 'filter_metabox_options', + ), 10, 3 + ); + $post_types = $this->get_post_type_titles(); + $rempost = array( + 'revision' => 1, + 'nav_menu_item' => 1, + 'custom_css' => 1, + 'customize_changeset' => 1, + ); + $post_types = array_diff_key( $post_types, $rempost ); + $this->default_options['types']['initial_options'] = $post_types; + foreach ( $post_types as $slug => $name ) { + $field = $slug . '_fb_object_type'; + $this->default_options[ $field ] = array( + 'name' => "$name " . __( 'Object Type', 'all-in-one-seo-pack' ) . "
    ($slug)", + 'type' => 'select', + 'style' => '', + 'initial_options' => $this->fb_object_types, + 'default' => 'article', + 'condshow' => array( 'aiosp_opengraph_types\[\]' => $slug ), + ); + $this->help_text[ $field ] = __( 'Choose a default value that best describes the content of your post type.', 'all-in-one-seo-pack' ); + $this->help_anchors[ $field ] = '#content-object-types'; + $this->locations['opengraph']['options'][] = $field; + $this->layout['facebook']['options'][] = $field; + } + $this->setting_options(); + $this->add_help_text_links(); + + } + + function get_all_images( $options = null, $p = null ) { + static $img = array(); + if ( ! is_array( $options ) ) { + $options = array(); + } + if ( ! empty( $this->options['aiosp_opengraph_meta_key'] ) ) { + $options['meta_key'] = $this->options['aiosp_opengraph_meta_key']; + } + if ( empty( $img ) ) { + $size = apply_filters( 'post_thumbnail_size', 'large' ); + $default = $this->get_the_image_by_default(); + if ( ! empty( $default ) ) { + $default = set_url_scheme( $default ); + $img[ $default ] = 0; + } + $img = array_merge( $img, parent::get_all_images( $options, null ) ); + } + + if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) { + $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg'; + } + + if ( ! empty( $options ) && ! empty( $options['aioseop_opengraph_settings_customimg'] ) ) { + $img[ $options['aioseop_opengraph_settings_customimg'] ] = 'customimg'; + $img[ $options['aioseop_opengraph_settings_customimg_twitter'] ] = 'customimg_twitter'; + } + + if ( $author_img = $this->get_the_image_by_author( $p ) ) { + $image['author'] = $author_img; + } + $image = array_flip( $img ); + $images = array(); + if ( ! empty( $image ) ) { + foreach ( $image as $k => $v ) { + $images[ $v ] = ''; + } + } + + return array( $image, $images ); + } + + function get_the_image_by_author( $options = null, $p = null ) { + if ( $p === null ) { + global $post; + } else { + $post = $p; + } + if ( ! empty( $post ) && ! empty( $post->post_author ) ) { + $matches = array(); + $get_avatar = get_avatar( $post->post_author, 300 ); + if ( preg_match( "/src='(.*?)'/i", $get_avatar, $matches ) ) { + return $matches[1]; + } + } + + return false; + } + + function get_the_image( $options = null, $p = null ) { + $meta_key = $this->options['aiosp_opengraph_meta_key']; + + return parent::get_the_image( array( 'meta_key' => $meta_key ), $p ); + } + + function get_the_image_by_default( $args = array() ) { + return $this->options['aiosp_opengraph_dimg']; + } + + function settings_update() { + + } + + /** + * Enqueue our file upload scripts and styles. + * @param $hook + */ + function og_admin_enqueue_scripts( $hook ) { + + if ( 'all-in-one-seo_page_aiosp_opengraph' != $hook && 'term.php' != $hook ) { + // Only enqueue if we're on the social module settings page. + return; + } + + wp_enqueue_script( 'media-upload' ); + wp_enqueue_script( 'thickbox' ); + wp_enqueue_style( 'thickbox' ); + wp_enqueue_media(); + } + + function save_tax_data( $term_id, $tt_id, $taxonomy ) { + static $update = false; + if ( $update ) { + return; + } + if ( $this->locations !== null ) { + foreach ( $this->locations as $k => $v ) { + if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) { + $opts = $this->default_options( $k ); + $options = array(); + $update = false; + foreach ( $opts as $l => $o ) { + if ( isset( $_POST[ $l ] ) ) { + $options[ $l ] = stripslashes_deep( $_POST[ $l ] ); + $options[ $l ] = esc_attr( $options[ $l ] ); + $update = true; + } + } + if ( $update ) { + $prefix = $this->get_prefix( $k ); + $options = apply_filters( $prefix . 'filter_term_metabox_options', $options, $k, $term_id ); + update_term_meta( $term_id, '_' . $prefix . $k, $options ); + } + } + } + } + } + + /** + * Returns the placeholder filtered and ready for DOM display. + * filter:aioseop_opengraph_placeholder + * @since 2.4.14 + * + * @param mixed $placeholder Placeholder to be filtered. + * @param string $type Type of the value to be filtered. + * + * @return string + */ + public function filter_placeholder( $placeholder, $type = 'text' ) { + return strip_tags( trim( $placeholder ) ); + } + + /** + * Returns filtered default options. + * filter:{prefix}default_options + * @since 2.4.13 + * + * @param array $options Default options. + * @param string $location Location. + * + * @return array + */ + public function filter_default_options( $options, $location ) { + if ( $location === 'settings' ) { + $prefix = $this->get_prefix( $location ) . $location . '_'; + // Add image checker as default + $options[ $prefix . 'customimg_checker' ] = 0; + } + return $options; + } + + /** + * Returns facebook debug script and link. + * @since 2.4.14 + * + * @return string + */ + private function get_facebook_debug() { + ob_start(); + ?> + + + $image, - 'image:caption' => wp_get_attachment_caption( $thumbnail_id ), - 'image:title' => get_the_title( $thumbnail_id ), ); } } @@ -2871,10 +2858,10 @@ private function get_images_from_post( $post ) { // Ignore all attachments except images. return null; } - $attributes = wp_get_attachment_image_src( $post->ID ); + $attributes = wp_get_attachment_image_src( $post->ID, 'full' ); if ( $attributes ) { $images[] = array( - 'image:loc' => $this->clean_url( $attributes[0] ), + 'image:loc' => aiosp_common::clean_url( $attributes[0] ), 'image:caption' => wp_get_attachment_caption( $post->ID ), 'image:title' => get_the_title( $post->ID ), ); @@ -2911,10 +2898,7 @@ private function get_images_from_post( $post ) { $content = ''; $content = $post->post_content; - $this->get_gallery_images( $post, $images ); - - $content .= $this->get_content_from_galleries( $content ); - $this->parse_content_for_images( $content, $images ); + $images = array_merge( $images, aiosp_common::parse_content_for_images( $post ) ); if ( $images ) { $tmp = $images; @@ -2923,13 +2907,14 @@ private function get_images_from_post( $post ) { $tmp = array_unique( $images ); } // remove any invalid/empty images. - $tmp = array_filter( $images, array( $this, 'is_image_valid' ) ); + $tmp = array_filter( $images, array( 'aiosp_common', 'is_image_valid' ) ); $images = array(); foreach ( $tmp as $image ) { - $image_attributes = $this->get_image_attributes( $image ); + $image = aiosp_common::get_image_src_for_url( $image, 'full' ); + $image_attributes = aiosp_common::get_image_attributes( $image ); $images[] = array_merge( array( - 'image:loc' => $this->clean_url( $image ), + 'image:loc' => aiosp_common::clean_url( $image ), ), $image_attributes ); @@ -2939,24 +2924,6 @@ private function get_images_from_post( $post ) { return $images; } - /** - * Fetch image attributes such as title and caption given the image URL. - * - * @param string $url The image URL. - */ - private function get_image_attributes( $url ) { - $attributes = array(); - global $wpdb; - $attachment = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $url ) ); - if ( $attachment && is_array( $attachment ) && is_numeric( $attachment[0] ) ) { - $attributes = array( - 'image:caption' => wp_get_attachment_caption( $attachment[0] ), - 'image:title' => get_the_title( $attachment[0] ), - ); - } - return $attributes; - } - /** * Fetch images from WP, Jetpack and WooCommerce galleries. * @@ -3079,131 +3046,6 @@ private function get_content_from_galleries( $content ) { return $gallery_content; } - /** - * Cleans the URL so that its acceptable in the sitemap. - * - * @param string $url The image url. - * - * @since 2.4.1 - * - * @return string - */ - function clean_url( $url ) { - // remove the query string. - $url = strtok( $url, '?' ); - // make the url XML-safe. - $url = htmlspecialchars( $url ); - // Make the url absolute, if its relative. - $url = aiosp_common::absolutize_url( $url ); - return apply_filters( 'aioseop_clean_url', $url ); - } - - /** - * Validate the image. - * NOTE: We will use parse_url here instead of wp_parse_url as we will correct the URLs beforehand and - * this saves us the need to check PHP version support. - * - * @param string $image The image src. - * - * @since 2.4.1 - * @since 2.4.3 Compatibility with Pre v4.7 wp_parse_url(). - * - * @return bool - */ - function is_image_valid( $image ) { - global $wp_version; - - // Bail if empty image. - if ( empty( $image ) ) { - return false; - } - - global $wp_version; - if ( version_compare( $wp_version, '4.4', '<' ) ) { - $p_url = parse_url( $image ); - $url = $p_url['scheme'] . $p_url['host'] . $p_url['path']; - } elseif ( version_compare( $wp_version, '4.7', '<' ) ) { - // Compatability for older WP version that don't have 4.7 changes. - // @link https://core.trac.wordpress.org/changeset/38726 - $p_url = wp_parse_url( $image ); - $url = $p_url['scheme'] . $p_url['host'] . $p_url['path']; - } else { - $component = PHP_URL_PATH; - $url = wp_parse_url( $image, $component ); - } - - // make the url absolute, if its relative. - $image = aiosp_common::absolutize_url( $image ); - - $extn = pathinfo( parse_url( $image, PHP_URL_PATH ), PATHINFO_EXTENSION ); - $allowed = apply_filters( 'aioseop_allowed_image_extensions', self::$image_extensions ); - // Bail if image does not refer to an image file otherwise google webmaster tools might reject the sitemap. - if ( ! in_array( $extn, $allowed, true ) ) { - return false; - } - - $image_host = parse_url( $image, PHP_URL_HOST ); - $host = parse_url( home_url(), PHP_URL_HOST ); - - if ( $image_host !== $host ) { - // Allowed hosts will be provided in a wildcard format i.e. img.yahoo.* or *.akamai.*. - // And we will convert that into a regular expression for matching. - $whitelist = apply_filters( 'aioseop_images_allowed_from_hosts', array() ); - $allowed = false; - if ( $whitelist ) { - foreach ( $whitelist as $pattern ) { - if ( preg_match( '/' . str_replace( '*', '.*', $pattern ) . '/', $image_host ) === 1 ) { - $allowed = true; - break; - } - } - } - return $allowed; - - } - return true; - } - - /** - * Parse the post for images. - * - * @param string $content the post content. - * @param array $images the array of images. - */ - function parse_content_for_images( $content, &$images ) { - // These tags should be WITHOUT trailing space because some plugins such as the nextgen gallery put newlines immediately after loadHTML( $content ); - libxml_clear_errors(); - $dom->preserveWhiteSpace = false; - $matches = $dom->getElementsByTagName( 'img' ); - foreach ( $matches as $match ) { - $images[] = $match->getAttribute( 'src' ); - } - } else { - // Fall back to regex, but also report an error. - global $img_err_msg; - if ( ! isset( $img_err_msg ) ) { - // we will log this error message only once, not per post. - $img_err_msg = true; - $this->debug_message( 'DOMDocument not found; using REGEX' ); - } - preg_match_all( '/ 0 ) { $this->factory->post->create_many( $without_images, array( 'post_type' => $type, 'post_content' => 'content without image', 'post_title' => 'title without image' ) ); } if ( $with_images > 0 ) { $ids = $this->factory->post->create_many( $with_images, array( 'post_type' => $type, 'post_content' => 'content with image', 'post_title' => 'title with image' ) ); foreach ( $ids as $id ) { - $this->upload_image_and_maybe_attach( str_replace( '\\', '/', AIOSEOP_UNIT_TESTING_DIR . '/resources/images/footer-logo.png' ), $id ); + $this->upload_image_and_maybe_attach( str_replace( '\\', '/', AIOSEOP_UNIT_TESTING_DIR . "/resources/images/$image_name" ), $id ); } } @@ -298,15 +297,19 @@ protected final function setup_posts( $without_images = 0, $with_images = 0, $ty $with = array(); $without = array(); + $with_ids = array(); + $without_ids = array(); $featured = 0; foreach ( $posts as $id ) { if ( has_post_thumbnail( $id ) ) { $featured++; $with[] = get_permalink( $id ); + $with_ids[] = $id; continue; } $without[] = get_permalink( $id ); + $without_ids[] = $id; } // 2 posts have featured image? @@ -315,6 +318,10 @@ protected final function setup_posts( $without_images = 0, $with_images = 0, $ty return array( 'with' => $with, 'without' => $without, + 'ids' => array( + 'with' => $with_ids, + 'without' => $without_ids, + ), ); } @@ -393,4 +400,3 @@ public function test_dont_remove_this_method(){ } - diff --git a/tests/modules/sitemap/test-sitemap.php b/tests/modules/sitemap/test-sitemap.php index 00bda97ae..f24d550c1 100644 --- a/tests/modules/sitemap/test-sitemap.php +++ b/tests/modules/sitemap/test-sitemap.php @@ -147,6 +147,10 @@ public function test_exclude_images() { * @ticket 1423 XML Sitemap - Don't include content from trashed pages. */ public function test_exclude_trashed_pages() { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + $posts = $this->factory->post->create_many( 2 ); wp_trash_post( $posts[0] ); @@ -183,6 +187,10 @@ public function test_exclude_trashed_pages() { * @dataProvider post_type_archive_pages_provider */ public function test_post_type_archive_pages( $post_types, $has_archive, $exclude ) { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + $tests = array(); foreach( $post_types as $post_type ) { @@ -246,6 +254,10 @@ public function post_type_archive_pages_provider() { * @ticket 366 Add WooCommerce product gallery images to XML sitemap */ public function test_woocommerce_gallery() { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + $woo = 'woocommerce/woocommerce.php'; $file = dirname( dirname( AIOSEOP_UNIT_TESTING_DIR ) ) . '/'; @@ -424,6 +436,10 @@ public function test_sitemap_index_pagination( $enabled_post_type, $enabled_post * @ticket 1230 XML Sitemap - Add support for images in JetPack and NextGen galleries */ public function test_jetpack_gallery() { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + $this->markTestSkipped( 'Skipping this till actual use case is determined.' ); $jetpack = 'jetpack/jetpack.php'; @@ -475,6 +491,10 @@ public function test_jetpack_gallery() { * @ticket 1230 XML Sitemap - Add support for images in JetPack and NextGen galleries */ public function test_nextgen_gallery() { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + wp_set_current_user( 1 ); $nextgen = 'nextgen-gallery/nggallery.php'; $file = dirname( dirname( AIOSEOP_UNIT_TESTING_DIR ) ) . '/'; @@ -675,12 +695,64 @@ public function enabledPostTypes() { ); } + /** + * Attaches images to posts and checks that the image included in the sitemap is the full size image. + * + * @dataProvider fullSizeImageProvider + */ + public function test_images_are_full_size( $type ) { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + + $url = null; + + $image_to_use = 'large-square.png'; + + switch ( $type ) { + case 'featured': + $posts = $this->setup_posts( 0, 1, 'post', $image_to_use ); + $url = $posts['with'][0]; + break; + case 'content': + $array = $this->setup_posts( 1 ); + $url = $array['without'][0]; + $attachment_id = $this->upload_image_and_maybe_attach( str_replace( '\\', '/', AIOSEOP_UNIT_TESTING_DIR . "/resources/images/$image_to_use" ) ); + $image_url = wp_get_attachment_url( $attachment_id ); + wp_update_post( array( 'ID' => $array['ids']['without'][0], 'post_content' => "blah " ) ); + break; + } + + $custom_options = array(); + $custom_options['aiosp_sitemap_indexes'] = ''; + $custom_options['aiosp_sitemap_images'] = ''; + $custom_options['aiosp_sitemap_gzipped'] = ''; + $custom_options['aiosp_sitemap_posttypes'] = array( 'post' ); + + $this->_setup_options( 'sitemap', $custom_options ); + + $xml = $this->validate_sitemap( + array( + $url => array( + 'image' => true, + ), + ) + ); + + // the sitemap will contain something like large-square-54.png. + $this->assertRegExp( '/large\-square(\-\d+)?\.png/', $xml ); + } + /** * Add invalid external URLs to the sitemap and see if they are shown as valid in the sitemap. * * @dataProvider invalidExternalPagesProvider */ public function test_make_external_urls_valid( $urls ) { + if ( is_multisite() ) { + $this->markTestSkipped( 'Only for single site' ); + } + $posts = $this->setup_posts( 2 ); $pages = array(); @@ -728,6 +800,15 @@ public function test_make_external_urls_valid( $urls ) { // so all urls } + /** + * Provides arguments to test test_images_are_full_size. + */ + public function fullSizeImageProvider() { + return array( + array( 'featured' ), + array( 'content' ), + ); + } /** * Provides the invalid external pages that need to be added to the sitemap. diff --git a/tests/resources/images/large-square.png b/tests/resources/images/large-square.png new file mode 100644 index 0000000000000000000000000000000000000000..749fd6ca958b3fc23ec2539e19f417bf82c518ec GIT binary patch literal 9882 zcmeAS@N?(olHy`uVBq!ia0y~yV7&vv985rw?cukLffQqLkh>GZx^prwfgF}}M_)$< zhK>E)e-c@Ne9i)o$YKTtp%M^gyq6|l!N8!V@9E+gQW5v|h9M(^fdKQuU*>an{fKs8 z%Li&;m^0Z3L@{bI14)4iqnyz&7)=MGd116X7%dY=>xI$kaI{G<+AJDv8jd!PN4p54 zJ)_Z{(P+jA5O(wz-FFUnBWx1!TpUXO@geCyf2@rPx literal 0 HcmV?d00001 From 740063a902ef5ec7c1199570a6fe1f1077021e85 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Tue, 9 Oct 2018 22:57:58 +0530 Subject: [PATCH 54/54] XML Sitemap module - Add support for RSS/Atom updates (#1432) * XML Sitemap module - Add support for RSS/Atom updates * codeclimate * codeclimate * codeclimate * codeclimate * codeclimate * test case * codeclimate * sync with master * support all phpunit versions * flush sitemap.rss rule * remove MERGE symbols * filename can no longer be specified in the options form * if   and other entities are included * description as CDATA * flush rules --- modules/aioseop_sitemap.php | 257 +++++++++++-- tests/modules/sitemap/test-sitemap.php | 40 +- tests/resources/xsd/rss.xsd | 500 +++++++++++++++++++++++++ 3 files changed, 765 insertions(+), 32 deletions(-) create mode 100644 tests/resources/xsd/rss.xsd diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php index e18e0794a..86e31bcea 100644 --- a/modules/aioseop_sitemap.php +++ b/modules/aioseop_sitemap.php @@ -706,9 +706,11 @@ function filter_display_options( $options ) { $options[ $this->prefix . 'max_posts' ] = 50000; } $url = aioseop_home_url( '/' . $this->get_filename() . '.xml' ); + $url_rss = aioseop_home_url( '/' . $this->get_filename() . '.rss' ); - $options[ $this->prefix . 'link' ] = sprintf( __( 'Click here to %s.', 'all-in-one-seo-pack' ), '' . __( 'view your sitemap', 'all-in-one-seo-pack' ) . '' ); + $options[ $this->prefix . 'link' ] = sprintf( __( 'Click here to %s.', 'all-in-one-seo-pack' ), '' . __( 'view your XML sitemap', 'all-in-one-seo-pack' ) . '' ); $options[ $this->prefix . 'link' ] .= __( ' Your sitemap has been created with content and images.', 'all-in-one-seo-pack' ); + $options[ $this->prefix . 'link' ] .= '

    ' . sprintf( __( 'Click here to %1$sview your RSS sitemap%2$s.', 'all-in-one-seo-pack' ), '', '' ) . '

    '; if ( '0' !== get_option( 'blog_public' ) ) { $options[ $this->prefix . 'link' ] .= ' ' . __( 'Changes are automatically submitted to search engines.', 'all-in-one-seo-pack' ); } @@ -1159,9 +1161,12 @@ function setup_rewrites() { function get_rewrite_rules() { $sitemap_rules_normal = $sitemap_rules_gzipped = array(); $sitemap_rules_normal = array( + $this->get_filename() . '.xml' => "index.php?{$this->prefix}path=root", $this->get_filename() . '_(.+)_(\d+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]&' . $this->prefix . 'page=$matches[2]', $this->get_filename() . '_(.+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]', + $this->get_filename() . '.rss' => 'index.php?' . $this->prefix . 'path=rss', + $this->get_filename() . 'latest.rss' => 'index.php?' . $this->prefix . 'path=rss_latest', ); if ( $this->options[ "{$this->prefix}gzipped" ] ) { $sitemap_rules_gzipped = array( @@ -1200,10 +1205,12 @@ function flush_rules_hook() { $sitemap_rules = $this->get_rewrite_rules( $wp_rewrite ); if ( ! empty( $sitemap_rules ) ) { $rules = get_option( 'rewrite_rules' ); - $rule = key( $sitemap_rules ); - if ( ! isset( $rules[ $rule ] ) || ( $rules[ $rule ] !== $sitemap_rules[ $rule ] ) ) { - $wp_rewrite->flush_rules(); - set_transient( "{$this->prefix}rules_flushed", true, 43200 ); + $new_rules = array_keys( $sitemap_rules ); + foreach ( $new_rules as $rule ) { + if ( ! isset( $rules[ $rule ] ) || ( $rules[ $rule ] !== $sitemap_rules[ $rule ] ) ) { + $wp_rewrite->flush_rules(); + set_transient( "{$this->prefix}rules_flushed", true, 43200 ); + } } } } @@ -1325,8 +1332,11 @@ function make_dynamic_xsl() { */ function get_sitemap_data( $sitemap_type, $page = 0 ) { $sitemap_data = array(); - if ( $this->options[ "{$this->prefix}indexes" ] ) { - $posttypes = $this->options[ "{$this->prefix}posttypes" ]; + + if ( 0 === strpos( $sitemap_type, 'rss' ) ) { + $sitemap_data = $this->get_simple_sitemap(); + } elseif ( $this->options[ "{$this->prefix}indexes" ] ) { + $posttypes = $this->options["{$this->prefix}posttypes"]; if ( empty( $posttypes ) ) { $posttypes = array(); } @@ -1467,8 +1477,11 @@ function do_sitemaps( $message = '' ) { $comment = sprintf( "file '%s' statically", $this->get_filename() ); $sitemap = $this->do_simple_sitemap( $comment ); + $this->write_sitemaps( $this->get_filename(), $sitemap ); - $this->log_stats( 'root', $this->options["{$this->prefix}gzipped"], false ); + $rss = $this->do_simple_sitemap_rss( $comment ); + $this->write_sitemaps( $this->get_filename(), $rss, '.rss' ); + $this->log_stats( 'root', $this->options[ "{$this->prefix}gzipped" ], false ); } } else { delete_transient( "{$this->prefix}rules_flushed" ); @@ -1502,10 +1515,10 @@ function add_xml_mime_type( $mime ) { * @param $filename * @param $contents */ - function write_sitemaps( $filename, $contents ) { - $this->write_sitemap( $filename . '.xml', $contents ); - if ( $this->options[ "{$this->prefix}gzipped" ] ) { - $this->write_sitemap( $filename . '.xml.gz', $contents, true ); + function write_sitemaps( $filename, $contents, $extn = '.xml' ) { + $this->write_sitemap( $filename . $extn, $contents ); + if ( $this->options["{$this->prefix}gzipped"] ) { + $this->write_sitemap( $filename . $extn . '.gz', $contents, true ); } } @@ -1769,10 +1782,17 @@ function get_sitemap_index_filenames() { */ function do_build_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) { if ( empty( $filename ) ) { - if ( 'root' === $sitemap_type ) { - $filename = $this->get_filename(); - } else { - $filename = $this->get_filename() . '_' . $sitemap_type; + switch ( $sitemap_type ) { + case 'root': + // fall-through. + case 'rss': + // fall-through. + case 'rss_latest': + $filename = $this->get_filename(); + break; + default: + $filename = $this->get_filename() . '_' . $sitemap_type; + break; } } if ( empty( $comment ) ) { @@ -1782,7 +1802,7 @@ function do_build_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = if ( ( 'root' === $sitemap_type ) && ! empty( $this->options[ "{$this->prefix}indexes" ] ) ) { return $this->build_sitemap_index( $sitemap_data, sprintf( $comment, $filename ) ); } else { - return $this->build_sitemap( $sitemap_data, sprintf( $comment, $filename ) ); + return $this->build_sitemap( $sitemap_data, $sitemap_type, sprintf( $comment, $filename ) ); } } @@ -2001,7 +2021,21 @@ function do_simple_sitemap( $comment = '' ) { $sitemap_data = $this->get_simple_sitemap(); $sitemap_data = apply_filters( $this->prefix . 'data', $sitemap_data, 'root', 0, $this->options ); - return $this->build_sitemap( $sitemap_data, $comment ); + return $this->build_sitemap( $sitemap_data, '', $comment ); + } + + /** + * Build a single stand-alone RSS sitemap without indexes. + * + * @param string $comment + * + * @return string + */ + function do_simple_sitemap_rss( $comment = '' ) { + $sitemap_data = $this->get_simple_sitemap(); + $sitemap_data = apply_filters( $this->prefix . 'data', $sitemap_data, 'rss', 0, $this->options ); + + return $this->build_sitemap( $sitemap_data, 'rss', $comment ); } /** @@ -2020,15 +2054,83 @@ function get_sitemap_xsl() { return esc_url( apply_filters( 'aioseop_sitemap_xsl_url', aioseop_home_url( '/sitemap.xsl' ) ) ); } + /** + * Output the RSS for a sitemap, full or latest. + * + * @param $urls + * @param string $sitemap_type The type of RSS sitemap viz. rss or rss_latest. + * @param string $comment + */ + private function output_rss( $urls, $sitemap_type, $comment ) { + echo '' . "\r\n\r\n"; + echo '\r\n"; + + echo ''; + if ( is_multisite() ) { + echo '' . esc_html( get_blog_option( get_current_blog_id(), 'blogname' ) ) . ' + ' . esc_url( get_blog_option( get_current_blog_id(), 'siteurl' ) ) . ' + ' . esc_html( get_blog_option( get_current_blog_id(), 'blogdescription' ) ) . ''; + } else { + echo '' . esc_html( get_option( 'blogname' ) ) . ' + ' . esc_url( get_option( 'siteurl' ) ) . ' + ' . esc_html( get_option( 'blogdescription' ) ) . ''; + } + + // remove urls that do not have the rss element. + $urls = array_filter( $urls, array( $this, 'include_in_rss' ) ); + + if ( false !== strpos( $sitemap_type, 'latest' ) ) { + // let's sort the array in descending order of date. + uasort( $urls, array( $this, 'sort_modifed_date_descending' ) ); + $urls = array_slice( $urls, 0, apply_filters( $this->prefix . 'rss_latest_limit', 20 ) ); + } + + foreach ( $urls as $url ) { + echo + ' + ' . esc_url( $url['loc'] ) . ' + ' . esc_html( $url['rss']['title'] ) . ' + ' . esc_url( $url['loc'] ) . ' + + ' . esc_html( $url['rss']['pubDate'] ) . ' + '; + } + echo ''; + } + + /** + * Remove elements not containing the rss element. + */ + public function include_in_rss( $array ) { + return isset( $array['rss'] ); + } + + /** + * Sort on the basis of modified date. + */ + public function sort_modifed_date_descending( $array1, $array2 ) { + if ( ! isset( $array1['rss'] ) || ! isset( $array2['rss'] ) ) { + return 0; + } + return $array1['rss']['timestamp'] < $array2['rss']['timestamp']; + } + /** * Output the XML for a sitemap. * * @param $urls + * @param string $sitemap_type The type of sitemap viz. root, rss, rss_latest etc.. For static sitemaps, this would be empty. * @param string $comment * * @return null */ - function output_sitemap( $urls, $comment = '' ) { + private function output_sitemap( $urls, $sitemap_type, $comment = '' ) { + if ( 0 === strpos( $sitemap_type, 'rss' ) ) { + // starts with rss. + $this->output_rss( $urls, $sitemap_type, $comment ); + return; + } + $max_items = 50000; if ( ! is_array( $urls ) ) { return null; @@ -2073,6 +2175,9 @@ function output_sitemap( $urls, $comment = '' ) { foreach ( $urls as $url ) { echo "\t\r\n"; if ( is_array( $url ) ) { + if ( isset( $url['rss'] ) ) { + unset( $url['rss'] ); + } foreach ( $url as $k => $v ) { if ( ! empty( $v ) ) { if ( 'loc' === $k ) { @@ -2179,13 +2284,14 @@ function build_sitemap_index( $urls, $comment = '' ) { * Return an XML sitemap as a string. * * @param $urls + * @param string $sitemap_type The type of sitemap viz. root, rss, rss_latest etc.. For static sitemaps, this would be empty. * @param string $comment * * @return string */ - function build_sitemap( $urls, $comment = '' ) { + function build_sitemap( $urls, $sitemap_type, $comment = '' ) { ob_start(); - $this->output_sitemap( $urls, $comment ); + $this->output_sitemap( $urls, $sitemap_type, $comment ); return ob_get_clean(); } @@ -2217,6 +2323,11 @@ function get_term_priority_data( $terms ) { } $pr_info['image:image'] = $this->get_images_from_term( $term ); + $pr_info['rss'] = array( + 'title' => $term->name, + 'description' => $term->description, + 'pubDate' => $this->get_date_for_term( $term ), + ); $prio[] = $pr_info; } } @@ -2224,6 +2335,37 @@ function get_term_priority_data( $terms ) { return $prio; } + /** + * Return the date of the latest post in the given taxonomy term. + * + * @param WP_Term $term The taxonomy term. + * + * @return string + */ + private function get_date_for_term( $term ) { + $date = ''; + $query = new WP_Query( array( + 'orderby' => 'post_date', + 'order' => 'DESC', + 'numberposts' => 1, + 'post_type' => 'any', + 'post_status' => 'publish', + 'tax_query' => array( + array( + 'taxonomy' => $term->taxonomy, + 'terms' => $term->term_id, + ), + ), + ) ); + + if ( $query->have_posts() ) { + $timestamp = mysql2date( 'U', $query->post->post_modified_gmt ); + $date = date( 'r', $timestamp ); + } + + return $date; + } + /** * Return a list of permalinks for an array of terms. * @@ -2538,11 +2680,12 @@ function get_date_archive_prio_from_posts( $posts ) { } if ( ! empty( $archives ) ) { - return $this->get_prio_from_posts( - $archives, $this->get_default_priority( 'archive', true ), $this->get_default_frequency( 'archive', true ), array( + return $this->get_prio_from_posts( $archives, $this->get_default_priority( 'archive', true ), $this->get_default_frequency( 'archive', true ), + array( $this, 'get_date_archive_link_from_post', - ) + ), + 'archive' ); } @@ -2644,11 +2787,12 @@ function get_author_prio_from_posts( $posts ) { } } - return $this->get_prio_from_posts( - $authors, $this->get_default_priority( 'author', true ), $this->get_default_frequency( 'author', true ), array( + return $this->get_prio_from_posts( $authors, $this->get_default_priority( 'author', true ), $this->get_default_frequency( 'author', true ), + array( $this, 'get_author_link_from_post', - ) + ), + 'author' ); } @@ -2707,10 +2851,11 @@ function get_comment_count_stats( $posts ) { * @param bool $prio_override * @param bool $freq_override * @param string $linkfunc + * @param string $type Type of entity being fetched viz. author, post etc. * * @return array */ - private function get_prio_from_posts( $posts, $prio_override = false, $freq_override = false, $linkfunc = 'get_permalink' ) { + function get_prio_from_posts( $posts, $prio_override = false, $freq_override = false, $linkfunc = 'get_permalink', $type = 'post' ) { $prio = array(); $args = array( 'prio_override' => $prio_override, @@ -2723,10 +2868,11 @@ private function get_prio_from_posts( $posts, $prio_override = false, $freq_over $stats = $this->get_comment_count_stats( $posts ); } if ( is_array( $posts ) ) { - foreach ( $posts as $post ) { + foreach ( $posts as $key => $post ) { // Determine if we check the post for images. $is_single = true; $post->filter = 'sample'; + $timestamp = null; if ( 'get_permalink' === $linkfunc ) { $url = $this->get_permalink( $post ); } else { @@ -2744,6 +2890,7 @@ private function get_prio_from_posts( $posts, $prio_override = false, $freq_over $date = $post->post_date_gmt; } if ( '0000-00-00 00:00:00' !== $date ) { + $timestamp = $date; $date = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $date ) ); } else { $date = 0; @@ -2783,6 +2930,31 @@ private function get_prio_from_posts( $posts, $prio_override = false, $freq_over if ( is_float( $pr_info['priority'] ) ) { $pr_info['priority'] = sprintf( '%0.1F', $pr_info['priority'] ); } + + // add the rss specific data. + if ( $timestamp ) { + $title = null; + switch ( $type ) { + case 'author': + $title = get_the_author_meta( 'display_name', $key ); + break; + default: + $title = get_the_title( $post ); + break; + } + + // RSS expects the GMT date. + $timestamp = mysql2date( 'U', $post->post_modified_gmt ); + $pr_info['rss'] = array( + 'title' => $title, + 'description' => $this->get_the_excerpt( $post ), + 'pubDate' => date( 'r', $timestamp ), + 'timestamp' => $timestamp, + 'post_type' => $post->post_type, + ); + } + + $pr_info['image:image'] = $is_single ? $this->get_images_from_post( $post ) : null; $pr_info = apply_filters( $this->prefix . 'prio_item_filter', $pr_info, $post, $args ); if ( ! empty( $pr_info ) ) { @@ -2794,6 +2966,30 @@ private function get_prio_from_posts( $posts, $prio_override = false, $freq_over return $prio; } + /** + * Return the excerpt of the given post. + * + * @param WP_Post $post The post object. + * + * @return string + */ + private function get_the_excerpt( $post ) { + global $wp_version; + if ( has_excerpt( $post->ID ) ) { + if ( version_compare( $wp_version, '4.5.0', '>=' ) ) { + return get_the_excerpt( $post ); + } + + $text = strip_shortcodes( $post->post_content ); + $text = apply_filters( 'the_content', $text ); + $text = str_replace( ']]>', ']]>', $text ); + $excerpt_length = apply_filters( 'excerpt_length', 55 ); + $excerpt_more = apply_filters( 'excerpt_more', '[…]' ); + return wp_trim_words( $text, $excerpt_length, $excerpt_more ); + } + return ''; + } + /** * Return the images attached to the term. * @@ -3453,5 +3649,4 @@ function get_all_post_type_data( $args ) { return $posts; } } -} - +} \ No newline at end of file diff --git a/tests/modules/sitemap/test-sitemap.php b/tests/modules/sitemap/test-sitemap.php index f24d550c1..de23968e9 100644 --- a/tests/modules/sitemap/test-sitemap.php +++ b/tests/modules/sitemap/test-sitemap.php @@ -140,6 +140,43 @@ public function test_exclude_images() { ) ); } + + /** + * Test the generated RSS file for the sitemap. + * + * @ticket 561 XML Sitemap module - Add support for RSS/Atom updates. + */ + public function test_rss() { + $posts = $this->setup_posts( 2 ); + + $custom_options = array(); + $custom_options['aiosp_sitemap_indexes'] = ''; + $custom_options['aiosp_sitemap_images'] = 'on'; + $custom_options['aiosp_sitemap_gzipped'] = ''; + $custom_options['aiosp_sitemap_posttypes'] = array( 'post' ); + + $this->_setup_options( 'sitemap', $custom_options ); + + $this->validate_sitemap( + array( + $posts['without'][0] => true, + $posts['without'][1] => true, + ) + ); + + $rss = ABSPATH . '/sitemap.rss'; + $this->assertFileExists( $rss ); + + libxml_use_internal_errors(true); + $dom = new DOMDocument(); + $dom->load( $rss ); + $content = file_get_contents( $rss ); + + $this->assertTrue( $dom->schemaValidate( AIOSEOP_UNIT_TESTING_DIR . '/resources/xsd/rss.xsd' ) ); + $this->assertContains( $posts['without'][0], $content ); + $this->assertContains( $posts['without'][1], $content ); + } + /** * Don't include content from trashed pages. @@ -851,4 +888,5 @@ public function invalidExternalPagesProvider() { ), ); } -} \ No newline at end of file +} + diff --git a/tests/resources/xsd/rss.xsd b/tests/resources/xsd/rss.xsd new file mode 100644 index 000000000..d7ddaee60 --- /dev/null +++ b/tests/resources/xsd/rss.xsd @@ -0,0 +1,500 @@ + + + + + XML Schema for RSS v2.0 feed files. + Project home: http://www.codeplex.com/rss2schema/ + Based on the RSS 2.0 specification document at http://cyber.law.harvard.edu/rss/rss.html + Author: Jorgen Thelin + Revision: 16 + Date: 01-Nov-2008 + Feedback to: http://www.codeplex.com/rss2schema/WorkItem/List.aspx + + + + + + + + + + + + + + An item may represent a "story" -- much like a story in a newspaper or magazine; if so its description is a synopsis of the story, and the link points to the full story. An item may also be complete in itself, if so, the description contains the text (entity-encoded HTML is allowed), and the link and title may be omitted. + + + + + + The title of the item. + + + + + The item synopsis. + + + + + The URL of the item. + + + + + Email address of the author of the item. + + + + + Includes the item in one or more categories. + + + + + URL of a page for comments relating to the item. + + + + + Describes a media object that is attached to the item. + + + + + guid or permalink URL for this entry + + + + + Indicates when the item was published. + + + + + The RSS channel that the item came from. + + + + + Extensibility element. + + + + + + + + + + + + The name of the channel. It's how people refer to your service. If you have an HTML website that contains the same information as your RSS file, the title of your channel should be the same as the title of your website. + + + + + The URL to the HTML website corresponding to the channel. + + + + + Phrase or sentence describing the channel. + + + + + The language the channel is written in. This allows aggregators to group all Italian language sites, for example, on a single page. A list of allowable values for this element, as provided by Netscape, is here. You may also use values defined by the W3C. + + + + + Copyright notice for content in the channel. + + + + + Email address for person responsible for editorial content. + + + + + Email address for person responsible for technical issues relating to channel. + + + + + The publication date for the content in the channel. All date-times in RSS conform to the Date and Time Specification of RFC 822, with the exception that the year may be expressed with two characters or four characters (four preferred). + + + + + The last time the content of the channel changed. + + + + + Specify one or more categories that the channel belongs to. + + + + + A string indicating the program used to generate the channel. + + + + + A URL that points to the documentation for the format used in the RSS file. It's probably a pointer to this page. It's for people who might stumble across an RSS file on a Web server 25 years from now and wonder what it is. + + + + + Allows processes to register with a cloud to be notified of updates to the channel, implementing a lightweight publish-subscribe protocol for RSS feeds. + + + + + ttl stands for time to live. It's a number of minutes that indicates how long a channel can be cached before refreshing from the source. + + + + + Specifies a GIF, JPEG or PNG image that can be displayed with the channel. + + + + + The PICS rating for the channel. + + + + + Specifies a text input box that can be displayed with the channel. + + + + + A hint for aggregators telling them which hours they can skip. + + + + + A hint for aggregators telling them which days they can skip. + + + + + Extensibility element. + + + + + + + + + Extensibility element. + + + + + + + + A time in GMT when aggregators should not request the channel data. The hour beginning at midnight is hour zero. + + + + + + + + + + + + + + A day when aggregators should not request the channel data. + + + + + + + + + + + + + + + + A time in GMT, when aggregators should not request the channel data. The hour beginning at midnight is hour zero. + + + + + + + + + + + + + + + + The URL of the image file. + + + + + Describes the image, it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML. + + + + + The URL of the site, when the channel is rendered, the image is a link to the site. (Note, in practice the image <title> and <link> should have the same value as the channel's <title> and <link>. + + + + + The width of the image in pixels. + + + + + The height of the image in pixels. + + + + + Text that is included in the TITLE attribute of the link formed around the image in the HTML rendering. + + + + + + + The height of the image in pixels. + + + + + + + + The width of the image in pixels. + + + + + + + + Specifies a web service that supports the rssCloud interface which can be implemented in HTTP-POST, XML-RPC or SOAP 1.1. Its purpose is to allow processes to register with a cloud to be notified of updates to the channel, implementing a lightweight publish-subscribe protocol for RSS feeds. + + + + + + + + + + + + + + + + + The purpose of this element is something of a mystery! You can use it to specify a search engine box. Or to allow a reader to provide feedback. Most aggregators ignore it. + + + + + The label of the Submit button in the text input area. + + + + + Explains the text input area. + + + + + The name of the text object in the text input area. + + + + + The URL of the CGI script that processes text input requests. + + + + + + + Using the regexp definiton of E-Mail Address by Lucadean from the .NET RegExp Pattern Repository at http://www.3leaf.com/default/NetRegExpRepository.aspx + + + + + + + + A date-time displayed in RFC-822 format. + Using the regexp definiton of rfc-822 date by Sam Ruby at http://www.intertwingly.net/blog/1360.html + + + + + + + + + + + + + + + + + + URL where the enclosure is located + + + + + Size in bytes + + + + + MIME media-type of the enclosure + + + + + + + + + + + + + + + + + +