WP Meta SEO - Version 4.4.3

Version Description

  • Add : Default post image setting for social meta
    • Fix : SEO checker on Elementor Meta SEO meta box
Download this release

Release Info

Developer JoomUnited
Plugin Icon 128x128 WP Meta SEO
Version 4.4.3
Comparing to
See all releases

Code changes from version 4.4.2 to 4.4.3

assets/css/elementor/wpms-elementor.css CHANGED
@@ -11,6 +11,11 @@
11
  input, select, textarea, button {
12
  font-family: inherit;
13
  }
 
 
 
 
 
14
  #wpms-metabox-on-elementor .wpmstabs .wpmstab {
15
  display: inline-block;
16
  text-align: center;
@@ -24,6 +29,10 @@ input, select, textarea, button {
24
  #wpms-metabox-on-elementor .wpmstabs .wpmstab a .active {
25
  background-color: #0b2e13;
26
  }
 
 
 
 
27
  #reload_analysis {
28
  font-size: 10px;
29
  padding: 8px 10px;
11
  input, select, textarea, button {
12
  font-family: inherit;
13
  }
14
+ #wpms-metabox-on-elementor .container-snippet input::placeholder {
15
+ font-size: 14px;
16
+ letter-spacing: 0.8px;
17
+ }
18
+
19
  #wpms-metabox-on-elementor .wpmstabs .wpmstab {
20
  display: inline-block;
21
  text-align: center;
29
  #wpms-metabox-on-elementor .wpmstabs .wpmstab a .active {
30
  background-color: #0b2e13;
31
  }
32
+
33
+ #wpms-metabox-on-elementor .wpmstabs .wpmstab a {
34
+ text-transform: none;
35
+ }
36
  #reload_analysis {
37
  font-size: 10px;
38
  padding: 8px 10px;
assets/css/metabox-tabs.css CHANGED
@@ -201,6 +201,11 @@
201
  height: 32px;
202
  }
203
 
 
 
 
 
 
204
  .metabox-snippet-title .container-snippet .text {
205
  padding-right: 20px;
206
  display: inline-block;
@@ -315,6 +320,38 @@ table.wpmseoanalysis td {
315
  line-height: 16px;
316
  }
317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  table.wpmseoanalysis td.score {
319
  width: 20px;
320
  height: 18px;
@@ -736,6 +773,10 @@ div.wpmseo-tab-content {
736
  transition: color 0.3s ease;
737
  }
738
 
 
 
 
 
739
  #wpmseo_meta .tabs .tab.disabled a {
740
  cursor: default;
741
  opacity: 0.6;
201
  height: 32px;
202
  }
203
 
204
+ .metabox-snippet-title .container-snippet .input::placeholder {
205
+ font-size: 14px;
206
+ letter-spacing: 0.8px;
207
+ }
208
+
209
  .metabox-snippet-title .container-snippet .text {
210
  padding-right: 20px;
211
  display: inline-block;
320
  line-height: 16px;
321
  }
322
 
323
+ .wpms-bootstrap-tagsinput {
324
+ display: flex !important;
325
+ align-items: center;
326
+ flex-wrap: wrap;
327
+ }
328
+
329
+ .wpms-bootstrap-tagsinput .label-info {
330
+ max-width: 200px;
331
+ text-overflow: ellipsis;
332
+ overflow: hidden;
333
+ display: block !important;
334
+ position: relative;
335
+ padding-right: 25px !important;
336
+ box-sizing: content-box;
337
+ margin-right: 5px !important;
338
+ }
339
+
340
+ .wpms-bootstrap-tagsinput .label-info span {
341
+ position: absolute;
342
+ right: 5px;
343
+ top: 5px;
344
+ z-index: 999;
345
+ }
346
+ /*.wpms-bootstrap-tagsinput input {
347
+ max-width: 100% !important;
348
+ width: 200px !important;
349
+ }
350
+ .wpms-bootstrap-tagsinput input:focus {
351
+ text-overflow: clip !important;
352
+ direction: rtl;
353
+ }*/
354
+
355
  table.wpmseoanalysis td.score {
356
  width: 20px;
357
  height: 18px;
773
  transition: color 0.3s ease;
774
  }
775
 
776
+ .wpmseo-metabox-tabs-div .wpmstab a {
777
+ text-transform: none;
778
+ }
779
+
780
  #wpmseo_meta .tabs .tab.disabled a {
781
  cursor: default;
782
  opacity: 0.6;
assets/css/settings.css CHANGED
@@ -203,4 +203,15 @@
203
  margin-left: 6% !important;
204
  width: 90% !important;
205
  padding: 10px 1% !important;
 
 
 
 
 
 
 
 
 
 
 
206
  }
203
  margin-left: 6% !important;
204
  width: 90% !important;
205
  padding: 10px 1% !important;
206
+ }
207
+
208
+ #wpms-op-markup-fb-img-btn,
209
+ #wpms-default-twitter-img-btn {
210
+ max-width: 100px;
211
+ height: 45px;
212
+ }
213
+
214
+ #wpms-op-markup-fb-img,
215
+ #wpms-default-twitter-img {
216
+ width: calc(100% - 104px);
217
  }
assets/js/cliffpyles.js CHANGED
@@ -9,9 +9,16 @@ jQuery(document).ready(function ($) {
9
  var meta_title = $('#metaseo_wpmseo_title').val();
10
  var meta_desc = $('#metaseo_wpmseo_desc').val();
11
  var seo_keywords = $("input#metaseo_wpmseo_specific_keywords").val();
 
 
 
 
 
12
 
13
  if (typeof wp.blocks !== "undefined") {
14
- mpageurl = $('#wp-admin-bar-view').find('a').attr('href');
 
 
15
  current_editor = 'gutenberg';
16
  if (parseInt(first_load) === 1) {
17
  title = wpmscliffpyles.post_title;
@@ -23,7 +30,9 @@ jQuery(document).ready(function ($) {
23
  }
24
  }
25
  } else {
26
- mpageurl = $('#editable-post-name-full').text();
 
 
27
  title = $('#title').val();
28
  if (typeof tinyMCE !== 'undefined' && tinyMCE.get('content') !== null) {
29
  mcontent = tinyMCE.editors.content.getContent();
@@ -33,8 +42,6 @@ jQuery(document).ready(function ($) {
33
  }
34
  }
35
 
36
- if (meta_title === '') meta_title = title;
37
-
38
  $('.wpmseotab .spinner').css({'visibility': ' inherit'}).show();
39
  $('.metaseo_right .panel-left, .metaseo_right .panel-right').html('');
40
  $.ajax({
9
  var meta_title = $('#metaseo_wpmseo_title').val();
10
  var meta_desc = $('#metaseo_wpmseo_desc').val();
11
  var seo_keywords = $("input#metaseo_wpmseo_specific_keywords").val();
12
+ mpageurl = $('.editor-post-link .components-text-control__input').val();
13
+
14
+ if (typeof mpageurl === 'undefined') {
15
+ mpageurl = $('.edit-post-post-link__link').attr('href');
16
+ }
17
 
18
  if (typeof wp.blocks !== "undefined") {
19
+ if (typeof mpageurl === 'undefined') {
20
+ mpageurl = $('#wp-admin-bar-view').find('a').attr('href');
21
+ }
22
  current_editor = 'gutenberg';
23
  if (parseInt(first_load) === 1) {
24
  title = wpmscliffpyles.post_title;
30
  }
31
  }
32
  } else {
33
+ if (typeof mpageurl === 'undefined') {
34
+ mpageurl = $('#editable-post-name-full').text();
35
+ }
36
  title = $('#title').val();
37
  if (typeof tinyMCE !== 'undefined' && tinyMCE.get('content') !== null) {
38
  mcontent = tinyMCE.editors.content.getContent();
42
  }
43
  }
44
 
 
 
45
  $('.wpmseotab .spinner').css({'visibility': ' inherit'}).show();
46
  $('.metaseo_right .panel-left, .metaseo_right .panel-right').html('');
47
  $.ajax({
assets/js/elementor/cliffpyles.js CHANGED
@@ -18,7 +18,6 @@ jQuery(document).ready(function ($) {
18
  elementorTitle = elementorTitle.replace("Elementor |", "");
19
  elementorTitle = elementorTitle.trim();
20
  }
21
- if (meta_title === '') meta_title = elementorTitle;
22
 
23
  // get content html from elementor frontend
24
  elementorContent = elementor.$previewElementorEl.html();
18
  elementorTitle = elementorTitle.replace("Elementor |", "");
19
  elementorTitle = elementorTitle.trim();
20
  }
 
21
 
22
  // get content html from elementor frontend
23
  elementorContent = elementor.$previewElementorEl.html();
assets/js/elementor/wpms-elementor.js CHANGED
@@ -71,6 +71,9 @@ jQuery(function ($) {
71
  if (typeof tinyMCE !== 'undefined' && tinyMCE.get('excerpt') !== null) {
72
  tinyMCE.get('excerpt').on('blur', msUpdateDesc);
73
  }
 
 
 
74
  },
75
  500
76
  );
@@ -220,19 +223,20 @@ jQuery(function ($) {
220
  'wp_metaseo_seoscore': scoreProgress
221
  };
222
  $.ajax({
223
- dataType: 'json',
224
- method: 'POST',
225
  url: ajaxurl,
 
 
226
  data: {
227
- 'action': 'wpms',
228
- 'task': 'wpmsElementorSavePost',
229
- 'elementorPostID': postID,
230
- 'wpms_nonce': wpmseoMetaboxL10n.wpms_nonce,
231
- 'datas': datas
232
  },
233
  success: function (res) {
234
- if (res) {
235
- }
 
236
  }
237
  });
238
  }
@@ -345,13 +349,10 @@ jQuery(function ($) {
345
  if (typeof str === 'undefined') {
346
  return;
347
  }
348
- let titleReplace = document.title;
349
  titleReplace = titleReplace.replace("Elementor |", "");
350
  titleReplace = titleReplace.trim();
351
- if (titleReplace.length) {
352
- str = str.replace(/%title%/g, titleReplace.replace(/(<([^>]+)>)/ig, ''));
353
- }
354
-
355
  // These are added in the head for performance reasons.
356
  str = str.replace(/%id%/g, wpmseoMetaboxL10n.id);
357
  str = str.replace(/%date%/g, wpmseoMetaboxL10n.date);
@@ -434,16 +435,13 @@ jQuery(function ($) {
434
  if (titleElm.val()) {
435
  title = titleElm.val().replace(/(<([^>]+)>)/ig, '');
436
  } else if (wpmseoMetaboxL10n.metatitle_tab === '1') {
437
- title = wpmseoMetaboxL10n.wpmseo_title_template;
438
  title = divHtml.html(title).text();
439
  }
440
 
441
  if (title === '') {
442
  var len = wpmseoMetaboxL10n.wpmseo_meta_title_length - $('#metaseo_snippet_title').val().length;
443
  metaseo_status_length(len, '#' + wpmseoMetaboxL10n.field_prefix + 'title-length');
444
-
445
  titleLengthError.hide();
446
- return;
447
  }
448
 
449
  title = msClean(title);
@@ -460,14 +458,6 @@ jQuery(function ($) {
460
  }
461
 
462
  var len = wpmseoMetaboxL10n.wpmseo_meta_title_length - $('#metaseo_snippet_title').val().length;
463
- if ($('#metaseo_snippet_title').val() === '') {
464
- var mtitle_template = wpmseoMetaboxL10n.wpmseo_title_template;
465
- if ($(wpmsdivtitle).length) {
466
- mtitle_template = mtitle_template.replace(/%title%/g, $(wpmsdivtitle).val().replace(/(<([^>]+)>)/ig, ''));
467
- }
468
- len = wpmseoMetaboxL10n.wpmseo_meta_title_length - mtitle_template.length;
469
- }
470
-
471
  metaseo_status_length(len, '#' + wpmseoMetaboxL10n.field_prefix + 'title-length');
472
  });
473
  }
@@ -632,4 +622,13 @@ jQuery(function ($) {
632
  }
633
  });
634
  }
 
 
 
 
 
 
 
 
 
635
  });
71
  if (typeof tinyMCE !== 'undefined' && tinyMCE.get('excerpt') !== null) {
72
  tinyMCE.get('excerpt').on('blur', msUpdateDesc);
73
  }
74
+
75
+ // set default size = 1
76
+ $('.wpms-bootstrap-tagsinput input').attr('size', 1);
77
  },
78
  500
79
  );
223
  'wp_metaseo_seoscore': scoreProgress
224
  };
225
  $.ajax({
 
 
226
  url: ajaxurl,
227
+ method: 'POST',
228
+ dataType: 'json',
229
  data: {
230
+ action: 'wpms',
231
+ task: 'wpmsElementorSavePost',
232
+ elementorPostID: postID,
233
+ wpms_nonce: wpmseoMetaboxL10n.wpms_nonce,
234
+ datas: datas
235
  },
236
  success: function (res) {
237
+ },
238
+ error: function (e) {
239
+ console.log(e);
240
  }
241
  });
242
  }
349
  if (typeof str === 'undefined') {
350
  return;
351
  }
352
+ let titleReplace = (typeof document.title !== 'undefined') ? document.title : '';
353
  titleReplace = titleReplace.replace("Elementor |", "");
354
  titleReplace = titleReplace.trim();
355
+ str = str.replace(/%title%/g, titleReplace.replace(/(<([^>]+)>)/ig, ''));
 
 
 
356
  // These are added in the head for performance reasons.
357
  str = str.replace(/%id%/g, wpmseoMetaboxL10n.id);
358
  str = str.replace(/%date%/g, wpmseoMetaboxL10n.date);
435
  if (titleElm.val()) {
436
  title = titleElm.val().replace(/(<([^>]+)>)/ig, '');
437
  } else if (wpmseoMetaboxL10n.metatitle_tab === '1') {
 
438
  title = divHtml.html(title).text();
439
  }
440
 
441
  if (title === '') {
442
  var len = wpmseoMetaboxL10n.wpmseo_meta_title_length - $('#metaseo_snippet_title').val().length;
443
  metaseo_status_length(len, '#' + wpmseoMetaboxL10n.field_prefix + 'title-length');
 
444
  titleLengthError.hide();
 
445
  }
446
 
447
  title = msClean(title);
458
  }
459
 
460
  var len = wpmseoMetaboxL10n.wpmseo_meta_title_length - $('#metaseo_snippet_title').val().length;
 
 
 
 
 
 
 
 
461
  metaseo_status_length(len, '#' + wpmseoMetaboxL10n.field_prefix + 'title-length');
462
  });
463
  }
622
  }
623
  });
624
  }
625
+
626
+ // Custom bootstrap tagsinput when paste value
627
+ $(document).on('paste', '.wpms-bootstrap-tagsinput > input', function(e) {
628
+ let pasteData = e.originalEvent.clipboardData.getData('text');
629
+ $(this).attr('size', pasteData.length);
630
+ })
631
+ .on('focusout', '.wpms-bootstrap-tagsinput > input', function (e) {
632
+ $(this).attr('size', 1);
633
+ });
634
  });
assets/js/settings.js CHANGED
@@ -33,4 +33,78 @@
33
  $(this).parent('.save-settings-mess').hide('fade');
34
  });
35
  });
36
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  $(this).parent('.save-settings-mess').hide('fade');
34
  });
35
  });
36
+ })(jQuery);
37
+
38
+ // Open graph
39
+ jQuery(function ($) {
40
+ $('.metaseo_enable_op_markup').on('click', () => {
41
+ if ($('#metaseo_enable_op_markup').is(':checked')) {
42
+ $('.wpms-op-markup-source').show();
43
+ if ($('#wpms-op-markup-source').val() === 'setDefaultImage') {
44
+ $('.wpms-op-markup-upload').show();
45
+ }
46
+ } else {
47
+ $('.wpms-op-markup-source').hide();
48
+ $('.wpms-op-markup-upload').hide();
49
+ }
50
+ });
51
+
52
+ $('#wpms-op-markup-source').on('change', () => {
53
+ if ($('#wpms-op-markup-source').val() === 'setDefaultImage') {
54
+ $('.wpms-op-markup-upload').show();
55
+ } else {
56
+ $('.wpms-op-markup-upload').hide();
57
+ }
58
+ });
59
+ });
60
+
61
+ // Twitter
62
+ jQuery(function ($) {
63
+ $('.metaseo_enable_twitter_img').on('click', () => {
64
+ if ($('#metaseo_enable_twitter_img').is(':checked')) {
65
+ $('.wpms-twitter-img-source').show();
66
+ if ($('#wpms-twitter-img-source').val() === 'setDefaultImage') {
67
+ $('.wpms-twitter-img-upload').show();
68
+ }
69
+ } else {
70
+ $('.wpms-twitter-img-source').hide();
71
+ $('.wpms-twitter-img-upload').hide();
72
+ }
73
+ });
74
+
75
+ $('#wpms-twitter-img-source').on('change', () => {
76
+ if ($('#wpms-twitter-img-source').val() === 'setDefaultImage') {
77
+ $('.wpms-twitter-img-upload').show();
78
+ } else {
79
+ $('.wpms-twitter-img-upload').hide();
80
+ }
81
+ });
82
+ });
83
+
84
+ // Upload image
85
+ 'use strict';
86
+ var wpmseo_target_id;
87
+ jQuery(document).ready(function ($) {
88
+ var wpmseo_uploader;
89
+ $('.wpmseo_image_upload_button').on('click', function (e) {
90
+ wpmseo_target_id = $(this).attr('id').replace(/-btn$/, '');
91
+ e.preventDefault();
92
+ if (wpmseo_uploader) {
93
+ wpmseo_uploader.open();
94
+ return;
95
+ }
96
+ wpmseo_uploader = wp.media.frames.file_frame = wp.media({
97
+ title: wpmsSettingsL10n.choose_image,
98
+ button: {text: wpmsSettingsL10n.choose_image},
99
+ multiple: false
100
+ });
101
+
102
+ wpmseo_uploader.on('select', function () {
103
+ var attachment = wpmseo_uploader.state().get('selection').first().toJSON();
104
+ $('#' + wpmseo_target_id).val(attachment.url);
105
+ wpmseo_uploader.close();
106
+ });
107
+
108
+ wpmseo_uploader.open();
109
+ });
110
+ });
assets/js/wp-metaseo-metabox.js CHANGED
@@ -31,7 +31,6 @@ function msReplaceVariables(str, callback) {
31
  if (typeof str === 'undefined') {
32
  return;
33
  }
34
-
35
  if (jQuery(wpmsdivtitle).length) {
36
  str = str.replace(/%title%/g, jQuery(wpmsdivtitle).val().replace(/(<([^>]+)>)/ig, ''));
37
  }
@@ -118,7 +117,6 @@ function msUpdateTitle(force) {
118
  if (titleElm.val()) {
119
  title = titleElm.val().replace(/(<([^>]+)>)/ig, '');
120
  } else if (wpmseoMetaboxL10n.metatitle_tab === '1') {
121
- title = wpmseoMetaboxL10n.wpmseo_title_template;
122
  title = divHtml.html(title).text();
123
  }
124
 
@@ -127,7 +125,7 @@ function msUpdateTitle(force) {
127
  metaseo_status_length(len, '#' + wpmseoMetaboxL10n.field_prefix + 'title-length');
128
 
129
  titleLengthError.hide();
130
- return;
131
  }
132
 
133
  title = msClean(title);
@@ -144,14 +142,6 @@ function msUpdateTitle(force) {
144
  var placeholder_title = divHtml.html(title).text();
145
  jQuery('#metaseo_snippet_title').val(placeholder_title);
146
  var len = wpmseoMetaboxL10n.wpmseo_meta_title_length - jQuery('#metaseo_snippet_title').val().length;
147
- if (jQuery('#metaseo_snippet_title').val() === '') {
148
- var mtitle_template = wpmseoMetaboxL10n.wpmseo_title_template;
149
- if (jQuery(wpmsdivtitle).length) {
150
- mtitle_template = mtitle_template.replace(/%title%/g, jQuery(wpmsdivtitle).val().replace(/(<([^>]+)>)/ig, ''));
151
- }
152
- len = wpmseoMetaboxL10n.wpmseo_meta_title_length - mtitle_template.length;
153
- }
154
-
155
  metaseo_status_length(len, '#' + wpmseoMetaboxL10n.field_prefix + 'title-length');
156
  });
157
  }
@@ -664,4 +654,13 @@ jQuery(document).ready(function ($) {
664
  $('#wpmseosnippet').find('.url').html(url);
665
  }
666
  });
 
 
 
 
 
 
 
 
 
667
  })(jQuery);
31
  if (typeof str === 'undefined') {
32
  return;
33
  }
 
34
  if (jQuery(wpmsdivtitle).length) {
35
  str = str.replace(/%title%/g, jQuery(wpmsdivtitle).val().replace(/(<([^>]+)>)/ig, ''));
36
  }
117
  if (titleElm.val()) {
118
  title = titleElm.val().replace(/(<([^>]+)>)/ig, '');
119
  } else if (wpmseoMetaboxL10n.metatitle_tab === '1') {
 
120
  title = divHtml.html(title).text();
121
  }
122
 
125
  metaseo_status_length(len, '#' + wpmseoMetaboxL10n.field_prefix + 'title-length');
126
 
127
  titleLengthError.hide();
128
+ //return;
129
  }
130
 
131
  title = msClean(title);
142
  var placeholder_title = divHtml.html(title).text();
143
  jQuery('#metaseo_snippet_title').val(placeholder_title);
144
  var len = wpmseoMetaboxL10n.wpmseo_meta_title_length - jQuery('#metaseo_snippet_title').val().length;
 
 
 
 
 
 
 
 
145
  metaseo_status_length(len, '#' + wpmseoMetaboxL10n.field_prefix + 'title-length');
146
  });
147
  }
654
  $('#wpmseosnippet').find('.url').html(url);
655
  }
656
  });
657
+
658
+ // Custom bootstrap tagsinput when paste value
659
+ $(document).on('paste', '.wpms-bootstrap-tagsinput > input', function(e) {
660
+ let pasteData = e.originalEvent.clipboardData.getData('text');
661
+ $(this).attr('size', pasteData.length);
662
+ })
663
+ .on('focusout', '.wpms-bootstrap-tagsinput > input', function (e) {
664
+ $(this).attr('size', 1);
665
+ });
666
  })(jQuery);
inc/class.metaseo-admin.php CHANGED
@@ -1499,9 +1499,12 @@ class MetaSeoAdmin
1499
  if (isset($_POST['datas']['mpageurl'])) {
1500
  $infos = pathinfo($_POST['datas']['mpageurl']);
1501
  $mpageurl = $infos['filename'];
 
 
 
1502
  }
1503
 
1504
- if (!empty($mpageurl) && !empty($mtitle) && strpos($mtitle, $mpageurl)) {
1505
  $output .= $this->createFieldAnalysis(
1506
  'pageurl',
1507
  $tooltip_page['page_url'],
@@ -2566,6 +2569,10 @@ class MetaSeoAdmin
2566
  WPMSEO_VERSION,
2567
  true
2568
  );
 
 
 
 
2569
  }
2570
 
2571
  wp_enqueue_style(
@@ -4269,6 +4276,7 @@ class MetaSeoAdmin
4269
  $_SESSION['_metaseo_settings_search_console'] = 1;
4270
  }
4271
  }
 
4272
  $posts = get_posts(array('post_type' => 'page', 'posts_per_page' => -1, 'numberposts' => -1));
4273
  $types_404 = array(
4274
  'none' => 'None',
1499
  if (isset($_POST['datas']['mpageurl'])) {
1500
  $infos = pathinfo($_POST['datas']['mpageurl']);
1501
  $mpageurl = $infos['filename'];
1502
+ if ($mpageurl[0] === '?') {
1503
+ $mpageurl = ltrim($mpageurl, '?'); // remove ? from ?page=abc
1504
+ }
1505
  }
1506
 
1507
+ if (!empty($mpageurl) && !empty($mtitle) && strpos(sanitize_title($mtitle), sanitize_title($mpageurl)) !== false) {
1508
  $output .= $this->createFieldAnalysis(
1509
  'pageurl',
1510
  $tooltip_page['page_url'],
2569
  WPMSEO_VERSION,
2570
  true
2571
  );
2572
+
2573
+ wp_localize_script('wpms-settings-script', 'wpmsSettingsL10n', array(
2574
+ 'choose_image' => esc_html__('Use Image', 'wp-meta-seo')
2575
+ ));
2576
  }
2577
 
2578
  wp_enqueue_style(
4276
  $_SESSION['_metaseo_settings_search_console'] = 1;
4277
  }
4278
  }
4279
+
4280
  $posts = get_posts(array('post_type' => 'page', 'posts_per_page' => -1, 'numberposts' => -1));
4281
  $types_404 = array(
4282
  'none' => 'None',
inc/class.metaseo-metabox.php CHANGED
@@ -132,7 +132,7 @@ class WPMSEOMetabox extends WPMSEOMeta
132
  *
133
  * @return boolean
134
  */
135
- public function savePostByElementor()
136
  {
137
  if (empty($_POST['wpms_nonce'])
138
  || !wp_verify_nonce($_POST['wpms_nonce'], 'wpms_nonce')) {
@@ -693,7 +693,7 @@ class WPMSEOMetabox extends WPMSEOMeta
693
  <ul class="wpmseo-metabox-tabs tabs ju-tabs wpmstabs" id="wpmseo-metabox-tabs">
694
  <li class="tab wpmstab col">
695
  <a id="elementor-wpms-general" class="wpmseo_tablink"
696
- href="#wpmseo_general">' . esc_html__('SEO Page optimization', 'wp-meta-seo') . '</a></li>';
697
 
698
  if (is_plugin_active(WPMSEO_ADDON_FILENAME)) {
699
  $service = $this->serverWebmaster();
132
  *
133
  * @return boolean
134
  */
135
+ public static function savePostByElementor()
136
  {
137
  if (empty($_POST['wpms_nonce'])
138
  || !wp_verify_nonce($_POST['wpms_nonce'], 'wpms_nonce')) {
693
  <ul class="wpmseo-metabox-tabs tabs ju-tabs wpmstabs" id="wpmseo-metabox-tabs">
694
  <li class="tab wpmstab col">
695
  <a id="elementor-wpms-general" class="wpmseo_tablink"
696
+ href="#wpmseo_general">' . esc_html__('SEO page optimization', 'wp-meta-seo') . '</a></li>';
697
 
698
  if (is_plugin_active(WPMSEO_ADDON_FILENAME)) {
699
  $service = $this->serverWebmaster();
inc/class.metaseo-opengraph.php CHANGED
@@ -261,24 +261,44 @@ class MetaSeoOpenGraph
261
  }
262
 
263
  /**
264
- * Get meta facebook image and twiter image
265
  *
266
- * @param integer $id Id of post
 
267
  *
268
  * @return array
269
  */
270
- public function getImage($id)
271
  {
272
  $meta_twimage = get_post_meta($id, '_metaseo_metatwitter-image', true);
273
  $meta_fbimage = get_post_meta($id, '_metaseo_metaopengraph-image', true);
274
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  $default_image = wp_get_attachment_image_src(get_post_thumbnail_id($id), 'single-post-thumbnail');
276
 
277
- if (empty($meta_twimage) && isset($default_image[0])) {
 
278
  $meta_twimage = $default_image[0];
279
  }
280
 
281
- if (empty($meta_fbimage) && isset($default_image[0])) {
 
282
  $meta_fbimage = $default_image[0];
283
  }
284
 
@@ -288,6 +308,79 @@ class MetaSeoOpenGraph
288
  );
289
  }
290
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  /**
292
  * Get meta twiter title
293
  *
261
  }
262
 
263
  /**
264
+ * Get meta Facebook image and Twitter image
265
  *
266
+ * @param integer $id Post ID
267
+ * @param array $settings WPMS settings
268
  *
269
  * @return array
270
  */
271
+ public function getImage($id, $settings)
272
  {
273
  $meta_twimage = get_post_meta($id, '_metaseo_metatwitter-image', true);
274
  $meta_fbimage = get_post_meta($id, '_metaseo_metaopengraph-image', true);
275
 
276
+ // If empty url or image not found then check setting default image
277
+ //phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
278
+ if (empty($meta_fbimage) || !(@getimagesize($meta_fbimage))) {
279
+ $fbSettings = $settings['metaseo_enable_default_fb_image'];
280
+ if ($fbSettings['active']) {
281
+ $meta_fbimage = $this->getImageSettings($id, $fbSettings);
282
+ }
283
+ }
284
+
285
+ //phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
286
+ if (empty($meta_twimage) || !(@getimagesize($meta_twimage))) {
287
+ $twSettings = $settings['metaseo_enable_default_twitter_image'];
288
+ if ($twSettings['active']) {
289
+ $meta_twimage = $this->getImageSettings($id, $twSettings);
290
+ }
291
+ }
292
+
293
  $default_image = wp_get_attachment_image_src(get_post_thumbnail_id($id), 'single-post-thumbnail');
294
 
295
+ //phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
296
+ if ((empty($meta_twimage) || !(@getimagesize($meta_twimage))) && isset($default_image[0])) {
297
  $meta_twimage = $default_image[0];
298
  }
299
 
300
+ //phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
301
+ if ((empty($meta_fbimage) || !(@getimagesize($meta_fbimage))) && isset($default_image[0])) {
302
  $meta_fbimage = $default_image[0];
303
  }
304
 
308
  );
309
  }
310
 
311
+ /**
312
+ * Get default social image setting by user
313
+ *
314
+ * @param string|integer $postID Post id
315
+ * @param array $settings WPMS settings
316
+ *
317
+ * @return string
318
+ */
319
+ public function getImageSettings($postID, $settings)
320
+ {
321
+ $imageSource = $settings['source'];
322
+ $image = '';
323
+ switch ($imageSource) {
324
+ case 'featured':
325
+ $image = $this->getFeaturedImage($postID);
326
+ break;
327
+ case 'firstInContent':
328
+ $image = $this->getFirstImageInContent($postID);
329
+ break;
330
+ case 'author':
331
+ $image = $this->getAuthorAvatar($postID);
332
+ break;
333
+ case 'setDefaultImage':
334
+ $image = $settings['default_set'];
335
+ break;
336
+ }
337
+
338
+ return $image;
339
+ }
340
+
341
+ /**
342
+ * Get featured image
343
+ *
344
+ * @param string|integer $postID Post ID
345
+ *
346
+ * @return mixed|string
347
+ */
348
+ public function getFeaturedImage($postID)
349
+ {
350
+ $imageId = get_post_thumbnail_id($postID);
351
+ $image = $imageId ? wp_get_attachment_image_src($imageId) : '';
352
+ return isset($image[0]) ? $image[0] : '';
353
+ }
354
+
355
+ /**
356
+ * Get first image in post/page content
357
+ *
358
+ * @param string|integer $postID Post ID
359
+ *
360
+ * @return string
361
+ */
362
+ public function getFirstImageInContent($postID)
363
+ {
364
+ $postContent = get_post_field('post_content', $postID);
365
+ preg_match_all('|<img.*?src=[\'"](.*?)[\'"].*?>|i', $postContent, $matches);
366
+ return !empty($matches[1]) ? current($matches[1]) : '';
367
+ }
368
+
369
+ /**
370
+ * Get post/page author avatar
371
+ *
372
+ * @param string|integer $postID Post ID
373
+ *
374
+ * @return string
375
+ */
376
+ public function getAuthorAvatar($postID)
377
+ {
378
+ $authorID = get_post_field('post_author', $postID);
379
+ $authorAvatar = get_avatar($authorID, 300);
380
+ preg_match("/src='(.*?)'/i", $authorAvatar, $matches);
381
+ return !empty($matches[1]) ? $matches[1] : '';
382
+ }
383
+
384
  /**
385
  * Get meta twiter title
386
  *
inc/class.metaseo-snippet-preview.php CHANGED
@@ -174,11 +174,6 @@ class WPMSEOSnippetPreview
174
  if (empty($this->post->post_title)) {
175
  $firstCreatePost = 1;
176
  }
177
- if ($this->title === '%title%' || empty($this->title)) {
178
- $this->title = $this->post->post_title;
179
- // update meta title
180
- update_post_meta($this->post->ID, '_metaseo_metatitle', $this->title);
181
- }
182
  // phpcs:disable WordPress.Security.EscapeOutput -- Content escaped before line 167
183
  $content = '<div id="wpmseosnippet">
184
  <a class="url m-t-10" style="width: 100%; padding-left: 12px; margin-bottom:5px">' . $url . '</a>
174
  if (empty($this->post->post_title)) {
175
  $firstCreatePost = 1;
176
  }
 
 
 
 
 
177
  // phpcs:disable WordPress.Security.EscapeOutput -- Content escaped before line 167
178
  $content = '<div id="wpmseosnippet">
179
  <a class="url m-t-10" style="width: 100%; padding-left: 12px; margin-bottom:5px">' . $url . '</a>
inc/pages/settings/social.php CHANGED
@@ -86,6 +86,58 @@ if (isset($_SESSION['_metaseo_settings_social']) && $_SESSION['_metaseo_settings
86
  </label>
87
  </p>
88
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  </div>
90
 
91
  <div class="ju-settings-option p-d-20">
@@ -111,6 +163,57 @@ if (isset($_SESSION['_metaseo_settings_social']) && $_SESSION['_metaseo_settings
111
  </label>
112
  </p>
113
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  </div>
115
  </div>
116
 
86
  </label>
87
  </p>
88
  </div>
89
+
90
+ <div class="wpms_row_full">
91
+ <label class="ju-setting-label" style="padding-left: 0"
92
+ data-tippy="<?php esc_html_e('Enable this feature if you want to set the default image to display when sharing post/page on Facebook', 'wp-meta-seo'); ?>">
93
+ <?php esc_html_e('Default post Facebook image', 'wp-meta-seo') ?>
94
+ </label>
95
+ <div class="ju-switch-button metaseo_enable_op_markup">
96
+ <label class="switch">
97
+ <input type="hidden" name="_metaseo_settings[metaseo_enable_default_fb_image][active]"
98
+ value="0">
99
+ <input <?php checked($metaseo_enable_default_fb_image['active'], 1); ?> id="metaseo_enable_op_markup" type="checkbox"
100
+ name="_metaseo_settings[metaseo_enable_default_fb_image][active]"
101
+ value="1">
102
+ <span class="slider round"></span>
103
+ </label>
104
+ </div>
105
+ </div>
106
+
107
+ <?php if ((int)$metaseo_enable_default_fb_image['active'] === 1) { ?>
108
+ <div class="wpms_row_full wpms-op-markup-source" style="display: block">
109
+ <?php } else { ?>
110
+ <div class="wpms_row_full wpms-op-markup-source" style="display: none">
111
+ <?php } ?>
112
+ <label class="ju-setting-label wpms_width_100 wpms_left" style="padding-left: 0;">
113
+ <?php esc_html_e('Image source', 'wp-meta-seo') ?>
114
+ </label>
115
+ <p>
116
+ <label>
117
+ <select id="wpms-op-markup-source" class="select wpms_width_100" name="_metaseo_settings[metaseo_enable_default_fb_image][source]">
118
+ <option <?php selected($metaseo_enable_default_fb_image['source'], 'featured'); ?> value="featured"><?php esc_html_e('Featured image', 'wp-meta-seo'); ?></option>
119
+ <option <?php selected($metaseo_enable_default_fb_image['source'], 'firstInContent'); ?> value="firstInContent"><?php esc_html_e('First image in content', 'wp-meta-seo'); ?></option>
120
+ <option <?php selected($metaseo_enable_default_fb_image['source'], 'author'); ?> value="author"><?php esc_html_e('Post author avatar', 'wp-meta-seo'); ?></option>
121
+ <option <?php selected($metaseo_enable_default_fb_image['source'], 'setDefaultImage'); ?> value="setDefaultImage"><?php esc_html_e('Default image', 'wp-meta-seo'); ?></option>
122
+ </select>
123
+ </label>
124
+ </p>
125
+ </div>
126
+
127
+ <?php if ($metaseo_enable_default_fb_image['source'] === 'setDefaultImage' && (int)$metaseo_enable_default_fb_image['active'] === 1) { ?>
128
+ <div class="wpms_row_full wpms_left wpms-op-markup-upload" style="display: block">
129
+ <?php } else { ?>
130
+ <div class="wpms_row_full wpms_left wpms-op-markup-upload" style="display: none">
131
+ <?php } ?>
132
+ <label class="ju-setting-label wpms_width_100 wpms_left" style="padding-left: 0;">
133
+ <label for=""><?php esc_html_e('Set default image', 'wp-meta-seo') ?></label>
134
+ </label>
135
+ <label class="wpms_width_100 label-input wpms_left">
136
+ <input id="wpms-op-markup-fb-img" type="text" size="36" class=" wpms-large-input" name="_metaseo_settings[metaseo_enable_default_fb_image][default_set]" value="<?php echo esc_attr($metaseo_enable_default_fb_image['default_set']); ?>">
137
+ <button id="wpms-op-markup-fb-img-btn" class="ju-button orange-button wpms-small-btn wpmseo_image_upload_button" type="button">Upload</button>
138
+ </label>
139
+ </div>
140
+
141
  </div>
142
 
143
  <div class="ju-settings-option p-d-20">
163
  </label>
164
  </p>
165
  </div>
166
+
167
+ <div class="wpms_row_full">
168
+ <label class="ju-setting-label" style="padding-left: 0"
169
+ data-tippy="<?php esc_html_e('Enable this feature if you want to set the default image to display when sharing post/page on Twitter', 'wp-meta-seo'); ?>">
170
+ <?php esc_html_e('Default post Twitter image', 'wp-meta-seo') ?>
171
+ </label>
172
+ <div class="ju-switch-button metaseo_enable_twitter_img">
173
+ <label class="switch">
174
+ <input type="hidden" name="_metaseo_settings[metaseo_enable_default_twitter_image][active]"
175
+ value="0">
176
+ <input <?php checked($metaseo_enable_default_twitter_image['active'], 1); ?> id="metaseo_enable_twitter_img" type="checkbox"
177
+ name="_metaseo_settings[metaseo_enable_default_twitter_image][active]"
178
+ value="1">
179
+ <span class="slider round"></span>
180
+ </label>
181
+ </div>
182
+ </div>
183
+
184
+ <?php if ((int)$metaseo_enable_default_twitter_image['active'] === 1) { ?>
185
+ <div class="wpms_row_full wpms-twitter-img-source" style="display: block">
186
+ <?php } else { ?>
187
+ <div class="wpms_row_full wpms-twitter-img-source" style="display: none">
188
+ <?php } ?>
189
+ <label class="ju-setting-label wpms_width_100 wpms_left" style="padding-left: 0;">
190
+ <?php esc_html_e('Image source', 'wp-meta-seo') ?>
191
+ </label>
192
+ <p>
193
+ <label>
194
+ <select id="wpms-twitter-img-source" class="select wpms_width_100" name="_metaseo_settings[metaseo_enable_default_twitter_image][source]">
195
+ <option <?php selected($metaseo_enable_default_twitter_image['source'], 'featured') ?> value="featured"><?php esc_html_e('Featured image', 'wp-meta-seo'); ?></option>
196
+ <option <?php selected($metaseo_enable_default_twitter_image['source'], 'firstInContent') ?> value="firstInContent"><?php esc_html_e('First image in content', 'wp-meta-seo'); ?></option>
197
+ <option <?php selected($metaseo_enable_default_twitter_image['source'], 'author') ?> value="author"><?php esc_html_e('Post author avatar', 'wp-meta-seo'); ?></option>
198
+ <option <?php selected($metaseo_enable_default_twitter_image['source'], 'setDefaultImage') ?> value="setDefaultImage"><?php esc_html_e('Default image', 'wp-meta-seo'); ?></option>
199
+ </select>
200
+ </label>
201
+ </p>
202
+ </div>
203
+
204
+ <?php if ($metaseo_enable_default_twitter_image['source'] === 'setDefaultImage' && (int)$metaseo_enable_default_twitter_image['active'] === 1) { ?>
205
+ <div class="wpms_row_full wpms_left wpms-twitter-img-upload" style="display: block">
206
+ <?php } else { ?>
207
+ <div class="wpms_row_full wpms_left wpms-twitter-img-upload" style="display: none">
208
+ <?php } ?>
209
+ <label class="ju-setting-label wpms_width_100 wpms_left" style="padding-left: 0;">
210
+ <label for=""><?php esc_html_e('Set default image', 'wp-meta-seo') ?></label>
211
+ </label>
212
+ <label class="wpms_width_100 label-input wpms_left">
213
+ <input id="wpms-default-twitter-img" type="text" size="36" class=" wpms-large-input" name="_metaseo_settings[metaseo_enable_default_twitter_image][default_set]" value="<?php echo esc_attr($metaseo_enable_default_twitter_image['default_set']); ?>">
214
+ <button id="wpms-default-twitter-img-btn" class="ju-button orange-button wpms-small-btn wpmseo_image_upload_button" type="button">Upload</button>
215
+ </label>
216
+ </div>
217
  </div>
218
  </div>
219
 
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.7
5
  Tested up to: 5.8.1
6
- Stable tag: 4.4.2
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -258,6 +258,10 @@ Yes WP Meta SEO is compatible with Gutenberg editor since 3.7 version.
258
 
259
  == Changelog ==
260
 
 
 
 
 
261
  = 4.4.2 =
262
  * Fix : Remove social meta tags on front-end when they are not filled
263
 
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.7
5
  Tested up to: 5.8.1
6
+ Stable tag: 4.4.3
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
258
 
259
  == Changelog ==
260
 
261
+ = 4.4.3 =
262
+ * Add : Default post image setting for social meta
263
+ * Fix : SEO checker on Elementor Meta SEO meta box
264
+
265
  = 4.4.2 =
266
  * Fix : Remove social meta tags on front-end when they are not filled
267
 
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: 4.4.2
8
  * Text Domain: wp-meta-seo
9
  * Domain Path: /languages
10
  * Author: JoomUnited
@@ -133,7 +133,7 @@ if (!defined('WPMSEO_VERSION')) {
133
  /**
134
  * Plugin version
135
  */
136
- define('WPMSEO_VERSION', '4.4.2');
137
  }
138
 
139
  if (!defined('WPMS_CLIENTID')) {
@@ -230,7 +230,17 @@ function wpmsGetDefaultSettings()
230
  'metaseo_overridemeta' => 1,
231
  'metaseo_canonical' => 0,
232
  'metaseo_removecatprefix' => 0,
233
- 'metaseo_specific_keywords' => ''
 
 
 
 
 
 
 
 
 
 
234
  );
235
  }
236
 
@@ -556,7 +566,7 @@ if (is_admin()) {
556
  $fbapp_id = '';
557
  }
558
  // get meta image for facebook & twiter
559
- $images = $opengraph->getImage($id);
560
  $meta_fbimage = $images[0];
561
  $meta_twimage = $images[1];
562
 
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: 4.4.3
8
  * Text Domain: wp-meta-seo
9
  * Domain Path: /languages
10
  * Author: JoomUnited
133
  /**
134
  * Plugin version
135
  */
136
+ define('WPMSEO_VERSION', '4.4.3');
137
  }
138
 
139
  if (!defined('WPMS_CLIENTID')) {
230
  'metaseo_overridemeta' => 1,
231
  'metaseo_canonical' => 0,
232
  'metaseo_removecatprefix' => 0,
233
+ 'metaseo_specific_keywords' => '',
234
+ 'metaseo_enable_default_fb_image' => array(
235
+ 'active' => 0,
236
+ 'source' => 'featured',
237
+ 'default_set' => ''
238
+ ),
239
+ 'metaseo_enable_default_twitter_image' => array(
240
+ 'active' => 0,
241
+ 'source' => 'featured',
242
+ 'default_set' => ''
243
+ ),
244
  );
245
  }
246
 
566
  $fbapp_id = '';
567
  }
568
  // get meta image for facebook & twiter
569
+ $images = $opengraph->getImage($id, $settings);
570
  $meta_fbimage = $images[0];
571
  $meta_twimage = $images[1];
572