All in One SEO Pack - Version 3.2.7

Version Description

Download this release

Release Info

Developer hallsofmontezuma
Plugin Icon 128x128 All in One SEO Pack
Version 3.2.7
Comparing to
See all releases

Code changes from version 3.2.3 to 3.2.7

aioseop_class.php CHANGED
@@ -217,7 +217,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
217
  $this->do_log = false;
218
  }
219
  /* translators: This is a header for the General Settings menu. %s is a placeholder and is replaced with the name of the plugin. */
220
- $this->name = sprintf( __( '%s Plugin Options', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME );
221
  /* translators: This is the main menu of the plugin. */
222
  $this->menu_name = __( 'General Settings', 'all-in-one-seo-pack' );
223
 
@@ -231,12 +231,12 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
231
  $this->default_options = array(
232
  'license_key' => array(
233
  /* translators: This is a setting where users can enter their license code for All in One SEO Pack Pro. */
234
- 'name' => __( 'License Key:', 'all-in-one-seo-pack' ),
235
  'type' => 'text',
236
  ),
237
  'home_title' => array(
238
  /* translators: This is a setting where users can enter the title for their homepage. */
239
- 'name' => __( 'Home Title:', 'all-in-one-seo-pack' ),
240
  'default' => null,
241
  'type' => 'text',
242
  'sanitize' => 'text',
@@ -247,7 +247,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
247
  ),
248
  'home_description' => array(
249
  /* translators: This is a setting where users can enter the description for their homepage. */
250
- 'name' => __( 'Home Description:', 'all-in-one-seo-pack' ),
251
  'default' => '',
252
  'type' => 'textarea',
253
  'sanitize' => 'text',
@@ -258,7 +258,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
258
  ),
259
  'togglekeywords' => array(
260
  /* translators: This is a setting where users can enable the use of meta keywords for their website. */
261
- 'name' => __( 'Use Keywords:', 'all-in-one-seo-pack' ),
262
  'default' => 1,
263
  'type' => 'radio',
264
  'initial_options' => array(
@@ -270,7 +270,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
270
  ),
271
  'home_keywords' => array(
272
  /* translators: This is a setting where users can enter meta keywords for their homepage. */
273
- 'name' => __( 'Home Keywords (comma separated):', 'all-in-one-seo-pack' ),
274
  'default' => null,
275
  'type' => 'textarea',
276
  'sanitize' => 'text',
@@ -291,18 +291,18 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
291
  ),
292
  'can' => array(
293
  /* translators: This is the name of a setting. Canonical URLs help users prevent duplicate content issues - https://en.wikipedia.org/wiki/Canonical_link_element. Leave "Canonical" in English if there is no such term in your language. */
294
- 'name' => __( 'Canonical URLs:', 'all-in-one-seo-pack' ),
295
  'default' => 1,
296
  ),
297
  'no_paged_canonical_links' => array(
298
  /* translators: This is the name of a setting. Canonical URLs help users prevent duplicate content issues - https://en.wikipedia.org/wiki/Canonical_link_element. Leave "Canonical" in English if there is no such term in your language. Enabling this setting means the plugin will use the URL of the first page as the canonical URL for all subsequent paginated pages. */
299
- 'name' => __( 'No Pagination for Canonical URLs:', 'all-in-one-seo-pack' ),
300
  'default' => 0,
301
  'condshow' => array( 'aiosp_can' => 'on' ),
302
  ),
303
  'force_rewrites' => array(
304
  /* translators: This is the name of a setting. Enabling this option forces the plugin to use output buffering to ensure that the title tag will be rewritten. */
305
- 'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
306
  'default' => 1,
307
  'type' => 'hidden',
308
  'prefix' => $this->prefix,
@@ -313,7 +313,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
313
  ),
314
  'use_original_title' => array(
315
  /* translators: This is the name of a setting. Enabling this option forces the plugin to use the wp_title() function to fetch the title tag. */
316
- 'name' => __( 'Use Original Title:', 'all-in-one-seo-pack' ),
317
  'type' => 'radio',
318
  'default' => 0,
319
  'initial_options' => array(
@@ -323,56 +323,56 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
323
  ),
324
  'home_page_title_format' => array(
325
  /* translators: This is a setting where users can enter the title format for the homepage. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
326
- 'name' => __( 'Home Page Title Format:', 'all-in-one-seo-pack' ),
327
  'type' => 'text',
328
  'default' => '%page_title%',
329
  ),
330
  'page_title_format' => array(
331
 
332
  /* translators: This is a setting where users can enter the title format for Pages. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
333
- 'name' => __( 'Page Title Format:', 'all-in-one-seo-pack' ),
334
  'type' => 'text',
335
  'default' => '%page_title% | %site_title%',
336
  ),
337
  'post_title_format' => array(
338
  /* translators: This is a setting where users can enter the title format for Posts. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
339
- 'name' => __( 'Post Title Format:', 'all-in-one-seo-pack' ),
340
  'type' => 'text',
341
  'default' => '%post_title% | %site_title%',
342
  ),
343
  'category_title_format' => array(
344
  /* translators: This is a setting where users can enter the title format for categories. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
345
- 'name' => __( 'Category Title Format:', 'all-in-one-seo-pack' ),
346
  'type' => 'text',
347
  'default' => '%category_title% | %site_title%',
348
  ),
349
  'archive_title_format' => array(
350
  /* translators: This is a setting where users can enter the title format for archive pages. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
351
- 'name' => __( 'Archive Title Format:', 'all-in-one-seo-pack' ),
352
  'type' => 'text',
353
  'default' => '%archive_title% | %site_title%',
354
  ),
355
  'date_title_format' => array(
356
  /* translators: This is a setting where users can enter the title format for date archive pages. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
357
- 'name' => __( 'Date Archive Title Format:', 'all-in-one-seo-pack' ),
358
  'type' => 'text',
359
  'default' => '%date% | %site_title%',
360
  ),
361
  'author_title_format' => array(
362
  /* translators: This is a setting where users can enter the title format for author archive pages. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
363
- 'name' => __( 'Author Archive Title Format:', 'all-in-one-seo-pack' ),
364
  'type' => 'text',
365
  'default' => '%author% | %site_title%',
366
  ),
367
  'tag_title_format' => array(
368
  /* translators: This is a setting where users can enter the title format for tag archive pages. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
369
- 'name' => __( 'Tag Title Format:', 'all-in-one-seo-pack' ),
370
  'type' => 'text',
371
  'default' => '%tag% | %site_title%',
372
  ),
373
  'search_title_format' => array(
374
  /* translators: This is a setting where users can enter the title format for the search page. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
375
- 'name' => __( 'Search Title Format:', 'all-in-one-seo-pack' ),
376
  'type' => 'text',
377
  'default' => '%search% | %site_title%',
378
  ),
@@ -384,82 +384,82 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
384
  ),
385
  '404_title_format' => array(
386
  /* translators: This is a setting where users can enter the title format for the 404 page. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
387
- 'name' => __( '404 Title Format:', 'all-in-one-seo-pack' ),
388
  'type' => 'text',
389
  'default' => __( 'Nothing found for %request_words%', 'all-in-one-seo-pack' ),
390
  ),
391
  'paged_format' => array(
392
  /* translators: This is a setting where users can enter the title format for paginated pages. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
393
- 'name' => __( 'Paged Format:', 'all-in-one-seo-pack' ),
394
  'type' => 'text',
395
  'default' => sprintf( ' - %s %%page%%', __( 'Part', 'all-in-one-seo-pack' ) ),
396
  ),
397
  'cpostactive' => array(
398
  /* translators: This is a setting where users can indicate which post types they want to use All in One SEO Pack with. */
399
- 'name' => __( 'SEO on only these Content Types:', 'all-in-one-seo-pack' ),
400
  'type' => 'multicheckbox',
401
  'default' => array( 'post', 'page' ),
402
  ),
403
  'taxactive' => array(
404
  /* translators: This is a setting where users can indicate which taxonomies they want to use All in One SEO Pack with. */
405
- 'name' => __( 'SEO on only these taxonomies:', 'all-in-one-seo-pack' ),
406
  'type' => 'multicheckbox',
407
  'default' => array( 'category', 'post_tag' ),
408
  ),
409
  'cpostnoindex' => array(
410
  /* translators: This is a setting where users can indicate which post types they want to NOINDEX by default. NOINDEX is a value of the HTML robots meta tag that asks search engines not to index the page. */
411
- 'name' => __( 'Default to NOINDEX:', 'all-in-one-seo-pack' ),
412
  'type' => 'multicheckbox',
413
  'default' => array(),
414
  ),
415
  'cpostnofollow' => array(
416
  /* translators: This is a setting where users can indicate which post types they want to NOFOLLOW by default. NOFOLLOW is a value of the HTML robots meta tag that asks search engines not to follow any links on the page. */
417
- 'name' => __( 'Default to NOFOLLOW:', 'all-in-one-seo-pack' ),
418
  'type' => 'multicheckbox',
419
  'default' => array(),
420
  ),
421
  'posttypecolumns' => array(
422
  /* translators: This is a setting where users can indicate for which post types they want to enable columns. Columns are added to the All Posts, All Pages, etc. list pages and allow users to quick-edit their title and description - https://semperplugins.com/documentation/display-settings/#show-column-labels-for-custom-post-types. */
423
- 'name' => __( 'Show Column Labels for Custom Post Types:', 'all-in-one-seo-pack' ),
424
  'type' => 'multicheckbox',
425
  'default' => array( 'post', 'page' ),
426
  ),
427
  'google_verify' => array(
428
- 'name' => 'Google Search Console:',
429
  'default' => '',
430
  'type' => 'text',
431
  ),
432
  'bing_verify' => array(
433
- 'name' => 'Bing Webmaster Tools:',
434
  'default' => '',
435
  'type' => 'text',
436
  ),
437
  'pinterest_verify' => array(
438
  /* translators: This is a setting where users can add their Pinterest website verification code. */
439
- 'name' => __( 'Pinterest Site Verification:', 'all-in-one-seo-pack' ),
440
  'default' => '',
441
  'type' => 'text',
442
  ),
443
  'yandex_verify' => array(
444
- 'name' => 'Yandex Webmaster Tools:',
445
  'default' => '',
446
  'type' => 'text',
447
  ),
448
  'baidu_verify' => array(
449
- 'name' => 'Baidu Webmaster Tools:',
450
  'default' => '',
451
  'type' => 'text',
452
  ),
453
  'google_analytics_id' => array(
454
  /* translators: This is a setting where users can add their Google Analytics verification code. Leave this in English if there is no translation for "Google Analytics". */
455
- 'name' => __( 'Google Analytics ID:', 'all-in-one-seo-pack' ),
456
  'default' => null,
457
  'type' => 'text',
458
  'placeholder' => 'UA-########-#',
459
  ),
460
  'ga_advanced_options' => array(
461
  /* translators: This is a setting users can enable to display more advanced options for Google Analytics. */
462
- 'name' => __( 'Advanced Analytics Options:', 'all-in-one-seo-pack' ),
463
  'default' => 'on',
464
  'type' => 'radio',
465
  'initial_options' => array(
@@ -476,7 +476,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
476
  ),
477
  'ga_domain' => array(
478
  /* translators: This is a setting which allows users to set the cookie domain for their Google Analytics tracking code. */
479
- 'name' => __( 'Tracking Domain:', 'all-in-one-seo-pack' ),
480
  'type' => 'text',
481
  'condshow' => array(
482
  'aiosp_google_analytics_id' => array(
@@ -489,7 +489,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
489
  ),
490
  'ga_multi_domain' => array(
491
  /* translators: This is a setting which allows users to enable Google Analytics tracking for multiple domain names. */
492
- 'name' => __( 'Track Multiple Domains:', 'all-in-one-seo-pack' ),
493
  'default' => 0,
494
  'condshow' => array(
495
  'aiosp_google_analytics_id' => array(
@@ -502,7 +502,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
502
  ),
503
  'ga_addl_domains' => array(
504
  /* translators: This is a setting which allows users to enter additional domain names used for Google Analytics cross-domain tracking - https://support.google.com/analytics/answer/1034342?hl=en.*/
505
- 'name' => __( 'Additional Domains:', 'all-in-one-seo-pack' ),
506
  'type' => 'textarea',
507
  'condshow' => array(
508
  'aiosp_google_analytics_id' => array(
@@ -516,7 +516,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
516
  ),
517
  'ga_anonymize_ip' => array(
518
  /* translators: This is a setting which tells Google Analytics not to track and store the IP addresses of website visitors. This is required to be compliant with the GDPR for example. */
519
- 'name' => __( 'Anonymize IP Addresses:', 'all-in-one-seo-pack' ),
520
  'type' => 'checkbox',
521
  'condshow' => array(
522
  'aiosp_google_analytics_id' => array(
@@ -529,7 +529,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
529
  ),
530
  'ga_display_advertising' => array(
531
  /* translators: This is a setting that enables a collection of Google Analytics features so you can, for example, create segments based on demographic and interest data. */
532
- 'name' => __( 'Display Advertiser Tracking:', 'all-in-one-seo-pack' ),
533
  'type' => 'checkbox',
534
  'condshow' => array(
535
  'aiosp_google_analytics_id' => array(
@@ -542,7 +542,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
542
  ),
543
  'ga_exclude_users' => array(
544
  /* translators: This is a setting that allows you to exclude certain WordPress user roles, e.g. Administrators, from Google Analytics tracking. */
545
- 'name' => __( 'Exclude Users From Tracking:', 'all-in-one-seo-pack' ),
546
  'type' => 'multicheckbox',
547
  'condshow' => array(
548
  'aiosp_google_analytics_id' => array(
@@ -555,7 +555,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
555
  ),
556
  'ga_track_outbound_links' => array(
557
  /* translators: This is a setting that enables tracking of outbound/external links by Google Analytics. */
558
- 'name' => __( 'Track Outbound Links:', 'all-in-one-seo-pack' ),
559
  'default' => 0,
560
  'condshow' => array(
561
  'aiosp_google_analytics_id' => array(
@@ -568,7 +568,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
568
  ),
569
  'ga_link_attribution' => array(
570
  /* translators: This is a setting for Google Analytics that allows you to tag your pages to implement enhanced link-tracking. */
571
- 'name' => __( 'Enhanced Link Attribution:', 'all-in-one-seo-pack' ),
572
  'default' => 0,
573
  'condshow' => array(
574
  'aiosp_google_analytics_id' => array(
@@ -581,7 +581,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
581
  ),
582
  'ga_enhanced_ecommerce' => array(
583
  /* translators: This is a setting which tells Google Analytics to track your customers' path to purchase on your e-commerce website. */
584
- 'name' => __( 'Enhanced Ecommerce:', 'all-in-one-seo-pack' ),
585
  'default' => 0,
586
  'condshow' => array(
587
  'aiosp_google_analytics_id' => array(
@@ -596,7 +596,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
596
  /* translators: This is a setting that outputs basic Schema.org markup, also known as structured data, into the source code of each page. */
597
  'name' => __( 'Use Schema.org Markup', 'all-in-one-seo-pack' ),
598
  'type' => 'radio',
599
- 'default' => 0,
600
  'initial_options' => array(
601
  1 => __( 'Enabled', 'all-in-one-seo-pack' ),
602
  0 => __( 'Disabled', 'all-in-one-seo-pack' ),
@@ -605,13 +605,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
605
  // TODO Change `schema_search_results_page` to `schema_add_search_results_page`. Requires modifying double arrow alignment.
606
  'schema_search_results_page' => array(
607
  /* translators: This is a setting users can enable to add the basic markup code to their source code that is needed for Google to generate a Sitelinks Search Box - https://developers.google.com/search/docs/data-types/sitelinks-searchbox.*/
608
- 'name' => __( 'Display Sitelinks Search Box:', 'all-in-one-seo-pack' ),
609
  'condshow' => array(
610
  'aiosp_schema_markup' => 1,
611
  ),
612
  ),
613
  'schema_social_profile_links' => array(
614
- 'name' => __( 'Social Profile Links:', 'all-in-one-seo-pack' ),
615
  'type' => 'textarea',
616
  'cols' => 60,
617
  'rows' => 5,
@@ -620,7 +620,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
620
  ),
621
  ),
622
  'schema_site_represents' => array(
623
- 'name' => __( 'Person or Organization:', 'all-in-one-seo-pack' ),
624
  'type' => 'radio',
625
  'default' => 'organization',
626
  'initial_options' => array(
@@ -632,7 +632,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
632
  ),
633
  ),
634
  'schema_organization_name' => array(
635
- 'name' => __( 'Organization Name:', 'all-in-one-seo-pack' ),
636
  'type' => 'text',
637
  'default' => '',
638
  'condshow' => array(
@@ -641,7 +641,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
641
  ),
642
  ),
643
  'schema_organization_logo' => array(
644
- 'name' => __( 'Organization Logo:', 'all-in-one-seo-pack' ),
645
  'type' => 'image',
646
  'condshow' => array(
647
  'aiosp_schema_markup' => 1,
@@ -650,7 +650,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
650
  ),
651
 
652
  'schema_person_user' => array(
653
- 'name' => __( 'Person\'s Username:', 'all-in-one-seo-pack' ),
654
  'type' => 'select',
655
  'default' => 1,
656
  'condshow' => array(
@@ -660,7 +660,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
660
  // Add initial options below.
661
  ),
662
  'schema_phone_number' => array(
663
- 'name' => __( 'Phone Number:', 'all-in-one-seo-pack' ),
664
  'type' => 'tel',
665
  'autocomplete' => 'off',
666
  'condshow' => array(
@@ -669,7 +669,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
669
  ),
670
  ),
671
  'schema_contact_type' => array(
672
- 'name' => __( 'Type of Contact:', 'all-in-one-seo-pack' ),
673
  'type' => 'select',
674
  'condshow' => array(
675
  'aiosp_schema_markup' => 1,
@@ -692,142 +692,142 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
692
  ),
693
  'use_categories' => array(
694
  /* translators: This is the name of a setting. By enabling it, the plugin will use the categories of the relevant post as meta keywords in addition to any user-specified keywords. */
695
- 'name' => __( 'Use Categories for META keywords:', 'all-in-one-seo-pack' ),
696
  'default' => 0,
697
  'condshow' => array( 'aiosp_togglekeywords' => 0 ),
698
  ),
699
  'use_tags_as_keywords' => array(
700
  /* translators: This is the name of a setting. By enabling it, the plugin will use the tags of the relevant post as meta keywords in addition to any user-specified keywords. */
701
- 'name' => __( 'Use Tags for META keywords:', 'all-in-one-seo-pack' ),
702
  'default' => 1,
703
  'condshow' => array( 'aiosp_togglekeywords' => 0 ),
704
  ),
705
  'dynamic_postspage_keywords' => array(
706
  /* translators: This a setting that allows you to dynamically output meta keywords on archive pages based on the keywords from the posts that are displayed by the archive page. */
707
- 'name' => __( 'Dynamically Generate Keywords for Posts Page/Archives:', 'all-in-one-seo-pack' ),
708
  'default' => 1,
709
  'condshow' => array( 'aiosp_togglekeywords' => 0 ),
710
  ),
711
  'category_noindex' => array(
712
  /* translators: This is a global setting that allows you to NOINDEX all your categories. */
713
- 'name' => __( 'Use noindex for Categories:', 'all-in-one-seo-pack' ),
714
  'default' => 1,
715
  ),
716
  'archive_date_noindex' => array(
717
  /* translators: This is a global setting that allows you to NOINDEX all your date archive pages. */
718
- 'name' => __( 'Use noindex for Date Archives:', 'all-in-one-seo-pack' ),
719
  'default' => 1,
720
  ),
721
  'archive_author_noindex' => array(
722
  /* translators: This is a global setting that allows you to NOINDEX all your author archive pages. */
723
- 'name' => __( 'Use noindex for Author Archives:', 'all-in-one-seo-pack' ),
724
  'default' => 1,
725
  ),
726
  'tags_noindex' => array(
727
  /* translators: This is a global setting that allows you to NOINDEX all your tag archive pages. */
728
- 'name' => __( 'Use noindex for Tag Archives:', 'all-in-one-seo-pack' ),
729
  'default' => 0,
730
  ),
731
  'search_noindex' => array(
732
  /* translators: This is a setting that allows you to NOINDEX your search results page. */
733
- 'name' => __( 'Use noindex for the Search page:', 'all-in-one-seo-pack' ),
734
  'default' => 0,
735
  ),
736
  '404_noindex' => array(
737
  /* translators: This is a setting that allows you to NOINDEX your 404 Not Found page. */
738
- 'name' => __( 'Use noindex for the 404 page:', 'all-in-one-seo-pack' ),
739
  'default' => 0,
740
  ),
741
  'tax_noindex' => array(
742
  /* translators: This is a global setting that allows you to NOINDEX specific taxonomies. */
743
- 'name' => __( 'Use noindex for Taxonomy Archives:', 'all-in-one-seo-pack' ),
744
  'type' => 'multicheckbox',
745
  'default' => array(),
746
  ),
747
  'paginated_noindex' => array(
748
  /* translators: This is a global setting that allows you to NOINDEX all your paginated content (page 2 and higher). */
749
- 'name' => __( 'Use noindex for paginated pages/posts:', 'all-in-one-seo-pack' ),
750
  'default' => 0,
751
  ),
752
  'paginated_nofollow' => array(
753
  /* translators: This is a global setting that allows you to NOFOLLOW all your paginated content. */
754
- 'name' => __( 'Use nofollow for paginated pages/posts:', 'all-in-one-seo-pack' ),
755
  'default' => 0,
756
  ),
757
  'generate_descriptions' => array(
758
  /* translators: This is a setting that allows the plugin to automatically populate the meta description tag based on the excerpt or content of the post/page.*/
759
- 'name' => __( 'Autogenerate Descriptions:', 'all-in-one-seo-pack' ),
760
  'default' => 0,
761
  ),
762
  'skip_excerpt' => array(
763
  /* translators: This is the name of a setting. By enabling it, the plugin will use the content of the post/page to automatically populate the meta description tag, instead of the excerpt. */
764
- 'name' => __( 'Use Content For Autogenerated Descriptions:', 'all-in-one-seo-pack' ),
765
  'default' => 0,
766
  'condshow' => array( 'aiosp_generate_descriptions' => 'on' ),
767
  ),
768
  'run_shortcodes' => array(
769
  /* translators: This is a setting that enables the plugin to execute shortcodes in the autogenerated descriptions. Shortcodes allow people to execute code inside WordPress posts, pages, and widgets without writing any code directly. */
770
- 'name' => __( 'Run Shortcodes In Autogenerated Descriptions:', 'all-in-one-seo-pack' ),
771
  'default' => 0,
772
  'condshow' => array( 'aiosp_generate_descriptions' => 'on' ),
773
  ),
774
  'hide_paginated_descriptions' => array(
775
  /* translators: This is a setting that, if enabled, removes the meta description for paginated content (page 2 and higher). */
776
- 'name' => __( 'Remove Descriptions For Paginated Pages:', 'all-in-one-seo-pack' ),
777
  'default' => 0,
778
  ),
779
  'dont_truncate_descriptions' => array(
780
  /* translators: This is a setting that makes sure the plugin does not truncate the meta description tag if it is longer than what All in One SEO Pack recommends. */
781
- 'name' => __( 'Never Shorten Long Descriptions:', 'all-in-one-seo-pack' ),
782
  'default' => 0,
783
  ),
784
  'unprotect_meta' => array(
785
  /* translators: This is a setting that allows users to unprotect internal postmeta fields for use with XML-RPC. */
786
- 'name' => __( 'Unprotect Post Meta Fields:', 'all-in-one-seo-pack' ),
787
  'default' => 0,
788
  ),
789
  'redirect_attachement_parent' => array(
790
  /* translators: This is the name of a setting. By enabling it, the plugin will redirect attachment page requests to the post parent, or in other words, the post/page where the media is embedded. */
791
- 'name' => __( 'Redirect Attachments to Post Parent:', 'all-in-one-seo-pack' ),
792
  'default' => 0,
793
  ),
794
  'ex_pages' => array(
795
  /* translators: This is a textarea setting where users can enter a list of pages that All in One SEO Pack should not affect. */
796
- 'name' => __( 'Exclude Pages:', 'all-in-one-seo-pack' ),
797
  'type' => 'textarea',
798
  'default' => '',
799
  ),
800
  'post_meta_tags' => array(
801
  /* translators: This is a setting that allows users to ouput additional code, such as references to stylesheets or JavaScript libraries, into the HEAD section of each post. */
802
- 'name' => __( 'Additional Post Headers:', 'all-in-one-seo-pack' ),
803
  'type' => 'textarea',
804
  'default' => '',
805
  'sanitize' => 'default',
806
  ),
807
  'page_meta_tags' => array(
808
  /* translators: This is a setting that allows users to ouput additional HTML tags, such as references to stylesheets or JavaScript libraries, into the HEAD section of each page. */
809
- 'name' => __( 'Additional Page Headers:', 'all-in-one-seo-pack' ),
810
  'type' => 'textarea',
811
  'default' => '',
812
  'sanitize' => 'default',
813
  ),
814
  'front_meta_tags' => array(
815
  /* translators: This is a setting that allows users to ouput additional HTML tags, such as references to stylesheets or JavaScript libraries, into the HEAD section of the frontpage/homepage. */
816
- 'name' => __( 'Additional Front Page Headers:', 'all-in-one-seo-pack' ),
817
  'type' => 'textarea',
818
  'default' => '',
819
  'sanitize' => 'default',
820
  ),
821
  'home_meta_tags' => array(
822
  /* translators: This is a setting that allows users to ouput additional HTML tags, such as references to stylesheets or JavaScript libraries, into the HEAD section of the static Posts page (see Settings > Reading). */
823
- 'name' => __( 'Additional Posts Page Headers:', 'all-in-one-seo-pack' ),
824
  'type' => 'textarea',
825
  'default' => '',
826
  'sanitize' => 'default',
827
  ),
828
  'do_log' => array(
829
  /* translators: This is a setting that enables All in One SEO Pack to log important events to help with debugging. */
830
- 'name' => __( 'Log important events:', 'all-in-one-seo-pack' ),
831
  'default' => null,
832
  ),
833
 
@@ -1004,7 +1004,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1004
  'options' => array( 'google_verify', 'bing_verify', 'pinterest_verify', 'yandex_verify', 'baidu_verify' ),
1005
  ),
1006
  'google' => array(
1007
- 'name' => __( 'Google Settings', 'all-in-one-seo-pack' ),
1008
  'help_link' => 'https://semperplugins.com/documentation/advanced-google-analytics-settings/',
1009
  'options' => array(
1010
  'google_analytics_id',
@@ -1090,7 +1090,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1090
  ),
1091
  'orderby' => 'nicename',
1092
  );
1093
- $users = get_users( $user_args );
1094
 
1095
  $this->default_options['schema_person_user']['initial_options'] = array();
1096
  foreach ( $users as $user ) {
@@ -1154,14 +1154,14 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1154
  $args['options']['nowrap'] = false;
1155
  $args['options']['save'] = false;
1156
  $info = $this->get_page_snippet_info();
1157
- $title = $info['title'];
1158
- $description = $info['description'];
1159
- $keywords = $info['keywords'];
1160
- $url = $info['url'];
1161
- $title_format = $info['title_format'];
1162
- $category = $info['category'];
1163
- $w = $info['w'];
1164
- $p = $info['p'];
1165
 
1166
  if ( $this->strlen( $title ) > 70 ) {
1167
  $title = $this->trim_excerpt_without_filters(
@@ -1182,8 +1182,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1182
  $title = $title_format;
1183
  }
1184
 
1185
- $args['value'] = sprintf( $args['value'], $title, esc_url( $url ), esc_attr( $description ) );
1186
- $buf = $this->get_option_row( $args['name'], $args['options'], $args );
1187
 
1188
  return $buf;
1189
  }
@@ -1230,7 +1230,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1230
  if ( false !== strpos( $title_format, '%blog_title%', 0 ) ) {
1231
  $title_format = str_replace( '%blog_title%', get_bloginfo( 'name' ), $title_format );
1232
  }
1233
- $title_format = $this->apply_cf_fields( $title_format );
1234
  if ( false !== strpos( $title_format, '%post_title%', 0 ) ) {
1235
  $title_format = str_replace( '%post_title%', $this->get_preview_snippet_title_helper( $title ), $title_format );
1236
  }
@@ -1362,9 +1362,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1362
  return $info;
1363
  }
1364
  global $post, $aioseop_options, $wp_query;
1365
- $title = $url = $description = $term = $category = '';
1366
- $p = $post;
1367
- $w = $wp_query;
 
 
 
 
1368
  if ( ! is_object( $post ) ) {
1369
  $post = $this->get_queried_object();
1370
  }
@@ -1396,9 +1400,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1396
  $this->is_front_page = false;
1397
  }
1398
  if ( 'page' === get_option( 'show_on_front' ) ) {
1399
- if ( is_page() && $post->ID == get_option( 'page_on_front' ) ) {
1400
  $this->is_front_page = true;
1401
- } elseif ( $post->ID == get_option( 'page_for_posts' ) ) {
1402
  $wp_query->is_home = true;
1403
  }
1404
  }
@@ -1460,7 +1464,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1460
  }
1461
  $description = $this->internationalize( $description );
1462
  }
1463
- if ( $this->is_front_page == true ) {
1464
  // $title_format = $aioseop_options['aiosp_home_page_title_format'];
1465
  $title_format = ''; // Not sure why this needs to be this way, but we should extract all this out to figure out what's going on.
1466
  }
@@ -1685,7 +1689,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1685
  if ( is_front_page() ) {
1686
  if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
1687
  global $post;
1688
- if ( get_option( 'show_on_front' ) == 'page' && is_page() && $post->ID == get_option( 'page_on_front' ) ) {
1689
  $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1690
  if ( ! $title ) {
1691
  $title = $this->internationalize( $post->post_title );
@@ -1712,34 +1716,36 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1712
  // #1616 - Avoid trying to get property of non-object when no posts are present on the homepage.
1713
  global $post;
1714
 
1715
- if ( $post === null ) {
1716
  $post_id = get_option( 'page_on_front' );
1717
  } else {
1718
  $post_id = $post->ID;
1719
  }
1720
 
1721
- if ( is_post_type_archive() && is_post_type_archive( 'product' ) && $post_id = wc_get_page_id( 'shop' ) && $post = get_post( $post_id ) ) {
1722
-
1723
- if ( wc_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
1724
- $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1725
- }
1726
- // $title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
1727
- if ( ! $title ) {
1728
- $title = $this->internationalize( get_post_meta( $post_id, '_aioseop_title', true ) );
1729
- } // This is/was causing the first product to come through.
1730
- if ( ! $title ) {
1731
- $title = $this->internationalize( $post->post_title );
1732
- }
1733
- if ( ! $title ) {
1734
- $title = $this->internationalize( $this->get_original_title( '', false ) );
1735
- }
1736
-
1737
- $title = $this->apply_page_title_format( $title, $post );
1738
- $title = $this->paged_title( $title );
1739
- $title = apply_filters( 'aioseop_title_page', $title );
1740
 
1741
- return $title;
 
 
1742
 
 
 
1743
  }
1744
 
1745
  // this is returned for woo.
@@ -1765,7 +1771,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1765
  if ( null === $post ) {
1766
  return false;
1767
  }
1768
- if ( $this->is_static_front_page() && ( $home_title = $this->internationalize( $aioseop_options['aiosp_home_title'] ) ) ) {
 
 
1769
  if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) {
1770
  $home_title = $this->apply_page_title_format( $home_title, $post, $aioseop_options['aiosp_home_page_title_format'] );
1771
  }
@@ -1802,20 +1810,24 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1802
 
1803
  return $title;
1804
  }
1805
- } elseif ( function_exists( 'wc_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = wc_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
1806
- // Too far down? -mrt.
1807
- $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1808
- if ( ! $title ) {
1809
- $title = $this->internationalize( $post->post_title );
1810
- }
1811
- if ( ! $title ) {
1812
- $title = $this->internationalize( $this->get_original_title( '', false ) );
1813
- }
1814
- $title = $this->apply_page_title_format( $title, $post );
1815
- $title = $this->paged_title( $title );
1816
- $title = apply_filters( 'aioseop_title_page', $title );
 
 
 
1817
 
1818
- return $title;
 
1819
  } elseif ( is_single() || $this->check_singular() ) {
1820
  // We're not in the loop :(.
1821
  if ( null === $post ) {
@@ -1843,7 +1855,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1843
 
1844
  return apply_filters( 'aioseop_title_single', $title );
1845
  } elseif ( is_search() && isset( $s ) && ! empty( $s ) ) {
1846
- $search = esc_attr( stripslashes( $s ) );
1847
  $title_format = $aioseop_options['aiosp_search_title_format'];
1848
  $title = str_replace( '%site_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
1849
  if ( false !== strpos( $title, '%blog_title%', 0 ) ) {
@@ -1863,7 +1875,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1863
  return $title;
1864
  } elseif ( is_tag() ) {
1865
  global $utw;
1866
- $tag = $tag_description = '';
 
1867
  if ( $utw ) {
1868
  $tags = $utw->GetCurrentTagSet();
1869
  $tag = $tags[0]->tag;
@@ -2048,7 +2061,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2048
  if ( false !== $has_filter ) {
2049
  add_filter( 'wp_title', array( $this, 'wp_title' ), $has_filter );
2050
  }
2051
- if ( $title && ( $title = trim( $title ) ) ) {
 
2052
  return trim( $title );
2053
  }
2054
  }
@@ -2064,7 +2078,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2064
  $title = $this->internationalize( single_post_title( '', false ) );
2065
  } elseif ( is_search() && isset( $s ) && ! empty( $s ) ) {
2066
  $search = esc_attr( stripslashes( $s ) );
2067
- $title = $search;
2068
  } elseif ( ( is_tax() || is_category() ) && ! is_feed() ) {
2069
  $category_name = $this->ucwords( $this->internationalize( single_cat_title( '', false ) ) );
2070
  $title = $category_name;
@@ -2085,11 +2099,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2085
  }
2086
  } elseif ( is_author() ) {
2087
  $author = get_userdata( get_query_var( 'author' ) );
2088
- if ( $author === false ) {
2089
  global $wp_query;
2090
  $author = $wp_query->get_queried_object();
2091
  }
2092
- if ( $author !== false ) {
2093
  $title = $author->display_name;
2094
  }
2095
  } elseif ( is_day() ) {
@@ -2161,7 +2175,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2161
  */
2162
  function apply_page_title_format( $title, $p = null, $title_format = '' ) {
2163
  global $aioseop_options;
2164
- if ( $p === null ) {
2165
  global $post;
2166
  } else {
2167
  $post = $p;
@@ -2214,7 +2228,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2214
  if ( false !== strpos( $new_title, "%{$type}_title%", 0 ) ) {
2215
  $new_title = str_replace( "%{$type}_title%", $title, $new_title );
2216
  }
2217
- if ( $type == 'post' ) {
2218
  if ( false !== strpos( $new_title, '%category%', 0 ) ) {
2219
  $new_title = str_replace( '%category%', $category, $new_title );
2220
  }
@@ -2372,7 +2386,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2372
  * @return string
2373
  */
2374
  function apply_post_title_format( $title, $category = '', $p = null ) {
2375
- if ( $p === null ) {
2376
  global $post;
2377
  } else {
2378
  $post = $p;
@@ -2393,7 +2407,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2393
  */
2394
  function get_post_title_format( $title_type = 'post', $p = null ) {
2395
  global $aioseop_options;
2396
- if ( ( $title_type != 'post' ) && ( $title_type != 'archive' ) ) {
2397
  return false;
2398
  }
2399
  $title_format = "%{$title_type}_title% | %site_title%";
@@ -2403,18 +2417,17 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2403
 
2404
  if ( ! empty( $aioseop_options['aiosp_cpostactive'] ) ) {
2405
  $wp_post_types = $aioseop_options['aiosp_cpostactive'];
2406
- if (
2407
- (
2408
- ( $title_type == 'archive' ) &&
2409
- is_post_type_archive( $wp_post_types ) &&
2410
- $prefix = "aiosp_{$title_type}_"
2411
- ) ||
2412
- (
2413
- ( $title_type == 'post' ) &&
2414
- $this->is_singular( $wp_post_types, $p ) &&
2415
- $prefix = 'aiosp_'
2416
- )
2417
- ) {
2418
  $post_type = get_post_type( $p );
2419
 
2420
  if ( ! empty( $aioseop_options[ "{$prefix}{$post_type}_title_format" ] ) ) {
@@ -2452,11 +2465,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2452
  */
2453
  function is_static_posts_page() {
2454
  static $is_posts_page = null;
2455
- if ( $is_posts_page !== null ) {
2456
  return $is_posts_page;
2457
  }
2458
  $post = $this->get_queried_object();
2459
- $is_posts_page = ( get_option( 'show_on_front' ) == 'page' && is_home() && ! empty( $post ) && $post->ID == get_option( 'page_for_posts' ) );
2460
 
2461
  return $is_posts_page;
2462
  }
@@ -2469,11 +2482,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2469
  * @return bool|null
2470
  */
2471
  function is_static_front_page() {
2472
- if ( isset( $this->is_front_page ) && $this->is_front_page !== null ) {
2473
  return $this->is_front_page;
2474
  }
2475
  $post = $this->get_queried_object();
2476
- $this->is_front_page = ( get_option( 'show_on_front' ) == 'page' && is_page() && ! empty( $post ) && $post->ID == get_option( 'page_on_front' ) );
2477
 
2478
  return $this->is_front_page;
2479
  }
@@ -2743,16 +2756,20 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2743
  $description = '';
2744
  if ( is_author() && $this->show_page_description() ) {
2745
  $description = $this->internationalize( get_the_author_meta( 'description' ) );
2746
- } elseif ( function_exists( 'wc_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = wc_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
2747
- // $description = $this->get_post_description( $post );
2748
- // $description = $this->apply_cf_fields( $description );
2749
- if ( ! ( wc_get_page_id( 'shop' ) == get_option( 'page_on_front' ) ) ) {
2750
- $description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
2751
- } elseif ( wc_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
2752
- // $description = $this->get_aioseop_description( $post );
2753
- $description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
2754
- } elseif ( wc_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
2755
- $description = $this->get_aioseop_description( $post );
 
 
 
 
2756
  }
2757
  } elseif ( is_front_page() ) {
2758
  $description = $this->get_aioseop_description( $post );
@@ -2769,7 +2786,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2769
  }
2770
 
2771
  // #1308 - we want to make sure we are ignoring php version only in the admin area while editing the post, so that it does not impact #932.
2772
- $screen = is_admin() ? get_current_screen() : null;
2773
  $ignore_php_version = $screen && isset( $screen->id ) && 'post' === $screen->id;
2774
 
2775
  $truncate = false;
@@ -2985,11 +3002,12 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
2985
  if ( $query->is_404 || $query->is_search ) {
2986
  return false;
2987
  }
2988
- $link = '';
2989
  // this boolean will determine if any additional parameters will be added to the final link or not.
2990
  // this is especially useful in issues such as #491.
2991
  $add_query_params = false;
2992
- $haspost = false;
 
2993
  if ( ! empty( $query->posts ) ) {
2994
  $haspost = count( $query->posts ) > 0;
2995
  }
@@ -3010,8 +3028,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3010
  return false;
3011
  }
3012
  $add_query_params = true;
3013
- } elseif ( $query->is_home && ( get_option( 'show_on_front' ) == 'page' ) && ( $pageid = get_option( 'page_for_posts' ) ) ) {
3014
- $link = aioseop_get_permalink( $pageid );
 
 
 
3015
  } elseif ( is_front_page() || ( $query->is_home && ( get_option( 'show_on_front' ) != 'page' || ! get_option( 'page_for_posts' ) ) ) ) {
3016
  if ( function_exists( 'icl_get_home_url' ) ) {
3017
  $link = icl_get_home_url();
@@ -3035,13 +3056,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3035
  $link = get_tag_link( $tag->term_id );
3036
  }
3037
  } elseif ( $query->is_day && $haspost ) {
3038
- $link = get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
3039
  $add_query_params = true;
3040
  } elseif ( $query->is_month && $haspost ) {
3041
- $link = get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
3042
  $add_query_params = true;
3043
  } elseif ( $query->is_year && $haspost ) {
3044
- $link = get_year_link( get_query_var( 'year' ) );
3045
  $add_query_params = true;
3046
  } elseif ( $query->is_tax && $haspost ) {
3047
  $taxonomy = get_query_var( 'taxonomy' );
@@ -3049,8 +3070,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3049
  if ( ! empty( $term ) ) {
3050
  $link = get_term_link( $term, $taxonomy );
3051
  }
3052
- } elseif ( $query->is_archive && function_exists( 'get_post_type_archive_link' ) && ( $post_type = get_query_var( 'post_type' ) ) ) {
3053
- if ( is_array( $post_type ) ) {
 
3054
  $post_type = reset( $post_type );
3055
  }
3056
  $link = get_post_type_archive_link( $post_type );
@@ -3090,7 +3112,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3090
  $page_name = $wp_rewrite->pagination_base;
3091
  }
3092
  if ( ! empty( $page ) && $page > 1 ) {
3093
- if ( $page == get_query_var( 'page' ) ) {
3094
  if ( get_query_var( 'p' ) ) {
3095
  // non-pretty urls.
3096
  $link = add_query_arg( 'page', $page, $link );
@@ -3122,7 +3144,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3122
  global $aioseop_options;
3123
  global $aioseop_keywords;
3124
  global $post;
3125
- $opts = $this->meta_opts;
 
 
3126
  if ( ( is_front_page() && $aioseop_options['aiosp_home_keywords'] && ! $this->is_static_posts_page() ) || $this->is_static_front_page() ) {
3127
  if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
3128
  $keywords = $this->get_all_keywords();
@@ -3131,7 +3155,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3131
  }
3132
  } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && $this->is_static_posts_page() ) {
3133
  $keywords = stripslashes( $this->internationalize( $opts['aiosp_keywords'] ) ); // And if option = use page set keywords instead of keywords from recent posts.
3134
- } elseif ( ( $blog_page = aiosp_common::get_blog_page( $post ) ) && empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) {
3135
  $keywords = stripslashes( $this->internationalize( get_post_meta( $blog_page->ID, '_aioseop_keywords', true ) ) );
3136
  } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && ( is_archive() || is_post_type_archive() ) ) {
3137
  $keywords = '';
@@ -3509,9 +3533,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3509
  $field = $p . '_title_format';
3510
  $name = $post_objs[ $p ]->labels->singular_name;
3511
  if ( ! isset( $this->default_options[ $field ] ) ) {
3512
- $this->default_options[ $field ] = array(
3513
  /* translators: The title format is the template that is used to format the title for each post of a certain post type (Posts, Pages, etc.). */
3514
- 'name' => "$name " . __( 'Title Format:', 'all-in-one-seo-pack' ) . "<br />($p)",
3515
  'type' => 'text',
3516
  'default' => '%post_title% | %site_title%',
3517
  'condshow' => array(
@@ -3636,13 +3660,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3636
  * @return mixed
3637
  */
3638
  function filter_submit( $submit ) {
3639
- $submit['Submit_Default'] = array(
3640
  'type' => 'submit',
3641
  'class' => 'aioseop_reset_settings_button button-secondary',
3642
  /* translators: This is the text of a button that allows users to reset the General Settings to their default values. */
3643
  'value' => __( 'Reset General Settings to Defaults', 'all-in-one-seo-pack' ) . ' &raquo;',
3644
  );
3645
- $submit['Submit_All_Default'] = array(
3646
  'type' => 'submit',
3647
  'class' => 'aioseop_reset_settings_button button-secondary',
3648
  /* translators: This is the text of a button that allows users to reset all settings across the entire plugin to their default values. */
@@ -3666,7 +3690,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3666
  if ( AIOSEOPPRO ) {
3667
  global $aioseop_update_checker;
3668
  }
3669
- if ( $delete === true ) {
3670
 
3671
  if ( AIOSEOPPRO ) {
3672
  $license_key = '';
@@ -3687,7 +3711,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3687
 
3688
  if ( AIOSEOPPRO ) {
3689
  foreach ( $default_options as $k => $v ) {
3690
- if ( $k != 'aiosp_license_key' ) {
3691
  $this->options[ $k ] = $v;
3692
  }
3693
  }
@@ -3712,7 +3736,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3712
  * @return mixed
3713
  */
3714
  function filter_settings( $settings, $location, $current ) {
3715
- if ( $location == null ) {
3716
  $prefix = $this->prefix;
3717
 
3718
  foreach ( array( 'seopostcol', 'seocustptcol', 'debug_info', 'max_words_excerpt' ) as $opt ) {
@@ -3725,7 +3749,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3725
  $settings['aiosp_license_key']['size'] = 38;
3726
  }
3727
  }
3728
- } elseif ( $location == 'aiosp' ) {
3729
  global $post, $aioseop_sitemap;
3730
  $prefix = $this->get_prefix( $location ) . $location . '_';
3731
  if ( ! empty( $post ) ) {
@@ -3752,9 +3776,9 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3752
  global $post;
3753
  $info = $this->get_page_snippet_info();
3754
 
3755
- $title = $info['title'];
3756
  $description = $info['description'];
3757
- $keywords = $info['keywords'];
3758
 
3759
  $settings[ "{$prefix}title" ]['placeholder'] = $this->html_entity_decode( $title );
3760
  $settings[ "{$prefix}description" ]['placeholder'] = $this->html_entity_decode( $description );
@@ -3795,23 +3819,23 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3795
  * @return mixed
3796
  */
3797
  function filter_options( $options, $location ) {
3798
- if ( $location == 'aiosp' ) {
3799
  global $post;
3800
  if ( ! empty( $post ) ) {
3801
  $prefix = $this->prefix;
3802
  $post_type = get_post_type( $post );
3803
  foreach ( array( 'noindex', 'nofollow' ) as $no ) {
3804
  if ( empty( $this->options[ 'aiosp_cpost' . $no ] ) || ( ! in_array( $post_type, $this->options[ 'aiosp_cpost' . $no ] ) ) ) {
3805
- if ( isset( $options[ "{$prefix}{$no}" ] ) && ( $options[ "{$prefix}{$no}" ] != 'on' ) ) {
3806
  unset( $options[ "{$prefix}{$no}" ] );
3807
  }
3808
  }
3809
  }
3810
  }
3811
  }
3812
- if ( $location == null ) {
3813
  $prefix = $this->prefix;
3814
- if ( isset( $options[ "{$prefix}use_original_title" ] ) && ( $options[ "{$prefix}use_original_title" ] === '' ) ) {
3815
  $options[ "{$prefix}use_original_title" ] = 0;
3816
  }
3817
  }
@@ -3850,6 +3874,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3850
  * Checks whether All in One SEO Pack is enabled for this page.
3851
  *
3852
  * @since ?
 
3853
  *
3854
  * @return bool
3855
  */
@@ -3899,31 +3924,21 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
3899
 
3900
  $this->meta_opts = $this->get_current_options( array(), 'aiosp' );
3901
 
3902
- $aiosp_disable = $aiosp_disable_analytics = false;
3903
 
3904
  if ( ! empty( $this->meta_opts ) ) {
3905
  if ( isset( $this->meta_opts['aiosp_disable'] ) ) {
3906
  $aiosp_disable = $this->meta_opts['aiosp_disable'];
3907
  }
3908
- if ( isset( $this->meta_opts['aiosp_disable_analytics'] ) ) {
3909
- $aiosp_disable_analytics = $this->meta_opts['aiosp_disable_analytics'];
3910
- }
3911
  }
3912
 
3913
  $aiosp_disable = apply_filters( 'aiosp_disable', $aiosp_disable ); // API filter to disable AIOSEOP.
3914
 
3915
  if ( $aiosp_disable ) {
3916
- if ( ! $aiosp_disable_analytics ) {
3917
- if ( aioseop_option_isset( 'aiosp_google_analytics_id' ) ) {
3918
- remove_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
3919
- add_action( 'wp_head', array( $this, 'aiosp_google_analytics' ) );
3920
- }
3921
- }
3922
-
3923
  return false;
3924
  }
3925
 
3926
- if ( ! empty( $this->meta_opts ) && $this->meta_opts['aiosp_disable'] == true ) {
3927
  return false;
3928
  }
3929
 
@@ -4044,7 +4059,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4044
  add_action( 'after_plugin_row_' . AIOSEOP_PLUGIN_BASENAME, array( $aioseop_update_checker, 'add_plugin_row' ) );
4045
  }
4046
  } else {
4047
- if ( $aioseop_options['aiosp_can'] == '1' || $aioseop_options['aiosp_can'] == 'on' ) {
4048
  remove_action( 'wp_head', 'rel_canonical' );
4049
  }
4050
  // Analytics.
@@ -4108,7 +4123,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4108
  global $wp_query;
4109
  if ( is_attachment() ) {
4110
 
4111
- $url = $this->aiosp_mrt_get_url( $wp_query );
4112
  $unique_desc = '';
4113
  if ( $url ) {
4114
  $matches = array();
@@ -4139,7 +4154,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4139
  return;
4140
  }
4141
 
4142
- $post = $this->get_queried_object();
4143
  $description = apply_filters( 'aioseop_amp_description', $this->get_main_description( $post ) ); // Get the description.
4144
 
4145
  // To disable AMP meta description just __return_false on the aioseop_amp_description filter.
@@ -4161,7 +4176,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4161
  if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
4162
  $desc_attr = '';
4163
  }
4164
- $desc_attr = apply_filters( 'aioseop_amp_description_attributes', $desc_attr );
4165
  $meta_string .= sprintf( "<meta name=\"description\" %s content=\"%s\" />\n", $desc_attr, $description );
4166
  }
4167
  if ( ! empty( $meta_string ) ) {
@@ -4185,6 +4200,31 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4185
  return empty( $post_type ) || in_array( get_post_type(), $aioseop_options['aiosp_cpostactive'], true );
4186
  }
4187
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4188
  /**
4189
  * WP Head
4190
  *
@@ -4201,7 +4241,6 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4201
  }
4202
 
4203
  if ( ! $this->is_page_included() ) {
4204
-
4205
  /**
4206
  * The aioseop_robots_meta filter hook.
4207
  *
@@ -4214,9 +4253,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4214
  * @return string
4215
  */
4216
  $robots_meta = apply_filters( 'aioseop_robots_meta', $this->get_robots_meta() );
4217
-
4218
  if ( ! empty( $robots_meta ) && 'index,follow' !== $robots_meta ) {
4219
- printf( '<meta name="robots" content="%s"', esc_attr( $robots_meta ) ) . " >\n";
4220
  }
4221
 
4222
  if ( ! empty( $old_wp_query ) ) {
@@ -4225,6 +4263,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4225
  unset( $old_wp_query );
4226
  }
4227
 
 
 
 
 
 
4228
  return;
4229
  }
4230
 
@@ -4275,14 +4318,20 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4275
 
4276
  // This outputs robots meta tags and custom canonical URl on WooCommerce product archive page.
4277
  // See Github issue https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/755.
4278
- if ( function_exists( 'wc_get_page_id' ) && is_post_type_archive( 'product' ) && ( $post_id = wc_get_page_id( 'shop' ) ) && ( $post = get_post( $post_id ) ) ) {
4279
- global $posts;
4280
- $opts = $this->meta_opts = $this->get_current_options( array(), 'aiosp', null, $post );
4281
- $posts = array();
4282
- $posts[] = $post;
 
 
 
 
 
 
4283
  }
4284
 
4285
- $posts = $save_posts;
4286
  // Handle the description format.
4287
  // We are not going to mandate that post description needs to be present because the content could be derived from a custom field too.
4288
  if ( ! ( is_front_page() && is_paged() ) ) {
@@ -4307,7 +4356,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4307
  if ( isset( $aioseop_options['aiosp_togglekeywords'] ) ) {
4308
  $togglekeywords = $aioseop_options['aiosp_togglekeywords'];
4309
  }
4310
- if ( $togglekeywords == 0 && ! ( is_front_page() && is_paged() ) ) {
4311
  $keywords = $this->get_main_keywords();
4312
  $keywords = $this->apply_cf_fields( $keywords );
4313
  $keywords = apply_filters( 'aioseop_keywords', $keywords );
@@ -4316,8 +4365,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4316
  if ( isset( $meta_string ) ) {
4317
  $meta_string .= "\n";
4318
  }
4319
- $keywords = wp_filter_nohtml_kses( str_replace( '"', '', $keywords ) );
4320
- $key_attr = apply_filters( 'aioseop_keywords_attributes', '' );
4321
  $meta_string .= sprintf( "<meta name=\"keywords\" %s content=\"%s\" />\n", $key_attr, $keywords );
4322
  }
4323
  }
@@ -4400,14 +4449,21 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4400
  if ( ! empty( $next ) ) {
4401
  $meta_string .= '<link rel="next" href="' . esc_url( $next ) . "\" />\n";
4402
  }
4403
- if ( $meta_string != null ) {
4404
  echo "$meta_string\n";
4405
  }
4406
 
4407
  // Handle Schema.
4408
- if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) && (bool) $aioseop_options['aiosp_schema_markup'] ) {
4409
- $aioseop_schema = new AIOSEOP_Schema_Builder();
4410
- $aioseop_schema->display_json_ld_head_script();
 
 
 
 
 
 
 
4411
  }
4412
 
4413
  // Handle canonical links.
@@ -4582,7 +4638,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4582
  */
4583
  do_action( 'aioseop_after_apply_description_format' );
4584
 
4585
- return $description;
4586
  }
4587
 
4588
  /**
@@ -4598,22 +4654,22 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4598
  */
4599
  function get_robots_meta() {
4600
  global $aioseop_options;
4601
- $page_number = $this->get_page_number();
4602
- $post_type = get_post_type();
4603
- $noindex = false;
4604
- $nofollow = false;
4605
- $aiosp_noindex = '';
4606
- $aiosp_nofollow = '';
4607
- $tax_noindex = array();
4608
- $is_static_page = false;
4609
- $is_static_posts_page = false;
4610
  $is_woocommerce_shop_page = false;
4611
 
4612
  if ( isset( $aioseop_options['aiosp_tax_noindex'] ) && ! empty( $aioseop_options['aiosp_tax_noindex'] ) ) {
4613
  $tax_noindex = $aioseop_options['aiosp_tax_noindex'];
4614
  }
4615
 
4616
- if ( is_front_page() ) {
4617
  return $this->get_robots_meta_string( false, false );
4618
  }
4619
 
@@ -4627,7 +4683,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4627
  }
4628
 
4629
  if ( $is_static_posts_page || $is_woocommerce_shop_page ) {
4630
- $post_type = 'page';
4631
  $is_static_page = true;
4632
  }
4633
 
@@ -4636,18 +4692,14 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4636
  ! is_author() &&
4637
  ! is_search()
4638
  ) {
4639
- $aiosp_noindex = $this->get_noindex_nofollow_meta_value( 'noindex' );
4640
  $aiosp_nofollow = $this->get_noindex_nofollow_meta_value( 'nofollow' );
4641
  }
4642
 
4643
- if ( 'on' === $aiosp_noindex ||
4644
- ( is_singular() && ! empty( $aioseop_options['aiosp_paginated_noindex'] ) && $page_number > 1 )
4645
- ) {
4646
  $noindex = true;
4647
  }
4648
- if ( 'on' === $aiosp_nofollow ||
4649
- ( is_singular() && ! empty( $aioseop_options['aiosp_paginated_nofollow'] ) && $page_number > 1 )
4650
- ) {
4651
  $nofollow = true;
4652
  }
4653
 
@@ -4712,8 +4764,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4712
  * @return string
4713
  */
4714
  private function get_noindex_nofollow_meta_value( $key ) {
4715
- $meta = array();
4716
- $meta_key = '_aioseop_' . $key;
4717
  $meta_value = '';
4718
 
4719
  $queried_object = get_queried_object();
@@ -4780,11 +4832,11 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4780
  */
4781
  private function check_singular() {
4782
  global $wp_query, $post;
4783
- $is_singular = false;
4784
  if ( is_singular() ) {
4785
  // #1297 - support for bbpress 'reply' post type.
4786
  if ( $post && 'reply' === $post->post_type ) {
4787
- $is_singular = true;
4788
  }
4789
  }
4790
  return $is_singular;
@@ -4819,7 +4871,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4819
  * @return array
4820
  */
4821
  function get_prev_next_links( $post = null ) {
4822
- $prev = $next = '';
 
4823
  $page = $this->get_page_number();
4824
  if ( is_home() || is_archive() || is_paged() ) {
4825
  global $wp_query;
@@ -4953,7 +5006,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4953
  * @return bool
4954
  */
4955
  function save_post_data( $id ) {
4956
- $awmp_edit = $nonce = null;
 
4957
  if ( empty( $_POST ) ) {
4958
  return false;
4959
  }
@@ -5071,7 +5125,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
5071
  $title = $t['title'];
5072
  }
5073
  $header .= '<li><label class="aioseop_header_nav"><a class="aioseop_header_tab' . $active . '" href="#' . $t['id'] . '">' . $title . '</a></label></li>';
5074
- $active = '';
5075
  }
5076
  $header .= '</ul>';
5077
 
@@ -5229,7 +5283,8 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
5229
  * @param $id
5230
  */
5231
  function save_category_metaboxes( $id ) {
5232
- $awmp_edit = $nonce = null;
 
5233
  if ( isset( $_POST['aiosp_edit'] ) ) {
5234
  $awmp_edit = $_POST['aiosp_edit'];
5235
  }
@@ -5327,7 +5382,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
5327
  }
5328
  */
5329
 
5330
- if ( isset( $_POST ) && isset( $_POST['module'] ) && isset( $_POST['nonce-aioseop'] ) && ( $_POST['module'] == 'All_in_One_SEO_Pack' ) && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) {
5331
  if ( isset( $_POST['Submit'] ) && AIOSEOPPRO ) {
5332
  if ( isset( $_POST['aiosp_custom_menu_order'] ) ) {
5333
  $custom_menu_order = $_POST['aiosp_custom_menu_order'];
@@ -5351,7 +5406,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
5351
  if ( ! AIOSEOPPRO ) {
5352
  if ( ! empty( $this->pointers ) ) {
5353
  foreach ( $this->pointers as $k => $p ) {
5354
- if ( ! empty( $p['pointer_scope'] ) && ( $p['pointer_scope'] == 'global' ) ) {
5355
  unset( $this->pointers[ $k ] );
5356
  }
5357
  }
@@ -5498,7 +5553,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
5498
  if ( $item != $file ) {
5499
  $order[] = $item;
5500
  }
5501
- if ( $index == 0 ) {
5502
  $order[] = $file;
5503
  }
5504
  }
@@ -5698,7 +5753,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
5698
  */
5699
  function check_recently_activated_modules() {
5700
  global $aioseop_options;
5701
- $options = get_option( 'aioseop_options' );
5702
  $modules_before = array();
5703
  $modules_now = array();
5704
  if ( array_key_exists( 'modules', $aioseop_options ) && array_key_exists( 'aiosp_feature_manager_options', $aioseop_options['modules'] ) ) {
@@ -5717,10 +5772,10 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
5717
  }
5718
 
5719
  $action = 'deactivate';
5720
- $diff = array_diff( $modules_before, $modules_now );
5721
  if ( count( $modules_now ) > count( $modules_before ) ) {
5722
  $action = 'activate';
5723
- $diff = array_diff( $modules_now, $modules_before );
5724
  }
5725
 
5726
  if ( $diff ) {
217
  $this->do_log = false;
218
  }
219
  /* translators: This is a header for the General Settings menu. %s is a placeholder and is replaced with the name of the plugin. */
220
+ $this->name = sprintf( __( '%s Plugin Options', 'all-in-one-seo-pack' ), AIOSEOP_PLUGIN_NAME );
221
  /* translators: This is the main menu of the plugin. */
222
  $this->menu_name = __( 'General Settings', 'all-in-one-seo-pack' );
223
 
231
  $this->default_options = array(
232
  'license_key' => array(
233
  /* translators: This is a setting where users can enter their license code for All in One SEO Pack Pro. */
234
+ 'name' => __( 'License Key', 'all-in-one-seo-pack' ),
235
  'type' => 'text',
236
  ),
237
  'home_title' => array(
238
  /* translators: This is a setting where users can enter the title for their homepage. */
239
+ 'name' => __( 'Home Title', 'all-in-one-seo-pack' ),
240
  'default' => null,
241
  'type' => 'text',
242
  'sanitize' => 'text',
247
  ),
248
  'home_description' => array(
249
  /* translators: This is a setting where users can enter the description for their homepage. */
250
+ 'name' => __( 'Home Description', 'all-in-one-seo-pack' ),
251
  'default' => '',
252
  'type' => 'textarea',
253
  'sanitize' => 'text',
258
  ),
259
  'togglekeywords' => array(
260
  /* translators: This is a setting where users can enable the use of meta keywords for their website. */
261
+ 'name' => __( 'Use Keywords', 'all-in-one-seo-pack' ),
262
  'default' => 1,
263
  'type' => 'radio',
264
  'initial_options' => array(
270
  ),
271
  'home_keywords' => array(
272
  /* translators: This is a setting where users can enter meta keywords for their homepage. */
273
+ 'name' => __( 'Home Keywords (comma separated)', 'all-in-one-seo-pack' ),
274
  'default' => null,
275
  'type' => 'textarea',
276
  'sanitize' => 'text',
291
  ),
292
  'can' => array(
293
  /* translators: This is the name of a setting. Canonical URLs help users prevent duplicate content issues - https://en.wikipedia.org/wiki/Canonical_link_element. Leave "Canonical" in English if there is no such term in your language. */
294
+ 'name' => __( 'Canonical URLs', 'all-in-one-seo-pack' ),
295
  'default' => 1,
296
  ),
297
  'no_paged_canonical_links' => array(
298
  /* translators: This is the name of a setting. Canonical URLs help users prevent duplicate content issues - https://en.wikipedia.org/wiki/Canonical_link_element. Leave "Canonical" in English if there is no such term in your language. Enabling this setting means the plugin will use the URL of the first page as the canonical URL for all subsequent paginated pages. */
299
+ 'name' => __( 'No Pagination for Canonical URLs', 'all-in-one-seo-pack' ),
300
  'default' => 0,
301
  'condshow' => array( 'aiosp_can' => 'on' ),
302
  ),
303
  'force_rewrites' => array(
304
  /* translators: This is the name of a setting. Enabling this option forces the plugin to use output buffering to ensure that the title tag will be rewritten. */
305
+ 'name' => __( 'Force Rewrites', 'all-in-one-seo-pack' ),
306
  'default' => 1,
307
  'type' => 'hidden',
308
  'prefix' => $this->prefix,
313
  ),
314
  'use_original_title' => array(
315
  /* translators: This is the name of a setting. Enabling this option forces the plugin to use the wp_title() function to fetch the title tag. */
316
+ 'name' => __( 'Use Original Title', 'all-in-one-seo-pack' ),
317
  'type' => 'radio',
318
  'default' => 0,
319
  'initial_options' => array(
323
  ),
324
  'home_page_title_format' => array(
325
  /* translators: This is a setting where users can enter the title format for the homepage. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
326
+ 'name' => __( 'Home Page Title Format', 'all-in-one-seo-pack' ),
327
  'type' => 'text',
328
  'default' => '%page_title%',
329
  ),
330
  'page_title_format' => array(
331
 
332
  /* translators: This is a setting where users can enter the title format for Pages. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
333
+ 'name' => __( 'Page Title Format', 'all-in-one-seo-pack' ),
334
  'type' => 'text',
335
  'default' => '%page_title% | %site_title%',
336
  ),
337
  'post_title_format' => array(
338
  /* translators: This is a setting where users can enter the title format for Posts. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
339
+ 'name' => __( 'Post Title Format', 'all-in-one-seo-pack' ),
340
  'type' => 'text',
341
  'default' => '%post_title% | %site_title%',
342
  ),
343
  'category_title_format' => array(
344
  /* translators: This is a setting where users can enter the title format for categories. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
345
+ 'name' => __( 'Category Title Format', 'all-in-one-seo-pack' ),
346
  'type' => 'text',
347
  'default' => '%category_title% | %site_title%',
348
  ),
349
  'archive_title_format' => array(
350
  /* translators: This is a setting where users can enter the title format for archive pages. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
351
+ 'name' => __( 'Archive Title Format', 'all-in-one-seo-pack' ),
352
  'type' => 'text',
353
  'default' => '%archive_title% | %site_title%',
354
  ),
355
  'date_title_format' => array(
356
  /* translators: This is a setting where users can enter the title format for date archive pages. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
357
+ 'name' => __( 'Date Archive Title Format', 'all-in-one-seo-pack' ),
358
  'type' => 'text',
359
  'default' => '%date% | %site_title%',
360
  ),
361
  'author_title_format' => array(
362
  /* translators: This is a setting where users can enter the title format for author archive pages. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
363
+ 'name' => __( 'Author Archive Title Format', 'all-in-one-seo-pack' ),
364
  'type' => 'text',
365
  'default' => '%author% | %site_title%',
366
  ),
367
  'tag_title_format' => array(
368
  /* translators: This is a setting where users can enter the title format for tag archive pages. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
369
+ 'name' => __( 'Tag Title Format', 'all-in-one-seo-pack' ),
370
  'type' => 'text',
371
  'default' => '%tag% | %site_title%',
372
  ),
373
  'search_title_format' => array(
374
  /* translators: This is a setting where users can enter the title format for the search page. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
375
+ 'name' => __( 'Search Title Format', 'all-in-one-seo-pack' ),
376
  'type' => 'text',
377
  'default' => '%search% | %site_title%',
378
  ),
384
  ),
385
  '404_title_format' => array(
386
  /* translators: This is a setting where users can enter the title format for the 404 page. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
387
+ 'name' => __( '404 Title Format', 'all-in-one-seo-pack' ),
388
  'type' => 'text',
389
  'default' => __( 'Nothing found for %request_words%', 'all-in-one-seo-pack' ),
390
  ),
391
  'paged_format' => array(
392
  /* translators: This is a setting where users can enter the title format for paginated pages. The title format is the format All in One SEO Pack uses to rewrite the title tag. */
393
+ 'name' => __( 'Paged Format', 'all-in-one-seo-pack' ),
394
  'type' => 'text',
395
  'default' => sprintf( ' - %s %%page%%', __( 'Part', 'all-in-one-seo-pack' ) ),
396
  ),
397
  'cpostactive' => array(
398
  /* translators: This is a setting where users can indicate which post types they want to use All in One SEO Pack with. */
399
+ 'name' => __( 'SEO on only these Content Types', 'all-in-one-seo-pack' ),
400
  'type' => 'multicheckbox',
401
  'default' => array( 'post', 'page' ),
402
  ),
403
  'taxactive' => array(
404
  /* translators: This is a setting where users can indicate which taxonomies they want to use All in One SEO Pack with. */
405
+ 'name' => __( 'SEO on only these taxonomies', 'all-in-one-seo-pack' ),
406
  'type' => 'multicheckbox',
407
  'default' => array( 'category', 'post_tag' ),
408
  ),
409
  'cpostnoindex' => array(
410
  /* translators: This is a setting where users can indicate which post types they want to NOINDEX by default. NOINDEX is a value of the HTML robots meta tag that asks search engines not to index the page. */
411
+ 'name' => __( 'Default to NOINDEX', 'all-in-one-seo-pack' ),
412
  'type' => 'multicheckbox',
413
  'default' => array(),
414
  ),
415
  'cpostnofollow' => array(
416
  /* translators: This is a setting where users can indicate which post types they want to NOFOLLOW by default. NOFOLLOW is a value of the HTML robots meta tag that asks search engines not to follow any links on the page. */
417
+ 'name' => __( 'Default to NOFOLLOW', 'all-in-one-seo-pack' ),
418
  'type' => 'multicheckbox',
419
  'default' => array(),
420
  ),
421
  'posttypecolumns' => array(
422
  /* translators: This is a setting where users can indicate for which post types they want to enable columns. Columns are added to the All Posts, All Pages, etc. list pages and allow users to quick-edit their title and description - https://semperplugins.com/documentation/display-settings/#show-column-labels-for-custom-post-types. */
423
+ 'name' => __( 'Show Column Labels for Custom Post Types', 'all-in-one-seo-pack' ),
424
  'type' => 'multicheckbox',
425
  'default' => array( 'post', 'page' ),
426
  ),
427
  'google_verify' => array(
428
+ 'name' => 'Google Search Console',
429
  'default' => '',
430
  'type' => 'text',
431
  ),
432
  'bing_verify' => array(
433
+ 'name' => 'Bing Webmaster Tools',
434
  'default' => '',
435
  'type' => 'text',
436
  ),
437
  'pinterest_verify' => array(
438
  /* translators: This is a setting where users can add their Pinterest website verification code. */
439
+ 'name' => __( 'Pinterest Site Verification', 'all-in-one-seo-pack' ),
440
  'default' => '',
441
  'type' => 'text',
442
  ),
443
  'yandex_verify' => array(
444
+ 'name' => 'Yandex Webmaster Tools',
445
  'default' => '',
446
  'type' => 'text',
447
  ),
448
  'baidu_verify' => array(
449
+ 'name' => 'Baidu Webmaster Tools',
450
  'default' => '',
451
  'type' => 'text',
452
  ),
453
  'google_analytics_id' => array(
454
  /* translators: This is a setting where users can add their Google Analytics verification code. Leave this in English if there is no translation for "Google Analytics". */
455
+ 'name' => __( 'Google Analytics ID', 'all-in-one-seo-pack' ),
456
  'default' => null,
457
  'type' => 'text',
458
  'placeholder' => 'UA-########-#',
459
  ),
460
  'ga_advanced_options' => array(
461
  /* translators: This is a setting users can enable to display more advanced options for Google Analytics. */
462
+ 'name' => __( 'Advanced Analytics Options', 'all-in-one-seo-pack' ),
463
  'default' => 'on',
464
  'type' => 'radio',
465
  'initial_options' => array(
476
  ),
477
  'ga_domain' => array(
478
  /* translators: This is a setting which allows users to set the cookie domain for their Google Analytics tracking code. */
479
+ 'name' => __( 'Tracking Domain', 'all-in-one-seo-pack' ),
480
  'type' => 'text',
481
  'condshow' => array(
482
  'aiosp_google_analytics_id' => array(
489
  ),
490
  'ga_multi_domain' => array(
491
  /* translators: This is a setting which allows users to enable Google Analytics tracking for multiple domain names. */
492
+ 'name' => __( 'Track Multiple Domains', 'all-in-one-seo-pack' ),
493
  'default' => 0,
494
  'condshow' => array(
495
  'aiosp_google_analytics_id' => array(
502
  ),
503
  'ga_addl_domains' => array(
504
  /* translators: This is a setting which allows users to enter additional domain names used for Google Analytics cross-domain tracking - https://support.google.com/analytics/answer/1034342?hl=en.*/
505
+ 'name' => __( 'Additional Domains', 'all-in-one-seo-pack' ),
506
  'type' => 'textarea',
507
  'condshow' => array(
508
  'aiosp_google_analytics_id' => array(
516
  ),
517
  'ga_anonymize_ip' => array(
518
  /* translators: This is a setting which tells Google Analytics not to track and store the IP addresses of website visitors. This is required to be compliant with the GDPR for example. */
519
+ 'name' => __( 'Anonymize IP Addresses', 'all-in-one-seo-pack' ),
520
  'type' => 'checkbox',
521
  'condshow' => array(
522
  'aiosp_google_analytics_id' => array(
529
  ),
530
  'ga_display_advertising' => array(
531
  /* translators: This is a setting that enables a collection of Google Analytics features so you can, for example, create segments based on demographic and interest data. */
532
+ 'name' => __( 'Display Advertiser Tracking', 'all-in-one-seo-pack' ),
533
  'type' => 'checkbox',
534
  'condshow' => array(
535
  'aiosp_google_analytics_id' => array(
542
  ),
543
  'ga_exclude_users' => array(
544
  /* translators: This is a setting that allows you to exclude certain WordPress user roles, e.g. Administrators, from Google Analytics tracking. */
545
+ 'name' => __( 'Exclude Users From Tracking', 'all-in-one-seo-pack' ),
546
  'type' => 'multicheckbox',
547
  'condshow' => array(
548
  'aiosp_google_analytics_id' => array(
555
  ),
556
  'ga_track_outbound_links' => array(
557
  /* translators: This is a setting that enables tracking of outbound/external links by Google Analytics. */
558
+ 'name' => __( 'Track Outbound Links', 'all-in-one-seo-pack' ),
559
  'default' => 0,
560
  'condshow' => array(
561
  'aiosp_google_analytics_id' => array(
568
  ),
569
  'ga_link_attribution' => array(
570
  /* translators: This is a setting for Google Analytics that allows you to tag your pages to implement enhanced link-tracking. */
571
+ 'name' => __( 'Enhanced Link Attribution', 'all-in-one-seo-pack' ),
572
  'default' => 0,
573
  'condshow' => array(
574
  'aiosp_google_analytics_id' => array(
581
  ),
582
  'ga_enhanced_ecommerce' => array(
583
  /* translators: This is a setting which tells Google Analytics to track your customers' path to purchase on your e-commerce website. */
584
+ 'name' => __( 'Enhanced Ecommerce', 'all-in-one-seo-pack' ),
585
  'default' => 0,
586
  'condshow' => array(
587
  'aiosp_google_analytics_id' => array(
596
  /* translators: This is a setting that outputs basic Schema.org markup, also known as structured data, into the source code of each page. */
597
  'name' => __( 'Use Schema.org Markup', 'all-in-one-seo-pack' ),
598
  'type' => 'radio',
599
+ 'default' => 1,
600
  'initial_options' => array(
601
  1 => __( 'Enabled', 'all-in-one-seo-pack' ),
602
  0 => __( 'Disabled', 'all-in-one-seo-pack' ),
605
  // TODO Change `schema_search_results_page` to `schema_add_search_results_page`. Requires modifying double arrow alignment.
606
  'schema_search_results_page' => array(
607
  /* translators: This is a setting users can enable to add the basic markup code to their source code that is needed for Google to generate a Sitelinks Search Box - https://developers.google.com/search/docs/data-types/sitelinks-searchbox.*/
608
+ 'name' => __( 'Display Sitelinks Search Box', 'all-in-one-seo-pack' ),
609
  'condshow' => array(
610
  'aiosp_schema_markup' => 1,
611
  ),
612
  ),
613
  'schema_social_profile_links' => array(
614
+ 'name' => __( 'Social Profile Links', 'all-in-one-seo-pack' ),
615
  'type' => 'textarea',
616
  'cols' => 60,
617
  'rows' => 5,
620
  ),
621
  ),
622
  'schema_site_represents' => array(
623
+ 'name' => __( 'Person or Organization', 'all-in-one-seo-pack' ),
624
  'type' => 'radio',
625
  'default' => 'organization',
626
  'initial_options' => array(
632
  ),
633
  ),
634
  'schema_organization_name' => array(
635
+ 'name' => __( 'Organization Name', 'all-in-one-seo-pack' ),
636
  'type' => 'text',
637
  'default' => '',
638
  'condshow' => array(
641
  ),
642
  ),
643
  'schema_organization_logo' => array(
644
+ 'name' => __( 'Organization Logo', 'all-in-one-seo-pack' ),
645
  'type' => 'image',
646
  'condshow' => array(
647
  'aiosp_schema_markup' => 1,
650
  ),
651
 
652
  'schema_person_user' => array(
653
+ 'name' => __( 'Person\'s Username', 'all-in-one-seo-pack' ),
654
  'type' => 'select',
655
  'default' => 1,
656
  'condshow' => array(
660
  // Add initial options below.
661
  ),
662
  'schema_phone_number' => array(
663
+ 'name' => __( 'Phone Number', 'all-in-one-seo-pack' ),
664
  'type' => 'tel',
665
  'autocomplete' => 'off',
666
  'condshow' => array(
669
  ),
670
  ),
671
  'schema_contact_type' => array(
672
+ 'name' => __( 'Type of Contact', 'all-in-one-seo-pack' ),
673
  'type' => 'select',
674
  'condshow' => array(
675
  'aiosp_schema_markup' => 1,
692
  ),
693
  'use_categories' => array(
694
  /* translators: This is the name of a setting. By enabling it, the plugin will use the categories of the relevant post as meta keywords in addition to any user-specified keywords. */
695
+ 'name' => __( 'Use Categories for META keywords', 'all-in-one-seo-pack' ),
696
  'default' => 0,
697
  'condshow' => array( 'aiosp_togglekeywords' => 0 ),
698
  ),
699
  'use_tags_as_keywords' => array(
700
  /* translators: This is the name of a setting. By enabling it, the plugin will use the tags of the relevant post as meta keywords in addition to any user-specified keywords. */
701
+ 'name' => __( 'Use Tags for META keywords', 'all-in-one-seo-pack' ),
702
  'default' => 1,
703
  'condshow' => array( 'aiosp_togglekeywords' => 0 ),
704
  ),
705
  'dynamic_postspage_keywords' => array(
706
  /* translators: This a setting that allows you to dynamically output meta keywords on archive pages based on the keywords from the posts that are displayed by the archive page. */
707
+ 'name' => __( 'Dynamically Generate Keywords for Posts Page/Archives', 'all-in-one-seo-pack' ),
708
  'default' => 1,
709
  'condshow' => array( 'aiosp_togglekeywords' => 0 ),
710
  ),
711
  'category_noindex' => array(
712
  /* translators: This is a global setting that allows you to NOINDEX all your categories. */
713
+ 'name' => __( 'Use noindex for Categories', 'all-in-one-seo-pack' ),
714
  'default' => 1,
715
  ),
716
  'archive_date_noindex' => array(
717
  /* translators: This is a global setting that allows you to NOINDEX all your date archive pages. */
718
+ 'name' => __( 'Use noindex for Date Archives', 'all-in-one-seo-pack' ),
719
  'default' => 1,
720
  ),
721
  'archive_author_noindex' => array(
722
  /* translators: This is a global setting that allows you to NOINDEX all your author archive pages. */
723
+ 'name' => __( 'Use noindex for Author Archives', 'all-in-one-seo-pack' ),
724
  'default' => 1,
725
  ),
726
  'tags_noindex' => array(
727
  /* translators: This is a global setting that allows you to NOINDEX all your tag archive pages. */
728
+ 'name' => __( 'Use noindex for Tag Archives', 'all-in-one-seo-pack' ),
729
  'default' => 0,
730
  ),
731
  'search_noindex' => array(
732
  /* translators: This is a setting that allows you to NOINDEX your search results page. */
733
+ 'name' => __( 'Use noindex for the Search page', 'all-in-one-seo-pack' ),
734
  'default' => 0,
735
  ),
736
  '404_noindex' => array(
737
  /* translators: This is a setting that allows you to NOINDEX your 404 Not Found page. */
738
+ 'name' => __( 'Use noindex for the 404 page', 'all-in-one-seo-pack' ),
739
  'default' => 0,
740
  ),
741
  'tax_noindex' => array(
742
  /* translators: This is a global setting that allows you to NOINDEX specific taxonomies. */
743
+ 'name' => __( 'Use noindex for Taxonomy Archives', 'all-in-one-seo-pack' ),
744
  'type' => 'multicheckbox',
745
  'default' => array(),
746
  ),
747
  'paginated_noindex' => array(
748
  /* translators: This is a global setting that allows you to NOINDEX all your paginated content (page 2 and higher). */
749
+ 'name' => __( 'Use noindex for paginated pages/posts', 'all-in-one-seo-pack' ),
750
  'default' => 0,
751
  ),
752
  'paginated_nofollow' => array(
753
  /* translators: This is a global setting that allows you to NOFOLLOW all your paginated content. */
754
+ 'name' => __( 'Use nofollow for paginated pages/posts', 'all-in-one-seo-pack' ),
755
  'default' => 0,
756
  ),
757
  'generate_descriptions' => array(
758
  /* translators: This is a setting that allows the plugin to automatically populate the meta description tag based on the excerpt or content of the post/page.*/
759
+ 'name' => __( 'Autogenerate Descriptions', 'all-in-one-seo-pack' ),
760
  'default' => 0,
761
  ),
762
  'skip_excerpt' => array(
763
  /* translators: This is the name of a setting. By enabling it, the plugin will use the content of the post/page to automatically populate the meta description tag, instead of the excerpt. */
764
+ 'name' => __( 'Use Content For Autogenerated Descriptions', 'all-in-one-seo-pack' ),
765
  'default' => 0,
766
  'condshow' => array( 'aiosp_generate_descriptions' => 'on' ),
767
  ),
768
  'run_shortcodes' => array(
769
  /* translators: This is a setting that enables the plugin to execute shortcodes in the autogenerated descriptions. Shortcodes allow people to execute code inside WordPress posts, pages, and widgets without writing any code directly. */
770
+ 'name' => __( 'Run Shortcodes In Autogenerated Descriptions', 'all-in-one-seo-pack' ),
771
  'default' => 0,
772
  'condshow' => array( 'aiosp_generate_descriptions' => 'on' ),
773
  ),
774
  'hide_paginated_descriptions' => array(
775
  /* translators: This is a setting that, if enabled, removes the meta description for paginated content (page 2 and higher). */
776
+ 'name' => __( 'Remove Descriptions For Paginated Pages', 'all-in-one-seo-pack' ),
777
  'default' => 0,
778
  ),
779
  'dont_truncate_descriptions' => array(
780
  /* translators: This is a setting that makes sure the plugin does not truncate the meta description tag if it is longer than what All in One SEO Pack recommends. */
781
+ 'name' => __( 'Never Shorten Long Descriptions', 'all-in-one-seo-pack' ),
782
  'default' => 0,
783
  ),
784
  'unprotect_meta' => array(
785
  /* translators: This is a setting that allows users to unprotect internal postmeta fields for use with XML-RPC. */
786
+ 'name' => __( 'Unprotect Post Meta Fields', 'all-in-one-seo-pack' ),
787
  'default' => 0,
788
  ),
789
  'redirect_attachement_parent' => array(
790
  /* translators: This is the name of a setting. By enabling it, the plugin will redirect attachment page requests to the post parent, or in other words, the post/page where the media is embedded. */
791
+ 'name' => __( 'Redirect Attachments to Post Parent', 'all-in-one-seo-pack' ),
792
  'default' => 0,
793
  ),
794
  'ex_pages' => array(
795
  /* translators: This is a textarea setting where users can enter a list of pages that All in One SEO Pack should not affect. */
796
+ 'name' => __( 'Exclude Pages', 'all-in-one-seo-pack' ),
797
  'type' => 'textarea',
798
  'default' => '',
799
  ),
800
  'post_meta_tags' => array(
801
  /* translators: This is a setting that allows users to ouput additional code, such as references to stylesheets or JavaScript libraries, into the HEAD section of each post. */
802
+ 'name' => __( 'Additional Post Headers', 'all-in-one-seo-pack' ),
803
  'type' => 'textarea',
804
  'default' => '',
805
  'sanitize' => 'default',
806
  ),
807
  'page_meta_tags' => array(
808
  /* translators: This is a setting that allows users to ouput additional HTML tags, such as references to stylesheets or JavaScript libraries, into the HEAD section of each page. */
809
+ 'name' => __( 'Additional Page Headers', 'all-in-one-seo-pack' ),
810
  'type' => 'textarea',
811
  'default' => '',
812
  'sanitize' => 'default',
813
  ),
814
  'front_meta_tags' => array(
815
  /* translators: This is a setting that allows users to ouput additional HTML tags, such as references to stylesheets or JavaScript libraries, into the HEAD section of the frontpage/homepage. */
816
+ 'name' => __( 'Additional Front Page Headers', 'all-in-one-seo-pack' ),
817
  'type' => 'textarea',
818
  'default' => '',
819
  'sanitize' => 'default',
820
  ),
821
  'home_meta_tags' => array(
822
  /* translators: This is a setting that allows users to ouput additional HTML tags, such as references to stylesheets or JavaScript libraries, into the HEAD section of the static Posts page (see Settings > Reading). */
823
+ 'name' => __( 'Additional Posts Page Headers', 'all-in-one-seo-pack' ),
824
  'type' => 'textarea',
825
  'default' => '',
826
  'sanitize' => 'default',
827
  ),
828
  'do_log' => array(
829
  /* translators: This is a setting that enables All in One SEO Pack to log important events to help with debugging. */
830
+ 'name' => __( 'Log important events', 'all-in-one-seo-pack' ),
831
  'default' => null,
832
  ),
833
 
1004
  'options' => array( 'google_verify', 'bing_verify', 'pinterest_verify', 'yandex_verify', 'baidu_verify' ),
1005
  ),
1006
  'google' => array(
1007
+ 'name' => __( 'Google Analytics', 'all-in-one-seo-pack' ),
1008
  'help_link' => 'https://semperplugins.com/documentation/advanced-google-analytics-settings/',
1009
  'options' => array(
1010
  'google_analytics_id',
1090
  ),
1091
  'orderby' => 'nicename',
1092
  );
1093
+ $users = get_users( $user_args );
1094
 
1095
  $this->default_options['schema_person_user']['initial_options'] = array();
1096
  foreach ( $users as $user ) {
1154
  $args['options']['nowrap'] = false;
1155
  $args['options']['save'] = false;
1156
  $info = $this->get_page_snippet_info();
1157
+ $title = $info['title'];
1158
+ $description = $info['description'];
1159
+ $keywords = $info['keywords'];
1160
+ $url = $info['url'];
1161
+ $title_format = $info['title_format'];
1162
+ $category = $info['category'];
1163
+ $w = $info['w'];
1164
+ $p = $info['p'];
1165
 
1166
  if ( $this->strlen( $title ) > 70 ) {
1167
  $title = $this->trim_excerpt_without_filters(
1182
  $title = $title_format;
1183
  }
1184
 
1185
+ $args['value'] = sprintf( $args['value'], $title, esc_url( $url ), esc_attr( $description ) );
1186
+ $buf = $this->get_option_row( $args['name'], $args['options'], $args );
1187
 
1188
  return $buf;
1189
  }
1230
  if ( false !== strpos( $title_format, '%blog_title%', 0 ) ) {
1231
  $title_format = str_replace( '%blog_title%', get_bloginfo( 'name' ), $title_format );
1232
  }
1233
+ $title_format = $this->apply_cf_fields( $title_format );
1234
  if ( false !== strpos( $title_format, '%post_title%', 0 ) ) {
1235
  $title_format = str_replace( '%post_title%', $this->get_preview_snippet_title_helper( $title ), $title_format );
1236
  }
1362
  return $info;
1363
  }
1364
  global $post, $aioseop_options, $wp_query;
1365
+ $title = '';
1366
+ $url = '';
1367
+ $description = '';
1368
+ $term = '';
1369
+ $category = '';
1370
+ $p = $post;
1371
+ $w = $wp_query;
1372
  if ( ! is_object( $post ) ) {
1373
  $post = $this->get_queried_object();
1374
  }
1400
  $this->is_front_page = false;
1401
  }
1402
  if ( 'page' === get_option( 'show_on_front' ) ) {
1403
+ if ( is_page() && get_option( 'page_on_front' ) == $post->ID ) {
1404
  $this->is_front_page = true;
1405
+ } elseif ( get_option( 'page_for_posts' ) == $post->ID ) {
1406
  $wp_query->is_home = true;
1407
  }
1408
  }
1464
  }
1465
  $description = $this->internationalize( $description );
1466
  }
1467
+ if ( true == $this->is_front_page ) {
1468
  // $title_format = $aioseop_options['aiosp_home_page_title_format'];
1469
  $title_format = ''; // Not sure why this needs to be this way, but we should extract all this out to figure out what's going on.
1470
  }
1689
  if ( is_front_page() ) {
1690
  if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
1691
  global $post;
1692
+ if ( 'page' == get_option( 'show_on_front' ) && is_page() && get_option( 'page_on_front' ) == $post->ID ) {
1693
  $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1694
  if ( ! $title ) {
1695
  $title = $this->internationalize( $post->post_title );
1716
  // #1616 - Avoid trying to get property of non-object when no posts are present on the homepage.
1717
  global $post;
1718
 
1719
+ if ( null === $post ) {
1720
  $post_id = get_option( 'page_on_front' );
1721
  } else {
1722
  $post_id = $post->ID;
1723
  }
1724
 
1725
+ if ( is_post_type_archive() && is_post_type_archive( 'product' ) && function_exists( 'wc_get_page_id' ) ) {
1726
+ $post_id = wc_get_page_id( 'shop' );
1727
+ if ( $post_id ) {
1728
+ $post = get_post( $post_id );
1729
+ if ( wc_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
1730
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1731
+ }
1732
+ // $title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
1733
+ if ( ! $title ) {
1734
+ $title = $this->internationalize( get_post_meta( $post_id, '_aioseop_title', true ) );
1735
+ } // This is/was causing the first product to come through.
1736
+ if ( ! $title ) {
1737
+ $title = $this->internationalize( $post->post_title );
1738
+ }
1739
+ if ( ! $title ) {
1740
+ $title = $this->internationalize( $this->get_original_title( '', false ) );
1741
+ }
 
 
1742
 
1743
+ $title = $this->apply_page_title_format( $title, $post );
1744
+ $title = $this->paged_title( $title );
1745
+ $title = apply_filters( 'aioseop_title_page', $title );
1746
 
1747
+ return $title;
1748
+ }
1749
  }
1750
 
1751
  // this is returned for woo.
1771
  if ( null === $post ) {
1772
  return false;
1773
  }
1774
+
1775
+ $home_title = $this->internationalize( $aioseop_options['aiosp_home_title'] );
1776
+ if ( $this->is_static_front_page() && ( $home_title ) ) {
1777
  if ( ! empty( $aioseop_options['aiosp_home_page_title_format'] ) ) {
1778
  $home_title = $this->apply_page_title_format( $home_title, $post, $aioseop_options['aiosp_home_page_title_format'] );
1779
  }
1810
 
1811
  return $title;
1812
  }
1813
+ } elseif ( is_post_type_archive( 'product' ) && function_exists( 'wc_get_page_id' ) ) {
1814
+ $post_id = wc_get_page_id( 'shop' );
1815
+ if ( $post_id ) {
1816
+ $post = get_post( $post_id );
1817
+ // Too far down? -mrt.
1818
+ $title = $this->internationalize( get_post_meta( $post->ID, '_aioseop_title', true ) );
1819
+ if ( ! $title ) {
1820
+ $title = $this->internationalize( $post->post_title );
1821
+ }
1822
+ if ( ! $title ) {
1823
+ $title = $this->internationalize( $this->get_original_title( '', false ) );
1824
+ }
1825
+ $title = $this->apply_page_title_format( $title, $post );
1826
+ $title = $this->paged_title( $title );
1827
+ $title = apply_filters( 'aioseop_title_page', $title );
1828
 
1829
+ return $title;
1830
+ }
1831
  } elseif ( is_single() || $this->check_singular() ) {
1832
  // We're not in the loop :(.
1833
  if ( null === $post ) {
1855
 
1856
  return apply_filters( 'aioseop_title_single', $title );
1857
  } elseif ( is_search() && isset( $s ) && ! empty( $s ) ) {
1858
+ $search = esc_attr( stripslashes( $s ) );
1859
  $title_format = $aioseop_options['aiosp_search_title_format'];
1860
  $title = str_replace( '%site_title%', $this->internationalize( get_bloginfo( 'name' ) ), $title_format );
1861
  if ( false !== strpos( $title, '%blog_title%', 0 ) ) {
1875
  return $title;
1876
  } elseif ( is_tag() ) {
1877
  global $utw;
1878
+ $tag = '';
1879
+ $tag_description = '';
1880
  if ( $utw ) {
1881
  $tags = $utw->GetCurrentTagSet();
1882
  $tag = $tags[0]->tag;
2061
  if ( false !== $has_filter ) {
2062
  add_filter( 'wp_title', array( $this, 'wp_title' ), $has_filter );
2063
  }
2064
+ $title = trim( $title );
2065
+ if ( $title ) {
2066
  return trim( $title );
2067
  }
2068
  }
2078
  $title = $this->internationalize( single_post_title( '', false ) );
2079
  } elseif ( is_search() && isset( $s ) && ! empty( $s ) ) {
2080
  $search = esc_attr( stripslashes( $s ) );
2081
+ $title = $search;
2082
  } elseif ( ( is_tax() || is_category() ) && ! is_feed() ) {
2083
  $category_name = $this->ucwords( $this->internationalize( single_cat_title( '', false ) ) );
2084
  $title = $category_name;
2099
  }
2100
  } elseif ( is_author() ) {
2101
  $author = get_userdata( get_query_var( 'author' ) );
2102
+ if ( false === $author ) {
2103
  global $wp_query;
2104
  $author = $wp_query->get_queried_object();
2105
  }
2106
+ if ( false !== $author ) {
2107
  $title = $author->display_name;
2108
  }
2109
  } elseif ( is_day() ) {
2175
  */
2176
  function apply_page_title_format( $title, $p = null, $title_format = '' ) {
2177
  global $aioseop_options;
2178
+ if ( null === $p ) {
2179
  global $post;
2180
  } else {
2181
  $post = $p;
2228
  if ( false !== strpos( $new_title, "%{$type}_title%", 0 ) ) {
2229
  $new_title = str_replace( "%{$type}_title%", $title, $new_title );
2230
  }
2231
+ if ( 'post' == $type ) {
2232
  if ( false !== strpos( $new_title, '%category%', 0 ) ) {
2233
  $new_title = str_replace( '%category%', $category, $new_title );
2234
  }
2386
  * @return string
2387
  */
2388
  function apply_post_title_format( $title, $category = '', $p = null ) {
2389
+ if ( null === $p ) {
2390
  global $post;
2391
  } else {
2392
  $post = $p;
2407
  */
2408
  function get_post_title_format( $title_type = 'post', $p = null ) {
2409
  global $aioseop_options;
2410
+ if ( ( 'post' != $title_type ) && ( 'archive' != $title_type ) ) {
2411
  return false;
2412
  }
2413
  $title_format = "%{$title_type}_title% | %site_title%";
2417
 
2418
  if ( ! empty( $aioseop_options['aiosp_cpostactive'] ) ) {
2419
  $wp_post_types = $aioseop_options['aiosp_cpostactive'];
2420
+
2421
+ $is_post_type_archive = ( 'archive' == $title_type ) && is_post_type_archive( $wp_post_types );
2422
+ $is_singular_post = ( 'post' == $title_type ) && $this->is_singular( $wp_post_types, $p );
2423
+
2424
+ if ( $is_post_type_archive || $is_singular_post ) {
2425
+ if ( $is_post_type_archive ) {
2426
+ $prefix = "aiosp_{$title_type}_";
2427
+ } else {
2428
+ $prefix = 'aiosp_';
2429
+ }
2430
+
 
2431
  $post_type = get_post_type( $p );
2432
 
2433
  if ( ! empty( $aioseop_options[ "{$prefix}{$post_type}_title_format" ] ) ) {
2465
  */
2466
  function is_static_posts_page() {
2467
  static $is_posts_page = null;
2468
+ if ( null !== $is_posts_page ) {
2469
  return $is_posts_page;
2470
  }
2471
  $post = $this->get_queried_object();
2472
+ $is_posts_page = ( 'page' == get_option( 'show_on_front' ) && is_home() && ! empty( $post ) && get_option( 'page_for_posts' ) == $post->ID );
2473
 
2474
  return $is_posts_page;
2475
  }
2482
  * @return bool|null
2483
  */
2484
  function is_static_front_page() {
2485
+ if ( isset( $this->is_front_page ) && null !== $this->is_front_page ) {
2486
  return $this->is_front_page;
2487
  }
2488
  $post = $this->get_queried_object();
2489
+ $this->is_front_page = ( 'page' == get_option( 'show_on_front' ) && is_page() && ! empty( $post ) && get_option( 'page_on_front' ) == $post->ID );
2490
 
2491
  return $this->is_front_page;
2492
  }
2756
  $description = '';
2757
  if ( is_author() && $this->show_page_description() ) {
2758
  $description = $this->internationalize( get_the_author_meta( 'description' ) );
2759
+ } elseif ( function_exists( 'wc_get_page_id' ) && is_post_type_archive( 'product' ) ) {
2760
+ $post_id = wc_get_page_id( 'shop' );
2761
+ if ( $post_id ) {
2762
+ $post = get_post( $post_id );
2763
+ // $description = $this->get_post_description( $post );
2764
+ // $description = $this->apply_cf_fields( $description );
2765
+ if ( ! ( wc_get_page_id( 'shop' ) == get_option( 'page_on_front' ) ) ) {
2766
+ $description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
2767
+ } elseif ( wc_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
2768
+ // $description = $this->get_aioseop_description( $post );
2769
+ $description = trim( $this->internationalize( get_post_meta( $post->ID, '_aioseop_description', true ) ) );
2770
+ } elseif ( wc_get_page_id( 'shop' ) == get_option( 'page_on_front' ) && empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
2771
+ $description = $this->get_aioseop_description( $post );
2772
+ }
2773
  }
2774
  } elseif ( is_front_page() ) {
2775
  $description = $this->get_aioseop_description( $post );
2786
  }
2787
 
2788
  // #1308 - we want to make sure we are ignoring php version only in the admin area while editing the post, so that it does not impact #932.
2789
+ $screen = is_admin() ? get_current_screen() : null;
2790
  $ignore_php_version = $screen && isset( $screen->id ) && 'post' === $screen->id;
2791
 
2792
  $truncate = false;
3002
  if ( $query->is_404 || $query->is_search ) {
3003
  return false;
3004
  }
3005
+
3006
  // this boolean will determine if any additional parameters will be added to the final link or not.
3007
  // this is especially useful in issues such as #491.
3008
  $add_query_params = false;
3009
+ $link = '';
3010
+ $haspost = false;
3011
  if ( ! empty( $query->posts ) ) {
3012
  $haspost = count( $query->posts ) > 0;
3013
  }
3028
  return false;
3029
  }
3030
  $add_query_params = true;
3031
+ } elseif ( $query->is_home && ( get_option( 'show_on_front' ) == 'page' ) ) {
3032
+ $pageid = get_option( 'page_for_posts' );
3033
+ if ( $pageid ) {
3034
+ $link = aioseop_get_permalink( $pageid );
3035
+ }
3036
  } elseif ( is_front_page() || ( $query->is_home && ( get_option( 'show_on_front' ) != 'page' || ! get_option( 'page_for_posts' ) ) ) ) {
3037
  if ( function_exists( 'icl_get_home_url' ) ) {
3038
  $link = icl_get_home_url();
3056
  $link = get_tag_link( $tag->term_id );
3057
  }
3058
  } elseif ( $query->is_day && $haspost ) {
3059
+ $link = get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
3060
  $add_query_params = true;
3061
  } elseif ( $query->is_month && $haspost ) {
3062
+ $link = get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
3063
  $add_query_params = true;
3064
  } elseif ( $query->is_year && $haspost ) {
3065
+ $link = get_year_link( get_query_var( 'year' ) );
3066
  $add_query_params = true;
3067
  } elseif ( $query->is_tax && $haspost ) {
3068
  $taxonomy = get_query_var( 'taxonomy' );
3070
  if ( ! empty( $term ) ) {
3071
  $link = get_term_link( $term, $taxonomy );
3072
  }
3073
+ } elseif ( $query->is_archive && function_exists( 'get_post_type_archive_link' ) ) {
3074
+ $post_type = get_query_var( 'post_type' );
3075
+ if ( $post_type && is_array( $post_type ) ) {
3076
  $post_type = reset( $post_type );
3077
  }
3078
  $link = get_post_type_archive_link( $post_type );
3112
  $page_name = $wp_rewrite->pagination_base;
3113
  }
3114
  if ( ! empty( $page ) && $page > 1 ) {
3115
+ if ( get_query_var( 'page' ) == $page ) {
3116
  if ( get_query_var( 'p' ) ) {
3117
  // non-pretty urls.
3118
  $link = add_query_arg( 'page', $page, $link );
3144
  global $aioseop_options;
3145
  global $aioseop_keywords;
3146
  global $post;
3147
+
3148
+ $opts = $this->meta_opts;
3149
+ $blog_page = aiosp_common::get_blog_page( $post );
3150
  if ( ( is_front_page() && $aioseop_options['aiosp_home_keywords'] && ! $this->is_static_posts_page() ) || $this->is_static_front_page() ) {
3151
  if ( ! empty( $aioseop_options['aiosp_use_static_home_info'] ) ) {
3152
  $keywords = $this->get_all_keywords();
3155
  }
3156
  } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && $this->is_static_posts_page() ) {
3157
  $keywords = stripslashes( $this->internationalize( $opts['aiosp_keywords'] ) ); // And if option = use page set keywords instead of keywords from recent posts.
3158
+ } elseif ( $blog_page && empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) ) {
3159
  $keywords = stripslashes( $this->internationalize( get_post_meta( $blog_page->ID, '_aioseop_keywords', true ) ) );
3160
  } elseif ( empty( $aioseop_options['aiosp_dynamic_postspage_keywords'] ) && ( is_archive() || is_post_type_archive() ) ) {
3161
  $keywords = '';
3533
  $field = $p . '_title_format';
3534
  $name = $post_objs[ $p ]->labels->singular_name;
3535
  if ( ! isset( $this->default_options[ $field ] ) ) {
3536
+ $this->default_options[ $field ] = array(
3537
  /* translators: The title format is the template that is used to format the title for each post of a certain post type (Posts, Pages, etc.). */
3538
+ 'name' => "$name " . __( 'Title Format', 'all-in-one-seo-pack' ) . "<br />($p)",
3539
  'type' => 'text',
3540
  'default' => '%post_title% | %site_title%',
3541
  'condshow' => array(
3660
  * @return mixed
3661
  */
3662
  function filter_submit( $submit ) {
3663
+ $submit['Submit_Default'] = array(
3664
  'type' => 'submit',
3665
  'class' => 'aioseop_reset_settings_button button-secondary',
3666
  /* translators: This is the text of a button that allows users to reset the General Settings to their default values. */
3667
  'value' => __( 'Reset General Settings to Defaults', 'all-in-one-seo-pack' ) . ' &raquo;',
3668
  );
3669
+ $submit['Submit_All_Default'] = array(
3670
  'type' => 'submit',
3671
  'class' => 'aioseop_reset_settings_button button-secondary',
3672
  /* translators: This is the text of a button that allows users to reset all settings across the entire plugin to their default values. */
3690
  if ( AIOSEOPPRO ) {
3691
  global $aioseop_update_checker;
3692
  }
3693
+ if ( true === $delete ) {
3694
 
3695
  if ( AIOSEOPPRO ) {
3696
  $license_key = '';
3711
 
3712
  if ( AIOSEOPPRO ) {
3713
  foreach ( $default_options as $k => $v ) {
3714
+ if ( 'aiosp_license_key' != $k ) {
3715
  $this->options[ $k ] = $v;
3716
  }
3717
  }
3736
  * @return mixed
3737
  */
3738
  function filter_settings( $settings, $location, $current ) {
3739
+ if ( null == $location ) {
3740
  $prefix = $this->prefix;
3741
 
3742
  foreach ( array( 'seopostcol', 'seocustptcol', 'debug_info', 'max_words_excerpt' ) as $opt ) {
3749
  $settings['aiosp_license_key']['size'] = 38;
3750
  }
3751
  }
3752
+ } elseif ( 'aiosp' == $location ) {
3753
  global $post, $aioseop_sitemap;
3754
  $prefix = $this->get_prefix( $location ) . $location . '_';
3755
  if ( ! empty( $post ) ) {
3776
  global $post;
3777
  $info = $this->get_page_snippet_info();
3778
 
3779
+ $title = $info['title'];
3780
  $description = $info['description'];
3781
+ $keywords = $info['keywords'];
3782
 
3783
  $settings[ "{$prefix}title" ]['placeholder'] = $this->html_entity_decode( $title );
3784
  $settings[ "{$prefix}description" ]['placeholder'] = $this->html_entity_decode( $description );
3819
  * @return mixed
3820
  */
3821
  function filter_options( $options, $location ) {
3822
+ if ( 'aiosp' == $location ) {
3823
  global $post;
3824
  if ( ! empty( $post ) ) {
3825
  $prefix = $this->prefix;
3826
  $post_type = get_post_type( $post );
3827
  foreach ( array( 'noindex', 'nofollow' ) as $no ) {
3828
  if ( empty( $this->options[ 'aiosp_cpost' . $no ] ) || ( ! in_array( $post_type, $this->options[ 'aiosp_cpost' . $no ] ) ) ) {
3829
+ if ( isset( $options[ "{$prefix}{$no}" ] ) && ( 'on' != $options[ "{$prefix}{$no}" ] ) ) {
3830
  unset( $options[ "{$prefix}{$no}" ] );
3831
  }
3832
  }
3833
  }
3834
  }
3835
  }
3836
+ if ( null == $location ) {
3837
  $prefix = $this->prefix;
3838
+ if ( isset( $options[ "{$prefix}use_original_title" ] ) && ( '' === $options[ "{$prefix}use_original_title" ] ) ) {
3839
  $options[ "{$prefix}use_original_title" ] = 0;
3840
  }
3841
  }
3874
  * Checks whether All in One SEO Pack is enabled for this page.
3875
  *
3876
  * @since ?
3877
+ * @since 3.3 Show Google Analytics if post type isn't checked in options.
3878
  *
3879
  * @return bool
3880
  */
3924
 
3925
  $this->meta_opts = $this->get_current_options( array(), 'aiosp' );
3926
 
3927
+ $aiosp_disable = false;
3928
 
3929
  if ( ! empty( $this->meta_opts ) ) {
3930
  if ( isset( $this->meta_opts['aiosp_disable'] ) ) {
3931
  $aiosp_disable = $this->meta_opts['aiosp_disable'];
3932
  }
 
 
 
3933
  }
3934
 
3935
  $aiosp_disable = apply_filters( 'aiosp_disable', $aiosp_disable ); // API filter to disable AIOSEOP.
3936
 
3937
  if ( $aiosp_disable ) {
 
 
 
 
 
 
 
3938
  return false;
3939
  }
3940
 
3941
+ if ( ! empty( $this->meta_opts ) && true == $this->meta_opts['aiosp_disable'] ) {
3942
  return false;
3943
  }
3944
 
4059
  add_action( 'after_plugin_row_' . AIOSEOP_PLUGIN_BASENAME, array( $aioseop_update_checker, 'add_plugin_row' ) );
4060
  }
4061
  } else {
4062
+ if ( '1' == $aioseop_options['aiosp_can'] || 'on' == $aioseop_options['aiosp_can'] ) {
4063
  remove_action( 'wp_head', 'rel_canonical' );
4064
  }
4065
  // Analytics.
4123
  global $wp_query;
4124
  if ( is_attachment() ) {
4125
 
4126
+ $url = $this->aiosp_mrt_get_url( $wp_query );
4127
  $unique_desc = '';
4128
  if ( $url ) {
4129
  $matches = array();
4154
  return;
4155
  }
4156
 
4157
+ $post = $this->get_queried_object();
4158
  $description = apply_filters( 'aioseop_amp_description', $this->get_main_description( $post ) ); // Get the description.
4159
 
4160
  // To disable AMP meta description just __return_false on the aioseop_amp_description filter.
4176
  if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) ) {
4177
  $desc_attr = '';
4178
  }
4179
+ $desc_attr = apply_filters( 'aioseop_amp_description_attributes', $desc_attr );
4180
  $meta_string .= sprintf( "<meta name=\"description\" %s content=\"%s\" />\n", $desc_attr, $description );
4181
  }
4182
  if ( ! empty( $meta_string ) ) {
4200
  return empty( $post_type ) || in_array( get_post_type(), $aioseop_options['aiosp_cpostactive'], true );
4201
  }
4202
 
4203
+ /**
4204
+ * Checks to see if Google Analytics should be excluded from the current page.
4205
+ *
4206
+ * Looks at both the individual post settings and the General Settings.
4207
+ *
4208
+ * @since 3.3.0
4209
+ *
4210
+ * @return bool
4211
+ */
4212
+ function analytics_excluded() {
4213
+
4214
+ $this->meta_opts = $this->get_current_options( array(), 'aiosp' ); // Get page-specific options.
4215
+
4216
+ $aiosp_disable_analytics = false;
4217
+
4218
+ if ( isset( $this->meta_opts['aiosp_disable_analytics'] ) ) {
4219
+ $aiosp_disable_analytics = $this->meta_opts['aiosp_disable_analytics'];
4220
+ }
4221
+
4222
+ if ( $aiosp_disable_analytics || ! aioseop_option_isset( 'aiosp_google_analytics_id' ) ) {
4223
+ return true;
4224
+ }
4225
+ return false;
4226
+ }
4227
+
4228
  /**
4229
  * WP Head
4230
  *
4241
  }
4242
 
4243
  if ( ! $this->is_page_included() ) {
 
4244
  /**
4245
  * The aioseop_robots_meta filter hook.
4246
  *
4253
  * @return string
4254
  */
4255
  $robots_meta = apply_filters( 'aioseop_robots_meta', $this->get_robots_meta() );
 
4256
  if ( ! empty( $robots_meta ) && 'index,follow' !== $robots_meta ) {
4257
+ echo sprintf( '<meta name="robots" content="%s"', esc_attr( $robots_meta ) ) . " />\n";
4258
  }
4259
 
4260
  if ( ! empty( $old_wp_query ) ) {
4263
  unset( $old_wp_query );
4264
  }
4265
 
4266
+ if ( ! $this->analytics_excluded() ) {
4267
+ remove_action( 'aioseop_modules_wp_head', array( $this, 'aiosp_google_analytics' ) );
4268
+ add_action( 'wp_head', array( $this, 'aiosp_google_analytics' ) );
4269
+ }
4270
+
4271
  return;
4272
  }
4273
 
4318
 
4319
  // This outputs robots meta tags and custom canonical URl on WooCommerce product archive page.
4320
  // See Github issue https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/755.
4321
+ if ( function_exists( 'wc_get_page_id' ) && is_post_type_archive( 'product' ) ) {
4322
+ $post_id = wc_get_page_id( 'shop' );
4323
+ if ( $post_id ) {
4324
+ $post = get_post( $post_id );
4325
+
4326
+ global $posts;
4327
+ $opts = $this->get_current_options( array(), 'aiosp', null, $post );
4328
+ $this->meta_opts = $this->get_current_options( array(), 'aiosp', null, $post );
4329
+ $posts = array();
4330
+ $posts[] = $post;
4331
+ }
4332
  }
4333
 
4334
+ $posts = $save_posts;
4335
  // Handle the description format.
4336
  // We are not going to mandate that post description needs to be present because the content could be derived from a custom field too.
4337
  if ( ! ( is_front_page() && is_paged() ) ) {
4356
  if ( isset( $aioseop_options['aiosp_togglekeywords'] ) ) {
4357
  $togglekeywords = $aioseop_options['aiosp_togglekeywords'];
4358
  }
4359
+ if ( 0 == $togglekeywords && ! ( is_front_page() && is_paged() ) ) {
4360
  $keywords = $this->get_main_keywords();
4361
  $keywords = $this->apply_cf_fields( $keywords );
4362
  $keywords = apply_filters( 'aioseop_keywords', $keywords );
4365
  if ( isset( $meta_string ) ) {
4366
  $meta_string .= "\n";
4367
  }
4368
+ $keywords = wp_filter_nohtml_kses( str_replace( '"', '', $keywords ) );
4369
+ $key_attr = apply_filters( 'aioseop_keywords_attributes', '' );
4370
  $meta_string .= sprintf( "<meta name=\"keywords\" %s content=\"%s\" />\n", $key_attr, $keywords );
4371
  }
4372
  }
4449
  if ( ! empty( $next ) ) {
4450
  $meta_string .= '<link rel="next" href="' . esc_url( $next ) . "\" />\n";
4451
  }
4452
+ if ( null != $meta_string ) {
4453
  echo "$meta_string\n";
4454
  }
4455
 
4456
  // Handle Schema.
4457
+ if ( version_compare( PHP_VERSION, '5.5', '>=' ) ) {
4458
+ if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) && boolval( $aioseop_options['aiosp_schema_markup'] ) ) {
4459
+ $aioseop_schema = new AIOSEOP_Schema_Builder();
4460
+ $aioseop_schema->display_json_ld_head_script();
4461
+ }
4462
+ } else {
4463
+ if ( ! empty( $aioseop_options['aiosp_schema_markup'] ) && (bool) $aioseop_options['aiosp_schema_markup'] ) {
4464
+ $aioseop_schema = new AIOSEOP_Schema_Builder();
4465
+ $aioseop_schema->display_json_ld_head_script();
4466
+ }
4467
  }
4468
 
4469
  // Handle canonical links.
4638
  */
4639
  do_action( 'aioseop_after_apply_description_format' );
4640
 
4641
+ return esc_html( $description );
4642
  }
4643
 
4644
  /**
4654
  */
4655
  function get_robots_meta() {
4656
  global $aioseop_options;
4657
+ $page_number = $this->get_page_number();
4658
+ $post_type = get_post_type();
4659
+ $noindex = false;
4660
+ $nofollow = false;
4661
+ $aiosp_noindex = '';
4662
+ $aiosp_nofollow = '';
4663
+ $tax_noindex = array();
4664
+ $is_static_page = false;
4665
+ $is_static_posts_page = false;
4666
  $is_woocommerce_shop_page = false;
4667
 
4668
  if ( isset( $aioseop_options['aiosp_tax_noindex'] ) && ! empty( $aioseop_options['aiosp_tax_noindex'] ) ) {
4669
  $tax_noindex = $aioseop_options['aiosp_tax_noindex'];
4670
  }
4671
 
4672
+ if ( is_front_page() && 0 === $page_number ) {
4673
  return $this->get_robots_meta_string( false, false );
4674
  }
4675
 
4683
  }
4684
 
4685
  if ( $is_static_posts_page || $is_woocommerce_shop_page ) {
4686
+ $post_type = 'page';
4687
  $is_static_page = true;
4688
  }
4689
 
4692
  ! is_author() &&
4693
  ! is_search()
4694
  ) {
4695
+ $aiosp_noindex = $this->get_noindex_nofollow_meta_value( 'noindex' );
4696
  $aiosp_nofollow = $this->get_noindex_nofollow_meta_value( 'nofollow' );
4697
  }
4698
 
4699
+ if ( 'on' === $aiosp_noindex || ( ! empty( $aioseop_options['aiosp_paginated_noindex'] ) && $page_number > 1 ) ) {
 
 
4700
  $noindex = true;
4701
  }
4702
+ if ( 'on' === $aiosp_nofollow || ( ! empty( $aioseop_options['aiosp_paginated_nofollow'] ) && $page_number > 1 ) ) {
 
 
4703
  $nofollow = true;
4704
  }
4705
 
4764
  * @return string
4765
  */
4766
  private function get_noindex_nofollow_meta_value( $key ) {
4767
+ $meta = array();
4768
+ $meta_key = '_aioseop_' . $key;
4769
  $meta_value = '';
4770
 
4771
  $queried_object = get_queried_object();
4832
  */
4833
  private function check_singular() {
4834
  global $wp_query, $post;
4835
+ $is_singular = false;
4836
  if ( is_singular() ) {
4837
  // #1297 - support for bbpress 'reply' post type.
4838
  if ( $post && 'reply' === $post->post_type ) {
4839
+ $is_singular = true;
4840
  }
4841
  }
4842
  return $is_singular;
4871
  * @return array
4872
  */
4873
  function get_prev_next_links( $post = null ) {
4874
+ $prev = '';
4875
+ $next = '';
4876
  $page = $this->get_page_number();
4877
  if ( is_home() || is_archive() || is_paged() ) {
4878
  global $wp_query;
5006
  * @return bool
5007
  */
5008
  function save_post_data( $id ) {
5009
+ $awmp_edit = null;
5010
+ $nonce = null;
5011
  if ( empty( $_POST ) ) {
5012
  return false;
5013
  }
5125
  $title = $t['title'];
5126
  }
5127
  $header .= '<li><label class="aioseop_header_nav"><a class="aioseop_header_tab' . $active . '" href="#' . $t['id'] . '">' . $title . '</a></label></li>';
5128
+ $active = '';
5129
  }
5130
  $header .= '</ul>';
5131
 
5283
  * @param $id
5284
  */
5285
  function save_category_metaboxes( $id ) {
5286
+ $awmp_edit = null;
5287
+ $nonce = null;
5288
  if ( isset( $_POST['aiosp_edit'] ) ) {
5289
  $awmp_edit = $_POST['aiosp_edit'];
5290
  }
5382
  }
5383
  */
5384
 
5385
+ if ( isset( $_POST ) && isset( $_POST['module'] ) && isset( $_POST['nonce-aioseop'] ) && ( 'All_in_One_SEO_Pack' == $_POST['module'] ) && wp_verify_nonce( $_POST['nonce-aioseop'], 'aioseop-nonce' ) ) {
5386
  if ( isset( $_POST['Submit'] ) && AIOSEOPPRO ) {
5387
  if ( isset( $_POST['aiosp_custom_menu_order'] ) ) {
5388
  $custom_menu_order = $_POST['aiosp_custom_menu_order'];
5406
  if ( ! AIOSEOPPRO ) {
5407
  if ( ! empty( $this->pointers ) ) {
5408
  foreach ( $this->pointers as $k => $p ) {
5409
+ if ( ! empty( $p['pointer_scope'] ) && ( 'global' == $p['pointer_scope'] ) ) {
5410
  unset( $this->pointers[ $k ] );
5411
  }
5412
  }
5553
  if ( $item != $file ) {
5554
  $order[] = $item;
5555
  }
5556
+ if ( 0 == $index ) {
5557
  $order[] = $file;
5558
  }
5559
  }
5753
  */
5754
  function check_recently_activated_modules() {
5755
  global $aioseop_options;
5756
+ $options = get_option( 'aioseop_options', array() );
5757
  $modules_before = array();
5758
  $modules_now = array();
5759
  if ( array_key_exists( 'modules', $aioseop_options ) && array_key_exists( 'aiosp_feature_manager_options', $aioseop_options['modules'] ) ) {
5772
  }
5773
 
5774
  $action = 'deactivate';
5775
+ $diff = array_diff( $modules_before, $modules_now );
5776
  if ( count( $modules_now ) > count( $modules_before ) ) {
5777
  $action = 'activate';
5778
+ $diff = array_diff( $modules_now, $modules_before );
5779
  }
5780
 
5781
  if ( $diff ) {
all_in_one_seo_pack.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: All In One SEO Pack
5
  Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
6
  Description: Out-of-the-box SEO for WordPress. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 50 million downloads since 2007.
7
- Version: 3.2.3
8
  Author: Michael Torbert
9
  Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
10
  Text Domain: all-in-one-seo-pack
@@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
32
  * The original WordPress SEO plugin.
33
  *
34
  * @package All-in-One-SEO-Pack
35
- * @version 3.2.3
36
  */
37
 
38
  if ( ! defined( 'AIOSEOPPRO' ) ) {
@@ -46,7 +46,7 @@ if ( ! defined( 'AIOSEOP_PLUGIN_NAME' ) ) {
46
  }
47
  }
48
  if ( ! defined( 'AIOSEOP_VERSION' ) ) {
49
- define( 'AIOSEOP_VERSION', '3.2.3' );
50
  }
51
 
52
  /*
@@ -128,7 +128,8 @@ if ( ! defined( 'WP_PLUGIN_DIR' ) ) {
128
  }
129
 
130
  global $aiosp, $aioseop_options, $aioseop_modules, $aioseop_module_list, $aiosp_activation, $aioseop_mem_limit, $aioseop_get_pages_start, $aioseop_admin_menu;
131
- $aioseop_get_pages_start = $aioseop_admin_menu = 0;
 
132
 
133
  if ( AIOSEOPPRO ) {
134
  global $aioseop_update_checker;
@@ -208,8 +209,8 @@ if ( ! empty( $aioseop_mem_limit ) ) {
208
  }
209
  }
210
 
211
- $aiosp_activation = false;
212
- // list all available modules here.
213
  $aioseop_module_list = array(
214
  'sitemap',
215
  'opengraph',
@@ -481,7 +482,8 @@ if ( ! function_exists( 'aioseop_init_class' ) ) {
481
  }
482
 
483
  add_action( 'init', array( $aiosp, 'add_hooks' ) );
484
- add_action( 'admin_init', array( $aioseop_updates, 'version_updates' ), 11 );
 
485
 
486
  // phpcs:ignore Squiz.Commenting.InlineComment.InvalidEndChar
487
  // add_action( 'admin_init', 'aioseop_review_plugin_notice' );
4
  Plugin Name: All In One SEO Pack
5
  Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
6
  Description: Out-of-the-box SEO for WordPress. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 50 million downloads since 2007.
7
+ Version: 3.2.7
8
  Author: Michael Torbert
9
  Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
10
  Text Domain: all-in-one-seo-pack
32
  * The original WordPress SEO plugin.
33
  *
34
  * @package All-in-One-SEO-Pack
35
+ * @version 3.2.7
36
  */
37
 
38
  if ( ! defined( 'AIOSEOPPRO' ) ) {
46
  }
47
  }
48
  if ( ! defined( 'AIOSEOP_VERSION' ) ) {
49
+ define( 'AIOSEOP_VERSION', '3.2.7' );
50
  }
51
 
52
  /*
128
  }
129
 
130
  global $aiosp, $aioseop_options, $aioseop_modules, $aioseop_module_list, $aiosp_activation, $aioseop_mem_limit, $aioseop_get_pages_start, $aioseop_admin_menu;
131
+ $aioseop_get_pages_start = 0;
132
+ $aioseop_admin_menu = 0;
133
 
134
  if ( AIOSEOPPRO ) {
135
  global $aioseop_update_checker;
209
  }
210
  }
211
 
212
+ $aiosp_activation = false;
213
+ // List all available modules here.
214
  $aioseop_module_list = array(
215
  'sitemap',
216
  'opengraph',
482
  }
483
 
484
  add_action( 'init', array( $aiosp, 'add_hooks' ) );
485
+ add_action( 'plugins_loaded', array( $aioseop_updates, 'version_updates' ), 11 );
486
+
487
 
488
  // phpcs:ignore Squiz.Commenting.InlineComment.InvalidEndChar
489
  // add_action( 'admin_init', 'aioseop_review_plugin_notice' );
inc/aioseop_updates_class.php CHANGED
@@ -66,7 +66,7 @@ class AIOSEOP_Updates {
66
  set_transient( '_aioseop_activation_redirect', true, 30 ); // Sets 30 second transient for welcome screen redirect on activation.
67
  }
68
  delete_transient( 'aioseop_feed' );
69
- add_action( 'admin_init', array( $this, 'aioseop_welcome' ) );
70
 
71
  }
72
 
@@ -145,10 +145,12 @@ class AIOSEOP_Updates {
145
  $this->reset_flush_rewrite_rules_201906();
146
  }
147
 
 
148
  if (
149
- version_compare( $old_version, '3.2', '<' )
 
150
  ) {
151
- $this->update_schema_markup();
152
  }
153
  }
154
 
@@ -367,7 +369,7 @@ class AIOSEOP_Updates {
367
  *
368
  * @since 3.2
369
  */
370
- public function update_schema_markup() {
371
  global $aiosp;
372
  global $aioseop_options;
373
 
66
  set_transient( '_aioseop_activation_redirect', true, 30 ); // Sets 30 second transient for welcome screen redirect on activation.
67
  }
68
  delete_transient( 'aioseop_feed' );
69
+ //add_action( 'admin_init', array( $this, 'aioseop_welcome' ) ); //Uncomment for welcome screen.
70
 
71
  }
72
 
145
  $this->reset_flush_rewrite_rules_201906();
146
  }
147
 
148
+ // Cause the update to occur again for 3.2.6.
149
  if (
150
+ version_compare( $old_version, '3.2', '<' ) ||
151
+ version_compare( $old_version, '3.2.6', '<' )
152
  ) {
153
+ $this->update_schema_markup_201907();
154
  }
155
  }
156
 
369
  *
370
  * @since 3.2
371
  */
372
+ public function update_schema_markup_201907() {
373
  global $aiosp;
374
  global $aioseop_options;
375
 
inc/extlib/OAuth.php DELETED
@@ -1,939 +0,0 @@
1
- <?php
2
- /* OAuth PHP Library
3
- * http://oauth.googlecode.com/svn/code/php/
4
- *
5
- * License: The MIT License
6
- *
7
- * Copyright (c) 2007 Andy Smith
8
- *
9
- * Permission is hereby granted, free of charge, to any person obtaining a copy
10
- * of this software and associated documentation files (the "Software"), to deal
11
- * in the Software without restriction, including without limitation the rights
12
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
- * copies of the Software, and to permit persons to whom the Software is
14
- * furnished to do so, subject to the following conditions:
15
- *
16
- * The above copyright notice and this permission notice shall be included in
17
- * all copies or substantial portions of the Software.
18
- *
19
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
- * THE SOFTWARE.
26
- *
27
- */
28
- // vim: foldmethod=marker
29
-
30
- /* Generic exception class
31
- */
32
- if ( !class_exists( 'OAuthException' ) ) {
33
- class OAuthException extends Exception {
34
- // pass
35
- }
36
- }
37
-
38
- if ( !class_exists( 'OAuthConsumer' ) ) {
39
- class OAuthConsumer {
40
- public $key;
41
- public $secret;
42
-
43
- function __construct($key, $secret, $callback_url=NULL) {
44
- $this->key = $key;
45
- $this->secret = $secret;
46
- $this->callback_url = $callback_url;
47
- }
48
-
49
- function __toString() {
50
- return "OAuthConsumer[key=$this->key,secret=$this->secret]";
51
- }
52
- }
53
- }
54
-
55
- if ( !class_exists( 'OAuthToken' ) ) {
56
- class OAuthToken {
57
- // access tokens and request tokens
58
- public $key;
59
- public $secret;
60
-
61
- /**
62
- * key = the token
63
- * secret = the token secret
64
- */
65
- function __construct($key, $secret) {
66
- $this->key = $key;
67
- $this->secret = $secret;
68
- }
69
-
70
- /**
71
- * generates the basic string serialization of a token that a server
72
- * would respond to request_token and access_token calls with
73
- */
74
- function to_string() {
75
- return "oauth_token=" .
76
- OAuthUtil::urlencode_rfc3986($this->key) .
77
- "&oauth_token_secret=" .
78
- OAuthUtil::urlencode_rfc3986($this->secret);
79
- }
80
-
81
- function __toString() {
82
- return $this->to_string();
83
- }
84
- }
85
- }
86
-
87
- if ( !class_exists('OAuthSignatureMethod') ) {
88
- /**
89
- * A class for implementing a Signature Method
90
- * See section 9 ("Signing Requests") in the spec
91
- */
92
- abstract class OAuthSignatureMethod {
93
- /**
94
- * Needs to return the name of the Signature Method (ie HMAC-SHA1)
95
- * @return string
96
- */
97
- abstract public function get_name();
98
-
99
- /**
100
- * Build up the signature
101
- * NOTE: The output of this function MUST NOT be urlencoded.
102
- * the encoding is handled in OAuthRequest when the final
103
- * request is serialized
104
- * @param OAuthRequest $request
105
- * @param OAuthConsumer $consumer
106
- * @param OAuthToken $token
107
- * @return string
108
- */
109
- abstract public function build_signature($request, $consumer, $token);
110
-
111
- /**
112
- * Verifies that a given signature is correct
113
- * @param OAuthRequest $request
114
- * @param OAuthConsumer $consumer
115
- * @param OAuthToken $token
116
- * @param string $signature
117
- * @return bool
118
- */
119
- public function check_signature($request, $consumer, $token, $signature) {
120
- $built = $this->build_signature($request, $consumer, $token);
121
-
122
- // Check for zero length, although unlikely here
123
- if (strlen($built) == 0 || strlen($signature) == 0) {
124
- return false;
125
- }
126
-
127
- if (strlen($built) != strlen($signature)) {
128
- return false;
129
- }
130
-
131
- // Avoid a timing leak with a (hopefully) time insensitive compare
132
- $result = 0;
133
- for ($i = 0; $i < strlen($signature); $i++) {
134
- $result |= ord($built{$i}) ^ ord($signature{$i});
135
- }
136
-
137
- return $result == 0;
138
- }
139
- }
140
- }
141
-
142
- if ( !class_exists('OAuthSignatureMethod_HMAC_SHA1') ) {
143
- /**
144
- * The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104]
145
- * where the Signature Base String is the text and the key is the concatenated values (each first
146
- * encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&'
147
- * character (ASCII code 38) even if empty.
148
- * - Chapter 9.2 ("HMAC-SHA1")
149
- */
150
- class OAuthSignatureMethod_HMAC_SHA1 extends OAuthSignatureMethod {
151
- function get_name() {
152
- return "HMAC-SHA1";
153
- }
154
-
155
- public function build_signature($request, $consumer, $token) {
156
- $base_string = $request->get_signature_base_string();
157
- $request->base_string = $base_string;
158
-
159
- $key_parts = array(
160
- $consumer->secret,
161
- ($token) ? $token->secret : ""
162
- );
163
-
164
- $key_parts = OAuthUtil::urlencode_rfc3986($key_parts);
165
- $key = implode('&', $key_parts);
166
-
167
- return base64_encode(hash_hmac('sha1', $base_string, $key, true));
168
- }
169
- }
170
- }
171
-
172
- if ( !class_exists('OAuthSignatureMethod_PLAINTEXT') ) {
173
- /**
174
- * The PLAINTEXT method does not provide any security protection and SHOULD only be used
175
- * over a secure channel such as HTTPS. It does not use the Signature Base String.
176
- * - Chapter 9.4 ("PLAINTEXT")
177
- */
178
- class OAuthSignatureMethod_PLAINTEXT extends OAuthSignatureMethod {
179
- public function get_name() {
180
- return "PLAINTEXT";
181
- }
182
-
183
- /**
184
- * oauth_signature is set to the concatenated encoded values of the Consumer Secret and
185
- * Token Secret, separated by a '&' character (ASCII code 38), even if either secret is
186
- * empty. The result MUST be encoded again.
187
- * - Chapter 9.4.1 ("Generating Signatures")
188
- *
189
- * Please note that the second encoding MUST NOT happen in the SignatureMethod, as
190
- * OAuthRequest handles this!
191
- */
192
- public function build_signature($request, $consumer, $token) {
193
- $key_parts = array(
194
- $consumer->secret,
195
- ($token) ? $token->secret : ""
196
- );
197
-
198
- $key_parts = OAuthUtil::urlencode_rfc3986($key_parts);
199
- $key = implode('&', $key_parts);
200
- $request->base_string = $key;
201
-
202
- return $key;
203
- }
204
- }
205
- }
206
-
207
-
208
- if ( !class_exists('OAuthSignatureMethod_RSA_SHA1') ) {
209
- /**
210
- * The RSA-SHA1 signature method uses the RSASSA-PKCS1-v1_5 signature algorithm as defined in
211
- * [RFC3447] section 8.2 (more simply known as PKCS#1), using SHA-1 as the hash function for
212
- * EMSA-PKCS1-v1_5. It is assumed that the Consumer has provided its RSA public key in a
213
- * verified way to the Service Provider, in a manner which is beyond the scope of this
214
- * specification.
215
- * - Chapter 9.3 ("RSA-SHA1")
216
- */
217
- abstract class OAuthSignatureMethod_RSA_SHA1 extends OAuthSignatureMethod {
218
- public function get_name() {
219
- return "RSA-SHA1";
220
- }
221
-
222
- // Up to the SP to implement this lookup of keys. Possible ideas are:
223
- // (1) do a lookup in a table of trusted certs keyed off of consumer
224
- // (2) fetch via http using a url provided by the requester
225
- // (3) some sort of specific discovery code based on request
226
- //
227
- // Either way should return a string representation of the certificate
228
- protected abstract function fetch_public_cert(&$request);
229
-
230
- // Up to the SP to implement this lookup of keys. Possible ideas are:
231
- // (1) do a lookup in a table of trusted certs keyed off of consumer
232
- //
233
- // Either way should return a string representation of the certificate
234
- protected abstract function fetch_private_cert(&$request);
235
-
236
- public function build_signature($request, $consumer, $token) {
237
- $base_string = $request->get_signature_base_string();
238
- $request->base_string = $base_string;
239
-
240
- // Fetch the private key cert based on the request
241
- $cert = $this->fetch_private_cert($request);
242
-
243
- // Pull the private key ID from the certificate
244
- $privatekeyid = openssl_get_privatekey($cert);
245
-
246
- // Sign using the key
247
- $ok = openssl_sign($base_string, $signature, $privatekeyid);
248
-
249
- // Release the key resource
250
- openssl_free_key($privatekeyid);
251
-
252
- return base64_encode($signature);
253
- }
254
-
255
- public function check_signature($request, $consumer, $token, $signature) {
256
- $decoded_sig = base64_decode($signature);
257
-
258
- $base_string = $request->get_signature_base_string();
259
-
260
- // Fetch the public key cert based on the request
261
- $cert = $this->fetch_public_cert($request);
262
-
263
- // Pull the public key ID from the certificate
264
- $publickeyid = openssl_get_publickey($cert);
265
-
266
- // Check the computed signature against the one passed in the query
267
- $ok = openssl_verify($base_string, $decoded_sig, $publickeyid);
268
-
269
- // Release the key resource
270
- openssl_free_key($publickeyid);
271
-
272
- return $ok == 1;
273
- }
274
- }
275
- }
276
-
277
- if ( !class_exists('OAuthRequest') ) {
278
- class OAuthRequest {
279
- protected $parameters;
280
- protected $http_method;
281
- protected $http_url;
282
- // for debug purposes
283
- public $base_string;
284
- public static $version = '1.0';
285
- public static $POST_INPUT = 'php://input';
286
-
287
- function __construct($http_method, $http_url, $parameters=NULL) {
288
- $parameters = ($parameters) ? $parameters : array();
289
- $parameters = array_merge( OAuthUtil::parse_parameters(parse_url($http_url, PHP_URL_QUERY)), $parameters);
290
- $this->parameters = $parameters;
291
- $this->http_method = $http_method;
292
- $this->http_url = $http_url;
293
- }
294
-
295
-
296
- /**
297
- * attempt to build up a request from what was passed to the server
298
- */
299
- public static function from_request($http_method=NULL, $http_url=NULL, $parameters=NULL) {
300
- $scheme = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on")
301
- ? 'http'
302
- : 'https';
303
- $http_url = ($http_url) ? $http_url : $scheme .
304
- '://' . $_SERVER['SERVER_NAME'] .
305
- ':' .
306
- $_SERVER['SERVER_PORT'] .
307
- $_SERVER['REQUEST_URI'];
308
- $http_method = ($http_method) ? $http_method : $_SERVER['REQUEST_METHOD'];
309
-
310
- // We weren't handed any parameters, so let's find the ones relevant to
311
- // this request.
312
- // If you run XML-RPC or similar you should use this to provide your own
313
- // parsed parameter-list
314
- if (!$parameters) {
315
- // Find request headers
316
- $request_headers = OAuthUtil::get_headers();
317
-
318
- // Parse the query-string to find GET parameters
319
- $parameters = OAuthUtil::parse_parameters($_SERVER['QUERY_STRING']);
320
-
321
- // It's a POST request of the proper content-type, so parse POST
322
- // parameters and add those overriding any duplicates from GET
323
- if ($http_method == "POST"
324
- && isset($request_headers['Content-Type'])
325
- && strstr($request_headers['Content-Type'],
326
- 'application/x-www-form-urlencoded')
327
- ) {
328
- $post_data = OAuthUtil::parse_parameters(
329
- file_get_contents(self::$POST_INPUT)
330
- );
331
- $parameters = array_merge($parameters, $post_data);
332
- }
333
-
334
- // We have a Authorization-header with OAuth data. Parse the header
335
- // and add those overriding any duplicates from GET or POST
336
- if (isset($request_headers['Authorization']) && substr($request_headers['Authorization'], 0, 6) == 'OAuth ') {
337
- $header_parameters = OAuthUtil::split_header(
338
- $request_headers['Authorization']
339
- );
340
- $parameters = array_merge($parameters, $header_parameters);
341
- }
342
-
343
- }
344
-
345
- return new OAuthRequest($http_method, $http_url, $parameters);
346
- }
347
-
348
- /**
349
- * pretty much a helper function to set up the request
350
- */
351
- public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL) {
352
- $parameters = ($parameters) ? $parameters : array();
353
- $defaults = array("oauth_version" => OAuthRequest::$version,
354
- "oauth_nonce" => OAuthRequest::generate_nonce(),
355
- "oauth_timestamp" => OAuthRequest::generate_timestamp(),
356
- "oauth_consumer_key" => $consumer->key);
357
- if ($token)
358
- $defaults['oauth_token'] = $token->key;
359
-
360
- $parameters = array_merge($defaults, $parameters);
361
-
362
- return new OAuthRequest($http_method, $http_url, $parameters);
363
- }
364
-
365
- public function set_parameter($name, $value, $allow_duplicates = true) {
366
- if ($allow_duplicates && isset($this->parameters[$name])) {
367
- // We have already added parameter(s) with this name, so add to the list
368
- if (is_scalar($this->parameters[$name])) {
369
- // This is the first duplicate, so transform scalar (string)
370
- // into an array so we can add the duplicates
371
- $this->parameters[$name] = array($this->parameters[$name]);
372
- }
373
-
374
- $this->parameters[$name][] = $value;
375
- } else {
376
- $this->parameters[$name] = $value;
377
- }
378
- }
379
-
380
- public function get_parameter($name) {
381
- return isset($this->parameters[$name]) ? $this->parameters[$name] : null;
382
- }
383
-
384
- public function get_parameters() {
385
- return $this->parameters;
386
- }
387
-
388
- public function unset_parameter($name) {
389
- unset($this->parameters[$name]);
390
- }
391
-
392
- /**
393
- * The request parameters, sorted and concatenated into a normalized string.
394
- * @return string
395
- */
396
- public function get_signable_parameters() {
397
- // Grab all parameters
398
- $params = $this->parameters;
399
-
400
- // Remove oauth_signature if present
401
- // Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.")
402
- if (isset($params['oauth_signature'])) {
403
- unset($params['oauth_signature']);
404
- }
405
-
406
- return OAuthUtil::build_http_query($params);
407
- }
408
-
409
- /**
410
- * Returns the base string of this request
411
- *
412
- * The base string defined as the method, the url
413
- * and the parameters (normalized), each urlencoded
414
- * and the concated with &.
415
- */
416
- public function get_signature_base_string() {
417
- $parts = array(
418
- $this->get_normalized_http_method(),
419
- $this->get_normalized_http_url(),
420
- $this->get_signable_parameters()
421
- );
422
-
423
- $parts = OAuthUtil::urlencode_rfc3986($parts);
424
-
425
- return implode('&', $parts);
426
- }
427
-
428
- /**
429
- * just uppercases the http method
430
- */
431
- public function get_normalized_http_method() {
432
- return strtoupper($this->http_method);
433
- }
434
-
435
- /**
436
- * parses the url and rebuilds it to be
437
- * scheme://host/path
438
- */
439
- public function get_normalized_http_url() {
440
- $parts = parse_url($this->http_url);
441
-
442
- $scheme = (isset($parts['scheme'])) ? $parts['scheme'] : 'http';
443
- $port = (isset($parts['port'])) ? $parts['port'] : (($scheme == 'https') ? '443' : '80');
444
- $host = (isset($parts['host'])) ? strtolower($parts['host']) : '';
445
- $path = (isset($parts['path'])) ? $parts['path'] : '';
446
-
447
- if (($scheme == 'https' && $port != '443')
448
- || ($scheme == 'http' && $port != '80')) {
449
- $host = "$host:$port";
450
- }
451
- return "$scheme://$host$path";
452
- }
453
-
454
- /**
455
- * builds a url usable for a GET request
456
- */
457
- public function to_url() {
458
- $post_data = $this->to_postdata();
459
- $out = $this->get_normalized_http_url();
460
- if ($post_data) {
461
- $out .= '?'.$post_data;
462
- }
463
- return $out;
464
- }
465
-
466
- /**
467
- * builds the data one would send in a POST request
468
- */
469
- public function to_postdata() {
470
- return OAuthUtil::build_http_query($this->parameters);
471
- }
472
-
473
- /**
474
- * builds the Authorization: header
475
- */
476
- public function to_header($realm=null) {
477
- $first = true;
478
- if($realm) {
479
- $out = 'Authorization: OAuth realm="' . OAuthUtil::urlencode_rfc3986($realm) . '"';
480
- $first = false;
481
- } else
482
- $out = 'Authorization: OAuth';
483
-
484
- $total = array();
485
- foreach ($this->parameters as $k => $v) {
486
- if (substr($k, 0, 5) != "oauth") continue;
487
- if (is_array($v)) {
488
- throw new OAuthException('Arrays not supported in headers');
489
- }
490
- $out .= ($first) ? ' ' : ',';
491
- $out .= OAuthUtil::urlencode_rfc3986($k) .
492
- '="' .
493
- OAuthUtil::urlencode_rfc3986($v) .
494
- '"';
495
- $first = false;
496
- }
497
- return $out;
498
- }
499
-
500
- public function __toString() {
501
- return $this->to_url();
502
- }
503
-
504
-
505
- public function sign_request($signature_method, $consumer, $token) {
506
- $this->set_parameter(
507
- "oauth_signature_method",
508
- $signature_method->get_name(),
509
- false
510
- );
511
- $signature = $this->build_signature($signature_method, $consumer, $token);
512
- $this->set_parameter("oauth_signature", $signature, false);
513
- }
514
-
515
- public function build_signature($signature_method, $consumer, $token) {
516
- $signature = $signature_method->build_signature($this, $consumer, $token);
517
- return $signature;
518
- }
519
-
520
- /**
521
- * util function: current timestamp
522
- */
523
- private static function generate_timestamp() {
524
- return time();
525
- }
526
-
527
- /**
528
- * util function: current nonce
529
- */
530
- private static function generate_nonce() {
531
- $mt = microtime();
532
- $rand = mt_rand();
533
-
534
- return md5($mt . $rand); // md5s look nicer than numbers
535
- }
536
- }
537
- }
538
-
539
- if ( !class_exists('OAuthServer') ) {
540
- class OAuthServer {
541
- protected $timestamp_threshold = 300; // in seconds, five minutes
542
- protected $version = '1.0'; // hi blaine
543
- protected $signature_methods = array();
544
-
545
- protected $data_store;
546
-
547
- function __construct($data_store) {
548
- $this->data_store = $data_store;
549
- }
550
-
551
- public function add_signature_method($signature_method) {
552
- $this->signature_methods[$signature_method->get_name()] =
553
- $signature_method;
554
- }
555
-
556
- // high level functions
557
-
558
- /**
559
- * process a request_token request
560
- * returns the request token on success
561
- */
562
- public function fetch_request_token(&$request) {
563
- $this->get_version($request);
564
-
565
- $consumer = $this->get_consumer($request);
566
-
567
- // no token required for the initial token request
568
- $token = NULL;
569
-
570
- $this->check_signature($request, $consumer, $token);
571
-
572
- // Rev A change
573
- $callback = $request->get_parameter('oauth_callback');
574
- $new_token = $this->data_store->new_request_token($consumer, $callback);
575
-
576
- return $new_token;
577
- }
578
-
579
- /**
580
- * process an access_token request
581
- * returns the access token on success
582
- */
583
- public function fetch_access_token(&$request) {
584
- $this->get_version($request);
585
-
586
- $consumer = $this->get_consumer($request);
587
-
588
- // requires authorized request token
589
- $token = $this->get_token($request, $consumer, "request");
590
-
591
- $this->check_signature($request, $consumer, $token);
592
-
593
- // Rev A change
594
- $verifier = $request->get_parameter('oauth_verifier');
595
- $new_token = $this->data_store->new_access_token($token, $consumer, $verifier);
596
-
597
- return $new_token;
598
- }
599
-
600
- /**
601
- * verify an api call, checks all the parameters
602
- */
603
- public function verify_request(&$request) {
604
- $this->get_version($request);
605
- $consumer = $this->get_consumer($request);
606
- $token = $this->get_token($request, $consumer, "access");
607
- $this->check_signature($request, $consumer, $token);
608
- return array($consumer, $token);
609
- }
610
-
611
- // Internals from here
612
- /**
613
- * version 1
614
- */
615
- private function get_version(&$request) {
616
- $version = $request->get_parameter("oauth_version");
617
- if (!$version) {
618
- // Service Providers MUST assume the protocol version to be 1.0 if this parameter is not present.
619
- // Chapter 7.0 ("Accessing Protected Ressources")
620
- $version = '1.0';
621
- }
622
- if ($version !== $this->version) {
623
- throw new OAuthException("OAuth version '$version' not supported");
624
- }
625
- return $version;
626
- }
627
-
628
- /**
629
- * figure out the signature with some defaults
630
- */
631
- private function get_signature_method($request) {
632
- $signature_method = $request instanceof OAuthRequest
633
- ? $request->get_parameter("oauth_signature_method")
634
- : NULL;
635
-
636
- if (!$signature_method) {
637
- // According to chapter 7 ("Accessing Protected Ressources") the signature-method
638
- // parameter is required, and we can't just fallback to PLAINTEXT
639
- throw new OAuthException('No signature method parameter. This parameter is required');
640
- }
641
-
642
- if (!in_array($signature_method,
643
- array_keys($this->signature_methods))) {
644
- throw new OAuthException(
645
- "Signature method '$signature_method' not supported " .
646
- "try one of the following: " .
647
- implode(", ", array_keys($this->signature_methods))
648
- );
649
- }
650
- return $this->signature_methods[$signature_method];
651
- }
652
-
653
- /**
654
- * try to find the consumer for the provided request's consumer key
655
- */
656
- private function get_consumer($request) {
657
- $consumer_key = $request instanceof OAuthRequest
658
- ? $request->get_parameter("oauth_consumer_key")
659
- : NULL;
660
-
661
- if (!$consumer_key) {
662
- throw new OAuthException("Invalid consumer key");
663
- }
664
-
665
- $consumer = $this->data_store->lookup_consumer($consumer_key);
666
- if (!$consumer) {
667
- throw new OAuthException("Invalid consumer");
668
- }
669
-
670
- return $consumer;
671
- }
672
-
673
- /**
674
- * try to find the token for the provided request's token key
675
- */
676
- private function get_token($request, $consumer, $token_type="access") {
677
- $token_field = $request instanceof OAuthRequest
678
- ? $request->get_parameter('oauth_token')
679
- : NULL;
680
-
681
- $token = $this->data_store->lookup_token(
682
- $consumer, $token_type, $token_field
683
- );
684
- if (!$token) {
685
- throw new OAuthException("Invalid $token_type token: $token_field");
686
- }
687
- return $token;
688
- }
689
-
690
- /**
691
- * all-in-one function to check the signature on a request
692
- * should guess the signature method appropriately
693
- */
694
- private function check_signature($request, $consumer, $token) {
695
- // this should probably be in a different method
696
- $timestamp = $request instanceof OAuthRequest
697
- ? $request->get_parameter('oauth_timestamp')
698
- : NULL;
699
- $nonce = $request instanceof OAuthRequest
700
- ? $request->get_parameter('oauth_nonce')
701
- : NULL;
702
-
703
- $this->check_timestamp($timestamp);
704
- $this->check_nonce($consumer, $token, $nonce, $timestamp);
705
-
706
- $signature_method = $this->get_signature_method($request);
707
-
708
- $signature = $request->get_parameter('oauth_signature');
709
- $valid_sig = $signature_method->check_signature(
710
- $request,
711
- $consumer,
712
- $token,
713
- $signature
714
- );
715
-
716
- if (!$valid_sig) {
717
- throw new OAuthException("Invalid signature");
718
- }
719
- }
720
-
721
- /**
722
- * check that the timestamp is new enough
723
- */
724
- private function check_timestamp($timestamp) {
725
- if( ! $timestamp )
726
- throw new OAuthException(
727
- 'Missing timestamp parameter. The parameter is required'
728
- );
729
-
730
- // verify that timestamp is recentish
731
- $now = time();
732
- if (abs($now - $timestamp) > $this->timestamp_threshold) {
733
- throw new OAuthException(
734
- "Expired timestamp, yours $timestamp, ours $now"
735
- );
736
- }
737
- }
738
-
739
- /**
740
- * check that the nonce is not repeated
741
- */
742
- private function check_nonce($consumer, $token, $nonce, $timestamp) {
743
- if( ! $nonce )
744
- throw new OAuthException(
745
- 'Missing nonce parameter. The parameter is required'
746
- );
747
-
748
- // verify that the nonce is uniqueish
749
- $found = $this->data_store->lookup_nonce(
750
- $consumer,
751
- $token,
752
- $nonce,
753
- $timestamp
754
- );
755
- if ($found) {
756
- throw new OAuthException("Nonce already used: $nonce");
757
- }
758
- }
759
- }
760
- }
761
-
762
- if ( !class_exists('OAuthDataStore') ) {
763
- class OAuthDataStore {
764
- function lookup_consumer($consumer_key) {
765
- // implement me
766
- }
767
-
768
- function lookup_token($consumer, $token_type, $token) {
769
- // implement me
770
- }
771
-
772
- function lookup_nonce($consumer, $token, $nonce, $timestamp) {
773
- // implement me
774
- }
775
-
776
- function new_request_token($consumer, $callback = null) {
777
- // return a new token attached to this consumer
778
- }
779
-
780
- function new_access_token($token, $consumer, $verifier = null) {
781
- // return a new access token attached to this consumer
782
- // for the user associated with this token if the request token
783
- // is authorized
784
- // should also invalidate the request token
785
- }
786
- }
787
- }
788
-
789
- if ( !class_exists('OAuthUtil') ) {
790
- class OAuthUtil {
791
- public static function urlencode_rfc3986($input) {
792
- if (is_array($input)) {
793
- return array_map(array('OAuthUtil', 'urlencode_rfc3986'), $input);
794
- } else if (is_scalar($input)) {
795
- return str_replace(
796
- '+',
797
- ' ',
798
- str_replace('%7E', '~', rawurlencode($input))
799
- );
800
- } else {
801
- return '';
802
- }
803
- }
804
-
805
- // This decode function isn't taking into consideration the above
806
- // modifications to the encoding process. However, this method doesn't
807
- // seem to be used anywhere so leaving it as is.
808
- public static function urldecode_rfc3986($string) {
809
- return urldecode($string);
810
- }
811
-
812
- // Utility function for turning the Authorization: header into
813
- // parameters, has to do some unescaping
814
- // Can filter out any non-oauth parameters if needed (default behaviour)
815
- // May 28th, 2010 - method updated to tjerk.meesters for a speed improvement.
816
- // see http://code.google.com/p/oauth/issues/detail?id=163
817
- public static function split_header($header, $only_allow_oauth_parameters = true) {
818
- $params = array();
819
- if (preg_match_all('/('.($only_allow_oauth_parameters ? 'oauth_' : '').'[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $header, $matches)) {
820
- foreach ($matches[1] as $i => $h) {
821
- $params[$h] = OAuthUtil::urldecode_rfc3986(empty($matches[3][$i]) ? $matches[4][$i] : $matches[3][$i]);
822
- }
823
- if (isset($params['realm'])) {
824
- unset($params['realm']);
825
- }
826
- }
827
- return $params;
828
- }
829
-
830
- // helper to try to sort out headers for people who aren't running apache
831
- public static function get_headers() {
832
- if (function_exists('apache_request_headers')) {
833
- // we need this to get the actual Authorization: header
834
- // because apache tends to tell us it doesn't exist
835
- $headers = apache_request_headers();
836
-
837
- // sanitize the output of apache_request_headers because
838
- // we always want the keys to be Cased-Like-This and arh()
839
- // returns the headers in the same case as they are in the
840
- // request
841
- $out = array();
842
- foreach ($headers AS $key => $value) {
843
- $key = str_replace(
844
- " ",
845
- "-",
846
- ucwords(strtolower(str_replace("-", " ", $key)))
847
- );
848
- $out[$key] = $value;
849
- }
850
- } else {
851
- // otherwise we don't have apache and are just going to have to hope
852
- // that $_SERVER actually contains what we need
853
- $out = array();
854
- if( isset($_SERVER['CONTENT_TYPE']) )
855
- $out['Content-Type'] = $_SERVER['CONTENT_TYPE'];
856
- if( isset($_ENV['CONTENT_TYPE']) )
857
- $out['Content-Type'] = $_ENV['CONTENT_TYPE'];
858
-
859
- foreach ($_SERVER as $key => $value) {
860
- if (substr($key, 0, 5) == "HTTP_") {
861
- // this is chaos, basically it is just there to capitalize the first
862
- // letter of every word that is not an initial HTTP and strip HTTP
863
- // code from przemek
864
- $key = str_replace(
865
- " ",
866
- "-",
867
- ucwords(strtolower(str_replace("_", " ", substr($key, 5))))
868
- );
869
- $out[$key] = $value;
870
- }
871
- }
872
- }
873
- return $out;
874
- }
875
-
876
- // This function takes a input like a=b&a=c&d=e and returns the parsed
877
- // parameters like this
878
- // array('a' => array('b','c'), 'd' => 'e')
879
- public static function parse_parameters( $input ) {
880
- if (!isset($input) || !$input) return array();
881
-
882
- $pairs = explode('&', $input);
883
-
884
- $parsed_parameters = array();
885
- foreach ($pairs as $pair) {
886
- $split = explode('=', $pair, 2);
887
- $parameter = OAuthUtil::urldecode_rfc3986($split[0]);
888
- $value = isset($split[1]) ? OAuthUtil::urldecode_rfc3986($split[1]) : '';
889
-
890
- if (isset($parsed_parameters[$parameter])) {
891
- // We have already recieved parameter(s) with this name, so add to the list
892
- // of parameters with this name
893
-
894
- if (is_scalar($parsed_parameters[$parameter])) {
895
- // This is the first duplicate, so transform scalar (string) into an array
896
- // so we can add the duplicates
897
- $parsed_parameters[$parameter] = array($parsed_parameters[$parameter]);
898
- }
899
-
900
- $parsed_parameters[$parameter][] = $value;
901
- } else {
902
- $parsed_parameters[$parameter] = $value;
903
- }
904
- }
905
- return $parsed_parameters;
906
- }
907
-
908
- public static function build_http_query($params) {
909
- if (!$params) return '';
910
-
911
- // Urlencode both keys and values
912
- $keys = OAuthUtil::urlencode_rfc3986(array_keys($params));
913
- $values = OAuthUtil::urlencode_rfc3986(array_values($params));
914
- $params = array_combine($keys, $values);
915
-
916
- // Parameters are sorted by name, using lexicographical byte value ordering.
917
- // Ref: Spec: 9.1.1 (1)
918
- uksort($params, 'strcmp');
919
-
920
- $pairs = array();
921
- foreach ($params as $parameter => $value) {
922
- if (is_array($value)) {
923
- // If two or more parameters share the same name, they are sorted by their value
924
- // Ref: Spec: 9.1.1 (1)
925
- // June 12th, 2010 - changed to sort because of issue 164 by hidetaka
926
- sort($value, SORT_STRING);
927
- foreach ($value as $duplicate_value) {
928
- $pairs[] = $parameter . '=' . $duplicate_value;
929
- }
930
- } else {
931
- $pairs[] = $parameter . '=' . $value;
932
- }
933
- }
934
- // For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
935
- // Each name-value pair is separated by an '&' character (ASCII code 38)
936
- return implode('&', $pairs);
937
- }
938
- }
939
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/extlib/index.php DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Silence is golden.
5
- */
 
 
 
 
 
inc/schema/graphs/graph-organization.php CHANGED
@@ -72,7 +72,11 @@ class AIOSEOP_Graph_Organization extends AIOSEOP_Graph {
72
  }
73
  } else {
74
  // Get Name from General > Schema Settings > Organization Name, and fallback on WP's Site Name.
75
- $rtn_data['name'] = $aioseop_options['aiosp_schema_organization_name'] ?: get_bloginfo( 'name' );
 
 
 
 
76
  $rtn_data['sameAs'] = $this->get_site_social_profile_links();
77
 
78
  // Handle Logo/Image.
72
  }
73
  } else {
74
  // Get Name from General > Schema Settings > Organization Name, and fallback on WP's Site Name.
75
+ if ( $aioseop_options['aiosp_schema_organization_name'] ) {
76
+ $rtn_data['name'] = $aioseop_options['aiosp_schema_organization_name'];
77
+ } else {
78
+ $rtn_data['name'] = get_bloginfo( 'name' );
79
+ }
80
  $rtn_data['sameAs'] = $this->get_site_social_profile_links();
81
 
82
  // Handle Logo/Image.
inc/schema/graphs/graph.php CHANGED
@@ -149,7 +149,21 @@ abstract class AIOSEOP_Graph {
149
  * @param array Dynamically generated data through inherited schema graphs.
150
  */
151
  $schema_data = apply_filters( 'aioseop_schema_class_data_' . get_class( $this ), $this->prepare() );
152
- return wp_json_encode( (object) $schema_data, JSON_UNESCAPED_SLASHES ) ?: '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  }
154
 
155
  /**
149
  * @param array Dynamically generated data through inherited schema graphs.
150
  */
151
  $schema_data = apply_filters( 'aioseop_schema_class_data_' . get_class( $this ), $this->prepare() );
152
+
153
+ // Encode to json string, and remove string type around shortcodes.
154
+ if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) {
155
+ $schema_data = wp_json_encode( (object) $schema_data, JSON_UNESCAPED_SLASHES );
156
+ } else {
157
+ // PHP <= 5.3 compatibility.
158
+ $schema_data = wp_json_encode( (object) $schema_data );
159
+ $schema_data = str_replace( '\/', '/', $schema_data );
160
+ }
161
+ // If json encode returned false, set as empty string.
162
+ if ( ! $schema_data ) {
163
+ $schema_data = '';
164
+ }
165
+
166
+ return $schema_data;
167
  }
168
 
169
  /**
inc/schema/schema-builder.php CHANGED
@@ -157,7 +157,14 @@ class AIOSEOP_Schema_Builder {
157
  $layout = apply_filters( 'aioseop_schema_layout', $layout );
158
 
159
  // Encode to json string, and remove string type around shortcodes.
160
- $layout = wp_json_encode( (object) $layout, JSON_UNESCAPED_SLASHES );
 
 
 
 
 
 
 
161
  $layout = str_replace( '"[', '[', $layout );
162
  $layout = str_replace( ']"', ']', $layout );
163
 
157
  $layout = apply_filters( 'aioseop_schema_layout', $layout );
158
 
159
  // Encode to json string, and remove string type around shortcodes.
160
+ if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) {
161
+ $layout = wp_json_encode( (object) $layout, JSON_UNESCAPED_SLASHES );
162
+ } else {
163
+ // PHP <= 5.3 compatibility.
164
+ $layout = wp_json_encode( (object) $layout );
165
+ $layout = str_replace( '\/', '/', $layout );
166
+ }
167
+
168
  $layout = str_replace( '"[', '[', $layout );
169
  $layout = str_replace( ']"', ']', $layout );
170
 
modules/aioseop_feature_manager.php CHANGED
@@ -175,7 +175,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
175
  * @return mixed
176
  */
177
  function filter_submit( $submit ) {
178
- $submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' ) . ' &raquo;';
179
  $submit['Submit']['class'] .= ' hidden';
180
  /* translators: this button deactivates all active modules of the plugin. */
181
  $submit['Submit_Default']['value'] = __( 'Reset Features', 'all-in-one-seo-pack' ) . ' &raquo;';
@@ -193,7 +193,11 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
193
  * @return string
194
  */
195
  function display_option_div( $buf, $args ) {
196
- $name = $img = $desc = $checkbox = $class = '';
 
 
 
 
197
  if ( isset( $args['options']['help_text'] ) && ! empty( $args['options']['help_text'] ) ) {
198
  $desc .= '<p class="aioseop_desc">' . $args['options']['help_text'] . '</p>';
199
  }
@@ -207,7 +211,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Feature_Manager' ) ) {
207
  }
208
 
209
  if ( $args['options']['save'] ) {
210
- $name = "<h3>{$args['options']['name']}</h3>";
211
  $checkbox .= '<input type="checkbox" onchange="jQuery(\'#' . $args['options']['id'] . ' .aioseop_featured_image, #' . $args['options']['id'] . ' .feature_button\').toggleClass(\'active\', this.checked);jQuery(\'input[name=Submit]\').trigger(\'click\');" style="display:none;" id="' . $args['name'] . '" name="' . $args['name'] . '"';
212
  if ( $args['value'] ) {
213
  $checkbox .= ' CHECKED';
175
  * @return mixed
176
  */
177
  function filter_submit( $submit ) {
178
+ $submit['Submit']['value'] = __( 'Update Features', 'all-in-one-seo-pack' ) . ' &raquo;';
179
  $submit['Submit']['class'] .= ' hidden';
180
  /* translators: this button deactivates all active modules of the plugin. */
181
  $submit['Submit_Default']['value'] = __( 'Reset Features', 'all-in-one-seo-pack' ) . ' &raquo;';
193
  * @return string
194
  */
195
  function display_option_div( $buf, $args ) {
196
+ $name = '';
197
+ $img = '';
198
+ $desc = '';
199
+ $checkbox = '';
200
+ $class = '';
201
  if ( isset( $args['options']['help_text'] ) && ! empty( $args['options']['help_text'] ) ) {
202
  $desc .= '<p class="aioseop_desc">' . $args['options']['help_text'] . '</p>';
203
  }
211
  }
212
 
213
  if ( $args['options']['save'] ) {
214
+ $name = "<h3>{$args['options']['name']}</h3>";
215
  $checkbox .= '<input type="checkbox" onchange="jQuery(\'#' . $args['options']['id'] . ' .aioseop_featured_image, #' . $args['options']['id'] . ' .feature_button\').toggleClass(\'active\', this.checked);jQuery(\'input[name=Submit]\').trigger(\'click\');" style="display:none;" id="' . $args['name'] . '" name="' . $args['name'] . '"';
216
  if ( $args['value'] ) {
217
  $checkbox .= ' CHECKED';
modules/aioseop_file_editor.php CHANGED
@@ -39,7 +39,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_File_Editor' ) ) {
39
  );
40
 
41
  $this->tabs = array(
42
- 'htaccess' => array( 'name' => __( '.htaccess' ) ),
43
  );
44
 
45
  $this->layout = array(
39
  );
40
 
41
  $this->tabs = array(
42
+ 'htaccess' => array( 'name' => __( '.htaccess', 'all-in-one-seo-pack' ) ),
43
  );
44
 
45
  $this->layout = array(
modules/aioseop_importer_exporter.php CHANGED
@@ -19,11 +19,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
19
  * All_in_One_SEO_Pack_Importer_Exporter constructor.
20
  */
21
  function __construct() {
22
- $this->name = __( 'Importer & Exporter', 'all-in-one-seo-pack' ); // Human-readable name of the module.
23
- $this->prefix = 'aiosp_importer_exporter_'; // option prefix.
24
- $this->file = __FILE__;
 
 
25
  parent::__construct();
26
- $this->warnings = array();
27
  $this->default_options = array(
28
  'import_submit' => array(
29
  'name' => __( 'Import', 'all-in-one-seo-pack' ),
@@ -41,7 +43,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
41
  ),
42
  ),
43
  'export_post_types' => array(
44
- 'name' => __( 'Export Post Types:', 'all-in-one-seo-pack' ),
45
  'default' => array(
46
  'post' => 'post',
47
  'page' => 'page',
@@ -63,6 +65,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
63
  ) . '<br />',
64
  ),
65
  );
 
66
  $this->layout = array(
67
  'default' => array(
68
  'name' => $this->name,
@@ -114,8 +117,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
114
  * @since ?
115
  */
116
  function debug_post_types() {
117
- $post_types = $this->get_post_type_titles();
118
- $rempost = array(
119
  'customize_changeset' => 1,
120
  'custom_css' => 1,
121
  'revision' => 1,
@@ -239,7 +242,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
239
  $return_array[ $x[1] ]
240
  );
241
  }
242
- if ( $k === 0 ) {
243
  $return_array[ $c ] = array_merge(
244
  $return_array[ $c ],
245
  $array[ $key ]
@@ -281,7 +284,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
281
  }
282
  $first = true;
283
  foreach ( $x as $k => $v ) {
284
- if ( $first === true ) {
285
  $b = $array[ $key ];
286
  $first = false;
287
  }
@@ -320,7 +323,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
320
  for ( $i = 0; $i < count( $elem2 ); $i ++ ) {
321
  $content .= $key2 . '[] = "' . $elem2[ $i ] . "\"\n";
322
  }
323
- } elseif ( $elem2 == '' ) {
324
  $content .= $key2 . " = \n";
325
  } else {
326
  $content .= $key2 . ' = "' . $elem2 . "\"\n";
@@ -333,7 +336,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
333
  for ( $i = 0; $i < count( $elem ); $i ++ ) {
334
  $content .= $key2 . '[] = "' . $elem[ $i ] . "\"\n";
335
  }
336
- } elseif ( $elem == '' ) {
337
  $content .= $key2 . " = \n";
338
  } else {
339
  $content .= $key2 . ' = "' . $elem . "\"\n";
@@ -390,7 +393,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
390
  if ( ! empty( $_REQUEST['export_submit'] ) ) {
391
  $submit = 'Export';
392
  }
393
- if ( ( $submit != null ) && wp_verify_nonce( $nonce, 'aioseop-nonce' ) ) {
394
  switch ( $submit ) {
395
  case 'Import':
396
  try {
@@ -406,25 +409,25 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
406
  if ( empty( $line ) ) {
407
  continue;
408
  }
409
- if ( $line[0] == ';' ) {
410
  continue;
411
  }
412
  if ( preg_match( '/^\[(\S+)\]$/', $line, $label ) ) {
413
  $section_label = strval( $label[1] );
414
- if ( $section_label == 'post_data' ) {
415
  $count ++;
416
  }
417
  if ( ! isset( $section[ $section_label ] ) ) {
418
  $section[ $section_label ] = array();
419
  }
420
  } elseif ( preg_match( "/^(\S+)\s*=\s*'(.*)'$/", $line, $matches ) ) {
421
- if ( $section_label == 'post_data' ) {
422
  $section[ $section_label ][ $count ][ $matches[1] ] = $matches[2];
423
  } else {
424
  $section[ $section_label ][ $matches[1] ] = $matches[2];
425
  }
426
  } elseif ( preg_match( '/^(\S+)\s*=\s*NULL$/', $line, $matches ) ) {
427
- if ( $section_label == 'post_data' ) {
428
  $section[ $section_label ][ $count ][ $matches[1] ] = null;
429
  } else {
430
  $section[ $section_label ][ $matches[1] ] = null;
@@ -448,7 +451,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
448
  foreach ( $module_options as $key => $value ) {
449
 
450
  // Updates Post Data.
451
- if ( $label == 'post_data' ) {
452
  $post_exists = post_exists(
453
  $module_options[ $key ]['post_title'],
454
  '',
@@ -456,8 +459,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
456
  );
457
  $target = get_post( $post_exists );
458
  if (
459
- ( ! empty( $module_options[ $key ]['post_type'] ) ) &&
460
- $post_exists != null
461
  ) {
462
  if ( is_array( $value ) ) {
463
  foreach ( $value as $field_name => $field_value ) {
@@ -488,7 +491,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
488
  $target_title
489
  );
490
  }
491
- if ( $post_warning != null ) {
492
  $this->warnings[] = $post_warning;
493
  $post_warning = null;
494
  }
@@ -513,7 +516,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
513
  }
514
  } catch ( Exception $e ) {
515
  // Shows only one warning when compromised file is imported.
516
- $this->warnings = array();
517
  $this->warnings[] = $e->getMessage();
518
  add_action(
519
  $this->prefix . 'settings_header_errors',
@@ -536,12 +539,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Importer_Exporter' ) ) {
536
  // Creates Files Contents.
537
  $settings_file = 'settings_aioseop.ini';
538
  /* translators: %s is a placeholder, which means that it should not be translated. It will be replaced with the name of the plugin, All in One SEO Pack. */
539
- $buf = '; ' . sprintf(
540
- __(
541
- 'Settings export file for %s',
542
- '
543
- all-in-one-seo-pack'
544
- ),
545
  AIOSEOP_PLUGIN_NAME
546
  ) . "\n";
547
 
19
  * All_in_One_SEO_Pack_Importer_Exporter constructor.
20
  */
21
  function __construct() {
22
+ $this->name = __( 'Importer & Exporter', 'all-in-one-seo-pack' ); // Human-readable name of the module.
23
+ $this->prefix = 'aiosp_importer_exporter_'; // option prefix.
24
+ $this->file = __FILE__;
25
+ $this->warnings = array();
26
+
27
  parent::__construct();
28
+
29
  $this->default_options = array(
30
  'import_submit' => array(
31
  'name' => __( 'Import', 'all-in-one-seo-pack' ),
43
  ),
44
  ),
45
  'export_post_types' => array(
46
+ 'name' => __( 'Export Post Types', 'all-in-one-seo-pack' ),
47
  'default' => array(
48
  'post' => 'post',
49
  'page' => 'page',
65
  ) . '<br />',
66
  ),
67
  );
68
+
69
  $this->layout = array(
70
  'default' => array(
71
  'name' => $this->name,
117
  * @since ?
118
  */
119
  function debug_post_types() {
120
+ $post_types = $this->get_post_type_titles();
121
+ $rempost = array(
122
  'customize_changeset' => 1,
123
  'custom_css' => 1,
124
  'revision' => 1,
242
  $return_array[ $x[1] ]
243
  );
244
  }
245
+ if ( 0 === $k ) {
246
  $return_array[ $c ] = array_merge(
247
  $return_array[ $c ],
248
  $array[ $key ]
284
  }
285
  $first = true;
286
  foreach ( $x as $k => $v ) {
287
+ if ( true === $first ) {
288
  $b = $array[ $key ];
289
  $first = false;
290
  }
323
  for ( $i = 0; $i < count( $elem2 ); $i ++ ) {
324
  $content .= $key2 . '[] = "' . $elem2[ $i ] . "\"\n";
325
  }
326
+ } elseif ( '' == $elem2 ) {
327
  $content .= $key2 . " = \n";
328
  } else {
329
  $content .= $key2 . ' = "' . $elem2 . "\"\n";
336
  for ( $i = 0; $i < count( $elem ); $i ++ ) {
337
  $content .= $key2 . '[] = "' . $elem[ $i ] . "\"\n";
338
  }
339
+ } elseif ( '' == $elem ) {
340
  $content .= $key2 . " = \n";
341
  } else {
342
  $content .= $key2 . ' = "' . $elem . "\"\n";
393
  if ( ! empty( $_REQUEST['export_submit'] ) ) {
394
  $submit = 'Export';
395
  }
396
+ if ( ( null != $submit ) && wp_verify_nonce( $nonce, 'aioseop-nonce' ) ) {
397
  switch ( $submit ) {
398
  case 'Import':
399
  try {
409
  if ( empty( $line ) ) {
410
  continue;
411
  }
412
+ if ( ';' == $line[0] ) {
413
  continue;
414
  }
415
  if ( preg_match( '/^\[(\S+)\]$/', $line, $label ) ) {
416
  $section_label = strval( $label[1] );
417
+ if ( 'post_data' == $section_label ) {
418
  $count ++;
419
  }
420
  if ( ! isset( $section[ $section_label ] ) ) {
421
  $section[ $section_label ] = array();
422
  }
423
  } elseif ( preg_match( "/^(\S+)\s*=\s*'(.*)'$/", $line, $matches ) ) {
424
+ if ( 'post_data' == $section_label ) {
425
  $section[ $section_label ][ $count ][ $matches[1] ] = $matches[2];
426
  } else {
427
  $section[ $section_label ][ $matches[1] ] = $matches[2];
428
  }
429
  } elseif ( preg_match( '/^(\S+)\s*=\s*NULL$/', $line, $matches ) ) {
430
+ if ( 'post_data' == $section_label ) {
431
  $section[ $section_label ][ $count ][ $matches[1] ] = null;
432
  } else {
433
  $section[ $section_label ][ $matches[1] ] = null;
451
  foreach ( $module_options as $key => $value ) {
452
 
453
  // Updates Post Data.
454
+ if ( 'post_data' == $label ) {
455
  $post_exists = post_exists(
456
  $module_options[ $key ]['post_title'],
457
  '',
459
  );
460
  $target = get_post( $post_exists );
461
  if (
462
+ ( ! empty( $module_options[ $key ]['post_type'] ) ) &&
463
+ null != $post_exists
464
  ) {
465
  if ( is_array( $value ) ) {
466
  foreach ( $value as $field_name => $field_value ) {
491
  $target_title
492
  );
493
  }
494
+ if ( null != $post_warning ) {
495
  $this->warnings[] = $post_warning;
496
  $post_warning = null;
497
  }
516
  }
517
  } catch ( Exception $e ) {
518
  // Shows only one warning when compromised file is imported.
519
+ $this->warnings = array();
520
  $this->warnings[] = $e->getMessage();
521
  add_action(
522
  $this->prefix . 'settings_header_errors',
539
  // Creates Files Contents.
540
  $settings_file = 'settings_aioseop.ini';
541
  /* translators: %s is a placeholder, which means that it should not be translated. It will be replaced with the name of the plugin, All in One SEO Pack. */
542
+ $buf = '; ' . sprintf(
543
+ __( 'Settings export file for %s', 'all-in-one-seo-pack' ),
 
 
 
 
544
  AIOSEOP_PLUGIN_NAME
545
  ) . "\n";
546
 
modules/aioseop_opengraph.php CHANGED
@@ -193,9 +193,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
193
  * @param string $taxonomy Taxonomy slug.
194
  */
195
  function created_term( $term_id, $tt_id, $taxonomy_name ) {
196
- $k = 'settings';
197
- $prefix = $this->get_prefix( $k );
198
- $tax = get_taxonomy( $taxonomy_name );
199
  $this->set_object_type_for_taxonomy( $prefix, $k, $taxonomy_name, $tax, false, array( $term_id ) );
200
  }
201
 
@@ -278,7 +278,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
278
  * Called when this module is activated.
279
  */
280
  public function activate_module() {
281
- if ( $this->locations !== null ) {
282
  foreach ( $this->locations as $k => $v ) {
283
  if ( ! isset( $v['type'] ) || 'metabox' !== $v['type'] ) {
284
  continue;
@@ -293,8 +293,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
293
  * @param string $k The key against which the options will be determined/set.
294
  */
295
  private function set_virgin_tax_terms( $k ) {
296
- $prefix = $this->get_prefix( $k );
297
- $opts = $this->default_options( $k );
298
  $taxonomies = get_taxonomies( array( 'public' => true ), 'object' );
299
  if ( ! $taxonomies ) {
300
  return;
@@ -784,13 +784,14 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
784
  }
785
 
786
  function filter_options( $options, $location ) {
787
- if ( $location == 'settings' ) {
788
  $prefix = $this->get_prefix( $location ) . $location . '_';
 
789
  list( $legacy, $images ) = $this->get_all_images( $options );
790
  if ( isset( $options ) && isset( $options[ "{$prefix}image" ] ) ) {
791
  $thumbnail = $options[ "{$prefix}image" ];
792
- if ( ctype_digit( (string) $thumbnail ) || ( $thumbnail == 'post' ) ) {
793
- if ( $thumbnail == 'post' ) {
794
  $thumbnail = $images['post1'];
795
  } elseif ( ! empty( $legacy[ $thumbnail ] ) ) {
796
  $thumbnail = $legacy[ $thumbnail ];
@@ -820,12 +821,12 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
820
  */
821
  function filter_settings( $settings, $location, $current ) {
822
  global $aiosp, $post;
823
- if ( $location == 'opengraph' || $location == 'settings' ) {
824
  $prefix = $this->get_prefix( $location ) . $location . '_';
825
- if ( $location == 'opengraph' ) {
826
  return $settings;
827
  }
828
- if ( $location == 'settings' ) {
829
  list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current );
830
  $opts = array( 'title', 'desc' );
831
  $current_post_type = get_post_type();
@@ -857,8 +858,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
857
  if ( isset( $this->options['aiosp_opengraph_defcard'] ) ) {
858
  $settings[ $prefix . 'setcard' ]['default'] = $this->options['aiosp_opengraph_defcard'];
859
  }
860
- $info = $aiosp->get_page_snippet_info();
861
- $title = $info['title'];
862
  $description = $info['description'];
863
 
864
  // Description options.
@@ -877,7 +878,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
877
 
878
  // #1308 - we want to make sure we are ignoring php version only in the admin area
879
  // while editing the post, so that it does not impact #932.
880
- $screen = get_current_screen();
881
  $ignore_php_version = is_admin() && isset( $screen->id ) && 'post' == $screen->id;
882
 
883
  // Add filters.
@@ -889,8 +890,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
889
  if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) {
890
  foreach ( $opts as $opt ) {
891
  if ( isset( $settings[ $prefix . $opt ] ) ) {
892
- $settings[ $prefix . $opt ]['type'] = 'hidden';
893
- $settings[ $prefix . $opt ]['label'] = 'none';
894
  unset( $settings[ $prefix . $opt ]['count'] );
895
  }
896
  }
@@ -922,7 +923,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
922
  global $aioseop_options;
923
  // Prepare default and prefix.
924
  $prefix = $this->get_prefix( $location ) . $location . '_';
925
- $opts = array();
926
 
927
  foreach ( $settings as $k => $v ) {
928
  if ( $v['save'] ) {
@@ -949,7 +950,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
949
  }
950
  break;
951
  }
952
- if ( $v === null ) {
953
  unset( $options[ $k ] );
954
  }
955
  }
@@ -986,7 +987,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
986
  * @return array
987
  */
988
  function filter_metabox_options( $options, $location, $post_id ) {
989
- if ( $location == 'settings' ) {
990
  $prefix = $this->get_prefix( $location ) . $location . '_';
991
  if ( isset( $options[ $prefix . 'customimg_checker' ] )
992
  && $options[ $prefix . 'customimg_checker' ]
@@ -999,11 +1000,14 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
999
 
1000
  /** Custom settings **/
1001
  function display_custom_options( $buf, $args ) {
1002
- if ( $args['name'] == 'aiosp_opengraph_scan_header' ) {
1003
  $buf .= '<div class="aioseop aioseop_options aiosp_opengraph_settings"><div class="aioseop_wrapper aioseop_custom_type" id="aiosp_opengraph_scan_header_wrapper"><div class="aioseop_input" id="aiosp_opengraph_scan_header" style="padding-left:20px;">';
1004
- $args['options']['type'] = 'submit';
1005
- $args['attr'] = " class='button-primary' ";
1006
- $args['value'] = $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' );
 
 
 
1007
  $buf .= __( 'Scan your site for duplicate social meta tags.', 'all-in-one-seo-pack' );
1008
  $buf .= '<br /><br />' . $this->get_option_html( $args );
1009
  $buf .= '</div></div></div>';
@@ -1050,7 +1054,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1050
  $attributes = apply_filters(
1051
  $this->prefix . 'attributes',
1052
  array(
1053
- 'prefix="og: http://ogp.me/ns#"',
1054
  )
1055
  );
1056
 
@@ -1084,7 +1088,10 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1084
  $key = $this->options['aiosp_opengraph_key'];
1085
  $dimg = $this->options['aiosp_opengraph_dimg'];
1086
  $current_post_type = get_post_type();
1087
- $title = $description = $image = $video = '';
 
 
 
1088
  $type = $this->type;
1089
  $sitename = $this->options['aiosp_opengraph_sitename'];
1090
  $tag = '';
@@ -1110,7 +1117,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1110
  // this will collect the extra values that are required outside the below IF block.
1111
  $extra_params = array();
1112
 
1113
- $setmeta = $this->options['aiosp_opengraph_setmeta'];
1114
  if ( is_front_page() ) {
1115
  $title = $this->options['aiosp_opengraph_hometitle'];
1116
  if ( $first_page ) {
@@ -1161,7 +1168,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1161
  in_array( $current_post_type, $this->options['aiosp_opengraph_types'] )
1162
  ) {
1163
 
1164
- if ( $type == 'article' ) {
1165
  if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) {
1166
  $section = $metabox['aioseop_opengraph_settings_section'];
1167
  }
@@ -1177,7 +1184,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1177
  $domain = $this->options['aiosp_opengraph_twitter_domain'];
1178
  }
1179
 
1180
- if ( $type == 'article' && ! empty( $post ) ) {
1181
  if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) {
1182
  $author = get_the_author_meta( 'facebook', $post->post_author );
1183
  }
@@ -1245,7 +1252,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1245
  if ( isset( $metabox['aioseop_opengraph_settings_category'] ) ) {
1246
  $type = $metabox['aioseop_opengraph_settings_category'];
1247
  }
1248
- if ( $type == 'article' ) {
1249
  if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) {
1250
  $section = $metabox['aioseop_opengraph_settings_section'];
1251
  }
@@ -1259,7 +1266,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1259
  if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) {
1260
  $domain = $this->options['aiosp_opengraph_twitter_domain'];
1261
  }
1262
- if ( $type == 'article' && ! empty( $post ) ) {
1263
  if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) {
1264
  $author = get_the_author_meta( 'facebook', $post->post_author );
1265
  }
@@ -1281,8 +1288,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1281
  $title = $aiosp->wp_title();
1282
  }
1283
  if ( empty( $description ) ) {
1284
- $term_id = isset( $_GET['tag_ID'] ) ? (int) $_GET['tag_ID'] : 0;
1285
- $term_id = $term_id ? $term_id : get_queried_object()->term_id;
1286
  $description = trim( strip_tags( get_term_meta( $term_id, '_aioseop_description', true ) ) );
1287
  }
1288
  // Add default title.
@@ -1327,7 +1334,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1327
  return;
1328
  }
1329
 
1330
- if ( $type === 'article' && ! empty( $post ) && is_singular() ) {
1331
  if ( ! empty( $this->options['aiosp_opengraph_gen_tags'] ) ) {
1332
  if ( ! empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) {
1333
  $keywords = $aiosp->get_main_keywords();
@@ -1437,7 +1444,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1437
  $thumbnail = set_url_scheme( $thumbnail );
1438
  }
1439
 
1440
- $width = $height = '';
 
1441
  if ( ! empty( $thumbnail ) ) {
1442
  if ( ! empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) ) {
1443
  $width = $metabox['aioseop_opengraph_settings_imagewidth'];
@@ -1472,11 +1480,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1472
  }
1473
 
1474
  // support for changing legacy twitter cardtype-photo to summary large image.
1475
- if ( $card == 'photo' ) {
1476
  $card = 'summary_large_image';
1477
  }
1478
 
1479
- $site = $domain = $creator = '';
 
 
1480
 
1481
  if ( ! empty( $this->options['aiosp_opengraph_twitter_site'] ) ) {
1482
  $site = $this->options['aiosp_opengraph_twitter_site'];
@@ -1506,25 +1516,25 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1506
 
1507
  $meta = array(
1508
  'facebook' => array(
1509
- 'title' => 'og:title',
1510
  'type' => 'og:type',
 
 
1511
  'url' => 'og:url',
 
1512
  'thumbnail' => 'og:image',
1513
  'width' => 'og:image:width',
1514
  'height' => 'og:image:height',
1515
  'video' => 'og:video',
1516
  'videowidth' => 'og:video:width',
1517
  'videoheight' => 'og:video:height',
1518
- 'sitename' => 'og:site_name',
1519
  'key' => 'fb:admins',
1520
  'appid' => 'fb:app_id',
1521
- 'description' => 'og:description',
1522
  'section' => 'article:section',
1523
  'tag' => 'article:tag',
1524
- 'publisher' => 'article:publisher',
1525
- 'author' => 'article:author',
1526
  'published_time' => 'article:published_time',
1527
  'modified_time' => 'article:modified_time',
 
 
1528
  ),
1529
  'twitter' => array(
1530
  'card' => 'twitter:card',
@@ -1538,9 +1548,12 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1538
  );
1539
 
1540
  // Issue #1848 ( https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/1848 ).
 
1541
  if ( is_ssl() ) {
1542
  $meta['facebook'] += array( 'thumbnail_1' => 'og:image:secure_url' );
1543
- $thumbnail_1 = $thumbnail;
 
 
1544
  }
1545
 
1546
  $tags = array(
@@ -1682,15 +1695,18 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1682
  10,
1683
  3
1684
  );
1685
- $post_types = $this->get_post_type_titles();
1686
- $rempost = array(
 
1687
  'revision' => 1,
1688
  'nav_menu_item' => 1,
1689
  'custom_css' => 1,
1690
  'customize_changeset' => 1,
1691
  );
1692
- $post_types = array_diff_key( $post_types, $rempost );
 
1693
  $this->default_options['types']['initial_options'] = $post_types;
 
1694
  foreach ( $post_types as $slug => $name ) {
1695
  $field = $slug . '_fb_object_type';
1696
  $this->default_options[ $field ] = array(
@@ -1719,7 +1735,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1719
  $size = apply_filters( 'post_thumbnail_size', 'large' );
1720
  $default = $this->get_the_image_by_default();
1721
  if ( ! empty( $default ) ) {
1722
- $default = set_url_scheme( $default );
1723
  $img[ $default ] = 0;
1724
  }
1725
  $img = array_merge( $img, parent::get_all_images( $options, null ) );
@@ -1734,7 +1750,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1734
  $img[ $options['aioseop_opengraph_settings_customimg_twitter'] ] = 'customimg_twitter';
1735
  }
1736
 
1737
- if ( $author_img = $this->get_the_image_by_author( $p ) ) {
 
1738
  $image['author'] = $author_img;
1739
  }
1740
  $image = array_flip( $img );
@@ -1749,7 +1766,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1749
  }
1750
 
1751
  function get_the_image_by_author( $options = null, $p = null ) {
1752
- if ( $p === null ) {
1753
  global $post;
1754
  } else {
1755
  $post = $p;
@@ -1841,9 +1858,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1841
  if ( $update ) {
1842
  return;
1843
  }
1844
- if ( $this->locations !== null ) {
1845
  foreach ( $this->locations as $k => $v ) {
1846
- if ( isset( $v['type'] ) && ( $v['type'] === 'metabox' ) ) {
1847
  $opts = $this->default_options( $k );
1848
  $options = array();
1849
  $update = false;
@@ -1891,7 +1908,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
1891
  * @return array
1892
  */
1893
  public function filter_default_options( $options, $location ) {
1894
- if ( $location === 'settings' ) {
1895
  $prefix = $this->get_prefix( $location ) . $location . '_';
1896
  // Add image checker as default.
1897
  $options[ $prefix . 'customimg_checker' ] = 0;
193
  * @param string $taxonomy Taxonomy slug.
194
  */
195
  function created_term( $term_id, $tt_id, $taxonomy_name ) {
196
+ $k = 'settings';
197
+ $prefix = $this->get_prefix( $k );
198
+ $tax = get_taxonomy( $taxonomy_name );
199
  $this->set_object_type_for_taxonomy( $prefix, $k, $taxonomy_name, $tax, false, array( $term_id ) );
200
  }
201
 
278
  * Called when this module is activated.
279
  */
280
  public function activate_module() {
281
+ if ( null !== $this->locations ) {
282
  foreach ( $this->locations as $k => $v ) {
283
  if ( ! isset( $v['type'] ) || 'metabox' !== $v['type'] ) {
284
  continue;
293
  * @param string $k The key against which the options will be determined/set.
294
  */
295
  private function set_virgin_tax_terms( $k ) {
296
+ $prefix = $this->get_prefix( $k );
297
+ $opts = $this->default_options( $k );
298
  $taxonomies = get_taxonomies( array( 'public' => true ), 'object' );
299
  if ( ! $taxonomies ) {
300
  return;
784
  }
785
 
786
  function filter_options( $options, $location ) {
787
+ if ( 'settings' == $location ) {
788
  $prefix = $this->get_prefix( $location ) . $location . '_';
789
+
790
  list( $legacy, $images ) = $this->get_all_images( $options );
791
  if ( isset( $options ) && isset( $options[ "{$prefix}image" ] ) ) {
792
  $thumbnail = $options[ "{$prefix}image" ];
793
+ if ( ctype_digit( (string) $thumbnail ) || ( 'post' == $thumbnail ) ) {
794
+ if ( 'post' == $thumbnail ) {
795
  $thumbnail = $images['post1'];
796
  } elseif ( ! empty( $legacy[ $thumbnail ] ) ) {
797
  $thumbnail = $legacy[ $thumbnail ];
821
  */
822
  function filter_settings( $settings, $location, $current ) {
823
  global $aiosp, $post;
824
+ if ( 'opengraph' == $location || 'settings' == $location ) {
825
  $prefix = $this->get_prefix( $location ) . $location . '_';
826
+ if ( 'opengraph' == $location ) {
827
  return $settings;
828
  }
829
+ if ( 'settings' == $location ) {
830
  list( $legacy, $settings[ $prefix . 'image' ]['initial_options'] ) = $this->get_all_images( $current );
831
  $opts = array( 'title', 'desc' );
832
  $current_post_type = get_post_type();
858
  if ( isset( $this->options['aiosp_opengraph_defcard'] ) ) {
859
  $settings[ $prefix . 'setcard' ]['default'] = $this->options['aiosp_opengraph_defcard'];
860
  }
861
+ $info = $aiosp->get_page_snippet_info();
862
+ $title = $info['title'];
863
  $description = $info['description'];
864
 
865
  // Description options.
878
 
879
  // #1308 - we want to make sure we are ignoring php version only in the admin area
880
  // while editing the post, so that it does not impact #932.
881
+ $screen = get_current_screen();
882
  $ignore_php_version = is_admin() && isset( $screen->id ) && 'post' == $screen->id;
883
 
884
  // Add filters.
890
  if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] ) {
891
  foreach ( $opts as $opt ) {
892
  if ( isset( $settings[ $prefix . $opt ] ) ) {
893
+ $settings[ $prefix . $opt ]['type'] = 'hidden';
894
+ $settings[ $prefix . $opt ]['label'] = 'none';
895
  unset( $settings[ $prefix . $opt ]['count'] );
896
  }
897
  }
923
  global $aioseop_options;
924
  // Prepare default and prefix.
925
  $prefix = $this->get_prefix( $location ) . $location . '_';
926
+ $opts = array();
927
 
928
  foreach ( $settings as $k => $v ) {
929
  if ( $v['save'] ) {
950
  }
951
  break;
952
  }
953
+ if ( null === $v ) {
954
  unset( $options[ $k ] );
955
  }
956
  }
987
  * @return array
988
  */
989
  function filter_metabox_options( $options, $location, $post_id ) {
990
+ if ( 'settings' == $location ) {
991
  $prefix = $this->get_prefix( $location ) . $location . '_';
992
  if ( isset( $options[ $prefix . 'customimg_checker' ] )
993
  && $options[ $prefix . 'customimg_checker' ]
1000
 
1001
  /** Custom settings **/
1002
  function display_custom_options( $buf, $args ) {
1003
+ if ( 'aiosp_opengraph_scan_header' == $args['name'] ) {
1004
  $buf .= '<div class="aioseop aioseop_options aiosp_opengraph_settings"><div class="aioseop_wrapper aioseop_custom_type" id="aiosp_opengraph_scan_header_wrapper"><div class="aioseop_input" id="aiosp_opengraph_scan_header" style="padding-left:20px;">';
1005
+
1006
+ $args['options']['type'] = 'submit';
1007
+ $args['attr'] = " class='button-primary' ";
1008
+ $args['value'] = __( 'Scan Now', 'all-in-one-seo-pack' );
1009
+ $args['options']['default'] = __( 'Scan Now', 'all-in-one-seo-pack' );
1010
+
1011
  $buf .= __( 'Scan your site for duplicate social meta tags.', 'all-in-one-seo-pack' );
1012
  $buf .= '<br /><br />' . $this->get_option_html( $args );
1013
  $buf .= '</div></div></div>';
1054
  $attributes = apply_filters(
1055
  $this->prefix . 'attributes',
1056
  array(
1057
+ 'prefix="og: https://ogp.me/ns#"',
1058
  )
1059
  );
1060
 
1088
  $key = $this->options['aiosp_opengraph_key'];
1089
  $dimg = $this->options['aiosp_opengraph_dimg'];
1090
  $current_post_type = get_post_type();
1091
+ $title = '';
1092
+ $description = '';
1093
+ $image = '';
1094
+ $video = '';
1095
  $type = $this->type;
1096
  $sitename = $this->options['aiosp_opengraph_sitename'];
1097
  $tag = '';
1117
  // this will collect the extra values that are required outside the below IF block.
1118
  $extra_params = array();
1119
 
1120
+ $setmeta = $this->options['aiosp_opengraph_setmeta'];
1121
  if ( is_front_page() ) {
1122
  $title = $this->options['aiosp_opengraph_hometitle'];
1123
  if ( $first_page ) {
1168
  in_array( $current_post_type, $this->options['aiosp_opengraph_types'] )
1169
  ) {
1170
 
1171
+ if ( 'article' == $type ) {
1172
  if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) {
1173
  $section = $metabox['aioseop_opengraph_settings_section'];
1174
  }
1184
  $domain = $this->options['aiosp_opengraph_twitter_domain'];
1185
  }
1186
 
1187
+ if ( 'article' == $type && ! empty( $post ) ) {
1188
  if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) {
1189
  $author = get_the_author_meta( 'facebook', $post->post_author );
1190
  }
1252
  if ( isset( $metabox['aioseop_opengraph_settings_category'] ) ) {
1253
  $type = $metabox['aioseop_opengraph_settings_category'];
1254
  }
1255
+ if ( 'article' == $type ) {
1256
  if ( ! empty( $metabox['aioseop_opengraph_settings_section'] ) ) {
1257
  $section = $metabox['aioseop_opengraph_settings_section'];
1258
  }
1266
  if ( ! empty( $this->options['aiosp_opengraph_twitter_domain'] ) ) {
1267
  $domain = $this->options['aiosp_opengraph_twitter_domain'];
1268
  }
1269
+ if ( 'article' == $type && ! empty( $post ) ) {
1270
  if ( isset( $post->post_author ) && ! empty( $this->options['aiosp_opengraph_facebook_author'] ) ) {
1271
  $author = get_the_author_meta( 'facebook', $post->post_author );
1272
  }
1288
  $title = $aiosp->wp_title();
1289
  }
1290
  if ( empty( $description ) ) {
1291
+ $term_id = isset( $_GET['tag_ID'] ) ? (int) $_GET['tag_ID'] : 0;
1292
+ $term_id = $term_id ? $term_id : get_queried_object()->term_id;
1293
  $description = trim( strip_tags( get_term_meta( $term_id, '_aioseop_description', true ) ) );
1294
  }
1295
  // Add default title.
1334
  return;
1335
  }
1336
 
1337
+ if ( 'article' === $type && ! empty( $post ) && is_singular() ) {
1338
  if ( ! empty( $this->options['aiosp_opengraph_gen_tags'] ) ) {
1339
  if ( ! empty( $this->options['aiosp_opengraph_gen_keywords'] ) ) {
1340
  $keywords = $aiosp->get_main_keywords();
1444
  $thumbnail = set_url_scheme( $thumbnail );
1445
  }
1446
 
1447
+ $width = '';
1448
+ $height = '';
1449
  if ( ! empty( $thumbnail ) ) {
1450
  if ( ! empty( $metabox['aioseop_opengraph_settings_imagewidth'] ) ) {
1451
  $width = $metabox['aioseop_opengraph_settings_imagewidth'];
1480
  }
1481
 
1482
  // support for changing legacy twitter cardtype-photo to summary large image.
1483
+ if ( 'photo' == $card ) {
1484
  $card = 'summary_large_image';
1485
  }
1486
 
1487
+ $site = '';
1488
+ $domain = '';
1489
+ $creator = '';
1490
 
1491
  if ( ! empty( $this->options['aiosp_opengraph_twitter_site'] ) ) {
1492
  $site = $this->options['aiosp_opengraph_twitter_site'];
1516
 
1517
  $meta = array(
1518
  'facebook' => array(
 
1519
  'type' => 'og:type',
1520
+ 'title' => 'og:title',
1521
+ 'description' => 'og:description',
1522
  'url' => 'og:url',
1523
+ 'sitename' => 'og:site_name',
1524
  'thumbnail' => 'og:image',
1525
  'width' => 'og:image:width',
1526
  'height' => 'og:image:height',
1527
  'video' => 'og:video',
1528
  'videowidth' => 'og:video:width',
1529
  'videoheight' => 'og:video:height',
 
1530
  'key' => 'fb:admins',
1531
  'appid' => 'fb:app_id',
 
1532
  'section' => 'article:section',
1533
  'tag' => 'article:tag',
 
 
1534
  'published_time' => 'article:published_time',
1535
  'modified_time' => 'article:modified_time',
1536
+ 'publisher' => 'article:publisher',
1537
+ 'author' => 'article:author',
1538
  ),
1539
  'twitter' => array(
1540
  'card' => 'twitter:card',
1548
  );
1549
 
1550
  // Issue #1848 ( https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/1848 ).
1551
+ // Issue #2867 ( https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/2867 ).
1552
  if ( is_ssl() ) {
1553
  $meta['facebook'] += array( 'thumbnail_1' => 'og:image:secure_url' );
1554
+ $thumbnail_1 = $thumbnail;
1555
+ $meta['facebook'] += array( 'video_1' => 'og:video:secure_url' );
1556
+ $video_1 = $video;
1557
  }
1558
 
1559
  $tags = array(
1695
  10,
1696
  3
1697
  );
1698
+
1699
+ $post_types = $this->get_post_type_titles();
1700
+ $rempost = array(
1701
  'revision' => 1,
1702
  'nav_menu_item' => 1,
1703
  'custom_css' => 1,
1704
  'customize_changeset' => 1,
1705
  );
1706
+ $post_types = array_diff_key( $post_types, $rempost );
1707
+
1708
  $this->default_options['types']['initial_options'] = $post_types;
1709
+
1710
  foreach ( $post_types as $slug => $name ) {
1711
  $field = $slug . '_fb_object_type';
1712
  $this->default_options[ $field ] = array(
1735
  $size = apply_filters( 'post_thumbnail_size', 'large' );
1736
  $default = $this->get_the_image_by_default();
1737
  if ( ! empty( $default ) ) {
1738
+ $default = set_url_scheme( $default );
1739
  $img[ $default ] = 0;
1740
  }
1741
  $img = array_merge( $img, parent::get_all_images( $options, null ) );
1750
  $img[ $options['aioseop_opengraph_settings_customimg_twitter'] ] = 'customimg_twitter';
1751
  }
1752
 
1753
+ $author_img = $this->get_the_image_by_author( $p );
1754
+ if ( $author_img ) {
1755
  $image['author'] = $author_img;
1756
  }
1757
  $image = array_flip( $img );
1766
  }
1767
 
1768
  function get_the_image_by_author( $options = null, $p = null ) {
1769
+ if ( null === $p ) {
1770
  global $post;
1771
  } else {
1772
  $post = $p;
1858
  if ( $update ) {
1859
  return;
1860
  }
1861
+ if ( null !== $this->locations ) {
1862
  foreach ( $this->locations as $k => $v ) {
1863
+ if ( isset( $v['type'] ) && ( 'metabox' === $v['type'] ) ) {
1864
  $opts = $this->default_options( $k );
1865
  $options = array();
1866
  $update = false;
1908
  * @return array
1909
  */
1910
  public function filter_default_options( $options, $location ) {
1911
+ if ( 'settings' === $location ) {
1912
  $prefix = $this->get_prefix( $location ) . $location . '_';
1913
  // Add image checker as default.
1914
  $options[ $prefix . 'customimg_checker' ] = 0;
modules/aioseop_performance.php CHANGED
@@ -32,17 +32,20 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
32
  * @param $mod
33
  */
34
  function __construct( $mod ) {
35
- $this->name = __( 'Performance', 'all-in-one-seo-pack' ); // Human-readable name of the plugin.
36
- $this->prefix = 'aiosp_performance_'; // Option prefix.
37
- $this->file = __FILE__; // The current file.
 
38
  parent::__construct();
39
 
40
  $this->default_options = array(
41
  'memory_limit' => array(
 
42
  'name' => __( 'Raise memory limit', 'all-in-one-seo-pack' ),
43
  'default' => '256M',
44
  'type' => 'select',
45
  'initial_options' => array(
 
46
  0 => __( 'Use the system default', 'all-in-one-seo-pack' ),
47
  '32M' => '32MB',
48
  '64M' => '64MB',
@@ -51,6 +54,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
51
  ),
52
  ),
53
  'execution_time' => array(
 
54
  'name' => __( 'Raise execution time', 'all-in-one-seo-pack' ),
55
  'default' => '',
56
  'type' => 'select',
@@ -67,7 +71,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
67
 
68
  global $aiosp, $aioseop_options;
69
  $this->default_options['force_rewrites'] = array(
70
- 'name' => __( 'Force Rewrites:', 'all-in-one-seo-pack' ),
 
71
  'default' => 1,
72
  'type' => 'radio',
73
  'initial_options' => array(
@@ -100,6 +105,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
100
  );
101
 
102
  $this->layout['system_status'] = array(
 
103
  'name' => __( 'System Status', 'all-in-one-seo-pack' ),
104
  'help_link' => 'https://semperplugins.com/documentation/performance-settings/',
105
  'options' => array_keys( $system_status ),
@@ -122,7 +128,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
122
  * @return mixed
123
  */
124
  function update_options_filter( $options, $location ) {
125
- if ( $location == null && isset( $options[ $this->prefix . 'force_rewrites' ] ) ) {
126
  unset( $options[ $this->prefix . 'force_rewrites' ] );
127
  }
128
 
@@ -139,7 +145,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
139
  * @return mixed
140
  */
141
  function display_options_filter( $options, $location ) {
142
- if ( $location == null ) {
143
  $options[ $this->prefix . 'force_rewrites' ] = 1;
144
  global $aiosp;
145
  $opts = $aiosp->get_current_options( array(), null );
@@ -157,9 +163,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
157
  * @param $location
158
  */
159
  function settings_update_action( $options, $location ) {
160
- if ( $location == null && isset( $_POST[ $this->prefix . 'force_rewrites' ] ) ) {
161
  $force_rewrites = $_POST[ $this->prefix . 'force_rewrites' ];
162
- if ( ( $force_rewrites == 0 ) || ( $force_rewrites == 1 ) ) {
163
  global $aiosp;
164
  $opts = $aiosp->get_current_options( array(), null );
165
  $opts['aiosp_force_rewrites'] = $force_rewrites;
@@ -198,7 +204,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
198
  * @since ?
199
  */
200
  function settings_page_init() {
201
- $this->default_options['status']['default'] = $this->get_serverinfo();
202
  $this->default_options['send_email']['default'] = $this->get_email_input();
203
  }
204
 
@@ -240,6 +246,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
240
  if ( ini_get( 'upload_max_filesize' ) ) {
241
  $upload_max = ini_get( 'upload_max_filesize' );
242
  } else {
 
243
  $upload_max = __( 'N/A', 'all-in-one-seo-pack' );
244
  }
245
  if ( ini_get( 'post_max_size' ) ) {
@@ -258,7 +265,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
258
  $memory_limit = __( 'N/A', 'all-in-one-seo-pack' );
259
  }
260
  if ( function_exists( 'memory_get_usage' ) ) {
261
- $memory_usage = round( memory_get_usage() / 1024 / 1024, 2 ) . __( ' MByte', 'all-in-one-seo-pack' );
262
  } else {
263
  $memory_usage = __( 'N/A', 'all-in-one-seo-pack' );
264
  }
@@ -304,33 +311,48 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
304
  $debug_info = array(
305
  __( 'Operating System', 'all-in-one-seo-pack' ) => PHP_OS,
306
  __( 'Server', 'all-in-one-seo-pack' ) => $_SERVER['SERVER_SOFTWARE'],
 
307
  __( 'Memory usage', 'all-in-one-seo-pack' ) => $memory_usage,
 
308
  __( 'MYSQL Version', 'all-in-one-seo-pack' ) => $sqlversion,
 
309
  __( 'SQL Mode', 'all-in-one-seo-pack' ) => $sql_mode,
310
  __( 'PHP Version', 'all-in-one-seo-pack' ) => PHP_VERSION,
 
311
  __( 'PHP Allow URL fopen', 'all-in-one-seo-pack' ) => $allow_url_fopen,
 
312
  __( 'PHP Memory Limit', 'all-in-one-seo-pack' ) => $memory_limit,
313
  __( 'PHP Max Upload Size', 'all-in-one-seo-pack' ) => $upload_max,
314
  __( 'PHP Max Post Size', 'all-in-one-seo-pack' ) => $post_max,
315
  __( 'PHP Max Script Execute Time', 'all-in-one-seo-pack' ) => $max_execute,
 
316
  __( 'PHP Exif support', 'all-in-one-seo-pack' ) => $exif,
 
317
  __( 'PHP IPTC support', 'all-in-one-seo-pack' ) => $iptc,
 
318
  __( 'PHP XML support', 'all-in-one-seo-pack' ) => $xml,
 
319
  __( 'Site URL', 'all-in-one-seo-pack' ) => $siteurl,
 
320
  __( 'Home URL', 'all-in-one-seo-pack' ) => $homeurl,
321
  __( 'WordPress Version', 'all-in-one-seo-pack' ) => $wp_version,
 
322
  __( 'WordPress DB Version', 'all-in-one-seo-pack' ) => $db_version,
 
323
  __( 'Multisite', 'all-in-one-seo-pack' ) => $ms,
324
  __( 'Active Theme', 'all-in-one-seo-pack' ) => $theme['Name'] . ' ' . $theme['Version'],
325
  __( 'Site Title', 'all-in-one-seo-pack' ) => $site_title,
326
  __( 'Site Language', 'all-in-one-seo-pack' ) => $language,
327
- __( 'Front Page Displays', 'all-in-one-seo-pack' ) => $front_displays === 'page' ? $front_displays . ' [ID = ' . $page_on_front . ']' : $front_displays,
 
328
  __( 'Search Engine Visibility', 'all-in-one-seo-pack' ) => $blog_public,
 
329
  __( 'Permalink Setting', 'all-in-one-seo-pack' ) => $perm_struct,
330
  );
331
  $debug_info[ __( 'Active Plugins', 'all-in-one-seo-pack' ) ] = null;
332
- $active_plugins = $inactive_plugins = array();
333
- $plugins = get_plugins();
 
334
  foreach ( $plugins as $path => $plugin ) {
335
  if ( is_plugin_active( $path ) ) {
336
  $debug_info[ $plugin['Name'] ] = $plugin['Version'];
@@ -338,15 +360,17 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
338
  $inactive_plugins[ $plugin['Name'] ] = $plugin['Version'];
339
  }
340
  }
341
- $debug_info[ __( 'Inactive Plugins', 'all-in-one-seo-pack' ) ] = null;
342
- $debug_info = array_merge( $debug_info, (array) $inactive_plugins );
343
 
344
- /* translators: %s is a placeholder, which means that it should not be translated. It will be replaced with the name of the premium version of the plugin, All in One SEO Pack Pro. */
 
 
 
 
345
  $mail_text = sprintf( __( '%s Debug Info', 'all-in-one-seo-pack' ), 'All in One SEO Pack Pro' ) . "\r\n------------------\r\n\r\n";
346
  $page_text = '';
347
  if ( ! empty( $debug_info ) ) {
348
  foreach ( $debug_info as $name => $value ) {
349
- if ( $value !== null ) {
350
  $page_text .= "<li><strong>$name</strong> $value</li>";
351
  $mail_text .= "$name: $value\r\n";
352
  } else {
@@ -360,7 +384,10 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
360
  if ( ! empty( $_REQUEST['sfwd_debug_submit'] ) ) {
361
  $nonce = $_REQUEST['sfwd_debug_nonce'];
362
  if ( ! wp_verify_nonce( $nonce, 'sfwd-debug-nonce' ) ) {
363
- echo "<div class='sfwd_debug_error'>" . __( 'Form submission error: verification check failed.', 'all-in-one-seo-pack' ) . '</div>';
 
 
 
364
  break;
365
  }
366
  $email = '';
@@ -369,8 +396,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
369
  }
370
  if ( $email ) {
371
  $attachments = array();
372
- $upload_dir = wp_upload_dir();
373
- $dir = $upload_dir['basedir'] . '/aiosp-log/';
374
  if ( wp_mkdir_p( $dir ) ) {
375
  $file_path = $dir . 'settings_aioseop-' . date( 'Y-m-d' ) . '-' . time() . '.ini';
376
  if ( ! file_exists( $file_path ) ) {
@@ -379,7 +406,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
379
  // @codingStandardsIgnoreEnd
380
  global $aiosp;
381
  $buf = '; ' . sprintf(
382
- /* translators: %s is a placeholder, which means that it should not be translated. It will be replaced with the name of the plugin, All in One SEO Pack. */
383
  __( 'Settings export file for %s', 'all-in-one-seo-pack' ),
384
  AIOSEOP_PLUGIN_NAME
385
  ) . "\n";
@@ -397,17 +424,28 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
397
  }
398
  }
399
 
400
- if ( wp_mail( $email, sprintf( __( 'SFWD Debug Mail From Site %s.', 'all-in-one-seo-pack' ), $siteurl ), $mail_text, '', $attachments ) ) {
401
- echo "<div class='sfwd_debug_mail_sent'>" . sprintf( __( 'Sent to %s.', 'all-in-one-seo-pack' ), $email ) . '</div>';
 
 
 
 
 
 
 
 
 
402
  } else {
403
- echo "<div class='sfwd_debug_error'>" . sprintf( __( 'Failed to send to %s.', 'all-in-one-seo-pack' ), $email ) . '</div>';
 
 
404
  }
405
  } else {
406
  echo "<div class='sfwd_debug_error'>" . __( 'Error: please enter an e-mail address before submitting.', 'all-in-one-seo-pack' ) . '</div>';
407
  }
408
  }
409
  } while ( 0 ); // Control structure for use with break.
410
- $buf = "<ul class='sfwd_debug_settings'>\n{$page_text}\n</ul>\n";
411
 
412
  return $buf;
413
  }
@@ -422,7 +460,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Performance' ) ) {
422
  function get_email_input() {
423
  $nonce = wp_create_nonce( 'sfwd-debug-nonce' );
424
  $buf =
425
- '<input name="sfwd_debug_send_email" type="text" value="" placeholder="' . __( 'E-mail debug information', 'all-in-one-seo-pack' ) . '" aria-label="' . __( 'Enter the email address provided by Semper Plugins Support to send your debug information', 'all-in-one-seo-pack' ) . '">' .
 
 
426
  '<input name="sfwd_debug_nonce" type="hidden" value="' . $nonce . '">' .
427
  '<input name="sfwd_debug_submit" type="submit" value="' . __( 'Submit', 'all-in-one-seo-pack' ) . '" class="button-primary">';
428
  return $buf;
32
  * @param $mod
33
  */
34
  function __construct( $mod ) {
35
+ /* translators: This is the title of our Performance module. */
36
+ $this->name = __( 'Performance', 'all-in-one-seo-pack' );
37
+ $this->prefix = 'aiosp_performance_';
38
+ $this->file = __FILE__;
39
  parent::__construct();
40
 
41
  $this->default_options = array(
42
  'memory_limit' => array(
43
+ /* translators: This is the name of a setting which allows users to increase their PHP memory limit. */
44
  'name' => __( 'Raise memory limit', 'all-in-one-seo-pack' ),
45
  'default' => '256M',
46
  'type' => 'select',
47
  'initial_options' => array(
48
+ /* translators: This a dropdown value for the "Raise memory limit" setting. If this is selected, All in One SEO Pack will not override the PHP memory limit and use the default system value. */
49
  0 => __( 'Use the system default', 'all-in-one-seo-pack' ),
50
  '32M' => '32MB',
51
  '64M' => '64MB',
54
  ),
55
  ),
56
  'execution_time' => array(
57
+ /* translators: This is the name of a setting which allows users to increase their PHP execution time limit. */
58
  'name' => __( 'Raise execution time', 'all-in-one-seo-pack' ),
59
  'default' => '',
60
  'type' => 'select',
71
 
72
  global $aiosp, $aioseop_options;
73
  $this->default_options['force_rewrites'] = array(
74
+ /* translators: This is the name of a setting which forces the plugin to use output buffering to rewrite the title tag in the source code. */
75
+ 'name' => __( 'Force Rewrites', 'all-in-one-seo-pack' ),
76
  'default' => 1,
77
  'type' => 'radio',
78
  'initial_options' => array(
105
  );
106
 
107
  $this->layout['system_status'] = array(
108
+ /* translators: This is the header of a table in which All in One SEO Pack displays data about the user's WordPress installation and server. */
109
  'name' => __( 'System Status', 'all-in-one-seo-pack' ),
110
  'help_link' => 'https://semperplugins.com/documentation/performance-settings/',
111
  'options' => array_keys( $system_status ),
128
  * @return mixed
129
  */
130
  function update_options_filter( $options, $location ) {
131
+ if ( null == $location && isset( $options[ $this->prefix . 'force_rewrites' ] ) ) {
132
  unset( $options[ $this->prefix . 'force_rewrites' ] );
133
  }
134
 
145
  * @return mixed
146
  */
147
  function display_options_filter( $options, $location ) {
148
+ if ( null == $location ) {
149
  $options[ $this->prefix . 'force_rewrites' ] = 1;
150
  global $aiosp;
151
  $opts = $aiosp->get_current_options( array(), null );
163
  * @param $location
164
  */
165
  function settings_update_action( $options, $location ) {
166
+ if ( null == $location && isset( $_POST[ $this->prefix . 'force_rewrites' ] ) ) {
167
  $force_rewrites = $_POST[ $this->prefix . 'force_rewrites' ];
168
+ if ( ( 0 == $force_rewrites ) || ( 1 == $force_rewrites ) ) {
169
  global $aiosp;
170
  $opts = $aiosp->get_current_options( array(), null );
171
  $opts['aiosp_force_rewrites'] = $force_rewrites;
204
  * @since ?
205
  */
206
  function settings_page_init() {
207
+ $this->default_options['status']['default'] = $this->get_serverinfo();
208
  $this->default_options['send_email']['default'] = $this->get_email_input();
209
  }
210
 
246
  if ( ini_get( 'upload_max_filesize' ) ) {
247
  $upload_max = ini_get( 'upload_max_filesize' );
248
  } else {
249
+ /* translators: "N/A" is an abbreviation for "Non Applicable". */
250
  $upload_max = __( 'N/A', 'all-in-one-seo-pack' );
251
  }
252
  if ( ini_get( 'post_max_size' ) ) {
265
  $memory_limit = __( 'N/A', 'all-in-one-seo-pack' );
266
  }
267
  if ( function_exists( 'memory_get_usage' ) ) {
268
+ $memory_usage = round( memory_get_usage() / 1024 / 1024, 2 ) . 'M';
269
  } else {
270
  $memory_usage = __( 'N/A', 'all-in-one-seo-pack' );
271
  }
311
  $debug_info = array(
312
  __( 'Operating System', 'all-in-one-seo-pack' ) => PHP_OS,
313
  __( 'Server', 'all-in-one-seo-pack' ) => $_SERVER['SERVER_SOFTWARE'],
314
+ /* translators: "Memory" in this context refers to RAM memory. */
315
  __( 'Memory usage', 'all-in-one-seo-pack' ) => $memory_usage,
316
+ /* translators: "MYSQL" is the name of a database software and should not be translated. */
317
  __( 'MYSQL Version', 'all-in-one-seo-pack' ) => $sqlversion,
318
+ /* translators: "SQL" is a programming language that is used to store or retrieve data from databases and should not be translated. */
319
  __( 'SQL Mode', 'all-in-one-seo-pack' ) => $sql_mode,
320
  __( 'PHP Version', 'all-in-one-seo-pack' ) => PHP_VERSION,
321
+ /* translators: This is a setting in the PHP interpreter of the server. Leave this untranslated if there's no proper translation for this. */
322
  __( 'PHP Allow URL fopen', 'all-in-one-seo-pack' ) => $allow_url_fopen,
323
+ /* translators: "Memory" in this context refers to RAM memory. */
324
  __( 'PHP Memory Limit', 'all-in-one-seo-pack' ) => $memory_limit,
325
  __( 'PHP Max Upload Size', 'all-in-one-seo-pack' ) => $upload_max,
326
  __( 'PHP Max Post Size', 'all-in-one-seo-pack' ) => $post_max,
327
  __( 'PHP Max Script Execute Time', 'all-in-one-seo-pack' ) => $max_execute,
328
+ /* translators: The "PHP Exif" part should not be translated. */
329
  __( 'PHP Exif support', 'all-in-one-seo-pack' ) => $exif,
330
+ /* translators: The "PHP IPTC" part should not be translated. */
331
  __( 'PHP IPTC support', 'all-in-one-seo-pack' ) => $iptc,
332
+ /* translators: The "PHP XML" part should not be translated. */
333
  __( 'PHP XML support', 'all-in-one-seo-pack' ) => $xml,
334
+ /* translators: This is the base URL (e.g. "examplewebsite.com") of the website. */
335
  __( 'Site URL', 'all-in-one-seo-pack' ) => $siteurl,
336
+ /* translators: This is the URL of the homepage (e.g. "examplewebsite.com/home") of the website. */
337
  __( 'Home URL', 'all-in-one-seo-pack' ) => $homeurl,
338
  __( 'WordPress Version', 'all-in-one-seo-pack' ) => $wp_version,
339
+ /* translators: "DB" is an abbreviation for "Database". */
340
  __( 'WordPress DB Version', 'all-in-one-seo-pack' ) => $db_version,
341
+ /* translators: "Multisite" or "WordPress Multisite" is a feature that allows users to create a network of websites. Leave this in English if there is no translation for this in your locale glossary. */
342
  __( 'Multisite', 'all-in-one-seo-pack' ) => $ms,
343
  __( 'Active Theme', 'all-in-one-seo-pack' ) => $theme['Name'] . ' ' . $theme['Version'],
344
  __( 'Site Title', 'all-in-one-seo-pack' ) => $site_title,
345
  __( 'Site Language', 'all-in-one-seo-pack' ) => $language,
346
+ /* translators: This is a label that shows what page is used as the homepage/front page. */
347
+ __( 'Front Page Displays', 'all-in-one-seo-pack' ) => 'page' === $front_displays ? $front_displays . ' [ID = ' . $page_on_front . ']' : $front_displays,
348
  __( 'Search Engine Visibility', 'all-in-one-seo-pack' ) => $blog_public,
349
+ /* translators: This is a label that shows what the current permalink structure is. The permalink structure is the way that the URLs of the website are formatted, e.g. "examplesite.com/?p=123" or "examplesite.com/1970/01/01/sample-post/". */
350
  __( 'Permalink Setting', 'all-in-one-seo-pack' ) => $perm_struct,
351
  );
352
  $debug_info[ __( 'Active Plugins', 'all-in-one-seo-pack' ) ] = null;
353
+ $active_plugins = array();
354
+ $inactive_plugins = array();
355
+ $plugins = get_plugins();
356
  foreach ( $plugins as $path => $plugin ) {
357
  if ( is_plugin_active( $path ) ) {
358
  $debug_info[ $plugin['Name'] ] = $plugin['Version'];
360
  $inactive_plugins[ $plugin['Name'] ] = $plugin['Version'];
361
  }
362
  }
 
 
363
 
364
+ $debug_key = __( 'Inactive Plugins', 'all-in-one-seo-pack' );
365
+ $debug_info[ $debug_key ] = null;
366
+ $debug_info = array_merge( $debug_info, (array) $inactive_plugins );
367
+
368
+ /* translators: "%s" is a placeholder so it should not be translated. It will be replaced with the name of the premium version of the plugin, All in One SEO Pack Pro. */
369
  $mail_text = sprintf( __( '%s Debug Info', 'all-in-one-seo-pack' ), 'All in One SEO Pack Pro' ) . "\r\n------------------\r\n\r\n";
370
  $page_text = '';
371
  if ( ! empty( $debug_info ) ) {
372
  foreach ( $debug_info as $name => $value ) {
373
+ if ( null !== $value ) {
374
  $page_text .= "<li><strong>$name</strong> $value</li>";
375
  $mail_text .= "$name: $value\r\n";
376
  } else {
384
  if ( ! empty( $_REQUEST['sfwd_debug_submit'] ) ) {
385
  $nonce = $_REQUEST['sfwd_debug_nonce'];
386
  if ( ! wp_verify_nonce( $nonce, 'sfwd-debug-nonce' ) ) {
387
+ echo "<div class='sfwd_debug_error'>" .
388
+ /* translators: This message is shown when a form could not be submitted due to a verification error (e.g. when a field is required and is still blank). */
389
+ __( 'Form submission error: verification check failed.', 'all-in-one-seo-pack' )
390
+ . '</div>';
391
  break;
392
  }
393
  $email = '';
396
  }
397
  if ( $email ) {
398
  $attachments = array();
399
+ $upload_dir = wp_upload_dir();
400
+ $dir = $upload_dir['basedir'] . '/aiosp-log/';
401
  if ( wp_mkdir_p( $dir ) ) {
402
  $file_path = $dir . 'settings_aioseop-' . date( 'Y-m-d' ) . '-' . time() . '.ini';
403
  if ( ! file_exists( $file_path ) ) {
406
  // @codingStandardsIgnoreEnd
407
  global $aiosp;
408
  $buf = '; ' . sprintf(
409
+ /* translators: %s is a placeholder so it should not be translated. It will be replaced with the name of the plugin, All in One SEO Pack. */
410
  __( 'Settings export file for %s', 'all-in-one-seo-pack' ),
411
  AIOSEOP_PLUGIN_NAME
412
  ) . "\n";
424
  }
425
  }
426
 
427
+ /* translators: %s is a placeholder and should not be translated. It will be replaced with the URL of the website. Also, "SFWD" is an abbreviation for our business name and shouldn't be translated either. */
428
+ if ( wp_mail(
429
+ $email,
430
+ sprintf( __( 'SFWD Debug Mail From Site %s.', 'all-in-one-seo-pack' ), $siteurl ),
431
+ $mail_text,
432
+ '',
433
+ $attachments
434
+ ) ) {
435
+ echo "<div class='sfwd_debug_mail_sent'>" .
436
+ /* translators: %s is a placeholder and should not be translated. It will be replaced with an e-mail address. */
437
+ sprintf( __( 'Sent to %s.', 'all-in-one-seo-pack' ), $email ) . '</div>';
438
  } else {
439
+ echo "<div class='sfwd_debug_error'>" .
440
+ /* translators: %s is a placeholder and should not be translated. It will be replaced with an e-mail address. */
441
+ sprintf( __( 'Failed to send to %s.', 'all-in-one-seo-pack' ), $email ) . '</div>';
442
  }
443
  } else {
444
  echo "<div class='sfwd_debug_error'>" . __( 'Error: please enter an e-mail address before submitting.', 'all-in-one-seo-pack' ) . '</div>';
445
  }
446
  }
447
  } while ( 0 ); // Control structure for use with break.
448
+ $buf = "<ul class='sfwd_debug_settings'>\n{$page_text}\n</ul>\n";
449
 
450
  return $buf;
451
  }
460
  function get_email_input() {
461
  $nonce = wp_create_nonce( 'sfwd-debug-nonce' );
462
  $buf =
463
+ '<input name="sfwd_debug_send_email" type="text" value="" placeholder="' .
464
+ /* translators: This is the text of a button that can be clicked. Therefore, "E-mail" is used as a verb in this context. */
465
+ __( 'E-mail debug information', 'all-in-one-seo-pack' ) . '" aria-label="' . __( 'Enter the email address provided by Semper Plugins Support to send your debug information', 'all-in-one-seo-pack' ) . '">' .
466
  '<input name="sfwd_debug_nonce" type="hidden" value="' . $nonce . '">' .
467
  '<input name="sfwd_debug_submit" type="submit" value="' . __( 'Submit', 'all-in-one-seo-pack' ) . '" class="button-primary">';
468
  return $buf;
modules/aioseop_sitemap.php CHANGED
@@ -316,10 +316,11 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
316
  'save' => false,
317
  ),
318
  'addl_mod' => array(
319
- 'name' => __( 'Last Modified', 'all-in-one-seo-pack' ),
320
- 'type' => 'date',
321
- 'save' => false,
322
- 'class' => 'aiseop-date',
 
323
  ),
324
  'addl_pages' => array(
325
  'name' => __( 'Additional Pages', 'all-in-one-seo-pack' ),
@@ -727,6 +728,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
727
 
728
  // Exclude Terms element items.
729
  $this->default_options['excl_terms']['initial_options'] = array();
 
730
  $taxonomies_active = array();
731
  if ( is_array( $this->options[ $this->prefix . 'taxonomies' ] ) ) {
732
  $taxonomies_active = $this->options[ $this->prefix . 'taxonomies' ];
@@ -744,7 +746,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
744
 
745
  $excl_terms_init_opts = array();
746
  foreach ( $taxonomies_active as $v1_taxonomy ) {
747
- $args_terms = array(
748
  'taxonomy' => $v1_taxonomy,
749
  'hide_empty' => false,
750
  );
@@ -1073,8 +1075,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1073
  // Parse taxonomy terms {$taxonomy_slug}-{$term_id}.
1074
  $excl_terms = array();
1075
  foreach ( $raw_excl_terms as $v1_tax_term ) {
1076
- $term_id = explode( '-', $v1_tax_term );
1077
- $term_id = intval( end( $term_id ) );
1078
  $taxonomy_slug = sanitize_text_field( str_replace( '-' . $term_id, '', $v1_tax_term ) );
1079
 
1080
  // Initialize taxonomy => terms array if not yet set.
@@ -1136,7 +1138,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1136
  if ( ! $siteurl ) {
1137
  $siteurl = get_home_url( $blog_id );
1138
  }
1139
- $url = $siteurl . '/' . $this->get_filename() . '.xml';
1140
  $siteurls[] = $url;
1141
  }
1142
  }
@@ -1598,9 +1600,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1598
  $sitemap_memory_usage = $end_memory_usage - $this->start_memory_usage;
1599
  $end_memory_usage = $end_memory_usage / 1024.0 / 1024.0;
1600
  $sitemap_memory_usage = $sitemap_memory_usage / 1024.0 / 1024.0;
1601
- $sitemap_type = __( 'static', 'all-in-one-seo-pack ' );
1602
  if ( $dynamic ) {
1603
- $sitemap_type = __( 'dynamic', 'all-in-one-seo-pack ' );
1604
  }
1605
  $this->debug_message( sprintf( ' %01.2f MB memory used generating the %s sitemap in %01.3f seconds, %01.2f MB total memory used.', $sitemap_memory_usage, $sitemap_type, $time, $end_memory_usage ) );
1606
  }
@@ -2069,6 +2071,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2069
  ),
2070
  ),
2071
  );
 
2072
  $q = new WP_Query( $args );
2073
  if ( 0 === $q->post_count ) {
2074
  unset( $post_types[ $index ] );
@@ -2078,8 +2081,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2078
  }
2079
 
2080
  if ( ! empty( $post_types ) ) {
2081
- $prio = $this->get_default_priority( 'post' );
2082
- $freq = $this->get_default_frequency( 'post' );
2083
 
2084
  // Get post counts from posts type. Exclude if NoIndex is on, and does not contain excluded terms.
2085
  $args = array(
@@ -2207,7 +2210,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2207
  // Remove Additional Pages index if all pages are static and no extra pages are specified.
2208
  if ( ! $this->does_addl_sitemap_contain_urls() ) {
2209
  $page_to_remove = array( get_site_url() . '/addl-sitemap.xml' );
2210
- $files = $this->remove_urls_from_sitemap_page( $files, $page_to_remove );
2211
  }
2212
 
2213
  return $files;
@@ -2225,9 +2228,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2225
  */
2226
  private function does_addl_sitemap_contain_urls() {
2227
  $is_addl_pages = ! empty( $this->options['aiosp_sitemap_addl_pages'] );
2228
- if ( ! $is_addl_pages &&
2229
- ( 0 !== (int) get_option( 'page_on_front' ) ) &&
2230
- ( 0 !== (int) get_option( 'page_for_posts' ) ) ) {
2231
  return false;
2232
  }
2233
  return true;
@@ -2431,8 +2432,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2431
  * @return array
2432
  */
2433
  public function get_sitemap_without_indexes() {
2434
- $child_urls = $this->get_child_sitemap_urls();
2435
- $options = $this->options;
2436
 
2437
  if ( is_array( $options[ "{$this->prefix}posttypes" ] ) ) {
2438
  $options[ "{$this->prefix}posttypes" ] = array_diff( $options[ "{$this->prefix}posttypes" ], array( 'all' ) );
@@ -2883,8 +2884,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2883
  $def_prio = $this->get_default_priority( 'taxonomies' );
2884
  $def_freq = $this->get_default_frequency( 'taxonomies' );
2885
  foreach ( $terms as $term ) {
2886
- $pr_info = array();
2887
- $pr_info['loc'] = $this->get_term_link( $term, $term->taxonomy );
2888
  $pr_info['lastmod'] = $this->get_tax_term_timestamp( $term );
2889
  if (
2890
  ( 'sel' === $this->options[ $this->prefix . 'freq_taxonomies' ] )
@@ -3297,7 +3298,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
3297
  }
3298
 
3299
  $homepage_url = get_site_url() . '/';
3300
- $urls = $this->update_static_page_timestamp( $urls, $homepage_url );
3301
 
3302
  return $urls;
3303
  }
@@ -3319,7 +3320,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
3319
  }
3320
 
3321
  $posts_page_url = get_permalink( $posts_page_id );
3322
- $urls = $this->update_static_page_timestamp( $urls, $posts_page_url );
3323
 
3324
  return $urls;
3325
  }
@@ -3580,7 +3581,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
3580
  }
3581
 
3582
  $archive_pages = array();
3583
- $types = apply_filters( "{$this->prefix}include_post_types_archives", $types );
3584
  if ( $types ) {
3585
  foreach ( $types as $post_type => $p ) {
3586
  // TODO Add `true` in 3rd argument with in_array(); which changes it to a strict comparison.
@@ -4561,14 +4562,17 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
4561
  $status = 'inherit';
4562
  }
4563
  // TODO Add `true` in 3rd argument with in_array(); which changes it to a strict comparison.
4564
- if ( is_array( $include ) && ( ( $pos = array_search( 'attachment', $include ) ) !== false ) ) {
4565
- unset( $include[ $pos ] );
4566
- $att_args = array(
4567
- 'post_type' => 'attachment',
4568
- 'post_status' => 'inherit',
4569
- );
4570
- $att_args = array_merge( $att_args, $page_query );
4571
- $posts = $this->get_all_post_type_data( $att_args );
 
 
 
4572
  }
4573
  $args = array(
4574
  'post_type' => $include,
@@ -4667,7 +4671,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
4667
 
4668
  if ( $latest_modified_product->have_posts() ) {
4669
  $timestamp = $latest_modified_product->posts[0]->post_modified_gmt;
4670
- $lastmod = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $timestamp ) );
4671
  // Last Change timestamp needs to be inserted as second attribute in order to have valid sitemap schema.
4672
  // TODO Use insert_timestamp_as_second_attribute() instead when #2721 is merged.
4673
  $links[ $shop_page_index ] = array_slice( $links[ $shop_page_index ], 0, 1, true ) + array( 'lastmod' => $lastmod ) + array_slice( $links[ $shop_page_index ], 1, null, true );
@@ -5012,8 +5016,8 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
5012
  }
5013
 
5014
  // Exclude (method) query args.
5015
- $ex_args = $args;
5016
- $ex_args['meta_query'] = array(
5017
  'relation' => 'OR',
5018
 
5019
  array(
@@ -5027,12 +5031,12 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
5027
  'compare' => '=',
5028
  ),
5029
  );
5030
- $ex_args['fields'] = 'ids';
5031
  // This needs to be -1 so that excluding posts isn't restricted to affect posts to not be excluded properly.
5032
  $ex_args['posts_per_page'] = -1;
 
5033
 
5034
  // Exclude (method) query.
5035
- $q_exclude = new WP_Query( $ex_args );
5036
  if ( ! empty( $q_exclude->posts ) ) {
5037
  $args['exclude'] = array_merge( $args['exclude'], $q_exclude->posts );
5038
  }
316
  'save' => false,
317
  ),
318
  'addl_mod' => array(
319
+ 'name' => __( 'Last Modified', 'all-in-one-seo-pack' ),
320
+ 'type' => 'date',
321
+ 'save' => false,
322
+ 'placeholder' => 'yyyy-mm-dd',
323
+ 'class' => 'aiseop-date',
324
  ),
325
  'addl_pages' => array(
326
  'name' => __( 'Additional Pages', 'all-in-one-seo-pack' ),
728
 
729
  // Exclude Terms element items.
730
  $this->default_options['excl_terms']['initial_options'] = array();
731
+
732
  $taxonomies_active = array();
733
  if ( is_array( $this->options[ $this->prefix . 'taxonomies' ] ) ) {
734
  $taxonomies_active = $this->options[ $this->prefix . 'taxonomies' ];
746
 
747
  $excl_terms_init_opts = array();
748
  foreach ( $taxonomies_active as $v1_taxonomy ) {
749
+ $args_terms = array(
750
  'taxonomy' => $v1_taxonomy,
751
  'hide_empty' => false,
752
  );
1075
  // Parse taxonomy terms {$taxonomy_slug}-{$term_id}.
1076
  $excl_terms = array();
1077
  foreach ( $raw_excl_terms as $v1_tax_term ) {
1078
+ $term_id = explode( '-', $v1_tax_term );
1079
+ $term_id = intval( end( $term_id ) );
1080
  $taxonomy_slug = sanitize_text_field( str_replace( '-' . $term_id, '', $v1_tax_term ) );
1081
 
1082
  // Initialize taxonomy => terms array if not yet set.
1138
  if ( ! $siteurl ) {
1139
  $siteurl = get_home_url( $blog_id );
1140
  }
1141
+ $url = $siteurl . '/' . $this->get_filename() . '.xml';
1142
  $siteurls[] = $url;
1143
  }
1144
  }
1600
  $sitemap_memory_usage = $end_memory_usage - $this->start_memory_usage;
1601
  $end_memory_usage = $end_memory_usage / 1024.0 / 1024.0;
1602
  $sitemap_memory_usage = $sitemap_memory_usage / 1024.0 / 1024.0;
1603
+ $sitemap_type = __( 'static', 'all-in-one-seo-pack' );
1604
  if ( $dynamic ) {
1605
+ $sitemap_type = __( 'dynamic', 'all-in-one-seo-pack' );
1606
  }
1607
  $this->debug_message( sprintf( ' %01.2f MB memory used generating the %s sitemap in %01.3f seconds, %01.2f MB total memory used.', $sitemap_memory_usage, $sitemap_type, $time, $end_memory_usage ) );
1608
  }
2071
  ),
2072
  ),
2073
  );
2074
+
2075
  $q = new WP_Query( $args );
2076
  if ( 0 === $q->post_count ) {
2077
  unset( $post_types[ $index ] );
2081
  }
2082
 
2083
  if ( ! empty( $post_types ) ) {
2084
+ $prio = $this->get_default_priority( 'post' );
2085
+ $freq = $this->get_default_frequency( 'post' );
2086
 
2087
  // Get post counts from posts type. Exclude if NoIndex is on, and does not contain excluded terms.
2088
  $args = array(
2210
  // Remove Additional Pages index if all pages are static and no extra pages are specified.
2211
  if ( ! $this->does_addl_sitemap_contain_urls() ) {
2212
  $page_to_remove = array( get_site_url() . '/addl-sitemap.xml' );
2213
+ $files = $this->remove_urls_from_sitemap_page( $files, $page_to_remove );
2214
  }
2215
 
2216
  return $files;
2228
  */
2229
  private function does_addl_sitemap_contain_urls() {
2230
  $is_addl_pages = ! empty( $this->options['aiosp_sitemap_addl_pages'] );
2231
+ if ( ! $is_addl_pages && ( 'page' === get_option( 'show_on_front' ) ) ) {
 
 
2232
  return false;
2233
  }
2234
  return true;
2432
  * @return array
2433
  */
2434
  public function get_sitemap_without_indexes() {
2435
+ $child_urls = $this->get_child_sitemap_urls();
2436
+ $options = $this->options;
2437
 
2438
  if ( is_array( $options[ "{$this->prefix}posttypes" ] ) ) {
2439
  $options[ "{$this->prefix}posttypes" ] = array_diff( $options[ "{$this->prefix}posttypes" ], array( 'all' ) );
2884
  $def_prio = $this->get_default_priority( 'taxonomies' );
2885
  $def_freq = $this->get_default_frequency( 'taxonomies' );
2886
  foreach ( $terms as $term ) {
2887
+ $pr_info = array();
2888
+ $pr_info['loc'] = $this->get_term_link( $term, $term->taxonomy );
2889
  $pr_info['lastmod'] = $this->get_tax_term_timestamp( $term );
2890
  if (
2891
  ( 'sel' === $this->options[ $this->prefix . 'freq_taxonomies' ] )
3298
  }
3299
 
3300
  $homepage_url = get_site_url() . '/';
3301
+ $urls = $this->update_static_page_timestamp( $urls, $homepage_url );
3302
 
3303
  return $urls;
3304
  }
3320
  }
3321
 
3322
  $posts_page_url = get_permalink( $posts_page_id );
3323
+ $urls = $this->update_static_page_timestamp( $urls, $posts_page_url );
3324
 
3325
  return $urls;
3326
  }
3581
  }
3582
 
3583
  $archive_pages = array();
3584
+ $types = apply_filters( "{$this->prefix}include_post_types_archives", $types );
3585
  if ( $types ) {
3586
  foreach ( $types as $post_type => $p ) {
3587
  // TODO Add `true` in 3rd argument with in_array(); which changes it to a strict comparison.
4562
  $status = 'inherit';
4563
  }
4564
  // TODO Add `true` in 3rd argument with in_array(); which changes it to a strict comparison.
4565
+ if ( is_array( $include ) ) {
4566
+ $pos = array_search( 'attachment', $include );
4567
+ if ( false !== $pos ) {
4568
+ unset( $include[ $pos ] );
4569
+ $att_args = array(
4570
+ 'post_type' => 'attachment',
4571
+ 'post_status' => 'inherit',
4572
+ );
4573
+ $att_args = array_merge( $att_args, $page_query );
4574
+ $posts = $this->get_all_post_type_data( $att_args );
4575
+ }
4576
  }
4577
  $args = array(
4578
  'post_type' => $include,
4671
 
4672
  if ( $latest_modified_product->have_posts() ) {
4673
  $timestamp = $latest_modified_product->posts[0]->post_modified_gmt;
4674
+ $lastmod = date( 'Y-m-d\TH:i:s\Z', mysql2date( 'U', $timestamp ) );
4675
  // Last Change timestamp needs to be inserted as second attribute in order to have valid sitemap schema.
4676
  // TODO Use insert_timestamp_as_second_attribute() instead when #2721 is merged.
4677
  $links[ $shop_page_index ] = array_slice( $links[ $shop_page_index ], 0, 1, true ) + array( 'lastmod' => $lastmod ) + array_slice( $links[ $shop_page_index ], 1, null, true );
5016
  }
5017
 
5018
  // Exclude (method) query args.
5019
+ $ex_args = $args;
5020
+ $ex_args['meta_query'] = array(
5021
  'relation' => 'OR',
5022
 
5023
  array(
5031
  'compare' => '=',
5032
  ),
5033
  );
 
5034
  // This needs to be -1 so that excluding posts isn't restricted to affect posts to not be excluded properly.
5035
  $ex_args['posts_per_page'] = -1;
5036
+ $ex_args['fields'] = 'ids';
5037
 
5038
  // Exclude (method) query.
5039
+ $q_exclude = new WP_Query( $ex_args );
5040
  if ( ! empty( $q_exclude->posts ) ) {
5041
  $args['exclude'] = array_merge( $args['exclude'], $q_exclude->posts );
5042
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: hallsofmontezuma, semperplugins, wpsmort, arnaudbroes
3
  Tags: SEO, Google Search Console, XML Sitemap, meta description, meta title, noindex
4
  Requires at least: 4.7
5
  Tested up to: 5.2
6
- Stable tag: 3.2.3
7
  License: GPLv2 or later
8
  Requires PHP: 5.2.4
9
 
3
  Tags: SEO, Google Search Console, XML Sitemap, meta description, meta title, noindex
4
  Requires at least: 4.7
5
  Tested up to: 5.2
6
+ Stable tag: 3.2.7
7
  License: GPLv2 or later
8
  Requires PHP: 5.2.4
9