WP Meta SEO - Version 1.7.0

Version Description

  • Add link SEO title field in link editor tool
  • Add a SEO bulk edition view on your links titles (of all your content)
  • Automatic meta SEO addition for category view: add category title as meta title and category description as meta description
  • Add SEO dashboard check for link titles
  • Fix WooCommerce meta description and title in category view (automatic)
  • Fix WP Meta SEO language to be conform to plugin directory translation tool
Download this release

Release Info

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

Code changes from version 1.6.0 to 1.7.0

css/metaseo-quirk.css CHANGED
@@ -724,7 +724,7 @@ pre code {
724
725
.col-sm-6 {
726
width: 50%;
727
- max-height: 180px;
728
}
729
730
.col-sm-5 {
724
725
.col-sm-6 {
726
width: 50%;
727
+ max-height: 170px;
728
}
729
730
.col-sm-5 {
css/metaseo_admin.css CHANGED
@@ -345,4 +345,45 @@ strong {
345
background: url("../img/loop.png") no-repeat scroll 0 50% transparent;
346
display: block;
347
padding-left: 45px;
348
}
345
background: url("../img/loop.png") no-repeat scroll 0 50% transparent;
346
display: block;
347
padding-left: 45px;
348
+ }
349
+
350
+ .metaseo_link_title{
351
+ width: 200px;
352
+ height:28px;
353
+ float: left;
354
+ }
355
+
356
+ .wpms_update_link{
357
+ display: none;
358
+ float: left;
359
+ background: #00a0d2;
360
+ border-color: #0073aa;
361
+ box-shadow: inset 0 1px 0 rgba( 120, 200, 230, 0.5 ), 0 1px 0 rgba( 0, 0, 0, 0.15 );
362
+ color: #fff;
363
+ text-decoration: none;
364
+ vertical-align: top;
365
+ font-size: 13px;
366
+ line-height: 26px;
367
+ height: 28px;
368
+ margin: 0;
369
+ padding: 0 10px 1px;
370
+ cursor: pointer;
371
+ border-width: 1px;
372
+ border-style: solid;
373
+ -webkit-appearance: none;
374
+ border-radius: 3px;
375
+ white-space: nowrap;
376
+ box-sizing: border-box;
377
+ }
378
+
379
+ .wpms_mesage_link{
380
+ display:none;
381
+ line-height:28px;
382
+ color: #7ad03a;
383
+ }
384
+
385
+ .wpms_error_mesage_link{
386
+ display:none;
387
+ line-height:28px;
388
+ color: #F00;
389
}
inc/class-metaseo-mutils.php CHANGED
@@ -23,27 +23,27 @@ class WPMSEO_Utils {
23
}
24
switch ($val) {
25
case 0:
26
- $score = __('N/A', 'wpms');
27
$css = 'na';
28
break;
29
case 4:
30
case 5:
31
- $score = __('Poor', 'wpms');
32
$css = 'poor';
33
break;
34
case 6:
35
case 7:
36
- $score = __('OK', 'wpms');
37
$css = 'ok';
38
break;
39
case 8:
40
case 9:
41
case 10:
42
- $score = __('Good', 'wpms');
43
$css = 'good';
44
break;
45
default:
46
- $score = __('Bad', 'wpms');
47
$css = 'bad';
48
break;
49
}
23
}
24
switch ($val) {
25
case 0:
26
+ $score = __('N/A', 'wp-meta-seo');
27
$css = 'na';
28
break;
29
case 4:
30
case 5:
31
+ $score = __('Poor', 'wp-meta-seo');
32
$css = 'poor';
33
break;
34
case 6:
35
case 7:
36
+ $score = __('OK', 'wp-meta-seo');
37
$css = 'ok';
38
break;
39
case 8:
40
case 9:
41
case 10:
42
+ $score = __('Good', 'wp-meta-seo');
43
$css = 'good';
44
break;
45
default:
46
+ $score = __('Bad', 'wp-meta-seo');
47
$css = 'bad';
48
break;
49
}
inc/class.image-helper.php CHANGED
@@ -123,6 +123,7 @@ class ImageHelper{
123
public static function IScan($imgs = array(), $content){
124
$ifound = array();
125
$doc = new DOMDocument();
126
@$doc->loadHtml($content);
127
$tags = $doc->getElementsByTagName('img');
128
@@ -344,15 +345,15 @@ class ImageHelper{
344
$im = ' image ';
345
}
346
347
- $msg[$iID]['iNotGood']['msg'] = __($results['iNotGoodTotal'][$iID] .$im. 'with wrong size', 'wpms');
348
$msg[$iID]['iNotGood']['warning'] = true;
349
350
- $msg[$iID]['iNotGood']['button'] = '<a href="javascript:void(0);" class=" img-resize button button-primary" data-img-name="'.$_imgs[$iID].'" data-post-id="'. $iID.'" data-opt-key="resize_image" onclick="showPostsList(this)">'.__('Resize image', 'wpms').'<span class="spinner-light"></span></a>';
351
352
update_post_meta($iID, '_metaseo_resize_image_counter', $results['iNotGoodTotal'][$iID]);
353
update_post_meta($iID, '_metaseo_resize_image', $post_group);
354
}else{
355
- $msg[$iID]['iNotGood']['msg'] = __('Image sizes are good!', 'wpms');
356
$msg[$iID]['iNotGood']['warning'] = false;
357
358
delete_post_meta($iID, '_metaseo_resize_image_counter');
@@ -369,16 +370,16 @@ class ImageHelper{
369
if($mkey == 'alt'){ $text = ' text'; }
370
371
if($results['imNotGoodTotal'][$iID][$mkey] > 1){
372
- $msg[$iID]['imNotGood']['msg'][$mkey] = __($results['imNotGoodTotal'][$iID][$mkey] . ' ' . $mkey . $text . 's are missing', 'wpms');
373
}
374
elseif($results['imNotGoodTotal'][$iID][$mkey] == 1){
375
- $msg[$iID]['imNotGood']['msg'][$mkey] = __($results['imNotGoodTotal'][$iID][$mkey] . ' ' . $mkey . $text . ' is missing', 'wpms');
376
}
377
378
}
379
380
$msg[$iID]['imNotGood']['warning'] = true;
381
- $msg[$iID]['imNotGood']['button'] = '<a href="javascript:void(0);" class=" fix-metas button button-primary" data-img-name="'.$_imgs[$iID].'" data-post-id="'. $iID.'" data-opt-key="fix_metas" onclick="showPostsList(this)">'.__('Fix meta', 'wpms').'<span class="spinner-light"></span></a>';
382
383
384
update_post_meta($iID, '_metaseo_fix_metas_counter', count($post_group));
@@ -388,7 +389,7 @@ class ImageHelper{
388
if( $results['imNotGoodTotal'][$iID]['alt'] == 0
389
&& $results['imNotGoodTotal'][$iID]['title'] == 0 ){
390
if($results['iNotGoodTotal'][$iID] != -1){
391
- $msg[$iID]['imNotGood']['button'] = '<a href="javascript:void(0);" class=" fix-metas button" data-img-name="'.$_imgs[$iID].'" data-post-id="'. $iID.'" data-opt-key="fix_metas" onclick="showPostsList(this)">'.__('Edit meta', 'wpms').'<span class="spinner-light"></span></a>';
392
}
393
else{
394
$msg[$iID]['imNotGood']['button'] = '';
@@ -414,7 +415,7 @@ class ImageHelper{
414
$query = "SELECT `post_content` FROM $wpdb->posts WHERE `ID`=" . $post_id;
415
416
if(!($post_content = @$wpdb->get_row($query)->post_content)){
417
- $ret['msg'] = __('This post is not existed or deleted, please choose one another!','wpms');
418
419
return $ret;
420
}
@@ -456,10 +457,10 @@ class ImageHelper{
456
457
if($id){
458
$ret['success'] = true;
459
- $ret['msg'] = __('Well! This image is so good now.', 'wpms');
460
}
461
else{
462
- $ret['msg'] = __('Opps! An error occured when updating the post, please try again', 'wpms');
463
}
464
465
return $ret;
123
public static function IScan($imgs = array(), $content){
124
$ifound = array();
125
$doc = new DOMDocument();
126
+ libxml_use_internal_errors( true );
127
@$doc->loadHtml($content);
128
$tags = $doc->getElementsByTagName('img');
129
345
$im = ' image ';
346
}
347
348
+ $msg[$iID]['iNotGood']['msg'] = __($results['iNotGoodTotal'][$iID] .$im. 'with wrong size', 'wp-meta-seo');
349
$msg[$iID]['iNotGood']['warning'] = true;
350
351
+ $msg[$iID]['iNotGood']['button'] = '<a href="javascript:void(0);" class=" img-resize button button-primary" data-img-name="'.$_imgs[$iID].'" data-post-id="'. $iID.'" data-opt-key="resize_image" onclick="showPostsList(this)">'.__('Resize image', 'wp-meta-seo').'<span class="spinner-light"></span></a>';
352
353
update_post_meta($iID, '_metaseo_resize_image_counter', $results['iNotGoodTotal'][$iID]);
354
update_post_meta($iID, '_metaseo_resize_image', $post_group);
355
}else{
356
+ $msg[$iID]['iNotGood']['msg'] = __('Image sizes are good!', 'wp-meta-seo');
357
$msg[$iID]['iNotGood']['warning'] = false;
358
359
delete_post_meta($iID, '_metaseo_resize_image_counter');
370
if($mkey == 'alt'){ $text = ' text'; }
371
372
if($results['imNotGoodTotal'][$iID][$mkey] > 1){
373
+ $msg[$iID]['imNotGood']['msg'][$mkey] = __($results['imNotGoodTotal'][$iID][$mkey] . ' ' . $mkey . $text . 's are missing', 'wp-meta-seo');
374
}
375
elseif($results['imNotGoodTotal'][$iID][$mkey] == 1){
376
+ $msg[$iID]['imNotGood']['msg'][$mkey] = __($results['imNotGoodTotal'][$iID][$mkey] . ' ' . $mkey . $text . ' is missing', 'wp-meta-seo');
377
}
378
379
}
380
381
$msg[$iID]['imNotGood']['warning'] = true;
382
+ $msg[$iID]['imNotGood']['button'] = '<a href="javascript:void(0);" class=" fix-metas button button-primary" data-img-name="'.$_imgs[$iID].'" data-post-id="'. $iID.'" data-opt-key="fix_metas" onclick="showPostsList(this)">'.__('Fix meta', 'wp-meta-seo').'<span class="spinner-light"></span></a>';
383
384
385
update_post_meta($iID, '_metaseo_fix_metas_counter', count($post_group));
389
if( $results['imNotGoodTotal'][$iID]['alt'] == 0
390
&& $results['imNotGoodTotal'][$iID]['title'] == 0 ){
391
if($results['iNotGoodTotal'][$iID] != -1){
392
+ $msg[$iID]['imNotGood']['button'] = '<a href="javascript:void(0);" class=" fix-metas button" data-img-name="'.$_imgs[$iID].'" data-post-id="'. $iID.'" data-opt-key="fix_metas" onclick="showPostsList(this)">'.__('Edit meta', 'wp-meta-seo').'<span class="spinner-light"></span></a>';
393
}
394
else{
395
$msg[$iID]['imNotGood']['button'] = '';
415
$query = "SELECT `post_content` FROM $wpdb->posts WHERE `ID`=" . $post_id;
416
417
if(!($post_content = @$wpdb->get_row($query)->post_content)){
418
+ $ret['msg'] = __('This post is not existed or deleted, please choose one another!','wp-meta-seo');
419
420
return $ret;
421
}
457
458
if($id){
459
$ret['success'] = true;
460
+ $ret['msg'] = __('Well! This image is so good now.', 'wp-meta-seo');
461
}
462
else{
463
+ $ret['msg'] = __('Opps! An error occured when updating the post, please try again', 'wp-meta-seo');
464
}
465
466
return $ret;
inc/class.metaseo-admin.php CHANGED
@@ -18,7 +18,8 @@ class MetaSeo_Admin {
18
"metaseo_showkeywords"=>0,
19
"metaseo_showtmetablock"=>1,
20
"metaseo_showsocial" => 1,
21
- "metaseo_seovalidate" => 0
22
);
23
$settings = get_option( '_metaseo_settings' );
24
@@ -55,6 +56,16 @@ class MetaSeo_Admin {
55
if ( '0' == get_option( 'blog_public' )) {
56
add_action( 'admin_notices', array( $this, 'wpms_public_warning' ) );
57
}
58
}
59
60
function wpms_set_ignore(){
@@ -92,15 +103,15 @@ class MetaSeo_Admin {
92
<a href="javascript:wpmsSetIgnore(\'wpms_public_warning\',\'robotsmessage\',\'%3$s\');" class="button">%4$s</a>
93
</p>
94
</div>',
95
- __( 'Your website is not indexed by search engine because of your WordPress settings.', 'wpms' ),
96
- sprintf( __( '%sFix it now%s', 'wpms' ), sprintf( '<a href="%s">', esc_url( admin_url( 'options-reading.php' ) ) ), '</a>' ),
97
esc_js( wp_create_nonce( 'wpseo-ignore' ) ),
98
- __( 'OK I know that.', 'wpms' )
99
);
100
}
101
102
function wpms_load_langguage(){
103
- load_plugin_textdomain( 'wpms', false, dirname( plugin_basename( WPMSEO_FILE ) ) . '/languages/' );
104
}
105
106
function metaseo_create_field($data_title,$alt,$dashicon,$label,$value_hidden){
@@ -111,13 +122,13 @@ class MetaSeo_Admin {
111
112
function metaseo_reload_analysis() {
113
$tooltip_page = array();
114
- $tooltip_page['title_in_heading'] = __('Check if a word of this content title is also in a title heading (h1, h2...)','wpms');
115
- $tooltip_page['title_in_content'] = __('Check if a word of this content title is also in the text','wpms');
116
- $tooltip_page['page_url'] = __('Does the page title match with the permalink (URL structure)','wpms');
117
- $tooltip_page['meta_title'] = __('Is the meta title of this page filled?','wpms');
118
- $tooltip_page['meta_desc'] = __('Is the meta description of this page filled?','wpms');
119
- $tooltip_page['image_resize'] = __('Check for image HTML resizing in content (usually image resized using handles)','wpms');
120
- $tooltip_page['image_alt'] = __('Check for image Alt text and title','wpms');
121
if(empty($_POST['datas'])){
122
wp_send_json(false);
123
}
@@ -146,14 +157,14 @@ class MetaSeo_Admin {
146
}
147
148
if($test){
149
- $output .= $this->metaseo_create_field('heading_title',$tooltip_page['title_in_heading'],'dashicons-yes',__('Page title word in content heading','wpms'),1);
150
$check ++;
151
}else{
152
- $output .= $this->metaseo_create_field('heading_title',$tooltip_page['title_in_heading'],'icons-mwarning',__('Page title word in content heading','wpms'),0);
153
}
154
155
}else{
156
- $output .= $this->metaseo_create_field('heading_title',$tooltip_page['title_in_heading'],'dashicons-yes',__('Page title word in content heading','wpms'),1);
157
$check ++;
158
}
159
@@ -174,41 +185,41 @@ class MetaSeo_Admin {
174
}
175
176
if($test1){
177
- $output .= $this->metaseo_create_field('content_title',$tooltip_page['title_in_content'],'dashicons-yes',__('Page title word in content','wpms'),1);
178
$check ++;
179
}else{
180
- $output .= $this->metaseo_create_field('content_title',$tooltip_page['title_in_content'],'icons-mwarning',__('Page title word in content','wpms'),0);
181
}
182
183
// page url matches page title
184
$mtitle = $_POST['datas']['title'];
185
if($_POST['datas']['mpageurl'] == sanitize_title($mtitle)){
186
- $output .= $this->metaseo_create_field('pageurl',$tooltip_page['page_url'],'dashicons-yes',__('Page url matches with page title','wpms'),1);
187
$check ++;
188
}else{
189
- $output .= $this->metaseo_create_field('pageurl',$tooltip_page['page_url'],'icons-mwarning',__('Page url matches with page title','wpms'),0);
190
}
191
192
// meta title filled
193
if(($_POST['datas']['meta_title'] != '' && strlen($_POST['datas']['meta_title']) <= self::$title_length)){
194
- $output .= $this->metaseo_create_field('metatitle',$tooltip_page['meta_title'],'dashicons-yes',__('Meta title filled','wpms'),1);
195
$check++;
196
}else{
197
- $output .= $this->metaseo_create_field('metatitle',$tooltip_page['meta_title'],'icons-mwarning',__('Meta title filled','wpms'),0);
198
}
199
200
// desc filled
201
if(($_POST['datas']['meta_desc'] != '' && strlen($_POST['datas']['meta_desc']) <= self::$desc_length)){
202
- $output .= $this->metaseo_create_field('metadesc',$tooltip_page['meta_desc'],'dashicons-yes',__('Meta description filled','wpms'),1);
203
$check++;
204
}else{
205
- $output .= $this->metaseo_create_field('metadesc',$tooltip_page['meta_desc'],'icons-mwarning',__('Meta description filled','wpms'),0);
206
}
207
208
// image resize
209
if($_POST['datas']['content'] == '') {
210
- $output .= $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'dashicons-yes',__('Wrong image resize','wpms'),1);
211
- $output .= $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'dashicons-yes',__('Image have meta title or alt','wpms'),1);
212
$check += 2;
213
}else{
214
$dom = new DOMDocument;
@@ -238,21 +249,21 @@ class MetaSeo_Admin {
238
}
239
240
if($img_wrong == false){
241
- $output .= $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'dashicons-yes',__('Wrong image resize','wpms'),1);
242
$check++;
243
}else{
244
- $output .= $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'icons-mwarning',__('Wrong image resize','wpms'),0);
245
}
246
247
if($img_wrong_alt == false){
248
- $output .= $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'dashicons-yes',__('Image have meta title or alt','wpms'),1);
249
$check++;
250
}else{
251
- $output .= $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'icons-mwarning',__('Image have meta title or alt','wpms'),0);
252
}
253
}else{
254
- $output .= $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'icons-mwarning',__('Wrong image resize','wpms'),0);
255
- $output .= $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'icons-mwarning',__('Image have meta title or alt','wpms'),0);
256
}
257
}
258
@@ -274,18 +285,44 @@ class MetaSeo_Admin {
274
wp_send_json(true);
275
}
276
277
function metaseo_field_settings(){
278
register_setting('Wp Meta SEO','_metaseo_settings');
279
add_settings_section('metaseo_dashboard','',array( $this, 'showSettings' ),'metaseo_settings');
280
- add_settings_field('metaseo_title_home', __('Homepage meta title', 'wpms'), array( $this, 'metaseo_title_home' ), 'metaseo_settings', 'metaseo_dashboard');
281
- add_settings_field('metaseo_desc_home', __('Homepage meta description', 'wpms'), array( $this, 'metaseo_desc_home' ), 'metaseo_settings', 'metaseo_dashboard');
282
- add_settings_field('metaseo_showfacebook', __('Facebook profile URL', 'wpms'), array( $this, 'showfacebook' ), 'metaseo_settings', 'metaseo_dashboard');
283
- add_settings_field('metaseo_showtwitter', __('Twitter Username', 'wpms'), array( $this, 'showtwitter' ), 'metaseo_settings', 'metaseo_dashboard');
284
- add_settings_field('metaseo_twitter_card', __('The default card type to use', 'wpms'), array( $this, 'showtwittercard' ), 'metaseo_settings', 'metaseo_dashboard');
285
- add_settings_field('metaseo_showkeywords', __('Meta keywords', 'wpms'), array( $this, 'showkeywords' ), 'metaseo_settings', 'metaseo_dashboard');
286
- add_settings_field('metaseo_showtmetablock', __('Meta block edition', 'wpms'), array( $this, 'showtmetablock' ), 'metaseo_settings', 'metaseo_dashboard');
287
- add_settings_field('metaseo_showsocial', __('Social networks meta', 'wpms'), array( $this, 'showsocial' ), 'metaseo_settings', 'metaseo_dashboard');
288
- add_settings_field('metaseo_seovalidate', __('Force SEO validation', 'wpms'), array( $this, 'showseovalidate' ), 'metaseo_settings', 'metaseo_dashboard');
289
}
290
291
public function showSettings(){
@@ -306,7 +343,7 @@ class MetaSeo_Admin {
306
echo '<input name="_metaseo_settings[metaseo_showkeywords]" type="hidden" value="0"/>';
307
?>
308
<label><input name="_metaseo_settings[metaseo_showkeywords]" type="checkbox" id="metaseo_showkeywords" value="1" <?php checked( 1, $this->settings['metaseo_showkeywords']); ?> />
309
- <?php _e( 'Active meta keywords','wpms'); ?></label>
310
<?php
311
}
312
@@ -314,7 +351,7 @@ class MetaSeo_Admin {
314
echo '<input name="_metaseo_settings[metaseo_showtmetablock]" type="hidden" value="0"/>';
315
?>
316
<label><input name="_metaseo_settings[metaseo_showtmetablock]" type="checkbox" id="metaseo_showtmetablock" value="1" <?php checked( 1, $this->settings['metaseo_showtmetablock']); ?> />
317
- <?php _e( 'Activate meta block edition below content','wpms' ); ?></label>
318
<?php
319
}
320
@@ -322,7 +359,7 @@ class MetaSeo_Admin {
322
echo '<input name="_metaseo_settings[metaseo_showsocial]" type="hidden" value="0"/>';
323
?>
324
<label><input name="_metaseo_settings[metaseo_showsocial]" type="checkbox" id="metaseo_showsocial" value="1" <?php checked( 1, $this->settings['metaseo_showsocial']); ?> />
325
- <?php _e( 'Activate social edition','wpms' ); ?></label>
326
<?php
327
}
328
@@ -330,7 +367,15 @@ class MetaSeo_Admin {
330
echo '<input name="_metaseo_settings[metaseo_seovalidate]" type="hidden" value="0"/>';
331
?>
332
<label><input name="_metaseo_settings[metaseo_seovalidate]" type="checkbox" id="metaseo_seovalidate" value="1" <?php checked( 1, $this->settings['metaseo_seovalidate']); ?> />
333
- <?php _e( 'Allow user to force on page SEO criteria validation by clicking on the icon','wpms' ); ?></label>
334
<?php
335
}
336
@@ -348,8 +393,8 @@ class MetaSeo_Admin {
348
$twitter_card = isset( $this->settings['metaseo_twitter_card'] ) ? $this->settings['metaseo_twitter_card'] : 'summary';
349
?>
350
<select class="select" name="_metaseo_settings[metaseo_twitter_card]" id="metaseo_twitter_card">
351
- <option <?php if($twitter_card == 'summary') echo 'selected' ?> value="summary"><?php _e( 'Summary', 'wpms' ); ?></option>
352
- <option <?php if($twitter_card == 'summary_large_image') echo 'selected' ?> value="summary_large_image"><?php _e( 'Summary with large image', 'wpms' ); ?></option>
353
</select>
354
<?php
355
}
@@ -390,35 +435,35 @@ class MetaSeo_Admin {
390
// wp_die();
391
// }
392
393
- $response->msg = __('Modification was saved', 'wpms') ;
394
if($metakey == 'metatitle') {
395
if(!update_post_meta($postID, '_metaseo_metatitle', $value)) {
396
$response->updated = false;
397
- $response->msg = __('Meta title was not saved', 'wpms') ;
398
}
399
else{
400
$response->updated = true;
401
- $response->msg = __('Meta title was saved', 'wpms') ;
402
}
403
}
404
405
if($metakey =='metadesc') {
406
if(!update_post_meta($postID, '_metaseo_metadesc', $value)) {
407
$response->updated = false;
408
- $response->msg = __('Meta description was not saved', 'wpms') ;
409
}else{
410
$response->updated = true;
411
- $response->msg = __('Meta description was saved', 'wpms') ;
412
}
413
}
414
415
if ($metakey == 'metakeywords') {
416
if (!update_post_meta($postID, '_metaseo_metakeywords', $value)) {
417
$response->updated = false;
418
- $response->msg = __('Meta keywords was not saved', 'wpms');
419
} else {
420
$response->updated = true;
421
- $response->msg = __('Meta keywords was saved', 'wpms');
422
}
423
}
424
@@ -463,7 +508,7 @@ class MetaSeo_Admin {
463
464
public function meta_seo_localize_script() {
465
return array(
466
- 'metaseo_message_false_copy' => __( 'We didn\'t find any element to apply a batch copy, congrats!', 'wpms' ),
467
);
468
}
469
@@ -481,7 +526,7 @@ class MetaSeo_Admin {
481
function register_menu_page() {
482
483
// Add main page
484
- $admin_page = add_menu_page(__('WP Meta SEO:', 'wpms') . ' ' . __('Dashboard', 'wpms'), __('WP Meta SEO', 'wpms'), 'manage_options', 'metaseo_dashboard', array(
485
$this,'load_page',) , 'dashicons-chart-area' );
486
487
/**
@@ -496,7 +541,7 @@ class MetaSeo_Admin {
496
array(
497
'metaseo_dashboard',
498
'',
499
- __('Content meta', 'wpms'),
500
$manage_options_cap,
501
'metaseo_content_meta',
502
array($this, 'load_page'),
@@ -505,7 +550,7 @@ class MetaSeo_Admin {
505
array(
506
'metaseo_dashboard',
507
'',
508
- __('Image meta', 'wpms'),
509
$manage_options_cap,
510
'metaseo_image_meta',
511
array($this, 'load_page'),
@@ -514,7 +559,16 @@ class MetaSeo_Admin {
514
array(
515
'metaseo_dashboard',
516
'',
517
- __('Settings', 'wpms'),
518
$manage_options_cap,
519
'metaseo_settings',
520
array($this, 'load_page'),
@@ -532,7 +586,7 @@ class MetaSeo_Admin {
532
foreach ($submenu_pages as $submenu_page) {
533
534
// Add submenu page
535
- $admin_page = add_submenu_page($submenu_page[0], $submenu_page[2] . ' - ' . __('WP Meta SEO:', 'wpms'), $submenu_page[2], $submenu_page[3], $submenu_page[4], $submenu_page[5]);
536
537
// Check if we need to hook
538
if (isset($submenu_page[6]) && null != $submenu_page[6] && is_array($submenu_page[6]) && count($submenu_page[6]) > 0) {
@@ -545,7 +599,7 @@ class MetaSeo_Admin {
545
546
global $submenu;
547
if (isset($submenu['metaseo_dashboard']) && current_user_can($manage_options_cap)) {
548
- $submenu['metaseo_dashboard'][0][0] = __('Dashboard', 'wpms');
549
}
550
}
551
@@ -567,7 +621,11 @@ class MetaSeo_Admin {
567
case 'metaseo_image_meta':
568
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/image-meta.php' );
569
break;
570
-
571
case 'metaseo_image_optimize':
572
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/image-optimize.php' );
573
break;
@@ -795,6 +853,7 @@ class MetaSeo_Admin {
795
796
add_action('wp_ajax_metaseo_reload_analysis',array($this,'metaseo_reload_analysis'));
797
add_action('wp_ajax_metaseo_validate_analysis',array($this,'metaseo_validate_analysis'));
798
}
799
800
}
18
"metaseo_showkeywords"=>0,
19
"metaseo_showtmetablock"=>1,
20
"metaseo_showsocial" => 1,
21
+ "metaseo_seovalidate" => 0,
22
+ "metaseo_linkfield" => 1
23
);
24
$settings = get_option( '_metaseo_settings' );
25
56
if ( '0' == get_option( 'blog_public' )) {
57
add_action( 'admin_notices', array( $this, 'wpms_public_warning' ) );
58
}
59
+ add_action( 'wp_enqueue_editor', array( $this,'wpms_link_title_field'), 20 );
60
+ }
61
+
62
+ function wpms_link_title_field() {
63
+ if(isset($this->settings['metaseo_linkfield']) && $this->settings['metaseo_linkfield'] == 1){
64
+ wp_enqueue_script( 'wpmslinkTitle', plugins_url('js/wpms-link-title-field.js', dirname(__FILE__)), array( 'wplink' ), WPMSEO_VERSION, true );
65
+ wp_localize_script( 'wpmslinkTitle', 'wpmsLinkTitleL10n', array(
66
+ 'titleLabel' => __( 'Title','wp-meta-seo' ),
67
+ ) );
68
+ }
69
}
70
71
function wpms_set_ignore(){
103
<a href="javascript:wpmsSetIgnore(\'wpms_public_warning\',\'robotsmessage\',\'%3$s\');" class="button">%4$s</a>
104
</p>
105
</div>',
106
+ __( 'Your website is not indexed by search engine because of your WordPress settings.', 'wp-meta-seo' ),
107
+ sprintf( __( '%sFix it now%s', 'wp-meta-seo' ), sprintf( '<a href="%s">', esc_url( admin_url( 'options-reading.php' ) ) ), '</a>' ),
108
esc_js( wp_create_nonce( 'wpseo-ignore' ) ),
109
+ __( 'OK I know that.', 'wp-meta-seo' )
110
);
111
}
112
113
function wpms_load_langguage(){
114
+ load_plugin_textdomain( 'wp-meta-seo', false, dirname( plugin_basename( WPMSEO_FILE ) ) . '/languages/' );
115
}
116
117
function metaseo_create_field($data_title,$alt,$dashicon,$label,$value_hidden){
122
123
function metaseo_reload_analysis() {
124
$tooltip_page = array();
125
+ $tooltip_page['title_in_heading'] = __('Check if a word of this content title is also in a title heading (h1, h2...)','wp-meta-seo');
126
+ $tooltip_page['title_in_content'] = __('Check if a word of this content title is also in the text','wp-meta-seo');
127
+ $tooltip_page['page_url'] = __('Does the page title match with the permalink (URL structure)','wp-meta-seo');
128
+ $tooltip_page['meta_title'] = __('Is the meta title of this page filled?','wp-meta-seo');
129
+ $tooltip_page['meta_desc'] = __('Is the meta description of this page filled?','wp-meta-seo');
130
+ $tooltip_page['image_resize'] = __('Check for image HTML resizing in content (usually image resized using handles)','wp-meta-seo');
131
+ $tooltip_page['image_alt'] = __('Check for image Alt text and title','wp-meta-seo');
132
if(empty($_POST['datas'])){
133
wp_send_json(false);
134
}
157
}
158
159
if($test){
160
+ $output .= $this->metaseo_create_field('heading_title',$tooltip_page['title_in_heading'],'dashicons-yes',__('Page title word in content heading','wp-meta-seo'),1);
161
$check ++;
162
}else{
163
+ $output .= $this->metaseo_create_field('heading_title',$tooltip_page['title_in_heading'],'icons-mwarning',__('Page title word in content heading','wp-meta-seo'),0);
164
}
165
166
}else{
167
+ $output .= $this->metaseo_create_field('heading_title',$tooltip_page['title_in_heading'],'dashicons-yes',__('Page title word in content heading','wp-meta-seo'),1);
168
$check ++;
169
}
170
185
}
186
187
if($test1){
188
+ $output .= $this->metaseo_create_field('content_title',$tooltip_page['title_in_content'],'dashicons-yes',__('Page title word in content','wp-meta-seo'),1);
189
$check ++;
190
}else{
191
+ $output .= $this->metaseo_create_field('content_title',$tooltip_page['title_in_content'],'icons-mwarning',__('Page title word in content','wp-meta-seo'),0);
192
}
193
194
// page url matches page title
195
$mtitle = $_POST['datas']['title'];
196
if($_POST['datas']['mpageurl'] == sanitize_title($mtitle)){
197
+ $output .= $this->metaseo_create_field('pageurl',$tooltip_page['page_url'],'dashicons-yes',__('Page url matches with page title','wp-meta-seo'),1);
198
$check ++;
199
}else{
200
+ $output .= $this->metaseo_create_field('pageurl',$tooltip_page['page_url'],'icons-mwarning',__('Page url matches with page title','wp-meta-seo'),0);
201
}
202
203
// meta title filled
204
if(($_POST['datas']['meta_title'] != '' && strlen($_POST['datas']['meta_title']) <= self::$title_length)){
205
+ $output .= $this->metaseo_create_field('metatitle',$tooltip_page['meta_title'],'dashicons-yes',__('Meta title filled','wp-meta-seo'),1);
206
$check++;
207
}else{
208
+ $output .= $this->metaseo_create_field('metatitle',$tooltip_page['meta_title'],'icons-mwarning',__('Meta title filled','wp-meta-seo'),0);
209
}
210
211
// desc filled
212
if(($_POST['datas']['meta_desc'] != '' && strlen($_POST['datas']['meta_desc']) <= self::$desc_length)){
213
+ $output .= $this->metaseo_create_field('metadesc',$tooltip_page['meta_desc'],'dashicons-yes',__('Meta description filled','wp-meta-seo'),1);
214
$check++;
215
}else{
216
+ $output .= $this->metaseo_create_field('metadesc',$tooltip_page['meta_desc'],'icons-mwarning',__('Meta description filled','wp-meta-seo'),0);
217
}
218
219
// image resize
220
if($_POST['datas']['content'] == '') {
221
+ $output .= $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'dashicons-yes',__('Wrong image resize','wp-meta-seo'),1);
222
+ $output .= $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'dashicons-yes',__('Image have meta title or alt','wp-meta-seo'),1);
223
$check += 2;
224
}else{
225
$dom = new DOMDocument;
249
}
250
251
if($img_wrong == false){
252
+ $output .= $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'dashicons-yes',__('Wrong image resize','wp-meta-seo'),1);
253
$check++;
254
}else{
255
+ $output .= $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'icons-mwarning',__('Wrong image resize','wp-meta-seo'),0);
256
}
257
258
if($img_wrong_alt == false){
259
+ $output .= $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'dashicons-yes',__('Image have meta title or alt','wp-meta-seo'),1);
260
$check++;
261
}else{
262
+ $output .= $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'icons-mwarning',__('Image have meta title or alt','wp-meta-seo'),0);
263
}
264
}else{
265
+ $output .= $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'icons-mwarning',__('Wrong image resize','wp-meta-seo'),0);
266
+ $output .= $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'icons-mwarning',__('Image have meta title or alt','wp-meta-seo'),0);
267
}
268
}
269
285
wp_send_json(true);
286
}
287
288
+ function metaseo_update_link(){
289
+ if(isset($_POST['postid'])){
290
+ if(isset($_POST['link_old']) && isset($_POST['link_new'])){
291
+ $link_old = stripcslashes($_POST['link_old']);
292
+ $link_new = $_POST['link_new'];
293
+ $post = get_post($_POST['postid']);
294
+ if(!empty($post) && !empty($post->post_content)){
295
+ if(strpos(html_entity_decode($post->post_content), $link_old) !== false){
296
+ $content = str_replace($link_old, $link_new, html_entity_decode($post->post_content));
297
+ $my_post = array(
298
+ 'ID' => $_POST['postid'],
299
+ 'post_content' => $content
300
+ );
301
+ wp_update_post( $my_post );
302
+ wp_send_json(array('link_new' => stripcslashes($link_new)));
303
+ }else{
304
+ wp_send_json(false);
305
+ }
306
+ }
307
+ wp_send_json(false);
308
+ }
309
+ }
310
+ wp_send_json(false);
311
+ }
312
+
313
function metaseo_field_settings(){
314
register_setting('Wp Meta SEO','_metaseo_settings');
315
add_settings_section('metaseo_dashboard','',array( $this, 'showSettings' ),'metaseo_settings');
316
+ add_settings_field('metaseo_title_home', __('Homepage meta title', 'wp-meta-seo'), array( $this, 'metaseo_title_home' ), 'metaseo_settings', 'metaseo_dashboard');
317
+ add_settings_field('metaseo_desc_home', __('Homepage meta description', 'wp-meta-seo'), array( $this, 'metaseo_desc_home' ), 'metaseo_settings', 'metaseo_dashboard');
318
+ add_settings_field('metaseo_showfacebook', __('Facebook profile URL', 'wp-meta-seo'), array( $this, 'showfacebook' ), 'metaseo_settings', 'metaseo_dashboard');
319
+ add_settings_field('metaseo_showtwitter', __('Twitter Username', 'wp-meta-seo'), array( $this, 'showtwitter' ), 'metaseo_settings', 'metaseo_dashboard');
320
+ add_settings_field('metaseo_twitter_card', __('The default card type to use', 'wp-meta-seo'), array( $this, 'showtwittercard' ), 'metaseo_settings', 'metaseo_dashboard');
321
+ add_settings_field('metaseo_showkeywords', __('Meta keywords', 'wp-meta-seo'), array( $this, 'showkeywords' ), 'metaseo_settings', 'metaseo_dashboard');
322
+ add_settings_field('metaseo_showtmetablock', __('Meta block edition', 'wp-meta-seo'), array( $this, 'showtmetablock' ), 'metaseo_settings', 'metaseo_dashboard');
323
+ add_settings_field('metaseo_showsocial', __('Social networks meta', 'wp-meta-seo'), array( $this, 'showsocial' ), 'metaseo_settings', 'metaseo_dashboard');
324
+ add_settings_field('metaseo_seovalidate', __('Force SEO validation', 'wp-meta-seo'), array( $this, 'showseovalidate' ), 'metaseo_settings', 'metaseo_dashboard');
325
+ add_settings_field('metaseo_linkfield', __('Link text field', 'wp-meta-seo'), array( $this, 'showlinkfield' ), 'metaseo_settings', 'metaseo_dashboard');
326
}
327
328
public function showSettings(){
343
echo '<input name="_metaseo_settings[metaseo_showkeywords]" type="hidden" value="0"/>';
344
?>
345
<label><input name="_metaseo_settings[metaseo_showkeywords]" type="checkbox" id="metaseo_showkeywords" value="1" <?php checked( 1, $this->settings['metaseo_showkeywords']); ?> />
346
+ <?php _e( 'Active meta keywords','wp-meta-seo'); ?></label>
347
<?php
348
}
349
351
echo '<input name="_metaseo_settings[metaseo_showtmetablock]" type="hidden" value="0"/>';
352
?>
353
<label><input name="_metaseo_settings[metaseo_showtmetablock]" type="checkbox" id="metaseo_showtmetablock" value="1" <?php checked( 1, $this->settings['metaseo_showtmetablock']); ?> />
354
+ <?php _e( 'Activate meta block edition below content','wp-meta-seo' ); ?></label>
355
<?php
356
}
357
359
echo '<input name="_metaseo_settings[metaseo_showsocial]" type="hidden" value="0"/>';
360
?>
361
<label><input name="_metaseo_settings[metaseo_showsocial]" type="checkbox" id="metaseo_showsocial" value="1" <?php checked( 1, $this->settings['metaseo_showsocial']); ?> />
362
+ <?php _e( 'Activate social edition','wp-meta-seo' ); ?></label>
363
<?php
364
}
365
367
echo '<input name="_metaseo_settings[metaseo_seovalidate]" type="hidden" value="0"/>';
368
?>
369
<label><input name="_metaseo_settings[metaseo_seovalidate]" type="checkbox" id="metaseo_seovalidate" value="1" <?php checked( 1, $this->settings['metaseo_seovalidate']); ?> />
370
+ <?php _e( 'Allow user to force on page SEO criteria validation by clicking on the icon','wp-meta-seo' ); ?></label>
371
+ <?php
372
+ }
373
+
374
+ public function showlinkfield(){
375
+ echo '<input name="_metaseo_settings[metaseo_linkfield]" type="hidden" value="0"/>';
376
+ ?>
377
+ <label><input name="_metaseo_settings[metaseo_linkfield]" type="checkbox" id="metaseo_linkfield" value="1" <?php checked( 1, $this->settings['metaseo_linkfield']); ?> />
378
+ <?php _e( "Adds back the missing 'title' field in the Insert/Edit URL box","wp-meta-seo" ); ?></label>
379
<?php
380
}
381
393
$twitter_card = isset( $this->settings['metaseo_twitter_card'] ) ? $this->settings['metaseo_twitter_card'] : 'summary';
394
?>
395
<select class="select" name="_metaseo_settings[metaseo_twitter_card]" id="metaseo_twitter_card">
396
+ <option <?php if($twitter_card == 'summary') echo 'selected' ?> value="summary"><?php _e( 'Summary', 'wp-meta-seo' ); ?></option>
397
+ <option <?php if($twitter_card == 'summary_large_image') echo 'selected' ?> value="summary_large_image"><?php _e( 'Summary with large image', 'wp-meta-seo' ); ?></option>
398
</select>
399
<?php
400
}
435
// wp_die();
436
// }
437
438
+ $response->msg = __('Modification was saved', 'wp-meta-seo') ;
439
if($metakey == 'metatitle') {
440
if(!update_post_meta($postID, '_metaseo_metatitle', $value)) {
441
$response->updated = false;
442
+ $response->msg = __('Meta title was not saved', 'wp-meta-seo') ;
443
}
444
else{
445
$response->updated = true;
446
+ $response->msg = __('Meta title was saved', 'wp-meta-seo') ;
447
}
448
}
449
450
if($metakey =='metadesc') {
451
if(!update_post_meta($postID, '_metaseo_metadesc', $value)) {
452
$response->updated = false;
453
+ $response->msg = __('Meta description was not saved', 'wp-meta-seo') ;
454
}else{
455
$response->updated = true;
456
+ $response->msg = __('Meta description was saved', 'wp-meta-seo') ;
457
}
458
}
459
460
if ($metakey == 'metakeywords') {
461
if (!update_post_meta($postID, '_metaseo_metakeywords', $value)) {
462
$response->updated = false;
463
+ $response->msg = __('Meta keywords was not saved', 'wp-meta-seo');
464
} else {
465
$response->updated = true;
466
+ $response->msg = __('Meta keywords was saved', 'wp-meta-seo');
467
}
468
}
469
508
509
public function meta_seo_localize_script() {
510
return array(
511
+ 'metaseo_message_false_copy' => __( 'We didn\'t find any element to apply a batch copy, congrats!', 'wp-meta-seo' ),
512
);
513
}
514
526
function register_menu_page() {
527
528
// Add main page
529
+ $admin_page = add_menu_page(__('WP Meta SEO:', 'wp-meta-seo') . ' ' . __('Dashboard', 'wp-meta-seo'), __('WP Meta SEO', 'wp-meta-seo'), 'manage_options', 'metaseo_dashboard', array(
530
$this,'load_page',) , 'dashicons-chart-area' );
531
532
/**
541
array(
542
'metaseo_dashboard',
543
'',
544
+ __('Content meta', 'wp-meta-seo'),
545
$manage_options_cap,
546
'metaseo_content_meta',
547
array($this, 'load_page'),
550
array(
551
'metaseo_dashboard',
552
'',
553
+ __('Image meta', 'wp-meta-seo'),
554
$manage_options_cap,
555
'metaseo_image_meta',
556
array($this, 'load_page'),
559
array(
560
'metaseo_dashboard',
561
'',
562
+ __('Link meta', 'wp-meta-seo'),
563
+ $manage_options_cap,
564
+ 'metaseo_link_meta',
565
+ array($this, 'load_page'),
566
+ null,
567
+ ),
568
+ array(
569
+ 'metaseo_dashboard',
570
+ '',
571
+ __('Settings', 'wp-meta-seo'),
572
$manage_options_cap,
573
'metaseo_settings',
574
array($this, 'load_page'),
586
foreach ($submenu_pages as $submenu_page) {
587
588
// Add submenu page
589
+ $admin_page = add_submenu_page($submenu_page[0], $submenu_page[2] . ' - ' . __('WP Meta SEO:', 'wp-meta-seo'), $submenu_page[2], $submenu_page[3], $submenu_page[4], $submenu_page[5]);
590
591
// Check if we need to hook
592
if (isset($submenu_page[6]) && null != $submenu_page[6] && is_array($submenu_page[6]) && count($submenu_page[6]) > 0) {
599
600
global $submenu;
601
if (isset($submenu['metaseo_dashboard']) && current_user_can($manage_options_cap)) {
602
+ $submenu['metaseo_dashboard'][0][0] = __('Dashboard', 'wp-meta-seo');
603
}
604
}
605
621
case 'metaseo_image_meta':
622
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/image-meta.php' );
623
break;
624
+
625
+ case 'metaseo_link_meta':
626
+ require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/link-meta.php' );
627
+ break;
628
+
629
case 'metaseo_image_optimize':
630
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/image-optimize.php' );
631
break;
853
854
add_action('wp_ajax_metaseo_reload_analysis',array($this,'metaseo_reload_analysis'));
855
add_action('wp_ajax_metaseo_validate_analysis',array($this,'metaseo_validate_analysis'));
856
+ add_action('wp_ajax_metaseo_update_link',array($this,'metaseo_update_link'));
857
}
858
859
}
inc/class.metaseo-content-list-table.php CHANGED
@@ -18,7 +18,7 @@ class MetaSeo_Content_List_Table extends WP_List_Table {
18
));
19
20
}
21
-
22
function display_tablenav($which) {
23
?>
24
<div class="tablenav <?php echo esc_attr($which); ?>">
@@ -113,8 +113,8 @@ class MetaSeo_Content_List_Table extends WP_List_Table {
113
$options .= sprintf('<option value="%2$s" %3$s>%1$s</option>', $obj->labels->name, $post_type->post_type, selected($selected, $post_type->post_type, false));
114
}
115
116
- $sl_bulk = '<select name="mbulk_copy" class="mbulk_copy"><option value="0">'.__('Bulk copy','wpms').'</option><option value="all">'.__('All Posts','wpms').'</option><option value="bulk-copy-metatitle">'.__('Selected posts','wpms').'</option></select>';
117
- $btn_bulk = '<input type="button" name="do_copy" id="post_do_copy" class="button button-primary btn_do_copy post_do_copy" value="'.__('Content title as meta title','wpms').'"><span class="spinner"></span>';
118
119
echo sprintf('<select name="post_type_filter" class="metaseo-filter">%1$s</select>', $options);
120
submit_button(__('Filter'), 'button', 'do_filter', false, array('id' => 'post-query-submit'));
@@ -125,7 +125,7 @@ class MetaSeo_Content_List_Table extends WP_List_Table {
125
}
126
127
function get_columns() {
128
- $preview = __(" This is a rendering of what this post might look like in Google's search results.", 'wpms');
129
$info = sprintf('<a class="info-content"><img src=' . WPMETASEO_PLUGIN_URL . 'img/info.png href="#">'
130
. '<p class="tooltip-metacontent">'
131
.$preview
@@ -133,17 +133,17 @@ class MetaSeo_Content_List_Table extends WP_List_Table {
133
134
$columns = array(
135
'cb' => '<input id="cb-select-all-1" type="checkbox" style="margin:0">',
136
- 'col_id' => __('', 'wpms'),
137
- 'col_title' => __('Title', 'wpms'),
138
- 'col_snippet' => sprintf(__('Snippet Preview %s', 'wpms'),$info),
139
- 'col_meta_title' => __('Meta Title', 'wpms'),
140
);
141
142
$settings = get_option( '_metaseo_settings' );
143
if(isset($settings['metaseo_showkeywords']) && $settings['metaseo_showkeywords'] == 1){
144
- $columns['col_meta_keywords'] = __('Meta Keywords', 'wpms');
145
}
146
- $columns['col_meta_desc'] = __('Meta Description', 'wpms');
147
148
return $columns;
149
}
@@ -191,6 +191,11 @@ class MetaSeo_Content_List_Table extends WP_List_Table {
191
}
192
}
193
194
//Order By block
195
$orderby = !empty($_GET["orderby"]) ? ($_GET["orderby"]) : 'post_title';
196
$order = !empty($_GET["order"]) ? ($_GET["order"]) : 'asc';
@@ -313,7 +318,7 @@ class MetaSeo_Content_List_Table extends WP_List_Table {
313
314
case 'col_title':
315
$post_title = stripslashes($rec->post_title);
316
- if($post_title == '') $post_title = __('(no title)' , 'wpms');
317
echo sprintf('<td %2$s><div class="action-wrapper"><strong id="post-title-'.$rec->ID.'">%1$s</strong>', $post_title, $attributes);
318
319
$post_type_object = get_post_type_object($rec->post_type);
@@ -409,6 +414,11 @@ class MetaSeo_Content_List_Table extends WP_List_Table {
409
$current_url = add_query_arg(array( "metaseo_posts_per_page" => intval($_POST['metaseo_posts_per_page'])), $current_url);
410
$redirect = true;
411
}
412
413
if($redirect === true){
414
wp_redirect($current_url);
18
));
19
20
}
21
+
22
function display_tablenav($which) {
23
?>
24
<div class="tablenav <?php echo esc_attr($which); ?>">
113
$options .= sprintf('<option value="%2$s" %3$s>%1$s</option>', $obj->labels->name, $post_type->post_type, selected($selected, $post_type->post_type, false));
114
}
115
116
+ $sl_bulk = '<select name="mbulk_copy" class="mbulk_copy"><option value="0">'.__('Bulk copy','wp-meta-seo').'</option><option value="all">'.__('All Posts','wp-meta-seo').'</option><option value="bulk-copy-metatitle">'.__('Selected posts','wp-meta-seo').'</option></select>';
117
+ $btn_bulk = '<input type="button" name="do_copy" id="post_do_copy" class="button button-primary btn_do_copy post_do_copy" value="'.__('Content title as meta title','wp-meta-seo').'"><span class="spinner"></span>';
118
119
echo sprintf('<select name="post_type_filter" class="metaseo-filter">%1$s</select>', $options);
120
submit_button(__('Filter'), 'button', 'do_filter', false, array('id' => 'post-query-submit'));
125
}
126
127
function get_columns() {
128
+ $preview = __(" This is a rendering of what this post might look like in Google's search results.", 'wp-meta-seo');
129
$info = sprintf('<a class="info-content"><img src=' . WPMETASEO_PLUGIN_URL . 'img/info.png href="#">'
130
. '<p class="tooltip-metacontent">'
131
.$preview
133
134
$columns = array(
135
'cb' => '<input id="cb-select-all-1" type="checkbox" style="margin:0">',
136
+ 'col_id' => __('', 'wp-meta-seo'),
137
+ 'col_title' => __('Title', 'wp-meta-seo'),
138
+ 'col_snippet' => sprintf(__('Snippet Preview %s', 'wp-meta-seo'),$info),
139
+ 'col_meta_title' => __('Meta Title', 'wp-meta-seo'),
140
);
141
142
$settings = get_option( '_metaseo_settings' );
143
if(isset($settings['metaseo_showkeywords']) && $settings['metaseo_showkeywords'] == 1){
144
+ $columns['col_meta_keywords'] = __('Meta Keywords', 'wp-meta-seo');
145
}
146
+ $columns['col_meta_desc'] = __('Meta Description', 'wp-meta-seo');
147
148
return $columns;
149
}
191
}
192
}
193
194
+ $keyword = !empty($_GET["s"]) ? $_GET["s"] : '';
195
+ if (isset($keyword) && $keyword != '') {
196
+ $where[] .= '(post_title LIKE "%' . $keyword .'%" OR mt.meta_value LIKE "%' . $keyword .'%" OR md.meta_value LIKE "%' . $keyword .'%")';
197
+ }
198
+
199
//Order By block
200
$orderby = !empty($_GET["orderby"]) ? ($_GET["orderby"]) : 'post_title';
201
$order = !empty($_GET["order"]) ? ($_GET["order"]) : 'asc';
318
319
case 'col_title':
320
$post_title = stripslashes($rec->post_title);
321
+ if($post_title == '') $post_title = __('(no title)' , 'wp-meta-seo');
322
echo sprintf('<td %2$s><div class="action-wrapper"><strong id="post-title-'.$rec->ID.'">%1$s</strong>', $post_title, $attributes);
323
324
$post_type_object = get_post_type_object($rec->post_type);
414
$current_url = add_query_arg(array( "metaseo_posts_per_page" => intval($_POST['metaseo_posts_per_page'])), $current_url);
415
$redirect = true;
416
}
417
+
418
+ if(isset($_POST['s'])){
419
+ $current_url = add_query_arg(array( "s" => urlencode($_POST['s'])), $current_url);
420
+ $redirect = true;
421
+ }
422
423
if($redirect === true){
424
wp_redirect($current_url);
inc/class.metaseo-dashboard.php CHANGED
@@ -18,6 +18,8 @@ class MetaSeo_Dashboard {
18
public static $mpostname_inurl = 0;
19
public static $mcategory_inurl = 0;
20
public static $mpermalink = 50;
21
22
23
public static function moptimizationChecking() {
@@ -48,6 +50,7 @@ class MetaSeo_Dashboard {
48
$posts = $wpdb->get_results($query);
49
if (count($posts) > 0) {
50
$doc = new DOMDocument();
51
$upload_dir = wp_upload_dir();
52
53
foreach ($posts as $post) {
@@ -111,7 +114,7 @@ class MetaSeo_Dashboard {
111
if ($rank !== '') {
112
echo $rank;
113
} else {
114
- echo __('We can\'t get rank of this site from Alexa.com!', 'wpms');
115
}
116
}
117
@@ -129,6 +132,7 @@ class MetaSeo_Dashboard {
129
}
130
131
$doc = new DOMDocument();
132
@$doc->loadHTML($content);
133
$doc->preserveWhiteSpace = false;
134
@@ -146,7 +150,7 @@ class MetaSeo_Dashboard {
146
}
147
148
$html = trim($tmp_dom->saveHTML());
149
- $html = str_replace('We don\'t have', __('Alexa doesn\'t have','wpms'), $html);
150
$html = str_replace('Get Certified', '', $html);
151
$html = str_replace('"/topsites/countries', '"http://www.alexa.com/topsites/countries', $html);
152
return $html;
@@ -187,14 +191,15 @@ class MetaSeo_Dashboard {
187
}
188
189
function evolutive_dashboard(){
190
- $results = array('permalink_setting' => 50 , 'metatitle_filled' => array(0,array(0,0)) , 'metadesc_filled' => array(0,array(0,0)) , 'new_content' => array(0,array(0,0)));
191
$args = array(
192
'posts_per_page' => -1,
193
- 'post_type' => array('post','page'),
194
'suppress_filters' => true
195
);
196
$mposts = get_posts( $args );
197
-
198
if(empty($mposts)){
199
return $results;
200
}else{
@@ -211,10 +216,35 @@ class MetaSeo_Dashboard {
211
if(($meta_desc != '' && strlen($meta_desc) <= self::$meta_desc_length ) || (!empty($meta_analysis) && !empty($meta_analysis['metadesc'])) ){
212
self::$metadesc_filled++;
213
}
214
}
215
216
$results['metatitle_filled'] = array(ceil(self::$metatitle_filled/(count($mposts))*100) , array(self::$metatitle_filled , count($mposts)));
217
$results['metadesc_filled'] = array(ceil(self::$metadesc_filled/(count($mposts))*100) , array(self::$metadesc_filled , count($mposts)));
218
}
219
220
$permalink_structure = get_option('permalink_structure');
@@ -249,5 +279,4 @@ class MetaSeo_Dashboard {
249
$results['new_content'] = array($count_new , array(count($newcontent->get_posts()) , count($mposts)));
250
return $results;
251
}
252
-
253
}
18
public static $mpostname_inurl = 0;
19
public static $mcategory_inurl = 0;
20
public static $mpermalink = 50;
21
+ public static $mlink_complete = 0;
22
+ public static $mcount_link = 0;
23
24
25
public static function moptimizationChecking() {
50
$posts = $wpdb->get_results($query);
51
if (count($posts) > 0) {
52
$doc = new DOMDocument();
53
+ libxml_use_internal_errors( true );
54
$upload_dir = wp_upload_dir();
55
56
foreach ($posts as $post) {
114
if ($rank !== '') {
115
echo $rank;
116
} else {
117
+ echo __('We can\'t get rank of this site from Alexa.com!', 'wp-meta-seo');
118
}
119
}
120
132
}
133
134
$doc = new DOMDocument();
135
+ libxml_use_internal_errors( true );
136
@$doc->loadHTML($content);
137
$doc->preserveWhiteSpace = false;
138
150
}
151
152
$html = trim($tmp_dom->saveHTML());
153
+ $html = str_replace('We don\'t have', __('Alexa doesn\'t have','wp-meta-seo'), $html);
154
$html = str_replace('Get Certified', '', $html);
155
$html = str_replace('"/topsites/countries', '"http://www.alexa.com/topsites/countries', $html);
156
return $html;
191
}
192
193
function evolutive_dashboard(){
194
+ $post_types = get_post_types( array('public' => true, 'exclude_from_search' => false) ) ;
195
+ if(!empty($post_types['attachment'])) unset($post_types['attachment']);
196
+ $results = array('permalink_setting' => 50 , 'metatitle_filled' => array(0,array(0,0)) , 'metadesc_filled' => array(0,array(0,0)) , 'new_content' => array(0,array(0,0)) , 'link_meta' => array(0,array(0,0)));
197
$args = array(
198
'posts_per_page' => -1,
199
+ 'post_type' => $post_types,
200
'suppress_filters' => true
201
);
202
$mposts = get_posts( $args );
203
if(empty($mposts)){
204
return $results;
205
}else{
216
if(($meta_desc != '' && strlen($meta_desc) <= self::$meta_desc_length ) || (!empty($meta_analysis) && !empty($meta_analysis['metadesc'])) ){
217
self::$metadesc_filled++;
218
}
219
+
220
+ // get link meta
221
+
222
+ $dom = new DOMDocument;
223
+ libxml_use_internal_errors( true );
224
+ if(isset($post->post_content) && $post->post_content != ''){
225
+ if ($dom->loadHTML($post->post_content)) {
226
+ $tags = $dom->getElementsByTagName('a');
227
+ foreach ($tags as $tag){
228
+ self::$mcount_link++;
229
+ $link_title = $tag->getAttribute('title');
230
+ if(isset($link_title) && $link_title != ''){
231
+ self::$mlink_complete++;
232
+ }
233
+ }
234
+
235
+ }
236
+ }
237
+ }
238
+
239
+ if(self::$mcount_link == 0){
240
+ $link_percent = 100;
241
+ }else{
242
+ $link_percent = ceil(self::$mlink_complete / self::$mcount_link*100);
243
}
244
245
$results['metatitle_filled'] = array(ceil(self::$metatitle_filled/(count($mposts))*100) , array(self::$metatitle_filled , count($mposts)));
246
$results['metadesc_filled'] = array(ceil(self::$metadesc_filled/(count($mposts))*100) , array(self::$metadesc_filled , count($mposts)));
247
+ $results['link_meta'] = array($link_percent , array(self::$mlink_complete , self::$mcount_link));
248
}
249
250
$permalink_structure = get_option('permalink_structure');
279
$results['new_content'] = array($count_new , array(count($newcontent->get_posts()) , count($mposts)));
280
return $results;
281
}
282
}
inc/class.metaseo-image-list-table.php CHANGED
@@ -41,12 +41,12 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
41
42
<div class="alignleft">
43
<select name="image_mbulk_copy" class="mbulk_copy">
44
- <option value="0"><?php _e('Bulk copy','wpms') ?></option>
45
- <option value="all"><?php _e('All Images','wpms') ?></option>
46
- <option value="bulk-copy-title-alt"><?php _e('Selected images','wpms') ?></option>
47
</select>
48
- <input type="button" name="image_do_copy_alt" class="button button-primary btn_do_copy image_do_copy_alt" value="<?php _e('Image name as alt text','wpms') ?>">
49
- <input type="button" name="image_do_copy_title" class="button button-primary btn_do_copy image_do_copy_title" value="<?php _e('Image name as image title','wpms') ?>">
50
<span class="spinner"></span>
51
</div>
52
@@ -145,14 +145,14 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
145
function get_columns() {
146
return $columns = array(
147
'cb' => '<input id="cb-select-all-1" type="checkbox">',
148
- 'col_id' => __('ID', 'wpms'),
149
- 'col_image' => __('Image', 'wpms'),
150
- 'col_image_name' => __('Name', 'wpms'),
151
- 'col_image_info' => __('Optimization Info', 'wpms'),
152
- 'col_image_alternative' => __('Alternative text', 'wpms'),
153
- 'col_image_title' => __('Title', 'wpms'),
154
- 'col_image_legend' => __('Legend', 'wpms'),
155
- 'col_image_desc' => __('Description', 'wpms'),
156
);
157
}
158
@@ -375,9 +375,9 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
375
376
$m = isset($_REQUEST['sldate']) ? $_REQUEST['sldate'] : 0;
377
?>
378
- <label for="filter-by-date" class="screen-reader-text"><?php _e('Filter by date'); ?></label>
379
<select name="<?php echo $name ?>" id="filter-by-date" class="metaseo-filter">
380
- <option<?php selected($m, 0); ?> value="0"><?php _e('All dates'); ?></option>
381
<?php
382
foreach ($months as $arc_row) {
383
@@ -599,9 +599,9 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
599
600
private static function display_fix_metas_list($img_post_id, $posts, $meta_counter, $p, $im){
601
if($meta_counter){
602
- $header = sprintf(__('We found %s image which needed to add or change meta information', 'wpms'),$meta_counter . $im . $p);
603
}else{
604
- $header = __('We found 0 image which needed to add or change meta information', 'wpms');//__('We found 0 image which needed to add or change meta information', 'wpms');
605
}
606
607
//Get default meta information of the image
@@ -616,7 +616,7 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
616
<tbody>
617
<?php $alternate = '';?>
618
<?php if(count($posts) < 1): ?>
619
- <tr><td colspan="10" style="height:95%"><?php echo __('This image has still not been inserted in any post!', 'wpms') ?></td></tr>
620
<?php else: ?>
621
<tr class="metaseo-border-bottom">
622
<td colspan="1">ID</td>
@@ -648,7 +648,7 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
648
$value = str_replace($chr, htmlentities2($chr), $value);
649
}
650
?>
651
- <input type="text" value="<?php echo ($value != '' ? $value : ''); ?>" id="metaseo-img-<?php echo $type. '-' .$post['ID'] ?>" class="metaseo-fix-meta metaseo-img-<?php echo $type ?>" data-meta-key="_metaseo_fix_metas" data-post-id="<?php echo $post['ID'] ?>" data-img-post-id="<?php echo $img_post_id ?>" data-meta-type="<?php echo $type ?>" data-meta-order="<?php echo $k ?>" data-file-name="<?php echo $file_name; ?>" placeholder="<?php echo ($value == '' ? __(ucfirst($type) . ' is empty', 'wpms') : '') ?>" onfocus="metaseo_fix_meta(this);" onblur="updateInputBlur(this)" onkeydown="return checkeyCode(event,this)" />
652
<span class="meta-update"></span>
653
<?php if(trim($type) != '' && trim($type) != $value): ?>
654
<a class="button meta-default" href="#" data-default-value="<?php echo esc_attr($type) ?>" title="Add to input box" onclick="add_meta_default(this)"> <?php echo '<img src= "' . WPMETASEO_PLUGIN_URL . 'img/img-arrow.png" />' ?> Copy </a>
@@ -673,7 +673,7 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
673
674
private static function display_resize_image_list($img_post_id,$posts, $img_counter, $p, $im){
675
676
- $header = sprintf(__('We found %s which needed to optimize', 'wpms'), $img_counter . $im . $p);
677
?>
678
<h3 class="content-header"><?php echo $header ?></h3>
679
<div class="content-box">
@@ -714,7 +714,7 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
714
<?php endforeach ?>
715
</td>
716
<td colspan="2" class="metaseo-action">
717
- <a href="javascript:void(0);" class="metaseo-optimize button" data-img-post-id="<?php echo $img_post_id ?>" data-post-id="<?php echo $post['ID'] ?>" onclick="optimize_imgs(this)"><?php echo __('Replace?', 'wpms') ?></a>
718
<span class="optimizing spinner"></span>
719
</td>
720
<td colspan="4">
@@ -768,7 +768,7 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
768
else{
769
$ret = array(
770
'success' => false,
771
- 'msg' => __('The post is not existed, please choose one another!', 'wpms')
772
);
773
}
774
@@ -1016,18 +1016,18 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
1016
1017
if(wp_update_post($data)){
1018
$response->updated = true;
1019
- $response->msg = __($label . ' was saved', 'wpms');
1020
}
1021
}
1022
else{
1023
update_post_meta($post_id, $aliases[$meta_type], $meta_value);
1024
$response->updated = true;
1025
- $response->msg = __($label . ' was saved', 'wpms');
1026
}
1027
1028
}
1029
else{
1030
- $response->msg = __('There is a problem when update image meta!', 'wpms');
1031
}
1032
1033
echo json_encode($response);
@@ -1044,7 +1044,7 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
1044
$linkold = $img_meta['file'];
1045
$response = new stdClass();
1046
$response->updated = FALSE;
1047
- $response->msg = __('There is a problem when update image name', 'wpms');
1048
1049
$upload_dirs = wp_upload_dir();
1050
$upload_dir = $upload_dirs['basedir'];
@@ -1146,24 +1146,24 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
1146
update_post_meta($postID, '_wp_attachment_metadata', $attached_metadata);
1147
1148
$response->updated = true;
1149
- $response->msg = __('Image name was changed', 'wpms');
1150
} else {
1151
$response->iname = $old_name;
1152
- $response->msg = __('There is a problem when update image name', 'wpms');
1153
}
1154
}
1155
} else {
1156
1157
- $response->msg = __('Name is existing', 'wpms');
1158
$response->iname = $old_name;
1159
}
1160
} else {
1161
$response->iname = $old_name;
1162
- $response->msg = __('File is not existed', 'wpms');
1163
}
1164
} else {
1165
$response->iname = $old_name;
1166
- $response->msg = __('Should not be empty', 'wpms');
1167
}
1168
echo json_encode($response);
1169
wp_die();
@@ -1175,7 +1175,7 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
1175
$response->updated = false;
1176
foreach($_post as $k => $v){
1177
if(!$v && !in_array($k, array('meta_value', 'meta_order'))){
1178
- $response->msg = __('There is a problem when update image meta!', 'wpms') ;
1179
1180
echo json_encode($response);
1181
wp_die();
@@ -1198,7 +1198,7 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
1198
//Then we must update this meta info in the appropriate post content
1199
if(!$post = get_post($post_id))
1200
{
1201
- $response->msg = __('The post has been deleted before, please check again!', 'wpms');
1202
}
1203
else{
1204
if($post->post_content !== ''){
@@ -1233,15 +1233,15 @@ class MetaSeo_Image_List_Table extends WP_List_Table {
1233
1234
//Update content of this post.
1235
if(!wp_update_post(array('ID' => $post->ID, 'post_content' => $post_content))){
1236
- $response->msg = __('The post haven\'t been updated, please check again!', 'wpms');
1237
}
1238
else{
1239
$response->updated = true;
1240
- $response->msg = __(ucfirst($meta_type) . ' was saved','wpms') ;
1241
}
1242
}
1243
else{
1244
- $response->msg = __('This image has been removed from the post, please check again!', 'wpms');
1245
}
1246
}
1247
else{
41
42
<div class="alignleft">
43
<select name="image_mbulk_copy" class="mbulk_copy">
44
+ <option value="0"><?php _e('Bulk copy','wp-meta-seo') ?></option>
45
+ <option value="all"><?php _e('All Images','wp-meta-seo') ?></option>
46
+ <option value="bulk-copy-title-alt"><?php _e('Selected images','wp-meta-seo') ?></option>
47
</select>
48
+ <input type="button" name="image_do_copy_alt" class="button button-primary btn_do_copy image_do_copy_alt" value="<?php _e('Image name as alt text','wp-meta-seo') ?>">
49
+ <input type="button" name="image_do_copy_title" class="button button-primary btn_do_copy image_do_copy_title" value="<?php _e('Image name as image title','wp-meta-seo') ?>">
50
<span class="spinner"></span>
51
</div>
52
145
function get_columns() {
146
return $columns = array(
147
'cb' => '<input id="cb-select-all-1" type="checkbox">',
148
+ 'col_id' => __('ID', 'wp-meta-seo'),
149
+ 'col_image' => __('Image', 'wp-meta-seo'),
150
+ 'col_image_name' => __('Name', 'wp-meta-seo'),
151
+ 'col_image_info' => __('Optimization Info', 'wp-meta-seo'),
152
+ 'col_image_alternative' => __('Alternative text', 'wp-meta-seo'),
153
+ 'col_image_title' => __('Title', 'wp-meta-seo'),
154
+ 'col_image_legend' => __('Legend', 'wp-meta-seo'),
155
+ 'col_image_desc' => __('Description', 'wp-meta-seo'),
156
);
157
}
158
375
376
$m = isset($_REQUEST['sldate']) ? $_REQUEST['sldate'] : 0;
377
?>
378
+ <label for="filter-by-date" class="screen-reader-text"><?php _e('Filter by date','wp-meta-seo'); ?></label>
379
<select name="<?php echo $name ?>" id="filter-by-date" class="metaseo-filter">
380
+ <option<?php selected($m, 0); ?> value="0"><?php _e('All dates','wp-meta-seo'); ?></option>
381
<?php
382
foreach ($months as $arc_row) {
383
599
600
private static function display_fix_metas_list($img_post_id, $posts, $meta_counter, $p, $im){
601
if($meta_counter){
602
+ $header = sprintf(__('We found %s image which needed to add or change meta information', 'wp-meta-seo'),$meta_counter . $im . $p);
603
}else{
604
+ $header = __('We found 0 image which needed to add or change meta information', 'wp-meta-seo');//__('We found 0 image which needed to add or change meta information', 'wp-meta-seo');
605
}
606
607
//Get default meta information of the image
616
<tbody>
617
<?php $alternate = '';?>
618
<?php if(count($posts) < 1): ?>
619
+ <tr><td colspan="10" style="height:95%"><?php echo __('This image has still not been inserted in any post!', 'wp-meta-seo') ?></td></tr>
620
<?php else: ?>
621
<tr class="metaseo-border-bottom">
622
<td colspan="1">ID</td>
648
$value = str_replace($chr, htmlentities2($chr), $value);
649
}
650
?>
651
+ <input type="text" value="<?php echo ($value != '' ? $value : ''); ?>" id="metaseo-img-<?php echo $type. '-' .$post['ID'] ?>" class="metaseo-fix-meta metaseo-img-<?php echo $type ?>" data-meta-key="_metaseo_fix_metas" data-post-id="<?php echo $post['ID'] ?>" data-img-post-id="<?php echo $img_post_id ?>" data-meta-type="<?php echo $type ?>" data-meta-order="<?php echo $k ?>" data-file-name="<?php echo $file_name; ?>" placeholder="<?php echo ($value == '' ? __(ucfirst($type) . ' is empty', 'wp-meta-seo') : '') ?>" onfocus="metaseo_fix_meta(this);" onblur="updateInputBlur(this)" onkeydown="return checkeyCode(event,this)" />
652
<span class="meta-update"></span>
653
<?php if(trim($type) != '' && trim($type) != $value): ?>
654
<a class="button meta-default" href="#" data-default-value="<?php echo esc_attr($type) ?>" title="Add to input box" onclick="add_meta_default(this)"> <?php echo '<img src= "' . WPMETASEO_PLUGIN_URL . 'img/img-arrow.png" />' ?> Copy </a>
673
674
private static function display_resize_image_list($img_post_id,$posts, $img_counter, $p, $im){
675
676
+ $header = sprintf(__('We found %s which needed to optimize', 'wp-meta-seo'), $img_counter . $im . $p);
677
?>
678
<h3 class="content-header"><?php echo $header ?></h3>
679
<div class="content-box">
714
<?php endforeach ?>
715
</td>
716
<td colspan="2" class="metaseo-action">
717
+ <a href="javascript:void(0);" class="metaseo-optimize button" data-img-post-id="<?php echo $img_post_id ?>" data-post-id="<?php echo $post['ID'] ?>" onclick="optimize_imgs(this)"><?php echo __('Replace?', 'wp-meta-seo') ?></a>
718
<span class="optimizing spinner"></span>
719
</td>
720
<td colspan="4">
768
else{
769
$ret = array(
770
'success' => false,
771
+ 'msg' => __('The post is not existed, please choose one another!', 'wp-meta-seo')
772
);
773
}
774
1016
1017
if(wp_update_post($data)){
1018
$response->updated = true;
1019
+ $response->msg = __($label . ' was saved', 'wp-meta-seo');
1020
}
1021
}
1022
else{
1023
update_post_meta($post_id, $aliases[$meta_type], $meta_value);
1024
$response->updated = true;
1025
+ $response->msg = __($label . ' was saved', 'wp-meta-seo');
1026
}
1027
1028
}
1029
else{
1030
+ $response->msg = __('There is a problem when update image meta!', 'wp-meta-seo');
1031
}
1032
1033
echo json_encode($response);
1044
$linkold = $img_meta['file'];
1045
$response = new stdClass();
1046
$response->updated = FALSE;
1047
+ $response->msg = __('There is a problem when update image name', 'wp-meta-seo');
1048
1049
$upload_dirs = wp_upload_dir();
1050
$upload_dir = $upload_dirs['basedir'];
1146
update_post_meta($postID, '_wp_attachment_metadata', $attached_metadata);
1147
1148
$response->updated = true;
1149
+ $response->msg = __('Image name was changed', 'wp-meta-seo');
1150
} else {
1151
$response->iname = $old_name;
1152
+ $response->msg = __('There is a problem when update image name', 'wp-meta-seo');
1153
}
1154
}
1155
} else {
1156
1157
+ $response->msg = __('Name is existing', 'wp-meta-seo');
1158
$response->iname = $old_name;
1159
}
1160
} else {
1161
$response->iname = $old_name;
1162
+ $response->msg = __('File is not existed', 'wp-meta-seo');
1163
}
1164
} else {
1165
$response->iname = $old_name;
1166
+ $response->msg = __('Should not be empty', 'wp-meta-seo');
1167
}
1168
echo json_encode($response);
1169
wp_die();
1175
$response->updated = false;
1176
foreach($_post as $k => $v){
1177
if(!$v && !in_array($k, array('meta_value', 'meta_order'))){
1178
+ $response->msg = __('There is a problem when update image meta!', 'wp-meta-seo') ;
1179
1180
echo json_encode($response);
1181
wp_die();
1198
//Then we must update this meta info in the appropriate post content
1199
if(!$post = get_post($post_id))
1200
{
1201
+ $response->msg = __('The post has been deleted before, please check again!', 'wp-meta-seo');
1202
}
1203
else{
1204
if($post->post_content !== ''){
1233
1234
//Update content of this post.
1235
if(!wp_update_post(array('ID' => $post->ID, 'post_content' => $post_content))){
1236
+ $response->msg = __('The post haven\'t been updated, please check again!', 'wp-meta-seo');
1237
}
1238
else{
1239
$response->updated = true;
1240
+ $response->msg = __(ucfirst($meta_type) . ' was saved','wp-meta-seo') ;
1241
}
1242
}
1243
else{
1244
+ $response->msg = __('This image has been removed from the post, please check again!', 'wp-meta-seo');
1245
}
1246
}
1247
else{
inc/class.metaseo-link-list-table.php ADDED
@@ -0,0 +1,551 @@
1
+ <?php
2
+ /*
3
+ * Comments to come later
4
+ *
5
+ *
6
+ */
7
+
8
+ if (!class_exists('WP_List_Table')) {
9
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
10
+ }
11
+
12
+ class MetaSeo_Link_List_Table extends WP_List_Table {
13
+
14
+ function __construct() {
15
+ parent::__construct(array(
16
+ 'singular' => 'metaseo_image',
17
+ 'plural' => 'metaseo_images',
18
+ 'ajax' => true
19
+ ));
20
+ }
21
+
22
+ function display_tablenav($which) {
23
+ $post_types = get_post_types( array('public' => true, 'exclude_from_search' => false) ) ;
24
+ if(!empty($post_types['attachment'])) unset($post_types['attachment']);
25
+ $p_type = "('".implode("','", $post_types)."')";
26
+ ?>
27
+ <div class="tablenav <?php echo esc_attr($which); ?>">
28
+
29
+ <?php if ($which == 'top'): ?>
30
+ <input type="hidden" name="page" value="metaseo_image_meta" />
31
+ <div class="alignleft actions bulkactions">
32
+ <?php $this->months_fillter($p_type, 'sldate', 'filter_date_action'); ?>
33
+ </div>
34
+ <?php elseif ($which == 'bottom'): ?>
35
+ <input type="hidden" name="page" value="metaseo_image_meta" />
36
+ <div class="alignleft actions bulkactions">
37
+ <?php $this->months_fillter($p_type, 'sldate1', 'filter_date_action'); ?>
38
+ </div>
39
+ <?php endif ?>
40
+
41
+ <input type="hidden" name="page" value="metaseo_image_meta" />
42
+ <?php if (!empty($_REQUEST['post_status'])): ?>
43
+ <input type="hidden" name="post_status" value="<?php echo esc_attr($_REQUEST['post_status']); ?>" />
44
+ <?php endif ?>
45
+
46
+ <?php //$this->extra_tablenav($which); ?>
47
+
48
+ <div style="float:right;margin-left:8px;">
49
+ <input type="number" required min="1" value="<?php echo $this->_pagination_args['per_page'] ?>" maxlength="3" name="metaseo_link_per_page" class="metaseo_imgs_per_page screen-per-page" max="999" min="1" step="1">
50
+ <input type="submit" name="btn_perpage" class="button_perpage button" id="button_perpage" value="Apply" >
51
+ </div>
52
+
53
+ <?php $this->pagination($which); ?>
54
+ <br class="clear" />
55
+ </div>
56
+
57
+ <?php
58
+ }
59
+
60
+ function get_views() {
61
+ global $wpdb;
62
+
63
+
64
+ $status_links = array();
65
+
66
+ $post_types = get_post_types(array('public' => true, 'exclude_from_search' => false));
67
+ $post_types = "'" . implode("', '", $post_types) . "'";
68
+
69
+ $states = get_post_stati(array('show_in_admin_all_list' => true));
70
+ $states['trash'] = 'trash';
71
+ $all_states = "'" . implode("', '", $states) . "'";
72
+
73
+ $total_posts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status IN ($all_states) AND post_type IN ($post_types)");
74
+
75
+ $class = empty($_REQUEST['post_status']) ? ' class="current"' : '';
76
+ $status_links['all'] = "<a href='admin.php?page=metaseo_image_meta'$class>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts'), number_format_i18n($total_posts)) . '</a>';
77
+
78
+ foreach (get_post_stati(array('show_in_admin_all_list' => true), 'objects') as $status) {
79
+
80
+ $status_name = $status->name;
81
+
82
+ $total = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status IN ('$status_name') AND post_type IN ($post_types)");
83
+
84
+ if ($total == 0) {
85
+ continue;
86
+ }
87
+
88
+ if (isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status']) {
89
+ $class = ' class="current"';
90
+ } else {
91
+ $class = '';
92
+ }
93
+
94
+ $status_links[$status_name] = "<a href='admin.php?page=metaseo_image_meta&amp;post_status=$status_name'$class>" . sprintf(translate_nooped_plural($status->label_count, $total), number_format_i18n($total)) . '</a>';
95
+ }
96
+ $trashed_posts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status IN ('trash') AND post_type IN ($post_types)");
97
+ $class = ( isset($_REQUEST['post_status']) && 'trash' == $_REQUEST['post_status'] ) ? 'class="current"' : '';
98
+ $status_links['trash'] = "<a href='admin.php?page=metaseo_image_meta&amp;post_status=trash'$class>" . sprintf(_nx('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', $trashed_posts, 'posts'), number_format_i18n($trashed_posts)) . '</a>';
99
+
100
+ return $status_links;
101
+ }
102
+
103
+ function extra_tablenav($which) {
104
+
105
+ #if ('top' == $which) {
106
+ echo '<div class="alignleft actions">';
107
+ global $wpdb;
108
+
109
+ $post_types = get_post_types(array('public' => true, 'exclude_from_search' => false));
110
+ $post_types = "'" . implode("', '", $post_types) . "'";
111
+
112
+ $states = get_post_stati(array('show_in_admin_all_list' => true));
113
+ $states['trash'] = 'trash';
114
+ $all_states = "'" . implode("', '", $states) . "'";
115
+
116
+ $query = "SELECT DISTINCT post_type FROM $wpdb->posts WHERE post_status IN ($all_states) AND post_type IN ($post_types) ORDER BY 'post_type' ASC";
117
+ $post_types = $wpdb->get_results($query);
118
+
119
+ $selected = !empty($_REQUEST['post_type_filter']) ? $_REQUEST['post_type_filter'] : -1;
120
+
121
+ $options = '<option value="-1">Show All Post Types</option>';
122
+
123
+ foreach ($post_types as $post_type) {
124
+ $obj = get_post_type_object($post_type->post_type);
125
+ $options .= sprintf('<option value="%2$s" %3$s>%1$s</option>', $obj->labels->name, $post_type->post_type, selected($selected, $post_type->post_type, false));
126
+ }
127
+
128
+ echo "</div>";
129
+ #echo "</form>";
130
+ #}
131
+ }
132
+
133
+ function get_columns() {
134
+ return $columns = array(
135
+ 'cb' => '<input id="cb-select-all-1" type="checkbox">',
136
+ 'col_id' => __('ID', 'wp-meta-seo'),
137
+ 'post_id' => __('Source', 'wp-meta-seo'),
138
+ 'col_link_url' => __('URL', 'wp-meta-seo'),
139
+ 'col_link_title' => __('Link title', 'wp-meta-seo'),
140
+ 'col_link_label' => __('Link text', 'wp-meta-seo'),
141
+ );
142
+ }
143
+
144
+ function get_sortable_columns() {
145
+ return $sortable = array(
146
+ 'post_id' => array('post_title', true)
147
+ );
148
+ }
149
+
150
+ /**
151
+ * Print column headers, accounting for hidden and sortable columns.
152
+ *
153
+ * @since 3.1.0
154
+ * @access public
155
+ *
156
+ * @param bool $with_id Whether to set the id attribute or not
157
+ */
158
+ public function print_column_headers($with_id = true) {
159
+ list( $columns, $hidden, $sortable ) = $this->get_column_info();
160
+
161
+ $current_url = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
162
+ $current_url = remove_query_arg('paged', $current_url);
163
+
164
+ if (isset($_GET['orderby']))
165
+ $current_orderby = $_GET['orderby'];
166
+ else
167
+ $current_orderby = '';
168
+
169
+ if (isset($_GET['order']) && 'desc' == $_GET['order'])
170
+ $current_order = 'desc';
171
+ else
172
+ $current_order = 'asc';
173
+
174
+ if (!empty($columns['cb'])) {
175
+ static $cb_counter = 1;
176
+ $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __('Select All') . '</label>'
177
+ . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" style="margin:0;" />';
178
+ $cb_counter++;
179
+ }
180
+
181
+ foreach ($columns as $column_key => $column_display_name) {
182
+ $class = array('manage-column', "column-$column_key");
183
+
184
+ $style = '';
185
+ if (in_array($column_key, $hidden))
186
+ $style = 'display:none;';
187
+
188
+ $style = ' style="' . $style . '"';
189
+
190
+ if ('cb' == $column_key)
191
+ $class[] = 'check-column';
192
+ elseif (in_array($column_key, array('posts', 'comments', 'links')))
193
+ $class[] = 'num';
194
+
195
+ if (isset($sortable[$column_key])) {
196
+ list( $orderby, $desc_first ) = $sortable[$column_key];
197
+
198
+ if ($current_orderby == $orderby) {
199
+ $order = 'asc' == $current_order ? 'desc' : 'asc';
200
+ $class[] = 'sorted';
201
+ $class[] = $current_order;
202
+ } else {
203
+ $order = $desc_first ? 'desc' : 'asc';
204
+ $class[] = 'sortable';
205
+ $class[] = $desc_first ? 'asc' : 'desc';
206
+ }
207
+
208
+ $column_display_name = '<a href="' . esc_url(add_query_arg(compact('orderby', 'order'), $current_url)) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>';
209
+ }
210
+
211
+ $id = $with_id ? "id='$column_key'" : '';
212
+
213
+ if (!empty($class))
214
+ $class = "class='" . join(' ', $class) . "'";
215
+
216
+ if ($column_key === 'col_id') {
217
+ echo "<th scope='col' $id $class $style colspan=\"1\">$column_display_name</th>";
218
+ } elseif ($column_key === 'col_image_name') {
219
+ echo "<th scope='col' $id $class $style colspan=\"4\">$column_display_name</th>";
220
+ } elseif ($column_key === 'col_image_info') {
221
+ echo "<th scope='col' $id $class $style colspan=\"5\">$column_display_name</th>";
222
+ } elseif ($column_key === 'cb') {
223
+ echo "<th scope='col' $id $class style='padding:8px 10px;'>$column_display_name</th>";
224
+ } else {
225
+ echo "<th scope='col' $id $class $style colspan=\"3\">$column_display_name</th>";
226
+ }
227
+ }
228
+ }
229
+
230
+ function prepare_items() {
231
+ global $wpdb, $_wp_column_headers;
232
+ //$GLOBALS['wp_filter']["manage_{$GLOBALS['screen']->id}_screen_columns"];
233
+
234
+ $screen = get_current_screen();
235
+
236
+ $where = array();
237
+ $post_type = isset($_REQUEST['post_type_filter']) ? $_REQUEST['post_type_filter'] : "";
238
+ if ($post_type == "-1") {
239
+ $post_type = "";
240
+ }
241
+
242
+ $post_types = get_post_types(array('public' => true, 'exclude_from_search' => false));
243
+ unset($post_types['attachment']);
244
+ if (!empty($post_type) && !in_array($post_type, $post_types))
245
+ $post_type = '\'post\'';
246
+ else if (empty($post_type)) {
247
+ $post_type = "'" . implode("', '", $post_types) . "'";
248
+ } else {
249
+ $post_type = "'" . $post_type . "'";
250
+ }
251
+
252
+ $where[] = "post_type IN ($post_type)";
253
+ $states = get_post_stati(array('show_in_admin_all_list' => true));
254
+ $states['trash'] = 'trash';
255
+ $all_states = "'" . implode("', '", $states) . "'";
256
+
257
+ if (empty($_REQUEST['post_status'])) {
258
+ $where[] = "post_status IN ($all_states)";
259
+ } else {
260
+ $requested_state = $_REQUEST['post_status'];
261
+ if (in_array($requested_state, $states)) {
262
+ $where[] = "post_status IN ('$requested_state')";
263
+ } else {
264
+ $where[] = "post_status IN ($all_states)";
265
+ }
266
+ }
267
+
268
+ if(!empty($_REQUEST['sldate'])){
269
+ $where[] = $wpdb->prepare(" post_date Like %s","%" .$_REQUEST['sldate']. "%");
270
+ }
271
+
272
+ //Order By block
273
+ $orderby = !empty($_GET["orderby"]) ? ($_GET["orderby"]) : 'post_title';
274
+ $order = !empty($_GET["order"]) ? ($_GET["order"]) : 'asc';
275
+
276
+ $sortable = $this->get_sortable_columns();
277
+ if (in_array($orderby, $sortable)) {
278
+ $orderStr = $orderby;
279
+ } else {
280
+ $orderStr = 'post_title';
281
+ }
282
+
283
+ if ($order == "asc") {
284
+ $orderStr .= " ASC";
285
+ } else {
286
+ $orderStr .= " DESC";
287
+ }
288
+
289
+ if (!empty($orderby) & !empty($order)) {
290
+ $orderStr = ' ORDER BY ' . $orderStr;
291
+ }
292
+
293
+ $query = "SELECT ID, post_title, post_content ,post_name, post_type, post_status"
294
+ . " FROM $wpdb->posts "
295
+ . " WHERE " . implode(' AND ', $where) . $orderStr;
296
+
297
+ $columns = $this->get_columns();
298
+ $hidden = array();
299
+ $sortable = $this->get_sortable_columns();
300
+ $this->_column_headers = array($columns, $hidden, $sortable);
301
+
302
+ $results = $wpdb->get_results($query);
303
+ $keyword = !empty($_GET["txtkeyword"]) ? $_GET["txtkeyword"] : '';
304
+ $list_link = array();
305
+ foreach ($results as $post){
306
+ $dom = new DOMDocument;
307
+ libxml_use_internal_errors( true );
308
+ if(isset($post->post_content) && $post->post_content != ''){
309
+ if ($dom->loadHTML($post->post_content)) {
310
+ // Extracting the specified elements from the web page
311
+ preg_match_all("|<[^>]+>(.*)</[^>]+>|U",$post->post_content,$matches, PREG_PATTERN_ORDER);
312
+ foreach (array_unique($matches[0]) as $match){
313
+ if(strpos($match, '<a') !== false && strpos($match, 'a>') !== false){
314
+ $dom = new DOMDocument;
315
+ libxml_use_internal_errors( true );
316
+ if ($dom->loadHTML($match)) {
317
+ $tags = $dom->getElementsByTagName('a');
318
+ $html_tag = $match;
319
+ $link_title = $tags->item(0)->getAttribute('title');
320
+ $link_url = $tags->item(0)->getAttribute('href');
321
+ $link_label = $tags->item(0)->nodeValue;
322
+ if(isset($link_label) && $link_label == ''){
323
+ $link_label = __('(None)','wp-meta-seo');
324
+ }
325
+
326
+ if (isset($keyword) && $keyword != '') {
327
+ if(strpos($link_label, $keyword) !== false || strpos($link_title, $keyword) !== false){
328
+ $list_link[] = array('html_tag' => $html_tag , 'link_title' => $link_title , 'link_label' => $link_label , 'link_url' => $link_url , 'post_title' => $post->post_title , 'post_id' => $post->ID);
329
+ }
330
+ }else{
331
+ $list_link[] = array('html_tag' => $html_tag , 'link_title' => $link_title , 'link_label' => $link_label , 'link_url' => $link_url ,'post_title' => $post->post_title , 'post_id' => $post->ID);
332
+ }
333
+ }
334
+ }
335
+ }
336
+ }
337
+ }
338
+ }
339
+
340
+ $total_items = count($list_link);
341
+ if (!empty($_REQUEST['metaseo_link_per_page'])) {
342
+ $_per_page = intval($_REQUEST['metaseo_link_per_page']);
343
+ } else {
344
+ $_per_page = 0;
345
+ }
346
+
347
+ $per_page = get_user_option('metaseo_link_per_page');
348
+ if ($per_page !== false) {
349
+ if ($_per_page && $_per_page !== $per_page) {
350
+ $per_page = $_per_page;
351
+ update_user_option(get_current_user_id(), 'metaseo_link_per_page', $per_page);
352
+ }
353
+ } else {
354
+ if ($_per_page > 0) {
355
+ $per_page = $_per_page;
356
+ } else {
357
+ $per_page = 10;
358
+ }
359
+ add_user_meta(get_current_user_id(), 'metaseo_link_per_page', $per_page);
360
+ }
361
+
362
+ $paged = !empty($_GET["paged"]) ? $_GET["paged"] : '';
363
+ if (empty($paged) || !is_numeric($paged) || $paged <= 0) {
364
+ $paged = 1;
365
+ }
366
+
367
+ $total_pages = ceil($total_items / $per_page);
368
+ $this->set_pagination_args(array(
369
+ 'total_items' => $total_items,
370
+ 'total_pages' => $total_pages,
371
+ 'per_page' => $per_page
372
+ ));
373
+
374
+ foreach ($list_link as $key => $item){
375
+ if($key >= $paged*$per_page || $key < ($paged-1)*$per_page){
376
+ unset($list_link[$key]);
377
+ }
378
+ }
379
+
380
+ $this->items = $list_link;
381
+ }
382
+
383
+ function search_box1() {
384
+ if (empty($_REQUEST['txtkeyword']) && !$this->has_items())
385
+ return;
386
+ $txtkeyword = (!empty($_REQUEST['txtkeyword'])) ? urldecode(stripslashes($_REQUEST['txtkeyword'])) : "";
387
+ if (!empty($_REQUEST['orderby']))
388
+ echo '<input type="hidden" name="orderby" value="' . esc_attr($_REQUEST['orderby']) . '" />';
389
+ if (!empty($_REQUEST['order']))
390
+ echo '<input type="hidden" name="order" value="' . esc_attr($_REQUEST['order']) . '" />';
391
+ if (!empty($_REQUEST['post_mime_type']))
392
+ echo '<input type="hidden" name="post_mime_type" value="' . esc_attr($_REQUEST['post_mime_type']) . '" />';
393
+ if (!empty($_REQUEST['detached']))
394
+ echo '<input type="hidden" name="detached" value="' . esc_attr($_REQUEST['detached']) . '" />';
395
+ ?>
396
+ <p class="search-box">
397
+
398
+ <input type="search" id="image-search-input" name="txtkeyword" value="<?php echo esc_attr(stripslashes($txtkeyword)); ?>" />
399
+ <?php submit_button('Search', 'button', 'search', false, array('id' => 'search-submit')); ?>
400
+ </p>
401
+ <?php
402
+ }
403
+
404
+ function months_fillter($post_type, $name, $namebutton) {
405
+ global $wpdb, $wp_locale;
406
+
407
+ $months = $wpdb->get_results("
408
+ SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
409
+ FROM $wpdb->posts
410
+ WHERE post_type IN $post_type
411
+ ORDER BY post_date DESC
412
+ ");
413
+
414
+ $months = apply_filters('months_dropdown_results', $months, $post_type);
415
+ $month_count = count($months);
416
+
417
+ if (!$month_count || ( 1 == $month_count && 0 == $months[0]->month ))
418
+ return;
419
+
420
+ $m = isset($_REQUEST['sldate']) ? $_REQUEST['sldate'] : 0;
421
+ ?>
422
+ <label for="filter-by-date" class="screen-reader-text"><?php _e('Filter by date','wp-meta-seo'); ?></label>
423
+ <select name="<?php echo $name ?>" id="filter-by-date" class="metaseo-filter">
424
+ <option<?php selected($m, 0); ?> value="0"><?php _e('All dates','wp-meta-seo'); ?></option>
425
+ <?php
426
+ foreach ($months as $arc_row) {
427
+
428
+ if (0 == $arc_row->year)
429
+ continue;
430
+ $month = zeroise($arc_row->month, 2);
431
+ $year = $arc_row->year;
432
+ printf("<option %s value='%s' >%s</option>\n", selected($m, "$year-$month", false), esc_attr("$arc_row->year-$month"), sprintf(__('%1$s %2$d'), $wp_locale->get_month($month), $year)
433
+ );
434
+ }
435
+ ?>
436
+ </select>
437
+
438
+ <?php
439
+ submit_button(__('Filter'), 'button', $namebutton, false, array('id' => 'image-submit'));
440
+ }
441
+
442
+ function display_rows() {
443
+ $url = URL;
444
+ $url = preg_replace('/(^(http|https):\/\/[w]*\.*)/', '', $url);
445
+ $records = $this->items;
446
+ $i = 0;
447
+ $alternate = "";
448
+
449
+ list( $columns, $hidden ) = $this->get_column_info();
450
+ if (!empty($records)) {
451
+ foreach ($records as $rec) {
452
+ $i++;
453
+ echo '<tr id="record_' . $i . '" data-link="'.$i.'" data-post_id="'.$rec['post_id'].'">';
454
+ foreach ($columns as $column_name => $column_display_name) {
455
+
456
+ $class = sprintf('class="%1$s column-%1$s"', $column_name);
457
+ $style = "";
458
+
459
+ if (in_array($column_name, $hidden)) {
460
+ $style = ' style="display:none;"';
461
+ }
462
+
463
+ $attributes = $class . $style;
464
+
465
+ switch ($column_name) {
466
+ case 'cb':
467
+ echo '<td scope="row" class="check-column" style="padding:8px 10px;">';
468
+ echo '<input id="cb-select-1" class="metaseo_post" type="checkbox" name="post[]" value="">';
469
+ echo '</td>';
470
+ break;
471
+
472
+ case 'col_id':
473
+ echo '<td class="col_id">';
474
+ echo $i;
475
+ echo '</td>';
476
+ break;
477
+
478
+ case 'post_id':
479
+ $row_action = array (
480
+ 'edit' => '<a href="'.get_edit_post_link( $rec['post_id'] ).'" title="Edit this item">Edit</a>',
481
+ 'view' => '<a href="'.get_post_permalink( $rec['post_id'] ).'" title="View &#8220;test&#8221;" rel="permalink">View</a>'
482
+ );
483
+ echo '<td class="col_id" colspan="3">';
484
+ echo '<a href="'.get_edit_post_link( $rec['post_id'] ).'">'.$rec['post_title'].'</a>';
485
+ echo $this->row_actions($row_action ,false);
486
+ echo '</td>';
487
+ break;
488
+
489
+ case 'col_link_url':
490
+ echo '<td class="wpms_link_html" colspan="3">';
491
+ echo '<a target="_blank" href="'.$rec['link_url'].'">'.$rec['link_url'].'</a>';
492
+ echo '<div style="display:none" class="wpms_new_link">'.$rec['html_tag'].'</div>';
493
+ echo '</td>';
494
+ break;
495
+
496
+ case 'col_link_title':
497
+ $link_title = $rec['link_title'];
498
+ echo '<td colspan="3">';
499
+ echo '<input type="text" data-post_id="'.$rec['post_id'].'" name="metaseo_link_title" id="metaseo_link_title" class="metaseo_link_title" value="'.$link_title.'">';
500
+ echo '<input type="hidden" class="wpms_old_link" value="'.esc_attr($rec['html_tag']).'">';
501
+ echo '<div data-post_id="'.$rec['post_id'].'" class="wpms_update_link">'.__('Update','wp-meta-seo').'</div>';
502
+ echo '<strong class="wpms_mesage_link">'.__('Saved.','wp-meta-seo').'</strong>';
503
+ echo '<strong class="wpms_error_mesage_link">'.__('Error.','wp-meta-seo').'</strong>';
504
+ echo '</td>';
505
+ break;
506
+
507
+ case 'col_link_label':
508
+ $link_label = $rec['link_label'];
509
+ echo '<td colspan="3">'.$link_label.'</td>';
510
+ break;
511
+ }
512
+ }
513
+
514
+ echo '</tr>';
515
+ }
516
+ }
517
+ }
518
+
519
+ public function process_action() {
520
+ global $wpdb;
521
+ $current_url = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
522
+ $redirect = false;
523
+
524
+ if (isset($_POST['search']) and $_POST['search'] === 'Search') {
525
+ $current_url = add_query_arg(array("search" => "Search", "txtkeyword" => urlencode(stripslashes($_POST["txtkeyword"]))), $current_url);
526
+ $redirect = true;
527
+ }
528
+
529
+ if (isset($_POST['filter_date_action']) and $_POST['filter_date_action'] === 'Filter') {
530
+ $current_url = add_query_arg(array("sldate" => $_POST["sldate"]), $current_url);
531
+ $redirect = true;
532
+ }
533
+
534
+ if (!empty($_POST['paged'])) {
535
+ $current_url = add_query_arg(array("paged" => intval($_POST['paged'])), $current_url);
536
+ $redirect = true;
537
+ }
538
+
539
+ if (!empty($_POST['metaseo_link_per_page'])) {
540
+ $current_url = add_query_arg(array("metaseo_link_per_page" => intval($_POST['metaseo_link_per_page'])), $current_url);
541
+ $redirect = true;
542
+ }
543
+
544
+ if ($redirect === true) {
545
+ wp_redirect($current_url);
546
+ ob_end_flush();
547
+ exit();
548
+ }
549
+ }
550
+
551
+ }
inc/class.metaseo-metabox.php CHANGED
@@ -54,44 +54,44 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
54
}
55
56
public static function translate_meta_boxes() {
57
- self::$meta_fields['general']['snippetpreview']['title'] = __('Results preview', 'wpms');
58
- self::$meta_fields['general']['snippetpreview']['help'] = sprintf(__('This is a preview of what your content will looks like in search engine results: title, description and URL', 'wpms'), '<a target="_blank" href="https://www.joomunited.com/wordpress-products/wpms">', '</a>');
59
60
- self::$meta_fields['general']['title']['title'] = __('Search engine title', 'wpms');
61
self::$meta_fields['general']['title']['description'] = sprintf(__('<span id="metaseo_wpmseo_title-length">%s</span>'),self::$meta_length_reason);
62
- self::$meta_fields['general']['title']['help'] = __('This is the title of your content that may be displayed in search engine results (meta title). By default it’s the content title (page title, post title…). 69 characters max allowed.', 'wpms');
63
64
$settings = get_option( '_metaseo_settings' );
65
if(isset($settings['metaseo_showkeywords']) && $settings['metaseo_showkeywords'] == 1){
66
- self::$meta_fields['general']['keywords']['title'] = __('Search engine keywords', 'wpms');
67
self::$meta_fields['general']['keywords']['description'] = '<span id="metaseo_wpmseo_keywords-length"></span>';
68
- self::$meta_fields['general']['keywords']['help'] = __('This is the keywords of your content that may be displayed in search engine results (meta keywords).', 'wpms');
69
}else{
70
unset(self::$meta_fields['general']['keywords']);
71
}
72
73
74
- self::$meta_fields['general']['desc']['title'] = __('Search engine description', 'wpms');
75
self::$meta_fields['general']['desc']['description'] = sprintf(__('<span id="metaseo_wpmseo_desc-length">%s</span>'),self::$meta_length_reason);
76
- self::$meta_fields['general']['desc']['help'] = __('The description of your content that may be displayed in search engine results aka meta description. By default search engine take an excerpt from your content (depending on the search query). 156 characters max allowed.', 'wpms');
77
78
- self::$meta_fields['social']['opengraph-title']['title'] = __('Facebook Title','wpms');
79
- self::$meta_fields['social']['opengraph-title']['description'] = __('Custom title to display when sharing this content on facebook, content title override','wpms');
80
81
- self::$meta_fields['social']['opengraph-desc']['title'] = __('Facebook Description','wpms');
82
- self::$meta_fields['social']['opengraph-desc']['description'] = __('Custom description to display when sharing this content on facebook, content description override','wpms');
83
84
- self::$meta_fields['social']['opengraph-image']['title'] = __('Facebook Image','wpms');
85
- self::$meta_fields['social']['opengraph-image']['description'] = __('Custom image to display when sharing this content on facebook, content description override, recommended size is 1200px x 630px','wpms');
86
87
- self::$meta_fields['social']['twitter-title']['title'] = __('Twitter Title','wpms');
88
- self::$meta_fields['social']['twitter-title']['description'] = __('Custom title to display when sharing this content on twitter, content title override','wpms');
89
90
- self::$meta_fields['social']['twitter-desc']['title'] = __('Twitter Description','wpms');
91
- self::$meta_fields['social']['twitter-desc']['description'] = __('Custom description to display when sharing this content on twitter, content description override','wpms');
92
93
- self::$meta_fields['social']['twitter-image']['title'] = __('Twitter Image','wpms');
94
- self::$meta_fields['social']['twitter-image']['description'] = __('Custom image to display when sharing this content on facebook, content description override, recommended min size 440px X 220px','wpms');
95
96
do_action('wpmseo_tab_translate');
97
}
@@ -148,7 +148,7 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
148
}
149
150
return array(
151
- 'choose_image' => __( 'Use Image', 'wpms' ),
152
'use_validate' => $this->settings['metaseo_seovalidate']
153
);
154
}
@@ -167,7 +167,7 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
167
$date = $this->get_post_date($post);
168
169
self::$meta_length = ( self::$meta_length - ( strlen($date) + 5 ) );
170
- self::$meta_length_reason = __(' (because of date display)', 'wpms');
171
}
172
173
self::$meta_length_reason = apply_filters('wpmseo_desc_length_reason', self::$meta_length_reason, $post);
@@ -208,7 +208,7 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
208
$cached_replacement_vars['sitename'] = get_option('blogname');
209
$array_keyword = array(
210
'field_prefix' => self::$form_prefix,
211
- 'choose_image' => __('Use Image', 'wpms'),
212
'wpmseo_meta_desc_length' => self::$meta_length,
213
'wpmseo_meta_title_length' => self::$meta_title_length,
214
'wpmseo_meta_keywords_length' => self::$meta_keywords_length,
@@ -217,7 +217,7 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
217
'wpmseo_permalink_template' => $sample_permalink,
218
'wpmseo_keyword_suggest_nonce' => wp_create_nonce('wpmseo-get-suggest'),
219
'wpmseo_replace_vars_nonce' => wp_create_nonce('wpmseo-replace-vars'),
220
- 'no_parent_text' => __('(no parent)', 'wpms'),
221
'show_keywords' => 0
222
);
223
$settings = get_option( '_metaseo_settings' );
@@ -253,7 +253,7 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
253
if (is_array($post_types) && $post_types !== array()) {
254
foreach ($post_types as $post_type) {
255
if ($this->is_metabox_hidden($post_type) === false) {
256
- add_meta_box('wpmseo_meta', __('WP Meta SEO - Page optimization','wpms'), array(
257
$this,
258
'meta_box',
259
), $post_type, 'normal', apply_filters('wpmseo_metabox_prio', 'high'));
@@ -282,12 +282,12 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
282
<div class="wpmseo-metabox-tabs-div">
283
<ul class="wpmseo-metabox-tabs" id="wpmseo-metabox-tabs">
284
<li class="general">
285
- <a class="wpmseo_tablink" data-link="wpmseo_general"><?php _e('SEO Page optimization', 'wpms'); ?></a>
286
</li>
287
288
<?php if((isset($default_settings['metaseo_showsocial']) && $default_settings['metaseo_showsocial'] == 1)): ?>
289
<li class="social">
290
- <a class="wpmseo_tablink" data-link="wpmseo_social"><?php _e( 'Social for search engine', 'wpms' ) ?></a>
291
</li>
292
<?php endif; ?>
293
<?php do_action('wpmseo_tab_header'); ?>
@@ -300,7 +300,7 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
300
}
301
unset($key, $meta_field);
302
}
303
- $this->do_tab('general', __('General', 'wpms'), $content);
304
305
$content = '';
306
foreach ( $this->get_meta_field_defs( 'social' ) as $meta_key => $meta_field ) {
@@ -341,14 +341,14 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
341
}
342
343
if($test || (!empty($meta_analysis) && !empty($meta_analysis['heading_title']))){
344
- $output = $this->metaseo_create_field('heading_title',$tooltip_page['title_in_heading'],'dashicons-yes',__('Page title word in content heading','wpms'),1);
345
$this->perc_score++;
346
}else{
347
- $output = $this->metaseo_create_field('heading_title',$tooltip_page['title_in_heading'],'icons-mwarning',__('Page title word in content heading','wpms'),0);
348
}
349
350
}else{
351
- $output = $this->metaseo_create_field('heading_title',$tooltip_page['title_in_heading'],'dashicons-yes',__('Page title word in content heading','wpms'),1);
352
$this->perc_score++;
353
}
354
return $output;
@@ -370,10 +370,10 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
370
}
371
372
if($test1 || (!empty($meta_analysis) && !empty($meta_analysis['content_title']))){
373
- $output = $this->metaseo_create_field('content_title',$tooltip_page['title_in_content'],'dashicons-yes',__('Page title word in content','wpms'),1);
374
$this->perc_score++;
375
}else{
376
- $output = $this->metaseo_create_field('content_title',$tooltip_page['title_in_content'],'icons-mwarning',__('Page title word in content','wpms'),0);
377
}
378
379
return $output;
@@ -384,10 +384,10 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
384
$info = pathinfo($pageurl);
385
386
if($info['filename'] == sanitize_title($post->post_title) || (!empty($meta_analysis) && !empty($meta_analysis['pageurl']))){
387
- $output = $this->metaseo_create_field('pageurl',$tooltip_page['page_url'],'dashicons-yes',__('Page url matches with page title','wpms'),1);
388
$this->perc_score++;
389
}else{
390
- $output = $this->metaseo_create_field('pageurl',$tooltip_page['page_url'],'icons-mwarning',__('Page url matches with page title','wpms'),0);
391
}
392
393
return $output;
@@ -395,27 +395,27 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
395
396
function metaseo_check_metatitle($meta_title,$tooltip_page,$meta_analysis){
397
if(($meta_title != '' && strlen($meta_title) <= self::$meta_title_length) || (!empty($meta_analysis) && !empty($meta_analysis['metatitle'])) ){
398
- $output = $this->metaseo_create_field('metatitle',$tooltip_page['meta_title'],'dashicons-yes',__('Meta title filled','wpms'),1);
399
$this->perc_score++;
400
}else{
401
- $output = $this->metaseo_create_field('metatitle',$tooltip_page['meta_title'],'icons-mwarning',__('Meta title filled','wpms'),0);
402
}
403
return $output;
404
}
405
406
function metaseo_check_metadesc($meta_desc,$tooltip_page,$meta_analysis){
407
if(($meta_desc != '' && strlen($meta_desc) <= self::$meta_length) || (!empty($meta_analysis) && !empty($meta_analysis['metadesc'])) ){
408
- $output = $this->metaseo_create_field('metadesc',$tooltip_page['meta_desc'],'dashicons-yes',__('Meta description filled','wpms'),1);
409
$this->perc_score++;
410
}else{
411
- $output = $this->metaseo_create_field('metadesc',$tooltip_page['meta_desc'],'icons-mwarning',__('Meta description filled','wpms'),0);
412
}
413
return $output;
414
}
415
416
function metaseo_check_imageresize($content,$tooltip_page,$meta_analysis){
417
if($content == '') {
418
- $output = $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'dashicons-yes',__('Wrong image resize','wpms'),1);
419
$this->perc_score++;
420
return $output;
421
}
@@ -439,21 +439,21 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
439
}
440
441
if($img_wrong == false || (!empty($meta_analysis) && !empty($meta_analysis['imgresize']))){
442
- $output = $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'dashicons-yes',__('Wrong image resize','wpms'),1);
443
$this->perc_score++;
444
}else{
445
- $output = $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'icons-mwarning',__('Wrong image resize','wpms'),0);
446
}
447
448
}else{
449
- $output = $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'icons-mwarning',__('Wrong image resize','wpms'),0);
450
}
451
return $output;
452
}
453
454
function metaseo_check_imagealt($content,$tooltip_page,$meta_analysis){
455
if($content == '') {
456
- $output = $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'dashicons-yes',__('Image have meta title or alt','wpms'),1);
457
$this->perc_score++;
458
return $output;
459
}
@@ -472,27 +472,27 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
472
}
473
474
if($img_wrong == false || (!empty($meta_analysis) && !empty($meta_analysis['imgalt']))){
475
- $output = $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'dashicons-yes',__('Image have meta title or alt','wpms'),1);
476
$this->perc_score++;
477
}else{
478
- $output = $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'icons-mwarning',__('Image have meta title or alt','wpms'),0);
479
}
480
481
}else{
482
- $output = $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'icons-mwarning',__('Image have meta title or alt','wpms'),0);
483
}
484
return $output;
485
}
486
487
function metaseo_page_analysis($post) {
488
$tooltip_page = array();
489
- $tooltip_page['title_in_heading'] = __('Check if a word of this content title is also in a title heading (h1, h2...)','wpms');
490
- $tooltip_page['title_in_content'] = __('Check if a word of this content title is also in the text','wpms');
491
- $tooltip_page['page_url'] = __('Does the page title match with the permalink (URL structure)','wpms');
492
- $tooltip_page['meta_title'] = __('Is the meta title of this page filled?','wpms');
493
- $tooltip_page['meta_desc'] = __('Is the meta description of this page filled?','wpms');
494
- $tooltip_page['image_resize'] = __('Check for image HTML resizing in content (usually image resized using handles)','wpms');
495
- $tooltip_page['image_alt'] = __('Check for image Alt text and title','wpms');
496
497
$meta_title = get_post_meta($post->ID, '_metaseo_metatitle', true);
498
$meta_desc = get_post_meta($post->ID, '_metaseo_metadesc', true);
@@ -539,7 +539,7 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
539
?>
540
<div class="wpmseotab <?php echo esc_attr($id) ?>">
541
<?php if($id == 'general'): ?>
542
- <p class="reload_analysis"><span class="spinner" style="float: left;"></span><input type="button" name="reload_analysis" id="reload_analysis" class="button button-primary" value="<?php _e('Reload analysis','wpms'); ?>"></p>
543
<?php endif; ?>
544
<table class="form-table">
545
<?php echo $content ?>
@@ -655,7 +655,7 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
655
656
case 'upload':
657
$content .= '<input id="' . $esc_form_key . '" type="text" size="36" class="' . $class . '" name="' . $esc_form_key . '" value="' . esc_attr($meta_value) . '" />';
658
- $content .= '<input id="' . $esc_form_key . '_button" class="wpmseo_image_upload_button button" type="button" value="'.__('Upload Image','wpms').'" />';
659
break;
660
}
661
54
}
55
56
public static function translate_meta_boxes() {
57
+ self::$meta_fields['general']['snippetpreview']['title'] = __('Results preview', 'wp-meta-seo');
58
+ self::$meta_fields['general']['snippetpreview']['help'] = sprintf(__('This is a preview of what your content will looks like in search engine results: title, description and URL', 'wp-meta-seo'), '<a target="_blank" href="https://www.joomunited.com/wordpress-products/wpms">', '</a>');
59
60
+ self::$meta_fields['general']['title']['title'] = __('Search engine title', 'wp-meta-seo');
61
self::$meta_fields['general']['title']['description'] = sprintf(__('<span id="metaseo_wpmseo_title-length">%s</span>'),self::$meta_length_reason);
62
+ self::$meta_fields['general']['title']['help'] = __('This is the title of your content that may be displayed in search engine results (meta title). By default it’s the content title (page title, post title…). 69 characters max allowed.', 'wp-meta-seo');
63
64
$settings = get_option( '_metaseo_settings' );
65
if(isset($settings['metaseo_showkeywords']) && $settings['metaseo_showkeywords'] == 1){
66
+ self::$meta_fields['general']['keywords']['title'] = __('Search engine keywords', 'wp-meta-seo');
67
self::$meta_fields['general']['keywords']['description'] = '<span id="metaseo_wpmseo_keywords-length"></span>';
68
+ self::$meta_fields['general']['keywords']['help'] = __('This is the keywords of your content that may be displayed in search engine results (meta keywords).', 'wp-meta-seo');
69
}else{
70
unset(self::$meta_fields['general']['keywords']);
71
}
72
73
74
+ self::$meta_fields['general']['desc']['title'] = __('Search engine description', 'wp-meta-seo');
75
self::$meta_fields['general']['desc']['description'] = sprintf(__('<span id="metaseo_wpmseo_desc-length">%s</span>'),self::$meta_length_reason);
76
+ self::$meta_fields['general']['desc']['help'] = __('The description of your content that may be displayed in search engine results aka meta description. By default search engine take an excerpt from your content (depending on the search query). 156 characters max allowed.', 'wp-meta-seo');
77
78
+ self::$meta_fields['social']['opengraph-title']['title'] = __('Facebook Title','wp-meta-seo');
79
+ self::$meta_fields['social']['opengraph-title']['description'] = __('Custom title to display when sharing this content on facebook, content title override','wp-meta-seo');
80
81
+ self::$meta_fields['social']['opengraph-desc']['title'] = __('Facebook Description','wp-meta-seo');
82
+ self::$meta_fields['social']['opengraph-desc']['description'] = __('Custom description to display when sharing this content on facebook, content description override','wp-meta-seo');
83
84
+ self::$meta_fields['social']['opengraph-image']['title'] = __('Facebook Image','wp-meta-seo');
85
+ self::$meta_fields['social']['opengraph-image']['description'] = __('Custom image to display when sharing this content on facebook, content description override, recommended size is 1200px x 630px','wp-meta-seo');
86
87
+ self::$meta_fields['social']['twitter-title']['title'] = __('Twitter Title','wp-meta-seo');
88
+ self::$meta_fields['social']['twitter-title']['description'] = __('Custom title to display when sharing this content on twitter, content title override','wp-meta-seo');
89
90
+ self::$meta_fields['social']['twitter-desc']['title'] = __('Twitter Description','wp-meta-seo');
91
+ self::$meta_fields['social']['twitter-desc']['description'] = __('Custom description to display when sharing this content on twitter, content description override','wp-meta-seo');
92
93
+ self::$meta_fields['social']['twitter-image']['title'] = __('Twitter Image','wp-meta-seo');
94
+ self::$meta_fields['social']['twitter-image']['description'] = __('Custom image to display when sharing this content on facebook, content description override, recommended min size 440px X 220px','wp-meta-seo');
95
96
do_action('wpmseo_tab_translate');
97
}
148
}
149
150
return array(
151
+ 'choose_image' => __( 'Use Image', 'wp-meta-seo' ),
152
'use_validate' => $this->settings['metaseo_seovalidate']
153
);
154
}
167
$date = $this->get_post_date($post);
168
169
self::$meta_length = ( self::$meta_length - ( strlen($date) + 5 ) );
170
+ self::$meta_length_reason = __(' (because of date display)', 'wp-meta-seo');
171
}
172
173
self::$meta_length_reason = apply_filters('wpmseo_desc_length_reason', self::$meta_length_reason, $post);
208
$cached_replacement_vars['sitename'] = get_option('blogname');
209
$array_keyword = array(
210
'field_prefix' => self::$form_prefix,
211
+ 'choose_image' => __('Use Image', 'wp-meta-seo'),
212
'wpmseo_meta_desc_length' => self::$meta_length,
213
'wpmseo_meta_title_length' => self::$meta_title_length,
214
'wpmseo_meta_keywords_length' => self::$meta_keywords_length,
217
'wpmseo_permalink_template' => $sample_permalink,
218
'wpmseo_keyword_suggest_nonce' => wp_create_nonce('wpmseo-get-suggest'),
219
'wpmseo_replace_vars_nonce' => wp_create_nonce('wpmseo-replace-vars'),
220
+ 'no_parent_text' => __('(no parent)', 'wp-meta-seo'),
221
'show_keywords' => 0
222
);
223
$settings = get_option( '_metaseo_settings' );
253
if (is_array($post_types) && $post_types !== array()) {
254
foreach ($post_types as $post_type) {
255
if ($this->is_metabox_hidden($post_type) === false) {
256
+ add_meta_box('wpmseo_meta', __('WP Meta SEO - Page optimization','wp-meta-seo'), array(
257
$this,
258
'meta_box',
259
), $post_type, 'normal', apply_filters('wpmseo_metabox_prio', 'high'));
282
<div class="wpmseo-metabox-tabs-div">
283
<ul class="wpmseo-metabox-tabs" id="wpmseo-metabox-tabs">
284
<li class="general">
285
+ <a class="wpmseo_tablink" data-link="wpmseo_general"><?php _e('SEO Page optimization', 'wp-meta-seo'); ?></a>
286
</li>
287
288
<?php if((isset($default_settings['metaseo_showsocial']) && $default_settings['metaseo_showsocial'] == 1)): ?>
289
<li class="social">
290
+ <a class="wpmseo_tablink" data-link="wpmseo_social"><?php _e( 'Social for search engine', 'wp-meta-seo' ) ?></a>
291
</li>
292
<?php endif; ?>
293
<?php do_action('wpmseo_tab_header'); ?>
300
}
301
unset($key, $meta_field);
302
}
303
+ $this->do_tab('general', __('General', 'wp-meta-seo'), $content);
304
305
$content = '';
306
foreach ( $this->get_meta_field_defs( 'social' ) as $meta_key => $meta_field ) {
341
}
342
343
if($test || (!empty($meta_analysis) && !empty($meta_analysis['heading_title']))){
344
+ $output = $this->metaseo_create_field('heading_title',$tooltip_page['title_in_heading'],'dashicons-yes',__('Page title word in content heading','wp-meta-seo'),1);
345
$this->perc_score++;
346
}else{
347
+ $output = $this->metaseo_create_field('heading_title',$tooltip_page['title_in_heading'],'icons-mwarning',__('Page title word in content heading','wp-meta-seo'),0);
348
}
349
350
}else{
351
+ $output = $this->metaseo_create_field('heading_title',$tooltip_page['title_in_heading'],'dashicons-yes',__('Page title word in content heading','wp-meta-seo'),1);
352
$this->perc_score++;
353
}
354
return $output;
370
}
371
372
if($test1 || (!empty($meta_analysis) && !empty($meta_analysis['content_title']))){
373
+ $output = $this->metaseo_create_field('content_title',$tooltip_page['title_in_content'],'dashicons-yes',__('Page title word in content','wp-meta-seo'),1);
374
$this->perc_score++;
375
}else{
376
+ $output = $this->metaseo_create_field('content_title',$tooltip_page['title_in_content'],'icons-mwarning',__('Page title word in content','wp-meta-seo'),0);
377
}
378
379
return $output;
384
$info = pathinfo($pageurl);
385
386
if($info['filename'] == sanitize_title($post->post_title) || (!empty($meta_analysis) && !empty($meta_analysis['pageurl']))){
387
+ $output = $this->metaseo_create_field('pageurl',$tooltip_page['page_url'],'dashicons-yes',__('Page url matches with page title','wp-meta-seo'),1);
388
$this->perc_score++;
389
}else{
390
+ $output = $this->metaseo_create_field('pageurl',$tooltip_page['page_url'],'icons-mwarning',__('Page url matches with page title','wp-meta-seo'),0);
391
}
392
393
return $output;
395
396
function metaseo_check_metatitle($meta_title,$tooltip_page,$meta_analysis){
397
if(($meta_title != '' && strlen($meta_title) <= self::$meta_title_length) || (!empty($meta_analysis) && !empty($meta_analysis['metatitle'])) ){
398
+ $output = $this->metaseo_create_field('metatitle',$tooltip_page['meta_title'],'dashicons-yes',__('Meta title filled','wp-meta-seo'),1);
399
$this->perc_score++;
400
}else{
401
+ $output = $this->metaseo_create_field('metatitle',$tooltip_page['meta_title'],'icons-mwarning',__('Meta title filled','wp-meta-seo'),0);
402
}
403
return $output;
404
}
405
406
function metaseo_check_metadesc($meta_desc,$tooltip_page,$meta_analysis){
407
if(($meta_desc != '' && strlen($meta_desc) <= self::$meta_length) || (!empty($meta_analysis) && !empty($meta_analysis['metadesc'])) ){
408
+ $output = $this->metaseo_create_field('metadesc',$tooltip_page['meta_desc'],'dashicons-yes',__('Meta description filled','wp-meta-seo'),1);
409
$this->perc_score++;
410
}else{
411
+ $output = $this->metaseo_create_field('metadesc',$tooltip_page['meta_desc'],'icons-mwarning',__('Meta description filled','wp-meta-seo'),0);
412
}
413
return $output;
414
}
415
416
function metaseo_check_imageresize($content,$tooltip_page,$meta_analysis){
417
if($content == '') {
418
+ $output = $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'dashicons-yes',__('Wrong image resize','wp-meta-seo'),1);
419
$this->perc_score++;
420
return $output;
421
}
439
}
440
441
if($img_wrong == false || (!empty($meta_analysis) && !empty($meta_analysis['imgresize']))){
442
+ $output = $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'dashicons-yes',__('Wrong image resize','wp-meta-seo'),1);
443
$this->perc_score++;
444
}else{
445
+ $output = $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'icons-mwarning',__('Wrong image resize','wp-meta-seo'),0);
446
}
447
448
}else{
449
+ $output = $this->metaseo_create_field('imgresize',$tooltip_page['image_resize'],'icons-mwarning',__('Wrong image resize','wp-meta-seo'),0);
450
}
451
return $output;
452
}
453
454
function metaseo_check_imagealt($content,$tooltip_page,$meta_analysis){
455
if($content == '') {
456
+ $output = $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'dashicons-yes',__('Image have meta title or alt','wp-meta-seo'),1);
457
$this->perc_score++;
458
return $output;
459
}
472
}
473
474
if($img_wrong == false || (!empty($meta_analysis) && !empty($meta_analysis['imgalt']))){
475
+ $output = $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'dashicons-yes',__('Image have meta title or alt','wp-meta-seo'),1);
476
$this->perc_score++;
477
}else{
478
+ $output = $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'icons-mwarning',__('Image have meta title or alt','wp-meta-seo'),0);
479
}
480
481
}else{
482
+ $output = $this->metaseo_create_field('imgalt',$tooltip_page['image_alt'],'icons-mwarning',__('Image have meta title or alt','wp-meta-seo'),0);
483
}
484
return $output;
485
}
486
487
function metaseo_page_analysis($post) {
488
$tooltip_page = array();
489
+ $tooltip_page['title_in_heading'] = __('Check if a word of this content title is also in a title heading (h1, h2...)','wp-meta-seo');
490
+ $tooltip_page['title_in_content'] = __('Check if a word of this content title is also in the text','wp-meta-seo');
491
+ $tooltip_page['page_url'] = __('Does the page title match with the permalink (URL structure)','wp-meta-seo');
492
+ $tooltip_page['meta_title'] = __('Is the meta title of this page filled?','wp-meta-seo');
493
+ $tooltip_page['meta_desc'] = __('Is the meta description of this page filled?','wp-meta-seo');
494
+ $tooltip_page['image_resize'] = __('Check for image HTML resizing in content (usually image resized using handles)','wp-meta-seo');
495
+ $tooltip_page['image_alt'] = __('Check for image Alt text and title','wp-meta-seo');
496
497
$meta_title = get_post_meta($post->ID, '_metaseo_metatitle', true);
498
$meta_desc = get_post_meta($post->ID, '_metaseo_metadesc', true);
539