SEO SIMPLE PACK - Version 3.1.1

Version Description

  • Minor bug fixes.
Download this release

Release Info

Developer looswebstudio
Plugin Icon 128x128 SEO SIMPLE PACK
Version 3.1.1
Comparing to
See all releases

Code changes from version 3.1.0 to 3.1.1

class/data.php CHANGED
@@ -128,8 +128,8 @@ class SSP_Data {
128
  'webmaster_google' => '',
129
  'webmaster_baidu' => '',
130
  'webmaster_yandex' => '',
131
- // 'google_analytics_type' => 'gtag',
132
- // 'google_analytics_id' => '',
133
  'google_g_id' => '',
134
  'google_ua_id' => '',
135
  'post_noindex' => false,
@@ -207,13 +207,11 @@ class SSP_Data {
207
 
208
  // 一般設定データ
209
  $saved_settings = get_option( self::DB_NAME['settings'] ) ?: [];
210
- self::$settings = $saved_settings;
211
- // self::$settings = array_merge( self::$default_settings, $saved_settings );
212
 
213
  // OGP設定
214
  $saved_ogp_settings = get_option( self::DB_NAME['ogp'] ) ?: [];
215
- self::$ogp = $saved_ogp_settings;
216
- // self::$ogp = array_merge( self::$default_ogp_settings, $saved_ogp_settings );
217
  }
218
 
219
 
128
  'webmaster_google' => '',
129
  'webmaster_baidu' => '',
130
  'webmaster_yandex' => '',
131
+ 'google_analytics_type' => 'gtag',
132
+ 'google_analytics_id' => '',
133
  'google_g_id' => '',
134
  'google_ua_id' => '',
135
  'post_noindex' => false,
207
 
208
  // 一般設定データ
209
  $saved_settings = get_option( self::DB_NAME['settings'] ) ?: [];
210
+ self::$settings = array_merge( self::$default_settings, $saved_settings );
 
211
 
212
  // OGP設定
213
  $saved_ogp_settings = get_option( self::DB_NAME['ogp'] ) ?: [];
214
+ self::$ogp = array_merge( self::$default_ogp_settings, $saved_ogp_settings );
 
215
  }
216
 
217
 
class/output.php CHANGED
@@ -716,28 +716,20 @@ class SSP_Output {
716
  }
717
  }
718
 
719
- // Google analytics - GA4
720
- $g_id = SSP_Data::get( 'settings', 'google_g_id' );
 
721
  if ( $g_id ) {
722
- Output_Helper::output_gtag( $g_id );
723
  }
724
 
725
  // Google analytics - UA
726
  $ua_id = SSP_Data::get( 'settings', 'google_ua_id' );
727
  if ( $ua_id ) {
728
- Output_Helper::output_uatag( $ua_id );
729
- }
730
-
731
- // アップデート時に無事にデータ移行できてれば不要だが、念の為残す ?
732
- // $ga_id = SSP_Data::get( 'settings', 'google_analytics_id' );
733
- // if ( $ga_id ) {
734
- // $ga_type = SSP_Data::get( 'settings', 'google_analytics_type' );
735
- // if ( 'gtag' === $ga_type ) {
736
- // Output_Helper::output_gtag( $ga_id );
737
- // } elseif ( 'analytics' === $ga_type ) {
738
- // Output_Helper::output_uatag( $ga_id );
739
- // }
740
- // }
741
  }
742
 
743
 
716
  }
717
  }
718
 
719
+ // Google analytics
720
+ $ga_ids = [];
721
+ $g_id = SSP_Data::get( 'settings', 'google_g_id' );
722
  if ( $g_id ) {
723
+ $ga_ids[] = $g_id;
724
  }
725
 
726
  // Google analytics - UA
727
  $ua_id = SSP_Data::get( 'settings', 'google_ua_id' );
728
  if ( $ua_id ) {
729
+ $ga_ids[] = $ua_id;
730
+ }
731
+
732
+ Output_Helper::output_gtag( $ga_ids );
 
 
 
 
 
 
 
 
 
733
  }
734
 
735
 
class/output_helper.php CHANGED
@@ -11,19 +11,26 @@ class Output_Helper {
11
  /**
12
  * gtagコード出力
13
  */
14
- public static function output_gtag( $gaid ) {
 
 
 
15
  ?>
16
  <!-- Google Analytics (gtag.js) -->
17
- <script async src="https://www.googletagmanager.com/gtag/js?id=<?=esc_attr( $gaid )?>"></script>
18
  <script>
19
  window.dataLayer = window.dataLayer || [];
20
  function gtag(){dataLayer.push(arguments);}
21
  gtag("js", new Date());
22
- gtag("config", "<?=esc_attr( $gaid )?>");
 
 
 
23
  </script>
24
  <?php
25
  }
26
 
 
27
  /**
28
  * 旧アナリティクスコード出力
29
  */
11
  /**
12
  * gtagコード出力
13
  */
14
+ public static function output_gtag( $ids ) {
15
+ if ( empty( $ids ) ) return;
16
+ $id1 = $ids[0];
17
+ $id2 = isset( $ids[1] ) ? $ids[1] : '';
18
  ?>
19
  <!-- Google Analytics (gtag.js) -->
20
+ <script async src="https://www.googletagmanager.com/gtag/js?id=<?=esc_attr( $id1 )?>"></script>
21
  <script>
22
  window.dataLayer = window.dataLayer || [];
23
  function gtag(){dataLayer.push(arguments);}
24
  gtag("js", new Date());
25
+ gtag("config", "<?=esc_attr( $id1 )?>");
26
+ <?php if ( $id2 ) : ?>
27
+ gtag("config", "<?=esc_attr( $id2 )?>");
28
+ <?php endif; ?>
29
  </script>
30
  <?php
31
  }
32
 
33
+
34
  /**
35
  * 旧アナリティクスコード出力
36
  */
class/update_action.php CHANGED
@@ -62,19 +62,19 @@ class Update_Action extends \SSP_Data {
62
  * アナリティクスをUA,GA4両方出力できるように変更するためのデータ置換
63
  */
64
  public static function migrate_ga_data() {
65
- $old_type = self::get( 'settings', 'google_analytics_type' );
66
- $old_code = self::get( 'settings', 'google_analytics_id' );
67
 
68
- if ( ! $old_type || ! $old_code ) return;
69
 
70
- if ( 'gtag' === $old_type ) {
71
- $new_code_key = 'google_g_id';
72
- } elseif ( 'analytics' === $old_type ) {
73
  $new_code_key = 'google_ua_id';
 
 
74
  }
75
 
76
  self::update_data( 'settings', [
77
- "$new_code_key" => $old_code,
78
- ], [ 'google_analytics_type', 'google_analytics_id' ]);
79
  }
80
  }
62
  * アナリティクスをUA,GA4両方出力できるように変更するためのデータ置換
63
  */
64
  public static function migrate_ga_data() {
65
+ $old_id = self::get( 'settings', 'google_analytics_id' );
66
+ if ( ! $old_id ) return;
67
 
68
+ $is_UA = 0 === strpos( $old_id, 'UA' );
69
 
70
+ if ( $is_UA ) {
 
 
71
  $new_code_key = 'google_ua_id';
72
+ } else {
73
+ $new_code_key = 'google_g_id';
74
  }
75
 
76
  self::update_data( 'settings', [
77
+ "$new_code_key" => $old_id,
78
+ ]);
79
  }
80
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://loos-web-studio.com/
4
  Tags: SEO, meta, analytics, wsebmaster, simple, japan, meta tag
5
  Requires at least: 4.9
6
  Tested up to: 6.0
7
- Stable tag: 3.1.0
8
  Requires PHP: 7.0
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -119,7 +119,10 @@ The following hooks are available.
119
 
120
 
121
  == Changelog ==
122
-  
 
 
 
123
  = 3.1.0 =
124
  - For Google Analytics, both GA4 and UA can now be set.
125
  - Fixed a bug that prevented page numbers from being displayed in the title tag.
4
  Tags: SEO, meta, analytics, wsebmaster, simple, japan, meta tag
5
  Requires at least: 4.9
6
  Tested up to: 6.0
7
+ Stable tag: 3.1.1
8
  Requires PHP: 7.0
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
119
 
120
 
121
  == Changelog ==
122
+
123
+ = 3.1.1 =
124
+ - Minor bug fixes.
125
+
126
  = 3.1.0 =
127
  - For Google Analytics, both GA4 and UA can now be set.
128
  - Fixed a bug that prevented page numbers from being displayed in the title tag.
seo-simple-pack.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: SEO SIMPLE PACK
4
  * Plugin URI: https://wemo.tech/1670
5
  * Description: A very simple SEO plugin. You can easily set and customize meta tags and OGP tags for each page.
6
- * Version: 3.1.0
7
  * Author: LOOS,Inc.
8
  * Author URI: https://loos-web-studio.com/
9
  * License: GPL2 or later
3
  * Plugin Name: SEO SIMPLE PACK
4
  * Plugin URI: https://wemo.tech/1670
5
  * Description: A very simple SEO plugin. You can easily set and customize meta tags and OGP tags for each page.
6
+ * Version: 3.1.1
7
  * Author: LOOS,Inc.
8
  * Author URI: https://loos-web-studio.com/
9
  * License: GPL2 or later