Head and Footer Scripts Inserter - Version 4.8

Version Description

  • Plugin data that saved in the database upgraded to version 0001.
Download this release

Release Info

Developer Arthur Gareginyan
Plugin Icon 128x128 Head and Footer Scripts Inserter
Version 4.8
Comparing to
See all releases

Code changes from version 4.7 to 4.8

header-and-footer-scripts-inserter.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Easily add your scripts to the WordPress website's head and footer sections. This is a must have tool for authors and website's owners.
6
  * Author: Arthur Gareginyan
7
  * Author URI: https://www.arthurgareginyan.com
8
- * Version: 4.7
9
  * License: GPL3
10
  * Text Domain: header-and-footer-scripts-inserter
11
  * Domain Path: /languages/
@@ -71,8 +71,8 @@ spacexchimp_p006_define_constants( 'SLUG', dirname( plugin_basename( __FILE__ )
71
  spacexchimp_p006_define_constants( 'NAME', $plugin_data['name'] );
72
  spacexchimp_p006_define_constants( 'VERSION', $plugin_data['version'] );
73
  spacexchimp_p006_define_constants( 'TEXT', $plugin_data['text'] );
74
- spacexchimp_p006_define_constants( 'PREFIX', 'HFScriptsIns' );
75
- spacexchimp_p006_define_constants( 'SETTINGS', 'HFScriptsIns' );
76
 
77
  /**
78
  * Load the plugin modules
5
  * Description: Easily add your scripts to the WordPress website's head and footer sections. This is a must have tool for authors and website's owners.
6
  * Author: Arthur Gareginyan
7
  * Author URI: https://www.arthurgareginyan.com
8
+ * Version: 4.8
9
  * License: GPL3
10
  * Text Domain: header-and-footer-scripts-inserter
11
  * Domain Path: /languages/
71
  spacexchimp_p006_define_constants( 'NAME', $plugin_data['name'] );
72
  spacexchimp_p006_define_constants( 'VERSION', $plugin_data['version'] );
73
  spacexchimp_p006_define_constants( 'TEXT', $plugin_data['text'] );
74
+ spacexchimp_p006_define_constants( 'PREFIX', 'spacexchimp_p006' );
75
+ spacexchimp_p006_define_constants( 'SETTINGS', 'spacexchimp_p006' );
76
 
77
  /**
78
  * Load the plugin modules
inc/php/page.php CHANGED
@@ -212,15 +212,15 @@ add_action( 'wp_head', 'my_custom_script' );</code></pre>
212
  <h3 class="title"><?php _e( 'Support', $text ); ?></h3>
213
  <div class="inside">
214
  <img src="<?php echo SPACEXCHIMP_P006_URL . 'inc/img/thanks.png'; ?>" alt="Thanks!" class="pull-right">
215
- <p><?php _e( 'If you appreciate my work, you can buy me a coffee!', $text ); ?></p>
216
- <p><?php _e( 'I spend a lot of time and effort trying to make sure that the themes, plugins and other things I build are useful, and the ultimate proof of that for me is that you actually want to use them. But, I’m an independent developer, without a regular income, so every little contribution helps cover my costs and lets me spend more time building things for people like you to enjoy.', $text ); ?></p>
217
- <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8A88KC7TFF6CS" target="_blank" class="btn btn-default button-labeled">
218
- <span class="btn-label">
219
- <img src="<?php echo SPACEXCHIMP_P006_URL . 'inc/img/paypal.svg'; ?>" alt="PayPal">
220
- </span>
221
- <?php _e( 'Donate with PayPal', $text ); ?>
222
- </a>
223
- <p><?php _e( 'Thank you for your support!', $text ); ?></p>
224
  </div>
225
  </div>
226
  </div>
212
  <h3 class="title"><?php _e( 'Support', $text ); ?></h3>
213
  <div class="inside">
214
  <img src="<?php echo SPACEXCHIMP_P006_URL . 'inc/img/thanks.png'; ?>" alt="Thanks!" class="pull-right">
215
+ <p><?php _e( 'If you appreciate my work, you can buy me a coffee!', $text ); ?></p>
216
+ <p><?php _e( 'I spend a lot of time and effort trying to make sure that the themes, plugins and other things I build are useful, and the ultimate proof of that for me is that you actually want to use them. But, I’m an independent developer, without a regular income, so every little contribution helps cover my costs and lets me spend more time building things for people like you to enjoy.', $text ); ?></p>
217
+ <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8A88KC7TFF6CS" target="_blank" class="btn btn-default button-labeled">
218
+ <span class="btn-label">
219
+ <img src="<?php echo SPACEXCHIMP_P006_URL . 'inc/img/paypal.svg'; ?>" alt="PayPal">
220
+ </span>
221
+ <?php _e( 'Donate with PayPal', $text ); ?>
222
+ </a>
223
+ <p><?php _e( 'Thank you for your support!', $text ); ?></p>
224
  </div>
225
  </div>
226
  </div>
inc/php/settings.php CHANGED
@@ -42,10 +42,10 @@ defined( 'ABSPATH' ) or die( "Restricted access!" );
42
  <p class="note"><?php _e( 'You can use the fields below to add scripts to HEAD section of your website.', $text ); ?></p>
43
 
44
  <p class='help-text'><?php _e( 'Scripts from this field will be printed in the beginning of <b>HEAD</b> section. Do not place plain text in this!', $text ); ?></p>
45
- <textarea name="HFScriptsIns_settings[header_beginning]" id="HFScriptsIns_settings[header_beginning]" ><?php echo $header_beginning; ?></textarea>
46
 
47
  <p class='help-text'><?php _e( 'Scripts from this field will be printed in the end of <b>HEAD</b> section. Do not place plain text in this!', $text ); ?></p>
48
- <textarea name="HFScriptsIns_settings[header_end]" id="HFScriptsIns_settings[header_end]" ><?php echo $header_end; ?></textarea>
49
 
50
  <input type="submit" name="submit" id="submit" class="btn btn-primary" value="<?php _e( 'Save changes', $text ); ?>">
51
  </div>
@@ -57,10 +57,10 @@ defined( 'ABSPATH' ) or die( "Restricted access!" );
57
  <p class="note"><?php _e( 'You can use the fields below to add scripts to FOOTER section of your website.', $text ); ?></p>
58
 
59
  <p class='help-text'><?php _e( 'Scripts from this field will be printed before a footers scripts. Do not place plain text in this!', $text ); ?></p>
60
- <textarea name="HFScriptsIns_settings[footer_beginning]" id="HFScriptsIns_settings[footer_beginning]" ><?php echo $footer_beginning; ?></textarea>
61
 
62
  <p class='help-text'><?php _e( 'Scripts from this field will be printed after all footers scripts. Do not place plain text in this!', $text ); ?></p>
63
- <textarea name="HFScriptsIns_settings[footer_end]" id="HFScriptsIns_settings[footer_end]" ><?php echo $footer_end; ?></textarea>
64
 
65
  <input type="submit" name="submit" id="submit" class="btn btn-primary" value="<?php _e( 'Save changes', $text ); ?>">
66
  </div>
42
  <p class="note"><?php _e( 'You can use the fields below to add scripts to HEAD section of your website.', $text ); ?></p>
43
 
44
  <p class='help-text'><?php _e( 'Scripts from this field will be printed in the beginning of <b>HEAD</b> section. Do not place plain text in this!', $text ); ?></p>
45
+ <textarea name="spacexchimp_p006_settings[header_beginning]" id="spacexchimp_p006_settings[header_beginning]" ><?php echo $header_beginning; ?></textarea>
46
 
47
  <p class='help-text'><?php _e( 'Scripts from this field will be printed in the end of <b>HEAD</b> section. Do not place plain text in this!', $text ); ?></p>
48
+ <textarea name="spacexchimp_p006_settings[header_end]" id="spacexchimp_p006_settings[header_end]" ><?php echo $header_end; ?></textarea>
49
 
50
  <input type="submit" name="submit" id="submit" class="btn btn-primary" value="<?php _e( 'Save changes', $text ); ?>">
51
  </div>
57
  <p class="note"><?php _e( 'You can use the fields below to add scripts to FOOTER section of your website.', $text ); ?></p>
58
 
59
  <p class='help-text'><?php _e( 'Scripts from this field will be printed before a footers scripts. Do not place plain text in this!', $text ); ?></p>
60
+ <textarea name="spacexchimp_p006_settings[footer_beginning]" id="spacexchimp_p006_settings[footer_beginning]" ><?php echo $footer_beginning; ?></textarea>
61
 
62
  <p class='help-text'><?php _e( 'Scripts from this field will be printed after all footers scripts. Do not place plain text in this!', $text ); ?></p>
63
+ <textarea name="spacexchimp_p006_settings[footer_end]" id="spacexchimp_p006_settings[footer_end]" ><?php echo $footer_end; ?></textarea>
64
 
65
  <input type="submit" name="submit" id="submit" class="btn btn-primary" value="<?php _e( 'Save changes', $text ); ?>">
66
  </div>
inc/php/upgrade.php CHANGED
@@ -4,3 +4,53 @@
4
  * Prevent Direct Access
5
  */
6
  defined( 'ABSPATH' ) or die( "Restricted access!" );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  * Prevent Direct Access
5
  */
6
  defined( 'ABSPATH' ) or die( "Restricted access!" );
7
+
8
+ /**
9
+ * Upgrade plugin data in the database to version 4.8
10
+ */
11
+ function spacexchimp_p006_upgrade_4_8() {
12
+
13
+ // Upgrade number
14
+ $upgrade_number_new = '0001';
15
+ $prefix_old = 'HFScriptsIns';
16
+ $prefix_new = 'spacexchimp_p006';
17
+
18
+ ///////////////////////////////////////////////////////////////////
19
+ // SEEVICE INFO //
20
+ ///////////////////////////////////////////////////////////////////
21
+
22
+ // Read plugin service info from the database
23
+ $service_info_old = get_option( $prefix_old . '_service_info' );
24
+ $service_info_current = get_option( $prefix_new . '_service_info' );
25
+ $upgrade_number_current = !empty( $service_info_current['upgrade'] ) ? $service_info_current['upgrade'] : '0000';
26
+
27
+ // Setting array with new data
28
+ $service_info_new = is_array( $service_info_old ) ? $service_info_old : array();
29
+ $service_info_new['upgrade'] = $upgrade_number_new;
30
+
31
+ // Exit if the upgrade is not needed or alreade done
32
+ if ( $upgrade_number_current >= $upgrade_number_new ) return;
33
+
34
+ // Update service info in the database
35
+ delete_option( $prefix_old . '_service_info' );
36
+ update_option( $prefix_new . '_service_info', $service_info_new );
37
+
38
+ ///////////////////////////////////////////////////////////////////
39
+ // SETTINGS //
40
+ ///////////////////////////////////////////////////////////////////
41
+
42
+ // Read plugin settings from the database
43
+ $settings_current = get_option( $prefix_old . '_settings' );
44
+
45
+ // Setting array with new data
46
+ $settings_new = is_array( $settings_current ) ? $settings_current : array();
47
+
48
+ // Exit if the upgrade is not needed or alreade done
49
+ if ( empty( $settings_current ) ) return;
50
+
51
+ // Update plugin setting in the database
52
+ delete_option( $prefix_old . '_settings' );
53
+ update_option( $prefix_new . '_settings', $settings_new );
54
+
55
+ }
56
+ spacexchimp_p006_upgrade_4_8();
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: inject, insert, insert scripts, insert javascript, insert js, insert html,
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8A88KC7TFF6CS
5
  Requires at least: 3.9
6
  Tested up to: 4.8
7
- Stable tag: 4.7
8
  License: GPL3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -175,6 +175,9 @@ Commercial licensing (e.g. for projects that can’t use an open-source license)
175
 
176
  == Changelog ==
177
 
 
 
 
178
  = 4.7 =
179
  * Added Spanish translation. (Thanks Patricio Toledo)
180
  * The group name of the '_service_info' option renamed to '_settings_group_si'.
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8A88KC7TFF6CS
5
  Requires at least: 3.9
6
  Tested up to: 4.8
7
+ Stable tag: 4.8
8
  License: GPL3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
175
 
176
  == Changelog ==
177
 
178
+ = 4.8 =
179
+ * Plugin data that saved in the database upgraded to version 0001.
180
+
181
  = 4.7 =
182
  * Added Spanish translation. (Thanks Patricio Toledo)
183
  * The group name of the '_service_info' option renamed to '_settings_group_si'.