Version Description
- Add : Change meta description max length (320 characters)
- Fix : Conflict with Antispam Bee plugin
- Fix : Page title word in content heading
Download this release
Release Info
Developer | JoomUnited |
Plugin | WP Meta SEO |
Version | 3.6.3 |
Comparing to | |
See all releases |
Code changes from version 3.6.2 to 3.6.3
- inc/class.metaseo-admin.php +12 -9
- inc/class.metaseo-dashboard.php +1 -1
- inc/class.metaseo-image-list-table.php +1 -1
- inc/class.metaseo-meta.php +1 -1
- inc/class.metaseo-metabox.php +12 -9
- inc/class.metaseo-opengraph.php +605 -0
- inc/pages/dashboard.php +10 -10
- js/metaseo_admin.js +1 -1
- languages/wp-meta-seo-en_US.mo +0 -0
- readme.txt +6 -1
- wp-meta-seo.php +78 -398
inc/class.metaseo-admin.php
CHANGED
@@ -18,7 +18,7 @@ class MetaSeoAdmin
|
|
18 |
* max length meta description
|
19 |
* @var int
|
20 |
*/
|
21 |
-
public static $desc_length =
|
22 |
/**
|
23 |
* max length meta title
|
24 |
* @var int
|
@@ -730,22 +730,25 @@ class MetaSeoAdmin
|
|
730 |
} else {
|
731 |
$dom = new DOMDocument;
|
732 |
libxml_use_internal_errors(true);
|
|
|
|
|
|
|
733 |
$content = apply_filters(
|
734 |
'the_content',
|
735 |
'<div>' . html_entity_decode(stripcslashes($_POST['datas']['content'])) . '</div>'
|
736 |
);
|
737 |
if ($dom->loadHTML($content)) {
|
738 |
// Extracting the specified elements from the web page
|
739 |
-
$tags_h1 =
|
740 |
-
$tags_h2 =
|
741 |
-
$tags_h3 =
|
742 |
-
$tags_h4 =
|
743 |
-
$tags_h5 =
|
744 |
-
$tags_h6 =
|
745 |
|
746 |
$test = false;
|
747 |
-
if (
|
748 |
-
&&
|
749 |
$test = false;
|
750 |
} else {
|
751 |
// check tag h1
|
18 |
* max length meta description
|
19 |
* @var int
|
20 |
*/
|
21 |
+
public static $desc_length = 320;
|
22 |
/**
|
23 |
* max length meta title
|
24 |
* @var int
|
730 |
} else {
|
731 |
$dom = new DOMDocument;
|
732 |
libxml_use_internal_errors(true);
|
733 |
+
if (is_plugin_active('js_composer_theme/js_composer.php')) {
|
734 |
+
add_shortcode( 'mk_fancy_title', 'vc_do_shortcode' );
|
735 |
+
}
|
736 |
$content = apply_filters(
|
737 |
'the_content',
|
738 |
'<div>' . html_entity_decode(stripcslashes($_POST['datas']['content'])) . '</div>'
|
739 |
);
|
740 |
if ($dom->loadHTML($content)) {
|
741 |
// Extracting the specified elements from the web page
|
742 |
+
$tags_h1 = $dom->getElementsByTagName('h1');
|
743 |
+
$tags_h2 = $dom->getElementsByTagName('h2');
|
744 |
+
$tags_h3 = $dom->getElementsByTagName('h3');
|
745 |
+
$tags_h4 = $dom->getElementsByTagName('h4');
|
746 |
+
$tags_h5 = $dom->getElementsByTagName('h5');
|
747 |
+
$tags_h6 = $dom->getElementsByTagName('h6');
|
748 |
|
749 |
$test = false;
|
750 |
+
if (empty($tags_h1) && empty($tags_h2) && empty($tags_h3)
|
751 |
+
&& empty($tags_h4) && empty($tags_h5) && empty($tags_h6)) {
|
752 |
$test = false;
|
753 |
} else {
|
754 |
// check tag h1
|
inc/class.metaseo-dashboard.php
CHANGED
@@ -17,7 +17,7 @@ class MetaSeoDashboard
|
|
17 |
* max length meta description
|
18 |
* @var int
|
19 |
*/
|
20 |
-
public static $meta_desc_length =
|
21 |
/**
|
22 |
* Get image optimize
|
23 |
* @return array
|
17 |
* max length meta description
|
18 |
* @var int
|
19 |
*/
|
20 |
+
public static $meta_desc_length = 320;
|
21 |
/**
|
22 |
* Get image optimize
|
23 |
* @return array
|
inc/class.metaseo-image-list-table.php
CHANGED
@@ -254,7 +254,7 @@ $wpdb->posts WHERE post_status IN ($all_states) AND post_type IN ($post_types) O
|
|
254 |
'col_image_info' => __('Optimization Info', 'wp-meta-seo'),
|
255 |
'col_image_alternative' => __('Alternative text', 'wp-meta-seo'),
|
256 |
'col_image_title' => __('Title', 'wp-meta-seo'),
|
257 |
-
'col_image_legend' => __('
|
258 |
'col_image_desc' => __('Description', 'wp-meta-seo'),
|
259 |
);
|
260 |
}
|
254 |
'col_image_info' => __('Optimization Info', 'wp-meta-seo'),
|
255 |
'col_image_alternative' => __('Alternative text', 'wp-meta-seo'),
|
256 |
'col_image_title' => __('Title', 'wp-meta-seo'),
|
257 |
+
'col_image_legend' => __('Caption', 'wp-meta-seo'),
|
258 |
'col_image_desc' => __('Description', 'wp-meta-seo'),
|
259 |
);
|
260 |
}
|
inc/class.metaseo-meta.php
CHANGED
@@ -20,7 +20,7 @@ class WPMSEOMeta
|
|
20 |
/**
|
21 |
* @var int
|
22 |
*/
|
23 |
-
public static $meta_length =
|
24 |
/**
|
25 |
* @var int
|
26 |
*/
|
20 |
/**
|
21 |
* @var int
|
22 |
*/
|
23 |
+
public static $meta_length = 320;
|
24 |
/**
|
25 |
* @var int
|
26 |
*/
|
inc/class.metaseo-metabox.php
CHANGED
@@ -128,7 +128,7 @@ class WPMSEOMetabox extends WPMSEOMeta
|
|
128 |
self::$meta_fields['general']['desc']['help'] = __('The description of your content that may be displayed
|
129 |
in search engine results aka meta description.
|
130 |
By default search engine take an excerpt from your content (depending on the search query).
|
131 |
-
|
132 |
|
133 |
self::$meta_fields['social']['opengraph-title']['title'] = __('Facebook Title', 'wp-meta-seo');
|
134 |
self::$meta_fields['social']['opengraph-title']['description'] = __('Custom title to display when
|
@@ -507,19 +507,22 @@ class WPMSEOMetabox extends WPMSEOMeta
|
|
507 |
}
|
508 |
$dom = new DOMDocument;
|
509 |
libxml_use_internal_errors(true);
|
|
|
|
|
|
|
510 |
$content = apply_filters('the_content', $post->post_content);
|
511 |
if ($dom->loadHTML($content)) {
|
512 |
// Extracting the specified elements from the web page
|
513 |
-
$tags_h1 =
|
514 |
-
$tags_h2 =
|
515 |
-
$tags_h3 =
|
516 |
-
$tags_h4 =
|
517 |
-
$tags_h5 =
|
518 |
-
$tags_h6 =
|
519 |
|
520 |
$test = false;
|
521 |
-
if (
|
522 |
-
&&
|
523 |
} else {
|
524 |
if (!empty($tags_h1)) {
|
525 |
foreach ($tags_h1 as $order => $tagh1) {
|
128 |
self::$meta_fields['general']['desc']['help'] = __('The description of your content that may be displayed
|
129 |
in search engine results aka meta description.
|
130 |
By default search engine take an excerpt from your content (depending on the search query).
|
131 |
+
320 characters max allowed.', 'wp-meta-seo');
|
132 |
|
133 |
self::$meta_fields['social']['opengraph-title']['title'] = __('Facebook Title', 'wp-meta-seo');
|
134 |
self::$meta_fields['social']['opengraph-title']['description'] = __('Custom title to display when
|
507 |
}
|
508 |
$dom = new DOMDocument;
|
509 |
libxml_use_internal_errors(true);
|
510 |
+
if (is_plugin_active('js_composer_theme/js_composer.php')) {
|
511 |
+
add_shortcode( 'mk_fancy_title', 'vc_do_shortcode' );
|
512 |
+
}
|
513 |
$content = apply_filters('the_content', $post->post_content);
|
514 |
if ($dom->loadHTML($content)) {
|
515 |
// Extracting the specified elements from the web page
|
516 |
+
$tags_h1 = $dom->getElementsByTagName('h1');
|
517 |
+
$tags_h2 = $dom->getElementsByTagName('h2');
|
518 |
+
$tags_h3 = $dom->getElementsByTagName('h3');
|
519 |
+
$tags_h4 = $dom->getElementsByTagName('h4');
|
520 |
+
$tags_h5 = $dom->getElementsByTagName('h5');
|
521 |
+
$tags_h6 = $dom->getElementsByTagName('h6');
|
522 |
|
523 |
$test = false;
|
524 |
+
if (empty($tags_h1) && empty($tags_h2) && empty($tags_h3)
|
525 |
+
&& empty($tags_h4) && empty($tags_h5) && empty($tags_h6)) {
|
526 |
} else {
|
527 |
if (!empty($tags_h1)) {
|
528 |
foreach ($tags_h1 as $order => $tagh1) {
|
inc/class.metaseo-opengraph.php
ADDED
@@ -0,0 +1,605 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Prohibit direct script loading */
|
3 |
+
defined('ABSPATH') || die('No direct script access allowed!');
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class MetaSeoOpenGraph
|
7 |
+
* Get meta data
|
8 |
+
*/
|
9 |
+
class MetaSeoOpenGraph
|
10 |
+
{
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Get meta title for title tag
|
14 |
+
* @param $wp_query
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
public function getTitle($wp_query)
|
18 |
+
{
|
19 |
+
$mpage_on_front = get_option('page_on_front');
|
20 |
+
$meta_title = get_post_meta($wp_query->post->ID, '_metaseo_metatitle', true);
|
21 |
+
if ($meta_title != maybe_unserialize($meta_title)) {
|
22 |
+
$meta_title = '';
|
23 |
+
}
|
24 |
+
|
25 |
+
if ($meta_title == '') {
|
26 |
+
$meta_title = $wp_query->post->post_title;
|
27 |
+
}
|
28 |
+
|
29 |
+
return $meta_title;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Get meta title for meta tag
|
34 |
+
* @param $wp_query
|
35 |
+
* @param array $settings meta seo settings
|
36 |
+
* @param string $meta_title meta title
|
37 |
+
* @return string
|
38 |
+
*/
|
39 |
+
public function getMetaTitle($wp_query, $settings, $meta_title)
|
40 |
+
{
|
41 |
+
$meta_title_esc = esc_attr($meta_title);
|
42 |
+
// check homepage is a page
|
43 |
+
if (get_post_meta($wp_query->post->ID, '_metaseo_metatitle', true) == '' && is_front_page()) {
|
44 |
+
$meta_title_esc = esc_attr($settings['metaseo_title_home']);
|
45 |
+
if ($meta_title_esc != maybe_unserialize($meta_title_esc)) {
|
46 |
+
$meta_title_esc = '';
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
return $meta_title_esc;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Get meta keyword for meta tag
|
55 |
+
* @param $wp_query
|
56 |
+
* @param array $settings meta seo settings
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function getKeyword($wp_query, $settings)
|
60 |
+
{
|
61 |
+
$keywords = '';
|
62 |
+
if (isset($settings['metaseo_showkeywords']) && $settings['metaseo_showkeywords'] == 1) {
|
63 |
+
$meta_keywords = get_post_meta($wp_query->post->ID, '_metaseo_metakeywords', true);
|
64 |
+
$keywords = esc_attr($meta_keywords);
|
65 |
+
}
|
66 |
+
return $keywords;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Get meta description for meta tag
|
71 |
+
* @param $wp_query
|
72 |
+
* @param array $settings meta seo settings
|
73 |
+
* @return string
|
74 |
+
*/
|
75 |
+
public function getDesc($wp_query, $settings)
|
76 |
+
{
|
77 |
+
$meta_description = get_post_meta($wp_query->post->ID, '_metaseo_metadesc', true);
|
78 |
+
if ($meta_description != maybe_unserialize($meta_description)) {
|
79 |
+
$meta_description = '';
|
80 |
+
}
|
81 |
+
|
82 |
+
if ($meta_description == '') {
|
83 |
+
$content = strip_shortcodes($wp_query->post->post_content);
|
84 |
+
$content = trim(strip_tags($content));
|
85 |
+
if (strlen($content) > MPMSCAT_DESC_LENGTH) {
|
86 |
+
$meta_description = substr($content, 0, 316) . ' ...';
|
87 |
+
} else {
|
88 |
+
$meta_description = $content;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
$meta_desc_esc = esc_attr($meta_description);
|
92 |
+
|
93 |
+
if (get_post_meta($wp_query->post->ID, '_metaseo_metadesc', true) == '' && is_front_page()) {
|
94 |
+
$meta_desc_esc = esc_attr($settings['metaseo_desc_home']);
|
95 |
+
if ($meta_desc_esc != maybe_unserialize($meta_desc_esc)) {
|
96 |
+
$meta_desc_esc = '';
|
97 |
+
}
|
98 |
+
}
|
99 |
+
return $meta_desc_esc;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Get meta facebook title
|
104 |
+
* @param $wp_query
|
105 |
+
* @param string $meta_title_esc meta title default
|
106 |
+
* @return mixed|string
|
107 |
+
*/
|
108 |
+
public function getFbtitle($wp_query, $meta_title_esc)
|
109 |
+
{
|
110 |
+
$meta_fbtitle = get_post_meta($wp_query->post->ID, '_metaseo_metaopengraph-title', true);
|
111 |
+
if ($meta_fbtitle != maybe_unserialize($meta_fbtitle)) {
|
112 |
+
$meta_fbtitle = '';
|
113 |
+
}
|
114 |
+
|
115 |
+
if ($meta_fbtitle == '') {
|
116 |
+
$meta_fbtitle = $meta_title_esc;
|
117 |
+
}
|
118 |
+
|
119 |
+
return $meta_fbtitle;
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Get meta facebook description
|
124 |
+
* @param $wp_query
|
125 |
+
* @param string $meta_desc_esc meta description default
|
126 |
+
* @return mixed|string
|
127 |
+
*/
|
128 |
+
public function getFbdesc($wp_query, $meta_desc_esc)
|
129 |
+
{
|
130 |
+
$meta_fbdesc = get_post_meta($wp_query->post->ID, '_metaseo_metaopengraph-desc', true);
|
131 |
+
if ($meta_fbdesc != maybe_unserialize($meta_fbdesc)) {
|
132 |
+
$meta_fbdesc = '';
|
133 |
+
}
|
134 |
+
|
135 |
+
if ($meta_fbdesc == '') {
|
136 |
+
$meta_fbdesc = $meta_desc_esc;
|
137 |
+
}
|
138 |
+
|
139 |
+
return $meta_fbdesc;
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Get meta facebook image and twiter image
|
144 |
+
* @param $wp_query
|
145 |
+
* @return array
|
146 |
+
*/
|
147 |
+
public function getImage($wp_query)
|
148 |
+
{
|
149 |
+
$meta_twimage = get_post_meta($wp_query->post->ID, '_metaseo_metatwitter-image', true);
|
150 |
+
$meta_fbimage = get_post_meta($wp_query->post->ID, '_metaseo_metaopengraph-image', true);
|
151 |
+
|
152 |
+
$default_image = wp_get_attachment_image_src(get_post_thumbnail_id(1), 'single-post-thumbnail');
|
153 |
+
if (empty($meta_twimage) && isset($default_image[0])) {
|
154 |
+
$meta_twimage = $default_image[0];
|
155 |
+
}
|
156 |
+
|
157 |
+
if (empty($meta_fbimage) && isset($default_image[0])) {
|
158 |
+
$meta_fbimage = $default_image[0];
|
159 |
+
}
|
160 |
+
|
161 |
+
return array($meta_fbimage, $meta_twimage);
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Get meta twiter title
|
166 |
+
* @param $wp_query
|
167 |
+
* @param string $meta_title_esc meta title default
|
168 |
+
* @return string
|
169 |
+
*/
|
170 |
+
public function getTwtitle($wp_query, $meta_title_esc)
|
171 |
+
{
|
172 |
+
$twitter_title = get_post_meta($wp_query->post->ID, '_metaseo_metatwitter-title', true);
|
173 |
+
if ($twitter_title != maybe_unserialize($twitter_title)) {
|
174 |
+
$twitter_title = '';
|
175 |
+
}
|
176 |
+
|
177 |
+
$meta_twtitle = esc_attr($twitter_title);
|
178 |
+
if ($meta_twtitle == '') {
|
179 |
+
$meta_twtitle = $meta_title_esc;
|
180 |
+
}
|
181 |
+
|
182 |
+
return $meta_twtitle;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Get meta twiter description
|
187 |
+
* @param $wp_query
|
188 |
+
* @param string $meta_desc_esc meta description default
|
189 |
+
* @return string
|
190 |
+
*/
|
191 |
+
public function getTwdesc($wp_query, $meta_desc_esc)
|
192 |
+
{
|
193 |
+
$twitter_desc = get_post_meta($wp_query->post->ID, '_metaseo_metatwitter-desc', true);
|
194 |
+
if ($twitter_desc != maybe_unserialize($twitter_desc)) {
|
195 |
+
$twitter_desc = '';
|
196 |
+
}
|
197 |
+
|
198 |
+
$meta_twdesc = esc_attr($twitter_desc);
|
199 |
+
if ($meta_twdesc == '') {
|
200 |
+
$meta_twdesc = $meta_desc_esc;
|
201 |
+
}
|
202 |
+
|
203 |
+
return $meta_twdesc;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Get meta twiter card
|
208 |
+
* @param array $settings meta seo settings
|
209 |
+
* @return string
|
210 |
+
*/
|
211 |
+
public function getTwCard($settings)
|
212 |
+
{
|
213 |
+
if ((!empty($settings['metaseo_twitter_card']))) {
|
214 |
+
$meta_twcard = $settings['metaseo_twitter_card'];
|
215 |
+
} else {
|
216 |
+
$meta_twcard = 'summary';
|
217 |
+
}
|
218 |
+
|
219 |
+
return $meta_twcard;
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Get meta for home page
|
224 |
+
* @param array $settings meta seo settings
|
225 |
+
* @return array
|
226 |
+
*/
|
227 |
+
public function getHome($settings)
|
228 |
+
{
|
229 |
+
// get option reading
|
230 |
+
$mpage_for_posts = get_option('page_for_posts');
|
231 |
+
$mshow_on_front = get_option('show_on_front');
|
232 |
+
$title = '';
|
233 |
+
$desc = '';
|
234 |
+
$page_follow = 'follow';
|
235 |
+
$page_index = 'index';
|
236 |
+
if ($mshow_on_front == 'posts') {
|
237 |
+
$title = esc_attr($settings['metaseo_title_home']);
|
238 |
+
$desc = esc_attr($settings['metaseo_desc_home']);
|
239 |
+
if ($title != maybe_unserialize($title)) {
|
240 |
+
$title = '';
|
241 |
+
}
|
242 |
+
|
243 |
+
if ($desc != maybe_unserialize($desc)) {
|
244 |
+
$desc = '';
|
245 |
+
}
|
246 |
+
|
247 |
+
// set meta title when setting is empty
|
248 |
+
if ($settings['metaseo_title_home'] == '') {
|
249 |
+
$title = esc_attr(get_bloginfo('name') . ' - ' . get_bloginfo('description'));
|
250 |
+
}
|
251 |
+
|
252 |
+
// set meta description when setting is empty
|
253 |
+
if ($settings['metaseo_desc_home'] == '') {
|
254 |
+
$desc = esc_attr(get_bloginfo('description'));
|
255 |
+
}
|
256 |
+
} elseif ($mshow_on_front == 'page') { // is page posts
|
257 |
+
$title = esc_attr(get_post_meta($mpage_for_posts, '_metaseo_metatitle', true));
|
258 |
+
$page_follow = get_post_meta($mpage_for_posts, '_metaseo_metafollow', true);
|
259 |
+
$page_index = get_post_meta($mpage_for_posts, '_metaseo_metaindex', true);
|
260 |
+
}
|
261 |
+
|
262 |
+
return array(
|
263 |
+
'title' => $title,
|
264 |
+
'desc' => $desc,
|
265 |
+
'page_follow' => $page_follow,
|
266 |
+
'page_index' => $page_index,
|
267 |
+
);
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Get meta for front page
|
272 |
+
* @return array
|
273 |
+
*/
|
274 |
+
public function getFrontPageMeta()
|
275 |
+
{
|
276 |
+
$mpage_on_front = get_option('page_on_front');
|
277 |
+
$title = esc_attr(get_post_meta($mpage_on_front, '_metaseo_metatitle', true));
|
278 |
+
$desc = esc_attr(get_post_meta($mpage_on_front, '_metaseo_metadesc', true));
|
279 |
+
$page_follow = get_post_meta($mpage_on_front, '_metaseo_metafollow', true);
|
280 |
+
$page_index = get_post_meta($mpage_on_front, '_metaseo_metaindex', true);
|
281 |
+
return array(
|
282 |
+
'title' => $title,
|
283 |
+
'desc' => $desc,
|
284 |
+
'page_follow' => $page_follow,
|
285 |
+
'page_index' => $page_index,
|
286 |
+
);
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Get meta for tag , category
|
291 |
+
* @param $wp_query
|
292 |
+
* @param array $settings meta seo settings
|
293 |
+
* @return array
|
294 |
+
*/
|
295 |
+
public function getTagMeta($wp_query, $settings)
|
296 |
+
{
|
297 |
+
$term = $wp_query->get_queried_object();
|
298 |
+
$meta_keywords_esc = '';
|
299 |
+
if (is_object($term) && !empty($term)) {
|
300 |
+
if (function_exists('get_term_meta')) {
|
301 |
+
$cat_metatitle = get_term_meta($term->term_id, 'wpms_category_metatitle', true);
|
302 |
+
$cat_metadesc = get_term_meta($term->term_id, 'wpms_category_metadesc', true);
|
303 |
+
} else {
|
304 |
+
$cat_metatitle = get_metadata('term', $term->term_id, 'wpms_category_metatitle', true);
|
305 |
+
$cat_metadesc = get_metadata('term', $term->term_id, 'wpms_category_metadesc', true);
|
306 |
+
}
|
307 |
+
|
308 |
+
if (isset($settings['metaseo_showkeywords']) && $settings['metaseo_showkeywords'] == 1) {
|
309 |
+
if (function_exists('get_term_meta')) {
|
310 |
+
$meta_keywords = get_term_meta($term->term_id, 'wpms_category_metakeywords', true);
|
311 |
+
} else {
|
312 |
+
$meta_keywords = get_metadata('term', $term->term_id, 'wpms_category_metakeywords', true);
|
313 |
+
}
|
314 |
+
|
315 |
+
$meta_keywords_esc = esc_attr($meta_keywords);
|
316 |
+
}
|
317 |
+
|
318 |
+
if (isset($cat_metatitle) && $cat_metatitle != '') {
|
319 |
+
$title = esc_attr($cat_metatitle);
|
320 |
+
} else {
|
321 |
+
$title = esc_attr($term->name);
|
322 |
+
}
|
323 |
+
|
324 |
+
if (isset($cat_metadesc) && $cat_metadesc != '') {
|
325 |
+
$desc = esc_attr($cat_metadesc);
|
326 |
+
} else {
|
327 |
+
$desc = esc_attr($term->description);
|
328 |
+
}
|
329 |
+
} else {
|
330 |
+
$title = '';
|
331 |
+
$desc = '';
|
332 |
+
}
|
333 |
+
|
334 |
+
return array(
|
335 |
+
'title' => $title,
|
336 |
+
'desc' => $desc,
|
337 |
+
'keyword' => $meta_keywords_esc
|
338 |
+
);
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Get meta facebook admin and twitter site
|
343 |
+
* @param $wp_query
|
344 |
+
* @param array $settings meta seo settings
|
345 |
+
* @return array
|
346 |
+
*/
|
347 |
+
public function getUserMeta($wp_query, $settings)
|
348 |
+
{
|
349 |
+
$meta_twitter_site = get_user_meta($wp_query->post->post_author, 'mtwitter', true);
|
350 |
+
$facebook_admin = get_user_meta($wp_query->post->post_author, 'mfacebook', true);
|
351 |
+
|
352 |
+
if ($settings) {
|
353 |
+
if ($meta_twitter_site == '' && $settings['metaseo_showtwitter'] != '') {
|
354 |
+
$meta_twitter_site = $settings['metaseo_showtwitter'];
|
355 |
+
}
|
356 |
+
|
357 |
+
if ($facebook_admin == '' && $settings['metaseo_showfacebook'] != '') {
|
358 |
+
$facebook_admin = $settings['metaseo_showfacebook'];
|
359 |
+
}
|
360 |
+
}
|
361 |
+
return array(
|
362 |
+
'meta_twitter_site' => $meta_twitter_site,
|
363 |
+
'facebook_admin' => $facebook_admin
|
364 |
+
);
|
365 |
+
}
|
366 |
+
|
367 |
+
/**
|
368 |
+
* Get current URL
|
369 |
+
* @return mixed|string
|
370 |
+
*/
|
371 |
+
public function getCurentUrl()
|
372 |
+
{
|
373 |
+
if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS'])) {
|
374 |
+
$http = 'https';
|
375 |
+
} else {
|
376 |
+
$http = 'http';
|
377 |
+
}
|
378 |
+
$current_url = $http . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
379 |
+
$current_url = esc_url($current_url);
|
380 |
+
return $current_url;
|
381 |
+
}
|
382 |
+
|
383 |
+
/**
|
384 |
+
* Get type
|
385 |
+
* @return string
|
386 |
+
*/
|
387 |
+
public function getType()
|
388 |
+
{
|
389 |
+
if (is_front_page() || is_home()) {
|
390 |
+
$type = 'website';
|
391 |
+
} elseif (is_singular()) {
|
392 |
+
$type = 'article';
|
393 |
+
} else {
|
394 |
+
// We use "object" for archives etc. as article doesn't apply there.
|
395 |
+
$type = 'object';
|
396 |
+
}
|
397 |
+
return $type;
|
398 |
+
}
|
399 |
+
|
400 |
+
/**
|
401 |
+
* @param $wp_query
|
402 |
+
* @param array $settings meta seo settings
|
403 |
+
* @param string $meta_twimage meta twiter image
|
404 |
+
* @param string $meta_twcard meta twiter card
|
405 |
+
* @param string $meta_twitter_site meta twiter site
|
406 |
+
* @param string $sitename site name
|
407 |
+
* @param string $meta_twdesc meta twiter description
|
408 |
+
* @param string $meta_twtitle meta twiter title
|
409 |
+
* @param string $meta_title meta title
|
410 |
+
* @param string $facebook_admin meta facebook admin
|
411 |
+
* @param string $meta_fbimage meta facebook image
|
412 |
+
* @param string $meta_fbdesc meta facebook description
|
413 |
+
* @param string $current_url current url
|
414 |
+
* @param string $type meta type
|
415 |
+
* @param string $fbapp_id meta facebook app id
|
416 |
+
* @param string $meta_fbtitle meta facebook title
|
417 |
+
* @param string $meta_desc_esc meta description
|
418 |
+
* @param string $meta_keywords_esc meta keywords
|
419 |
+
* @param string $meta_title_esc meta title
|
420 |
+
* @param string $page_index page index
|
421 |
+
* @param string $page_follow page follow
|
422 |
+
* @return array
|
423 |
+
*/
|
424 |
+
public function getPatterns(
|
425 |
+
$wp_query,
|
426 |
+
$settings,
|
427 |
+
$meta_twimage,
|
428 |
+
$meta_twcard,
|
429 |
+
$meta_twitter_site,
|
430 |
+
$sitename,
|
431 |
+
$meta_twdesc,
|
432 |
+
$meta_twtitle,
|
433 |
+
$meta_title,
|
434 |
+
$facebook_admin,
|
435 |
+
$meta_fbimage,
|
436 |
+
$meta_fbdesc,
|
437 |
+
$current_url,
|
438 |
+
$type,
|
439 |
+
$fbapp_id,
|
440 |
+
$meta_fbtitle,
|
441 |
+
$meta_desc_esc,
|
442 |
+
$meta_keywords_esc,
|
443 |
+
$meta_title_esc,
|
444 |
+
$page_index,
|
445 |
+
$page_follow
|
446 |
+
) {
|
447 |
+
$patterns = array(
|
448 |
+
'twitter_image' => array(
|
449 |
+
'#<meta name="twitter:image" [^<>]+ ?>#i',
|
450 |
+
'<meta name="twitter:image" content="' . $meta_twimage . '" />',
|
451 |
+
($meta_twimage != '' ? true : false)),
|
452 |
+
'twitter_card' => array(
|
453 |
+
'#<meta name="twitter:card" [^<>]+ ?>#i',
|
454 |
+
'<meta name="twitter:card" content="' . $meta_twcard . '" />',
|
455 |
+
($meta_twcard != '' ? true : false)),
|
456 |
+
'twitter_site' => array(
|
457 |
+
'#<meta name="twitter:site" [^<>]+ ?>#i',
|
458 |
+
'<meta name="twitter:site" content="@' . $meta_twitter_site . '" />',
|
459 |
+
($meta_twitter_site != '' ? true : false)),
|
460 |
+
'twitter_domain' => array(
|
461 |
+
'#<meta name="twitter:domain" [^<>]+ ?>#i',
|
462 |
+
'<meta name="twitter:domain" content="' . $sitename . '" />',
|
463 |
+
($sitename != '' ? true : false)),
|
464 |
+
'twitter_desc' => array(
|
465 |
+
'#<meta name="twitter:description" [^<>]+ ?>#i',
|
466 |
+
'<meta name="twitter:description" content="' . $meta_twdesc . '" />',
|
467 |
+
($meta_twdesc != '' ? true : false)),
|
468 |
+
'twitter_title' => array(
|
469 |
+
'#<meta name="twitter:title" [^<>]+ ?>#i',
|
470 |
+
'<meta name="twitter:title" content="' . $meta_twtitle . '" />',
|
471 |
+
($meta_twtitle != '' ? true : false)),
|
472 |
+
'_title' => array('/<title.*?\/title>/i', '<title>' . $meta_title . '</title>',
|
473 |
+
($meta_title != '' ? true : false)),
|
474 |
+
'facebook_admin' => array(
|
475 |
+
'#<meta property="fb:admins" [^<>]+ ?>#i',
|
476 |
+
'<meta property="fb:admins" content="' . $facebook_admin . '" />',
|
477 |
+
($facebook_admin != '' ? true : false)),
|
478 |
+
'facebook_image' => array(
|
479 |
+
'#<meta property="og:image" [^<>]+ ?>#i',
|
480 |
+
'<meta property="og:image" content="' . $meta_fbimage . '" />',
|
481 |
+
($meta_fbimage != '' ? true : false)),
|
482 |
+
'site_name' => array(
|
483 |
+
'#<meta property="og:site_name" [^<>]+ ?>#i',
|
484 |
+
'<meta property="og:site_name" content="' . $sitename . '" />',
|
485 |
+
($sitename != '' ? true : false)),
|
486 |
+
'og:description' => array(
|
487 |
+
'#<meta property="og:description" [^<>]+ ?>#i',
|
488 |
+
'<meta property="og:description" content="' . $meta_fbdesc . '" />',
|
489 |
+
($meta_fbdesc != '' ? true : false)),
|
490 |
+
'og:url' => array(
|
491 |
+
'#<meta property="og:url" [^<>]+ ?>#i',
|
492 |
+
'<meta property="og:url" content="' . $current_url . '" />',
|
493 |
+
($current_url != '' ? true : false)),
|
494 |
+
'og:type' => array(
|
495 |
+
'#<meta property="og:type" [^<>]+ ?>#i',
|
496 |
+
'<meta property="og:type" content="' . $type . '" />',
|
497 |
+
($type != '' ? true : false)),
|
498 |
+
'fb:app_id' => array(
|
499 |
+
'#<meta property="fb:app_id" [^<>]+ ?>#i',
|
500 |
+
'<meta property="fb:app_id" content="' . $fbapp_id . '" />',
|
501 |
+
($type != '' ? true : false)),
|
502 |
+
'og:title' => array(
|
503 |
+
'#<meta property="og:title" [^<>]+ ?>#i',
|
504 |
+
'<meta property="og:title" content="' . $meta_fbtitle . '" />',
|
505 |
+
($meta_fbtitle != '' ? true : false)),
|
506 |
+
'_description' => array(
|
507 |
+
'#<meta name="description" [^<>]+ ?>#i',
|
508 |
+
'<meta name="description" content="' . $meta_desc_esc . '" />',
|
509 |
+
($meta_desc_esc != '' ? true : false)),
|
510 |
+
'keywords' => array(
|
511 |
+
'#<meta name="keywords" [^<>]+ ?>#i',
|
512 |
+
'<meta name="keywords" content="' . $meta_keywords_esc . '" />',
|
513 |
+
($meta_keywords_esc != '' ? true : false)),
|
514 |
+
'title' => array(
|
515 |
+
'#<meta name="title" [^<>]+ ?>#i',
|
516 |
+
'<meta name="title" content="' . $meta_title_esc . '" />',
|
517 |
+
($meta_title_esc != '' ? true : false))
|
518 |
+
);
|
519 |
+
|
520 |
+
if (!empty($settings['metaseo_follow'])) {
|
521 |
+
$patterns['follow'] = array(
|
522 |
+
'#<meta name="robots" [^<>]+ ?>#i',
|
523 |
+
'<meta name="robots" content="' . $page_index . ',' . $page_follow . '" />'
|
524 |
+
);
|
525 |
+
}
|
526 |
+
|
527 |
+
if (get_post_meta($wp_query->post->ID, '_metaseo_metatitle', true) != '') {
|
528 |
+
$patterns['title'] = array(
|
529 |
+
'#<meta name="title" [^<>]+ ?>#i',
|
530 |
+
'<meta name="title" content="' . $meta_title_esc . '" />',
|
531 |
+
($meta_title_esc != '' ? true : false));
|
532 |
+
}
|
533 |
+
|
534 |
+
// unset meta tag if empty value
|
535 |
+
if ($meta_keywords_esc == '') {
|
536 |
+
unset($patterns['keywords']);
|
537 |
+
}
|
538 |
+
|
539 |
+
if (!isset($fbapp_id) || (isset($fbapp_id) && $fbapp_id == '')) {
|
540 |
+
unset($patterns['fb:app_id']);
|
541 |
+
}
|
542 |
+
|
543 |
+
if ($meta_twitter_site == '') {
|
544 |
+
unset($patterns['twitter_site']);
|
545 |
+
}
|
546 |
+
|
547 |
+
if ($meta_twimage == '') {
|
548 |
+
unset($patterns['twitter_image']);
|
549 |
+
}
|
550 |
+
|
551 |
+
if ($meta_twtitle == '') {
|
552 |
+
unset($patterns['twitter_title']);
|
553 |
+
}
|
554 |
+
|
555 |
+
if ($meta_twdesc == '') {
|
556 |
+
unset($patterns['twitter_desc']);
|
557 |
+
}
|
558 |
+
|
559 |
+
if ($meta_fbdesc == '') {
|
560 |
+
unset($patterns['og:description']);
|
561 |
+
}
|
562 |
+
|
563 |
+
if ($meta_desc_esc == '') {
|
564 |
+
unset($patterns['_description']);
|
565 |
+
}
|
566 |
+
|
567 |
+
if ($facebook_admin == '') {
|
568 |
+
unset($patterns['facebook_admin']);
|
569 |
+
}
|
570 |
+
|
571 |
+
if ($meta_fbimage == '') {
|
572 |
+
unset($patterns['facebook_image']);
|
573 |
+
}
|
574 |
+
|
575 |
+
$default_settings = array(
|
576 |
+
"metaseo_showsocial" => 1,
|
577 |
+
"metaseo_metatitle_tab" => 0
|
578 |
+
);
|
579 |
+
|
580 |
+
if (is_array($settings)) {
|
581 |
+
$default_settings = array_merge($default_settings, $settings);
|
582 |
+
}
|
583 |
+
|
584 |
+
if (empty($default_settings['metaseo_metatitle_tab'])) {
|
585 |
+
unset($patterns['_title']);
|
586 |
+
}
|
587 |
+
|
588 |
+
// unset meta tag if empty value
|
589 |
+
if ((isset($default_settings['metaseo_showsocial']) && $default_settings['metaseo_showsocial'] == 0)) {
|
590 |
+
unset($patterns['twitter_image']);
|
591 |
+
unset($patterns['twitter_card']);
|
592 |
+
unset($patterns['twitter_site']);
|
593 |
+
unset($patterns['twitter_domain']);
|
594 |
+
unset($patterns['twitter_desc']);
|
595 |
+
unset($patterns['twitter_title']);
|
596 |
+
unset($patterns['facebook_admin']);
|
597 |
+
unset($patterns['facebook_image']);
|
598 |
+
unset($patterns['site_name']);
|
599 |
+
unset($patterns['og:description']);
|
600 |
+
unset($patterns['og:title']);
|
601 |
+
}
|
602 |
+
|
603 |
+
return $patterns;
|
604 |
+
}
|
605 |
+
}
|
inc/pages/dashboard.php
CHANGED
@@ -21,7 +21,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
|
|
21 |
<div class="col-md-9">
|
22 |
<div class="row panel-statistics">
|
23 |
<div class="wpms_dash_widgets wpms_dash_permalink"
|
24 |
-
alt="<?php _e('It’s better using a permalink structure that is adding
|
25 |
in your URL the category name and content title. This parameter can be changed
|
26 |
in Settings > Permalinks WordPress menu.
|
27 |
Tag recommended is %category%/%postname%', 'wp-meta-seo') ?>">
|
@@ -51,7 +51,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
|
|
51 |
</div>
|
52 |
|
53 |
<div class="wpms_dash_widgets wpms_dash_metatitle"
|
54 |
-
alt="<?php _e('Meta titles are displayed in search engine results
|
55 |
as a page title. It’s a good thing for SEO to have some custom and attractive ones.
|
56 |
Be sure to fill at least the met information on your most popular pages', 'wp-meta-seo') ?>">
|
57 |
<div class="row panel-statistics">
|
@@ -82,7 +82,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
|
|
82 |
</div>
|
83 |
|
84 |
<div class="wpms_dash_widgets wpms_dash_metadesc"
|
85 |
-
alt="<?php _e('Meta descriptions are displayed in search
|
86 |
engine results as a page description. It’s a good thing for SEO to have some
|
87 |
custom and attractive ones. Be sure to fill at least the meta information on
|
88 |
your most popular pages.', 'wp-meta-seo') ?>">
|
@@ -127,7 +127,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
|
|
127 |
?>
|
128 |
|
129 |
<div class="wpms_dash_widgets wpms_dash_imgsresize"
|
130 |
-
alt="<?php _e('Display image at its natural size, do not use HTML resize.
|
131 |
It happens usually when you use handles to resize an image. You have a bulk
|
132 |
edition tool to fix that.', 'wp-meta-seo') ?>">
|
133 |
<div class="row panel-statistics">
|
@@ -158,7 +158,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
|
|
158 |
</div>
|
159 |
|
160 |
<div class="wpms_dash_widgets wpms_dash_imgsmeta"
|
161 |
-
alt="<?php _e('We recommend to use both alt text and image title.
|
162 |
The main advantage is that it helps search engines discover your images and display
|
163 |
them in image search results. Plus, these tags improve the accessibility of your site
|
164 |
and give more information about your images. Use our bulk
|
@@ -191,7 +191,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
|
|
191 |
</div>
|
192 |
|
193 |
<div class="wpms_dash_widgets wpms_dash_newcontent"
|
194 |
-
alt="<?php _e('It is highly recommended to update or add new content on
|
195 |
your website quite frequently. At least 3 updated or new
|
196 |
content per month would be great :)', 'wp-meta-seo') ?>">
|
197 |
<div class="row panel-statistics">
|
@@ -222,7 +222,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
|
|
222 |
</div>
|
223 |
|
224 |
<div class="wpms_dash_widgets wpms_dash_linkmeta"
|
225 |
-
alt="<?php _e('The link title attribute does not have any SEO
|
226 |
value for links. BUT links titles can influence click behavior for users, which may
|
227 |
indirectly affect your SEO performance', 'wp-meta-seo') ?>">
|
228 |
<div class="row panel-statistics">
|
@@ -253,7 +253,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
|
|
253 |
</div>
|
254 |
|
255 |
<div class="wpms_dash_widgets wpms_dash_404_error"
|
256 |
-
alt="<?php _e('A website with a bunch of 404 errors doesn’t provide a good
|
257 |
user experience, which is significantly important in content marketing and SEO.
|
258 |
We recommend to use our internal broken link checker and redirect tool to fix all
|
259 |
the 404 error you can periodically.', 'wp-meta-seo') ?>">
|
@@ -292,7 +292,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
|
|
292 |
if (!is_plugin_active($plugin_imgRecycle_file)) :
|
293 |
?>
|
294 |
<div class="wpms_dash_widgets"
|
295 |
-
alt="<?php _e('Images represent around 60% of a web page weight.
|
296 |
An image compression reduce the image size by up to 70% while preserving
|
297 |
the same visual quality. Small loading time is great for SEO!', 'wp-meta-seo') ?>">
|
298 |
<div class="row panel-statistics">
|
@@ -325,7 +325,7 @@ $plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.p
|
|
325 |
<?php else : ?>
|
326 |
<?php $optimizer = $dashboard->getImagesCount(); ?>
|
327 |
<div class="wpms_dash_widgets"
|
328 |
-
alt="<?php _e('Images represent around 60% of a web page weight.
|
329 |
An image compression reduce the image size by up to 70% while preserving
|
330 |
the same visual quality. Small loading time is great for SEO!', 'wp-meta-seo') ?>">
|
331 |
<div class="row panel-statistics">
|
21 |
<div class="col-md-9">
|
22 |
<div class="row panel-statistics">
|
23 |
<div class="wpms_dash_widgets wpms_dash_permalink"
|
24 |
+
data-alt="<?php _e('It’s better using a permalink structure that is adding
|
25 |
in your URL the category name and content title. This parameter can be changed
|
26 |
in Settings > Permalinks WordPress menu.
|
27 |
Tag recommended is %category%/%postname%', 'wp-meta-seo') ?>">
|
51 |
</div>
|
52 |
|
53 |
<div class="wpms_dash_widgets wpms_dash_metatitle"
|
54 |
+
data-alt="<?php _e('Meta titles are displayed in search engine results
|
55 |
as a page title. It’s a good thing for SEO to have some custom and attractive ones.
|
56 |
Be sure to fill at least the met information on your most popular pages', 'wp-meta-seo') ?>">
|
57 |
<div class="row panel-statistics">
|
82 |
</div>
|
83 |
|
84 |
<div class="wpms_dash_widgets wpms_dash_metadesc"
|
85 |
+
data-alt="<?php _e('Meta descriptions are displayed in search
|
86 |
engine results as a page description. It’s a good thing for SEO to have some
|
87 |
custom and attractive ones. Be sure to fill at least the meta information on
|
88 |
your most popular pages.', 'wp-meta-seo') ?>">
|
127 |
?>
|
128 |
|
129 |
<div class="wpms_dash_widgets wpms_dash_imgsresize"
|
130 |
+
data-alt="<?php _e('Display image at its natural size, do not use HTML resize.
|
131 |
It happens usually when you use handles to resize an image. You have a bulk
|
132 |
edition tool to fix that.', 'wp-meta-seo') ?>">
|
133 |
<div class="row panel-statistics">
|
158 |
</div>
|
159 |
|
160 |
<div class="wpms_dash_widgets wpms_dash_imgsmeta"
|
161 |
+
data-alt="<?php _e('We recommend to use both alt text and image title.
|
162 |
The main advantage is that it helps search engines discover your images and display
|
163 |
them in image search results. Plus, these tags improve the accessibility of your site
|
164 |
and give more information about your images. Use our bulk
|
191 |
</div>
|
192 |
|
193 |
<div class="wpms_dash_widgets wpms_dash_newcontent"
|
194 |
+
data-alt="<?php _e('It is highly recommended to update or add new content on
|
195 |
your website quite frequently. At least 3 updated or new
|
196 |
content per month would be great :)', 'wp-meta-seo') ?>">
|
197 |
<div class="row panel-statistics">
|
222 |
</div>
|
223 |
|
224 |
<div class="wpms_dash_widgets wpms_dash_linkmeta"
|
225 |
+
data-alt="<?php _e('The link title attribute does not have any SEO
|
226 |
value for links. BUT links titles can influence click behavior for users, which may
|
227 |
indirectly affect your SEO performance', 'wp-meta-seo') ?>">
|
228 |
<div class="row panel-statistics">
|
253 |
</div>
|
254 |
|
255 |
<div class="wpms_dash_widgets wpms_dash_404_error"
|
256 |
+
data-alt="<?php _e('A website with a bunch of 404 errors doesn’t provide a good
|
257 |
user experience, which is significantly important in content marketing and SEO.
|
258 |
We recommend to use our internal broken link checker and redirect tool to fix all
|
259 |
the 404 error you can periodically.', 'wp-meta-seo') ?>">
|
292 |
if (!is_plugin_active($plugin_imgRecycle_file)) :
|
293 |
?>
|
294 |
<div class="wpms_dash_widgets"
|
295 |
+
data-alt="<?php _e('Images represent around 60% of a web page weight.
|
296 |
An image compression reduce the image size by up to 70% while preserving
|
297 |
the same visual quality. Small loading time is great for SEO!', 'wp-meta-seo') ?>">
|
298 |
<div class="row panel-statistics">
|
325 |
<?php else : ?>
|
326 |
<?php $optimizer = $dashboard->getImagesCount(); ?>
|
327 |
<div class="wpms_dash_widgets"
|
328 |
+
data-alt="<?php _e('Images represent around 60% of a web page weight.
|
329 |
An image compression reduce the image size by up to 70% while preserving
|
330 |
the same visual quality. Small loading time is great for SEO!', 'wp-meta-seo') ?>">
|
331 |
<div class="row panel-statistics">
|
js/metaseo_admin.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* and open the template in the editor.
|
5 |
*/
|
6 |
var title_max_len = 69;
|
7 |
-
var desc_max_len =
|
8 |
var keywords_max_len = 256;
|
9 |
var metaseoValueHolder = {};
|
10 |
|
4 |
* and open the template in the editor.
|
5 |
*/
|
6 |
var title_max_len = 69;
|
7 |
+
var desc_max_len = 320;
|
8 |
var keywords_max_len = 256;
|
9 |
var metaseoValueHolder = {};
|
10 |
|
languages/wp-meta-seo-en_US.mo
CHANGED
Binary file
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: JoomUnited
|
|
3 |
Tags: google, webmaster tools, keywords, meta, meta description, meta keywords, meta title, robots meta, search engine optimization, seo, wordpress seo, yahoo, image optimization, image resize, custom post seo, redirect, redirection, 301, broken link
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.9.1
|
6 |
-
Stable tag: 3.6.
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -272,6 +272,11 @@ It could be! if you have a lot of pages that need to be indexed with no specific
|
|
272 |
|
273 |
== Changelog ==
|
274 |
|
|
|
|
|
|
|
|
|
|
|
275 |
= 3.6.2 =
|
276 |
* Fix : Saving translation does not apply
|
277 |
* Fix : JS error when edit a post (public false)
|
3 |
Tags: google, webmaster tools, keywords, meta, meta description, meta keywords, meta title, robots meta, search engine optimization, seo, wordpress seo, yahoo, image optimization, image resize, custom post seo, redirect, redirection, 301, broken link
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.9.1
|
6 |
+
Stable tag: 3.6.3
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
272 |
|
273 |
== Changelog ==
|
274 |
|
275 |
+
= 3.6.3 =
|
276 |
+
* Add : Change meta description max length (320 characters)
|
277 |
+
* Fix : Conflict with Antispam Bee plugin
|
278 |
+
* Fix : Page title word in content heading
|
279 |
+
|
280 |
= 3.6.2 =
|
281 |
* Fix : Saving translation does not apply
|
282 |
* Fix : JS error when edit a post (public false)
|
wp-meta-seo.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: WP Meta SEO
|
5 |
* Plugin URI: http://www.joomunited.com/wordpress-products/wp-meta-seo
|
6 |
* Description: WP Meta SEO is a plugin for WordPress to fill meta for content, images and main SEO info in a single view.
|
7 |
-
* Version: 3.6.
|
8 |
* Text Domain: wp-meta-seo
|
9 |
* Domain Path: /languages
|
10 |
* Author: JoomUnited
|
@@ -99,7 +99,7 @@ if (!defined('WPMSEO_VERSION')) {
|
|
99 |
/**
|
100 |
* plugin version
|
101 |
*/
|
102 |
-
define('WPMSEO_VERSION', '3.6.
|
103 |
}
|
104 |
|
105 |
if (!defined('WPMS_CLIENTID')) {
|
@@ -127,7 +127,7 @@ if (!defined('MPMSCAT_DESC_LENGTH')) {
|
|
127 |
/**
|
128 |
* default meta description length
|
129 |
*/
|
130 |
-
define('MPMSCAT_DESC_LENGTH',
|
131 |
}
|
132 |
|
133 |
if (!defined('MPMSCAT_KEYWORDS_LENGTH')) {
|
@@ -238,16 +238,21 @@ if (is_admin()) {
|
|
238 |
}
|
239 |
|
240 |
/******** Check again and modify title, meta title, meta description before output ********/
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
|
|
|
|
|
|
|
|
|
|
245 |
}
|
246 |
|
247 |
add_action('wp_head', 'bufferEnd');
|
248 |
require_once(WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-front_end.php');
|
249 |
$GLOBALS['metaseo_front'] = new MetaSeoFront;
|
250 |
-
function
|
251 |
{
|
252 |
ob_start("wpmsCallback");
|
253 |
}
|
@@ -265,338 +270,77 @@ if (is_admin()) {
|
|
265 |
{
|
266 |
// modify buffer here, and then return the updated code
|
267 |
global $wp_query;
|
|
|
268 |
if (empty($wp_query->post->ID)) {
|
269 |
return $buffer;
|
270 |
}
|
271 |
|
272 |
// get meta title
|
273 |
-
$
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
if ($meta_title == '') {
|
279 |
-
$meta_title = $wp_query->post->post_title;
|
280 |
-
}
|
281 |
-
|
282 |
-
$meta_title_esc = esc_attr($meta_title);
|
283 |
-
|
284 |
// get meta keyword
|
285 |
-
$
|
286 |
-
if (isset($settings['metaseo_showkeywords']) && $settings['metaseo_showkeywords'] == 1) {
|
287 |
-
$meta_keywords = get_post_meta($wp_query->post->ID, '_metaseo_metakeywords', true);
|
288 |
-
$meta_keywords_esc = esc_attr($meta_keywords);
|
289 |
-
} else {
|
290 |
-
$meta_keywords_esc = '';
|
291 |
-
}
|
292 |
$page_follow = get_post_meta($wp_query->post->ID, '_metaseo_metafollow', true);
|
293 |
$page_index = get_post_meta($wp_query->post->ID, '_metaseo_metaindex', true);
|
294 |
-
|
295 |
-
// get meta description
|
296 |
-
$meta_description = get_post_meta($wp_query->post->ID, '_metaseo_metadesc', true);
|
297 |
-
if ($meta_description != maybe_unserialize($meta_description)) {
|
298 |
-
$meta_description = '';
|
299 |
-
}
|
300 |
-
|
301 |
-
if ($meta_description == '') {
|
302 |
-
$content = strip_shortcodes($wp_query->post->post_content);
|
303 |
-
$content = trim(strip_tags($content));
|
304 |
-
if (strlen($content) > 156) {
|
305 |
-
$meta_description = substr($content, 0, 152) . ' ...';
|
306 |
-
} else {
|
307 |
-
$meta_description = $content;
|
308 |
-
}
|
309 |
-
}
|
310 |
-
$meta_desc_esc = esc_attr($meta_description);
|
311 |
-
|
312 |
-
// get option reading
|
313 |
-
$mpage_for_posts = get_option('page_for_posts');
|
314 |
-
$mpage_on_front = get_option('page_on_front');
|
315 |
-
$mshow_on_front = get_option('show_on_front');
|
316 |
-
|
317 |
-
// check homepage is a page
|
318 |
-
if (get_post_meta($wp_query->post->ID, '_metaseo_metatitle', true) == '' && is_front_page()) {
|
319 |
-
$meta_title_esc = esc_attr($settings['metaseo_title_home']);
|
320 |
-
if ($meta_title_esc != maybe_unserialize($meta_title_esc)) {
|
321 |
-
$meta_title_esc = '';
|
322 |
-
}
|
323 |
-
}
|
324 |
-
|
325 |
-
if (get_post_meta($wp_query->post->ID, '_metaseo_metadesc', true) == '' && is_front_page()) {
|
326 |
-
$meta_desc_esc = esc_attr($settings['metaseo_desc_home']);
|
327 |
-
if ($meta_desc_esc != maybe_unserialize($meta_desc_esc)) {
|
328 |
-
$meta_desc_esc = '';
|
329 |
-
}
|
330 |
-
}
|
331 |
-
|
332 |
// get meta title for twitter
|
333 |
-
$
|
334 |
-
if ($twitter_title != maybe_unserialize($twitter_title)) {
|
335 |
-
$twitter_title = '';
|
336 |
-
}
|
337 |
-
|
338 |
-
$meta_twtitle = esc_attr($twitter_title);
|
339 |
-
if ($meta_twtitle == '') {
|
340 |
-
$meta_twtitle = $meta_title_esc;
|
341 |
-
}
|
342 |
-
|
343 |
-
|
344 |
// get meta description for twitter
|
345 |
-
$
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
$
|
351 |
-
|
352 |
-
|
353 |
-
}
|
354 |
-
|
355 |
$sitename = get_bloginfo('name');
|
356 |
-
$meta_twitter_site = get_user_meta($wp_query->post->post_author, 'mtwitter', true);
|
357 |
-
$facebook_admin = get_user_meta($wp_query->post->post_author, 'mfacebook', true);
|
358 |
-
|
359 |
-
$settings = get_option('_metaseo_settings');
|
360 |
-
if ($settings) {
|
361 |
-
if ($meta_twitter_site == '' && $settings['metaseo_showtwitter'] != '') {
|
362 |
-
$meta_twitter_site = $settings['metaseo_showtwitter'];
|
363 |
-
}
|
364 |
-
|
365 |
-
if ($facebook_admin == '' && $settings['metaseo_showfacebook'] != '') {
|
366 |
-
$facebook_admin = $settings['metaseo_showfacebook'];
|
367 |
-
}
|
368 |
-
}
|
369 |
-
|
370 |
-
if ((!empty($settings['metaseo_twitter_card']))) {
|
371 |
-
$meta_twcard = $settings['metaseo_twitter_card'];
|
372 |
-
} else {
|
373 |
-
$meta_twcard = 'summary';
|
374 |
-
}
|
375 |
-
$meta_twimage = get_post_meta($wp_query->post->ID, '_metaseo_metatwitter-image', true);
|
376 |
|
377 |
// get meta title for facebook
|
378 |
-
$meta_fbtitle =
|
379 |
-
if ($meta_fbtitle != maybe_unserialize($meta_fbtitle)) {
|
380 |
-
$meta_fbtitle = '';
|
381 |
-
}
|
382 |
-
|
383 |
-
if ($meta_fbtitle == '') {
|
384 |
-
$meta_fbtitle = $meta_title_esc;
|
385 |
-
}
|
386 |
-
|
387 |
// get meta description for facebook
|
388 |
-
$meta_fbdesc =
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
}
|
396 |
-
|
397 |
-
$meta_fbimage = get_post_meta($wp_query->post->ID, '_metaseo_metaopengraph-image', true);
|
398 |
-
|
399 |
-
$default_image = wp_get_attachment_image_src(get_post_thumbnail_id(1), 'single-post-thumbnail');
|
400 |
-
if (empty($meta_twimage) && isset($default_image[0])) {
|
401 |
-
$meta_twimage = $default_image[0];
|
402 |
-
}
|
403 |
|
404 |
-
|
405 |
-
|
406 |
-
}
|
407 |
|
408 |
// check homepage is latest post
|
409 |
if (is_home()) {
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
$titlehome = '';
|
415 |
-
}
|
416 |
-
|
417 |
-
if ($deschome != maybe_unserialize($deschome)) {
|
418 |
-
$deschome = '';
|
419 |
-
}
|
420 |
-
|
421 |
-
$meta_title = $meta_title_esc = $meta_twtitle = $meta_fbtitle = $titlehome;
|
422 |
-
$meta_desc_esc = $meta_twdesc = $meta_fbdesc = $deschome;
|
423 |
-
|
424 |
-
// set meta title when setting is empty
|
425 |
-
if ($settings['metaseo_title_home'] == '') {
|
426 |
-
$meta_title = esc_attr(get_bloginfo('name') . ' - ' . get_bloginfo('description'));
|
427 |
-
$meta_title_esc = esc_attr(get_bloginfo('name') . ' - ' . get_bloginfo('description'));
|
428 |
-
$meta_twtitle = esc_attr(get_bloginfo('name') . ' - ' . get_bloginfo('description'));
|
429 |
-
$meta_fbtitle = esc_attr(get_bloginfo('name') . ' - ' . get_bloginfo('description'));
|
430 |
-
}
|
431 |
-
|
432 |
-
// set meta description when setting is empty
|
433 |
-
if ($settings['metaseo_desc_home'] == '') {
|
434 |
-
$meta_desc_esc = esc_attr(get_bloginfo('description'));
|
435 |
-
$meta_twdesc = esc_attr(get_bloginfo('description'));
|
436 |
-
$meta_fbdesc = esc_attr(get_bloginfo('description'));
|
437 |
-
}
|
438 |
-
$page_follow = 'follow';
|
439 |
-
$page_index = 'index';
|
440 |
-
} elseif ($mshow_on_front == 'page') { // is page posts
|
441 |
-
$meta_title = esc_attr(get_post_meta($mpage_for_posts, '_metaseo_metatitle', true));
|
442 |
-
$meta_title_esc = esc_attr(get_post_meta($mpage_for_posts, '_metaseo_metatitle', true));
|
443 |
-
$meta_twtitle = esc_attr(get_post_meta($mpage_for_posts, '_metaseo_metatitle', true));
|
444 |
-
$meta_fbtitle = esc_attr(get_post_meta($mpage_for_posts, '_metaseo_metatitle', true));
|
445 |
-
$page_follow = get_post_meta($mpage_for_posts, '_metaseo_metafollow', true);
|
446 |
-
$page_index = get_post_meta($mpage_for_posts, '_metaseo_metaindex', true);
|
447 |
}
|
|
|
|
|
448 |
}
|
449 |
|
450 |
// is front page
|
451 |
if (is_front_page() && 'page' == get_option('show_on_front') && is_page(get_option('page_on_front'))) {
|
452 |
-
$
|
453 |
-
$meta_title_esc =
|
454 |
-
$
|
455 |
-
$
|
456 |
-
|
457 |
-
$meta_desc_esc = esc_attr(get_post_meta($mpage_on_front, '_metaseo_metadesc', true));
|
458 |
-
$meta_twdesc = esc_attr(get_post_meta($mpage_on_front, '_metaseo_metadesc', true));
|
459 |
-
$meta_fbdesc = esc_attr(get_post_meta($mpage_on_front, '_metaseo_metadesc', true));
|
460 |
-
$page_follow = get_post_meta($mpage_on_front, '_metaseo_metafollow', true);
|
461 |
-
$page_index = get_post_meta($mpage_on_front, '_metaseo_metaindex', true);
|
462 |
}
|
463 |
|
464 |
|
465 |
if (is_category() || is_tag() || is_tax()) {
|
466 |
-
$
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
$cat_metadesc = get_term_meta($term->term_id, 'wpms_category_metadesc', true);
|
471 |
-
} else {
|
472 |
-
$cat_metatitle = get_metadata('term', $term->term_id, 'wpms_category_metatitle', true);
|
473 |
-
$cat_metadesc = get_metadata('term', $term->term_id, 'wpms_category_metadesc', true);
|
474 |
-
}
|
475 |
-
|
476 |
-
if (isset($settings['metaseo_showkeywords']) && $settings['metaseo_showkeywords'] == 1) {
|
477 |
-
if (function_exists('get_term_meta')) {
|
478 |
-
$meta_keywords = get_term_meta($term->term_id, 'wpms_category_metakeywords', true);
|
479 |
-
} else {
|
480 |
-
$meta_keywords = get_metadata('term', $term->term_id, 'wpms_category_metakeywords', true);
|
481 |
-
}
|
482 |
-
|
483 |
-
$meta_keywords_esc = esc_attr($meta_keywords);
|
484 |
-
} else {
|
485 |
-
$meta_keywords_esc = '';
|
486 |
-
}
|
487 |
-
|
488 |
-
if (isset($cat_metatitle) && $cat_metatitle != '') {
|
489 |
-
$meta_title = $meta_title_esc = $meta_fbtitle = $meta_twtitle = esc_attr($cat_metatitle);
|
490 |
-
} else {
|
491 |
-
$meta_title = $meta_title_esc = $meta_fbtitle = $meta_twtitle = esc_attr($term->name);
|
492 |
-
}
|
493 |
-
|
494 |
-
if (isset($cat_metadesc) && $cat_metadesc != '') {
|
495 |
-
$meta_desc_esc = $meta_fbdesc = $meta_twdesc = esc_attr($cat_metadesc);
|
496 |
-
} else {
|
497 |
-
$meta_desc_esc = $meta_fbdesc = $meta_twdesc = esc_attr($term->description);
|
498 |
-
}
|
499 |
-
} else {
|
500 |
-
$meta_title = $meta_title_esc = $meta_fbtitle = $meta_twtitle = '';
|
501 |
-
$meta_desc_esc = $meta_fbdesc = $meta_twdesc = '';
|
502 |
-
}
|
503 |
-
|
504 |
$page_follow = 'follow';
|
505 |
}
|
506 |
|
507 |
-
if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS'])) {
|
508 |
-
$http = 'https';
|
509 |
-
} else {
|
510 |
-
$http = 'http';
|
511 |
-
}
|
512 |
-
$current_url = $http . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
513 |
-
$current_url = esc_url($current_url);
|
514 |
-
|
515 |
-
if (is_front_page() || is_home()) {
|
516 |
-
$type = 'website';
|
517 |
-
} elseif (is_singular()) {
|
518 |
-
$type = 'article';
|
519 |
-
} else {
|
520 |
-
// We use "object" for archives etc. as article doesn't apply there.
|
521 |
-
$type = 'object';
|
522 |
-
}
|
523 |
-
|
524 |
-
/* for facebook application id */
|
525 |
-
$fbapp_id = $settings['metaseo_showfbappid'];
|
526 |
-
// create List array meta tag
|
527 |
-
$patterns = array(
|
528 |
-
'twitter_image' => array(
|
529 |
-
'#<meta name="twitter:image" [^<>]+ ?>#i',
|
530 |
-
'<meta name="twitter:image" content="' . $meta_twimage . '" />',
|
531 |
-
($meta_twimage != '' ? true : false)),
|
532 |
-
'twitter_card' => array(
|
533 |
-
'#<meta name="twitter:card" [^<>]+ ?>#i',
|
534 |
-
'<meta name="twitter:card" content="' . $meta_twcard . '" />',
|
535 |
-
($meta_twcard != '' ? true : false)),
|
536 |
-
'twitter_site' => array(
|
537 |
-
'#<meta name="twitter:site" [^<>]+ ?>#i',
|
538 |
-
'<meta name="twitter:site" content="@' . $meta_twitter_site . '" />',
|
539 |
-
($meta_twitter_site != '' ? true : false)),
|
540 |
-
'twitter_domain' => array(
|
541 |
-
'#<meta name="twitter:domain" [^<>]+ ?>#i',
|
542 |
-
'<meta name="twitter:domain" content="' . $sitename . '" />',
|
543 |
-
($sitename != '' ? true : false)),
|
544 |
-
'twitter_desc' => array(
|
545 |
-
'#<meta name="twitter:description" [^<>]+ ?>#i',
|
546 |
-
'<meta name="twitter:description" content="' . $meta_twdesc . '" />',
|
547 |
-
($meta_twdesc != '' ? true : false)),
|
548 |
-
'twitter_title' => array(
|
549 |
-
'#<meta name="twitter:title" [^<>]+ ?>#i',
|
550 |
-
'<meta name="twitter:title" content="' . $meta_twtitle . '" />',
|
551 |
-
($meta_twtitle != '' ? true : false)),
|
552 |
-
'_title' => array('/<title.*?\/title>/i', '<title>' . $meta_title . '</title>',
|
553 |
-
($meta_title != '' ? true : false)),
|
554 |
-
'facebook_admin' => array(
|
555 |
-
'#<meta property="fb:admins" [^<>]+ ?>#i',
|
556 |
-
'<meta property="fb:admins" content="' . $facebook_admin . '" />',
|
557 |
-
($facebook_admin != '' ? true : false)),
|
558 |
-
'facebook_image' => array(
|
559 |
-
'#<meta property="og:image" [^<>]+ ?>#i',
|
560 |
-
'<meta property="og:image" content="' . $meta_fbimage . '" />',
|
561 |
-
($meta_fbimage != '' ? true : false)),
|
562 |
-
'site_name' => array(
|
563 |
-
'#<meta property="og:site_name" [^<>]+ ?>#i',
|
564 |
-
'<meta property="og:site_name" content="' . $sitename . '" />',
|
565 |
-
($sitename != '' ? true : false)),
|
566 |
-
'og:description' => array(
|
567 |
-
'#<meta property="og:description" [^<>]+ ?>#i',
|
568 |
-
'<meta property="og:description" content="' . $meta_fbdesc . '" />',
|
569 |
-
($meta_fbdesc != '' ? true : false)),
|
570 |
-
'og:url' => array(
|
571 |
-
'#<meta property="og:url" [^<>]+ ?>#i',
|
572 |
-
'<meta property="og:url" content="' . $current_url . '" />',
|
573 |
-
($current_url != '' ? true : false)),
|
574 |
-
'og:type' => array(
|
575 |
-
'#<meta property="og:type" [^<>]+ ?>#i',
|
576 |
-
'<meta property="og:type" content="' . $type . '" />',
|
577 |
-
($type != '' ? true : false)),
|
578 |
-
'fb:app_id' => array(
|
579 |
-
'#<meta property="fb:app_id" [^<>]+ ?>#i',
|
580 |
-
'<meta property="fb:app_id" content="' . $fbapp_id . '" />',
|
581 |
-
($type != '' ? true : false)),
|
582 |
-
'og:title' => array(
|
583 |
-
'#<meta property="og:title" [^<>]+ ?>#i',
|
584 |
-
'<meta property="og:title" content="' . $meta_fbtitle . '" />',
|
585 |
-
($meta_fbtitle != '' ? true : false)),
|
586 |
-
'_description' => array(
|
587 |
-
'#<meta name="description" [^<>]+ ?>#i',
|
588 |
-
'<meta name="description" content="' . $meta_desc_esc . '" />',
|
589 |
-
($meta_desc_esc != '' ? true : false)),
|
590 |
-
'keywords' => array(
|
591 |
-
'#<meta name="keywords" [^<>]+ ?>#i',
|
592 |
-
'<meta name="keywords" content="' . $meta_keywords_esc . '" />',
|
593 |
-
($meta_keywords_esc != '' ? true : false)),
|
594 |
-
'title' => array(
|
595 |
-
'#<meta name="title" [^<>]+ ?>#i',
|
596 |
-
'<meta name="title" content="' . $meta_title_esc . '" />',
|
597 |
-
($meta_title_esc != '' ? true : false))
|
598 |
-
);
|
599 |
-
|
600 |
if (empty($page_index)) {
|
601 |
$page_index = 'index';
|
602 |
}
|
@@ -605,100 +349,36 @@ if (is_admin()) {
|
|
605 |
$page_follow = 'follow';
|
606 |
}
|
607 |
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
$
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
if ($meta_twitter_site == '') {
|
632 |
-
unset($patterns['twitter_site']);
|
633 |
-
}
|
634 |
-
|
635 |
-
if ($meta_twimage == '') {
|
636 |
-
unset($patterns['twitter_image']);
|
637 |
-
}
|
638 |
-
|
639 |
-
if ($meta_twtitle == '') {
|
640 |
-
unset($patterns['twitter_title']);
|
641 |
-
}
|
642 |
-
|
643 |
-
if ($meta_twdesc == '') {
|
644 |
-
unset($patterns['twitter_desc']);
|
645 |
-
}
|
646 |
-
|
647 |
-
if ($meta_fbdesc == '') {
|
648 |
-
unset($patterns['og:description']);
|
649 |
-
}
|
650 |
-
|
651 |
-
if ($meta_desc_esc == '') {
|
652 |
-
unset($patterns['_description']);
|
653 |
-
}
|
654 |
-
|
655 |
-
if ($facebook_admin == '') {
|
656 |
-
unset($patterns['facebook_admin']);
|
657 |
-
}
|
658 |
-
|
659 |
-
if ($meta_fbimage == '') {
|
660 |
-
unset($patterns['facebook_image']);
|
661 |
-
}
|
662 |
-
|
663 |
-
$default_settings = array(
|
664 |
-
"metaseo_title_home" => "",
|
665 |
-
"metaseo_desc_home" => "",
|
666 |
-
"metaseo_showfacebook" => "",
|
667 |
-
"metaseo_showtwitter" => "",
|
668 |
-
"metaseo_twitter_card" => "summary",
|
669 |
-
"metaseo_showkeywords" => 0,
|
670 |
-
"metaseo_showtmetablock" => 1,
|
671 |
-
"metaseo_showsocial" => 1,
|
672 |
-
"metaseo_metatitle_tab" => 0
|
673 |
);
|
674 |
|
675 |
-
if (is_array($settings)) {
|
676 |
-
$default_settings = array_merge($default_settings, $settings);
|
677 |
-
}
|
678 |
-
|
679 |
-
if (empty($default_settings['metaseo_metatitle_tab'])) {
|
680 |
-
unset($patterns['_title']);
|
681 |
-
}
|
682 |
-
|
683 |
-
// unset meta tag if empty value
|
684 |
-
if ((isset($default_settings['metaseo_showsocial']) && $default_settings['metaseo_showsocial'] == 0)) {
|
685 |
-
unset($patterns['twitter_image']);
|
686 |
-
unset($patterns['twitter_card']);
|
687 |
-
unset($patterns['twitter_site']);
|
688 |
-
unset($patterns['twitter_domain']);
|
689 |
-
unset($patterns['twitter_desc']);
|
690 |
-
unset($patterns['twitter_title']);
|
691 |
-
unset($patterns['facebook_admin']);
|
692 |
-
unset($patterns['facebook_image']);
|
693 |
-
unset($patterns['site_name']);
|
694 |
-
unset($patterns['og:description']);
|
695 |
-
unset($patterns['og:title']);
|
696 |
-
}
|
697 |
-
|
698 |
foreach ($patterns as $k => $pattern) {
|
699 |
if (preg_match_all($pattern[0], $buffer, $matches)) {
|
700 |
$replacement = array();
|
701 |
foreach ($matches[0] as $key => $match) {
|
|
|
702 |
if ($key < 1) {
|
703 |
$replacement[] = $pattern[2] ? $pattern[1] : $match . "\n";
|
704 |
} else {
|
4 |
* Plugin Name: WP Meta SEO
|
5 |
* Plugin URI: http://www.joomunited.com/wordpress-products/wp-meta-seo
|
6 |
* Description: WP Meta SEO is a plugin for WordPress to fill meta for content, images and main SEO info in a single view.
|
7 |
+
* Version: 3.6.3
|
8 |
* Text Domain: wp-meta-seo
|
9 |
* Domain Path: /languages
|
10 |
* Author: JoomUnited
|
99 |
/**
|
100 |
* plugin version
|
101 |
*/
|
102 |
+
define('WPMSEO_VERSION', '3.6.3');
|
103 |
}
|
104 |
|
105 |
if (!defined('WPMS_CLIENTID')) {
|
127 |
/**
|
128 |
* default meta description length
|
129 |
*/
|
130 |
+
define('MPMSCAT_DESC_LENGTH', 320);
|
131 |
}
|
132 |
|
133 |
if (!defined('MPMSCAT_KEYWORDS_LENGTH')) {
|
238 |
}
|
239 |
|
240 |
/******** Check again and modify title, meta title, meta description before output ********/
|
241 |
+
require_once(WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-opengraph.php');
|
242 |
+
add_action('plugins_loaded', 'wpmsFrontendInit', 15);
|
243 |
+
function wpmsFrontendInit()
|
244 |
+
{
|
245 |
+
if (is_plugin_active('divi_layout_injector/divi_layout_injector.php')) {
|
246 |
+
add_action('get_header', 'bufferStart');
|
247 |
+
} else {
|
248 |
+
add_action('template_redirect', 'bufferStart', 999);
|
249 |
+
}
|
250 |
}
|
251 |
|
252 |
add_action('wp_head', 'bufferEnd');
|
253 |
require_once(WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-front_end.php');
|
254 |
$GLOBALS['metaseo_front'] = new MetaSeoFront;
|
255 |
+
function bufferStart()
|
256 |
{
|
257 |
ob_start("wpmsCallback");
|
258 |
}
|
270 |
{
|
271 |
// modify buffer here, and then return the updated code
|
272 |
global $wp_query;
|
273 |
+
$settings = get_option('_metaseo_settings');
|
274 |
if (empty($wp_query->post->ID)) {
|
275 |
return $buffer;
|
276 |
}
|
277 |
|
278 |
// get meta title
|
279 |
+
$opengraph = new MetaSeoOpenGraph();
|
280 |
+
$meta_title = $opengraph->getTitle($wp_query);
|
281 |
+
$meta_title_esc = $opengraph->getMetaTitle($wp_query, $settings, $meta_title);
|
282 |
+
// get meta description
|
283 |
+
$meta_desc_esc = $opengraph->getDesc($wp_query, $settings);
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
// get meta keyword
|
285 |
+
$meta_keywords_esc = $opengraph->getKeyword($wp_query, $settings);
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
$page_follow = get_post_meta($wp_query->post->ID, '_metaseo_metafollow', true);
|
287 |
$page_index = get_post_meta($wp_query->post->ID, '_metaseo_metaindex', true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
// get meta title for twitter
|
289 |
+
$meta_twtitle = $opengraph->getTwtitle($wp_query, $meta_title_esc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
// get meta description for twitter
|
291 |
+
$meta_twdesc = $opengraph->getTwdesc($wp_query, $meta_desc_esc);
|
292 |
+
// get twiter card
|
293 |
+
$meta_twcard = $opengraph->getTwCard($settings);
|
294 |
+
|
295 |
+
// get facebook admin and twiter site meta
|
296 |
+
$usermeta = $opengraph->getUserMeta($wp_query, $settings);
|
297 |
+
$meta_twitter_site = $usermeta['meta_twitter_site'];
|
298 |
+
$facebook_admin = $usermeta['facebook_admin'];
|
|
|
|
|
299 |
$sitename = get_bloginfo('name');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
|
301 |
// get meta title for facebook
|
302 |
+
$meta_fbtitle = $opengraph->getFbtitle($wp_query, $meta_title_esc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
// get meta description for facebook
|
304 |
+
$meta_fbdesc = $opengraph->getFbdesc($wp_query, $meta_desc_esc);
|
305 |
+
// get facebook app id
|
306 |
+
$fbapp_id = $settings['metaseo_showfbappid'];
|
307 |
+
// get meta image for facebook & twiter
|
308 |
+
$images = $opengraph->getImage($wp_query);
|
309 |
+
$meta_fbimage = $images[0];
|
310 |
+
$meta_twimage = $images[1];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
|
312 |
+
$current_url = $opengraph->getCurentUrl();
|
313 |
+
$type = $opengraph->getType();
|
|
|
314 |
|
315 |
// check homepage is latest post
|
316 |
if (is_home()) {
|
317 |
+
$metas = $opengraph->getHome($settings);
|
318 |
+
$meta_title = $meta_title_esc = $meta_twtitle = $meta_fbtitle = $metas['title'];
|
319 |
+
if (isset($metas['desc'])) {
|
320 |
+
$meta_desc_esc = $meta_twdesc = $meta_fbdesc = $metas['desc'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
}
|
322 |
+
$page_follow = $metas['page_follow'];
|
323 |
+
$page_index = $metas['page_index'];
|
324 |
}
|
325 |
|
326 |
// is front page
|
327 |
if (is_front_page() && 'page' == get_option('show_on_front') && is_page(get_option('page_on_front'))) {
|
328 |
+
$metas = $opengraph->getFrontPageMeta();
|
329 |
+
$meta_title = $meta_title_esc = $meta_twtitle = $meta_fbtitle = $metas['title'];
|
330 |
+
$meta_desc_esc = $meta_twdesc = $meta_fbdesc = $metas['desc'];
|
331 |
+
$page_follow = $metas['page_follow'];
|
332 |
+
$page_index = $metas['page_index'];
|
|
|
|
|
|
|
|
|
|
|
333 |
}
|
334 |
|
335 |
|
336 |
if (is_category() || is_tag() || is_tax()) {
|
337 |
+
$metas = $opengraph->getTagMeta($wp_query, $settings);
|
338 |
+
$meta_keywords_esc = $metas['keyword'];
|
339 |
+
$meta_title = $meta_title_esc = $meta_fbtitle = $meta_twtitle = $metas['title'];
|
340 |
+
$meta_desc_esc = $meta_fbdesc = $meta_twdesc = $metas['desc'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
$page_follow = 'follow';
|
342 |
}
|
343 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
if (empty($page_index)) {
|
345 |
$page_index = 'index';
|
346 |
}
|
349 |
$page_follow = 'follow';
|
350 |
}
|
351 |
|
352 |
+
// create List array meta tag
|
353 |
+
$patterns = $opengraph->getPatterns(
|
354 |
+
$wp_query,
|
355 |
+
$settings,
|
356 |
+
$meta_twimage,
|
357 |
+
$meta_twcard,
|
358 |
+
$meta_twitter_site,
|
359 |
+
$sitename,
|
360 |
+
$meta_twdesc,
|
361 |
+
$meta_twtitle,
|
362 |
+
$meta_title,
|
363 |
+
$facebook_admin,
|
364 |
+
$meta_fbimage,
|
365 |
+
$meta_fbdesc,
|
366 |
+
$current_url,
|
367 |
+
$type,
|
368 |
+
$fbapp_id,
|
369 |
+
$meta_fbtitle,
|
370 |
+
$meta_desc_esc,
|
371 |
+
$meta_keywords_esc,
|
372 |
+
$meta_title_esc,
|
373 |
+
$page_index,
|
374 |
+
$page_follow
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
);
|
376 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
foreach ($patterns as $k => $pattern) {
|
378 |
if (preg_match_all($pattern[0], $buffer, $matches)) {
|
379 |
$replacement = array();
|
380 |
foreach ($matches[0] as $key => $match) {
|
381 |
+
|
382 |
if ($key < 1) {
|
383 |
$replacement[] = $pattern[2] ? $pattern[1] : $match . "\n";
|
384 |
} else {
|