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 | My Custom Functions |
Version | 4.44 |
Comparing to | |
See all releases |
Code changes from version 4.43 to 4.44
- 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
- my-custom-functions.php +2 -1
- readme.txt +5 -1
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_p001_control_hidden( $name, $value ) {
|
12 |
+
|
13 |
+
// Put value of plugin constants into an array for easier access
|
14 |
+
$plugin = spacexchimp_p001_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,6 +126,14 @@ function spacexchimp_p001_message_save() {
|
|
126 |
<?php _e( 'Custom code saved successfully.', $plugin['text'] ); ?>
|
127 |
</p>
|
128 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
<?php
|
130 |
}
|
131 |
|
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 |
}
|
139 |
|
inc/php/page.php
CHANGED
@@ -55,6 +55,9 @@ function spacexchimp_p001_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 SETTINGS -->
|
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 SETTINGS -->
|
63 |
|
inc/php/tabs/settings.php
CHANGED
@@ -48,6 +48,14 @@ defined( 'ABSPATH' ) or die( "Restricted access!" );
|
|
48 |
</div>
|
49 |
</div>
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
<!-- SUBMIT -->
|
52 |
<input type="submit" name="submit" id="submit" class="btn btn-primary" value="<?php _e( 'Save changes', $plugin['text'] ); ?>">
|
53 |
<!-- END SUBMIT -->
|
48 |
</div>
|
49 |
</div>
|
50 |
|
51 |
+
<!-- HIDDEN -->
|
52 |
+
<?php
|
53 |
+
spacexchimp_p001_control_hidden( 'hidden_scrollto',
|
54 |
+
'0'
|
55 |
+
);
|
56 |
+
?>
|
57 |
+
<!-- END HIDDEN -->
|
58 |
+
|
59 |
<!-- SUBMIT -->
|
60 |
<input type="submit" name="submit" id="submit" class="btn btn-primary" value="<?php _e( 'Save changes', $plugin['text'] ); ?>">
|
61 |
<!-- END SUBMIT -->
|
my-custom-functions.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Easily and safely add your custom PHP code 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: my-custom-functions
|
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 PHP code 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.44
|
9 |
* License: GPL3
|
10 |
* Text Domain: my-custom-functions
|
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' );
|
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 |
|
@@ -256,6 +256,10 @@ Commercial licensing (e.g. for projects that can’t use an open-source license)
|
|
256 |
|
257 |
== Changelog ==
|
258 |
|
|
|
|
|
|
|
|
|
259 |
= 4.43 - Aug 10, 2020 =
|
260 |
* Maintenance: Ensure compatibility with upcoming WordPress 5.5.
|
261 |
* 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.44
|
9 |
License: GPL3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
256 |
|
257 |
== Changelog ==
|
258 |
|
259 |
+
= 4.44 - Oct 3, 2020 =
|
260 |
+
* New feature: Restoring screen position after saving changes. No more annoying return to the top of the page after clicking the "Save" button.
|
261 |
+
* Maintenance: Loading of dynamic content on the settings page has been updated to more versatile.
|
262 |
+
|
263 |
= 4.43 - Aug 10, 2020 =
|
264 |
* Maintenance: Ensure compatibility with upcoming WordPress 5.5.
|
265 |
* 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)
|