Version Description
- Oct 3, 2020 =
- New feature: Restoring screen position after saving changes. No more annoying return to the top of the page after clicking the "Save" button.
- Maintenance: Loading of dynamic content on the settings page has been updated to more versatile.
Download this release
Release Info
Developer | Arthur Gareginyan |
Plugin | Head and Footer Scripts Inserter |
Version | 4.46 |
Comparing to | |
See all releases |
Code changes from version 4.45 to 4.46
- header-and-footer-scripts-inserter.php +2 -1
- inc/js/admin.js +2 -2
- inc/php/controls.php +27 -0
- inc/php/inline-js.php +38 -0
- inc/php/messages.php +8 -0
- inc/php/page.php +3 -0
- inc/php/tabs/settings.php +8 -0
- readme.txt +5 -1
header-and-footer-scripts-inserter.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Easily and safely add your custom HTML code (plus JavaScript, CSS, etc.) to your WordPress website, directly out of the WordPress Admin Area, without the need to have an external editor.
|
6 |
* Author: Space X-Chimp
|
7 |
* Author URI: https://www.spacexchimp.com
|
8 |
-
* Version: 4.
|
9 |
* License: GPL3
|
10 |
* Text Domain: header-and-footer-scripts-inserter
|
11 |
* Domain Path: /languages/
|
@@ -100,5 +100,6 @@ require_once( $plugin['path'] . 'inc/php/upgrade.php' );
|
|
100 |
require_once( $plugin['path'] . 'inc/php/versioning.php' );
|
101 |
require_once( $plugin['path'] . 'inc/php/enqueue.php' );
|
102 |
require_once( $plugin['path'] . 'inc/php/functional.php' );
|
|
|
103 |
require_once( $plugin['path'] . 'inc/php/page.php' );
|
104 |
require_once( $plugin['path'] . 'inc/php/messages.php' );
|
5 |
* Description: Easily and safely add your custom HTML code (plus JavaScript, CSS, etc.) to your WordPress website, directly out of the WordPress Admin Area, without the need to have an external editor.
|
6 |
* Author: Space X-Chimp
|
7 |
* Author URI: https://www.spacexchimp.com
|
8 |
+
* Version: 4.46
|
9 |
* License: GPL3
|
10 |
* Text Domain: header-and-footer-scripts-inserter
|
11 |
* Domain Path: /languages/
|
100 |
require_once( $plugin['path'] . 'inc/php/versioning.php' );
|
101 |
require_once( $plugin['path'] . 'inc/php/enqueue.php' );
|
102 |
require_once( $plugin['path'] . 'inc/php/functional.php' );
|
103 |
+
require_once( $plugin['path'] . 'inc/php/controls.php' );
|
104 |
require_once( $plugin['path'] . 'inc/php/page.php' );
|
105 |
require_once( $plugin['path'] . 'inc/php/messages.php' );
|
inc/js/admin.js
CHANGED
@@ -19,8 +19,8 @@ jQuery(document).ready(function($) {
|
|
19 |
}, 3000);
|
20 |
}
|
21 |
|
22 |
-
// Add dynamic content to page
|
23 |
-
$('.include-tab-store').load('https://
|
24 |
|
25 |
// Add questions and answers into spoilers and color them in different colors
|
26 |
$('.panel-group .panel').each(function(i) {
|
19 |
}, 3000);
|
20 |
}
|
21 |
|
22 |
+
// Add a dynamic content to the plugin settings page. Needed for having an up to date banners
|
23 |
+
$('.include-tab-store').load('https://resources.spacexchimp.com/wordpress/plugins/dynamic-content/page.html');
|
24 |
|
25 |
// Add questions and answers into spoilers and color them in different colors
|
26 |
$('.panel-group .panel').each(function(i) {
|
inc/php/controls.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Prevent Direct Access
|
5 |
+
*/
|
6 |
+
defined( 'ABSPATH' ) or die( "Restricted access!" );
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Generator of the hidden option for saving plugin settings to database
|
10 |
+
*/
|
11 |
+
function spacexchimp_p006_control_hidden( $name, $value ) {
|
12 |
+
|
13 |
+
// Put value of plugin constants into an array for easier access
|
14 |
+
$plugin = spacexchimp_p006_plugin();
|
15 |
+
|
16 |
+
// Generate a part of table
|
17 |
+
$out = "<input
|
18 |
+
type='hidden'
|
19 |
+
name='" . $plugin['settings'] . "_settings[$name]'
|
20 |
+
id='" . $plugin['settings'] . "_settings[$name]'
|
21 |
+
value='$value'
|
22 |
+
class='control-hidden $name'
|
23 |
+
>";
|
24 |
+
|
25 |
+
// Print the generated part of table
|
26 |
+
echo $out;
|
27 |
+
}
|
inc/php/inline-js.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Prevent Direct Access
|
5 |
+
*/
|
6 |
+
defined( 'ABSPATH' ) or die( "Restricted access!" );
|
7 |
+
|
8 |
+
// Retrieve options from database and declare variables
|
9 |
+
$options = get_option( $plugin['settings'] . '_settings' );
|
10 |
+
|
11 |
+
// Make the "$options" array if the plugin options data in the database is not exist
|
12 |
+
if ( ! is_array( $options ) ) {
|
13 |
+
$options = array();
|
14 |
+
}
|
15 |
+
|
16 |
+
$hidden_scrollto = !empty( $options['hidden_scrollto'] ) ? $options['hidden_scrollto'] : '0';
|
17 |
+
|
18 |
+
?>
|
19 |
+
<script type="text/javascript">
|
20 |
+
jQuery(document).ready(function($) {
|
21 |
+
|
22 |
+
// Scroll to previouse position
|
23 |
+
var hidden_scrollto = <?php echo $hidden_scrollto; ?>;
|
24 |
+
$(document).scrollTop(hidden_scrollto);
|
25 |
+
|
26 |
+
// Update the value of the scroll position option
|
27 |
+
$(window).scroll(function() {
|
28 |
+
$('input:hidden.control-hidden.hidden_scrollto').val($(document).scrollTop());
|
29 |
+
});
|
30 |
+
});
|
31 |
+
</script>
|
32 |
+
<?php
|
33 |
+
|
34 |
+
// Update the plugin options data in the database
|
35 |
+
if ( $hidden_scrollto != '0' ) {
|
36 |
+
$options['hidden_scrollto'] = '0';
|
37 |
+
update_option( $plugin['settings'] . '_settings', $options );
|
38 |
+
}
|
inc/php/messages.php
CHANGED
@@ -126,5 +126,13 @@ function spacexchimp_p006_message_save() {
|
|
126 |
<?php _e( 'Custom code saved successfully.', $plugin['text'] ); ?>
|
127 |
</p>
|
128 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
<?php
|
130 |
}
|
126 |
<?php _e( 'Custom code saved successfully.', $plugin['text'] ); ?>
|
127 |
</p>
|
128 |
</div>
|
129 |
+
<style>
|
130 |
+
#message.updated {
|
131 |
+
z-index: 9999;
|
132 |
+
position: fixed;
|
133 |
+
top: 40px;
|
134 |
+
right: 40px;
|
135 |
+
}
|
136 |
+
</style>
|
137 |
<?php
|
138 |
}
|
inc/php/page.php
CHANGED
@@ -55,6 +55,9 @@ function spacexchimp_p006_render_submenu_page() {
|
|
55 |
<?php require_once( $plugin['path'] . 'inc/php/sidebar.php' ); ?>
|
56 |
|
57 |
<?php require_once( $plugin['path'] . 'inc/php/tabs/settings.php' ); ?>
|
|
|
|
|
|
|
58 |
</div>
|
59 |
<!-- END-TAB MAIN -->
|
60 |
|
55 |
<?php require_once( $plugin['path'] . 'inc/php/sidebar.php' ); ?>
|
56 |
|
57 |
<?php require_once( $plugin['path'] . 'inc/php/tabs/settings.php' ); ?>
|
58 |
+
|
59 |
+
<!-- INCLUDE PHP-JS FILE -->
|
60 |
+
<?php require_once( $plugin['path'] . 'inc/php/inline-js.php' ); ?>
|
61 |
</div>
|
62 |
<!-- END-TAB MAIN -->
|
63 |
|
inc/php/tabs/settings.php
CHANGED
@@ -94,6 +94,14 @@ defined( 'ABSPATH' ) or die( "Restricted access!" );
|
|
94 |
placeholder="<?php _e( 'Enter your custom HTML code here', $plugin['text'] ); ?>"
|
95 |
><?php echo $footer_end; ?></textarea>
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
<!-- SUBMIT -->
|
98 |
<input type="submit" name="submit" id="submit" class="btn btn-primary" value="<?php _e( 'Save changes', $plugin['text'] ); ?>">
|
99 |
<!-- END SUBMIT -->
|
94 |
placeholder="<?php _e( 'Enter your custom HTML code here', $plugin['text'] ); ?>"
|
95 |
><?php echo $footer_end; ?></textarea>
|
96 |
|
97 |
+
<!-- HIDDEN -->
|
98 |
+
<?php
|
99 |
+
spacexchimp_p006_control_hidden( 'hidden_scrollto',
|
100 |
+
'0'
|
101 |
+
);
|
102 |
+
?>
|
103 |
+
<!-- END HIDDEN -->
|
104 |
+
|
105 |
<!-- SUBMIT -->
|
106 |
<input type="submit" name="submit" id="submit" class="btn btn-primary" value="<?php _e( 'Save changes', $plugin['text'] ); ?>">
|
107 |
<!-- END SUBMIT -->
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: https://www.spacexchimp.com/donate.html
|
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.5
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 4.
|
9 |
License: GPL3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
@@ -224,6 +224,10 @@ Commercial licensing (e.g. for projects that can’t use an open-source license)
|
|
224 |
|
225 |
== Changelog ==
|
226 |
|
|
|
|
|
|
|
|
|
227 |
= 4.45 - Aug 10, 2020 =
|
228 |
* Maintenance: Ensure compatibility with upcoming WordPress 5.5.
|
229 |
* Enhancement: Remove the second ask for an upgrade on the "Plugins" page and change the color of some links to the right emotional colors. (Thanks to Abdulla Hussain)
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.5
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 4.46
|
9 |
License: GPL3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
224 |
|
225 |
== Changelog ==
|
226 |
|
227 |
+
= 4.46 - Oct 3, 2020 =
|
228 |
+
* New feature: Restoring screen position after saving changes. No more annoying return to the top of the page after clicking the "Save" button.
|
229 |
+
* Maintenance: Loading of dynamic content on the settings page has been updated to more versatile.
|
230 |
+
|
231 |
= 4.45 - Aug 10, 2020 =
|
232 |
* Maintenance: Ensure compatibility with upcoming WordPress 5.5.
|
233 |
* Enhancement: Remove the second ask for an upgrade on the "Plugins" page and change the color of some links to the right emotional colors. (Thanks to Abdulla Hussain)
|