Version Description
- Compatibility with PHP version 5.2 improved.
- PHP shorthands improved.
- Added function for generating the plugin constants.
- Some constants now get the value from the plugin header data.
- The "_plugin_version_number" function improved.
- Added file "upgrade.php" for future upgrades.
Download this release
Release Info
Developer | Arthur Gareginyan |
Plugin | My Custom Functions |
Version | 4.2 |
Comparing to | |
See all releases |
Code changes from version 4.1.1 to 4.2
- inc/php/messages.php +2 -2
- inc/php/page.php +2 -2
- inc/php/settings.php +5 -5
- inc/php/upgrade.php +8 -0
- inc/php/version.php +10 -13
- my-custom-functions.php +26 -21
- readme.txt +12 -4
inc/php/messages.php
CHANGED
@@ -48,12 +48,12 @@ function MCFunctions_hello_message() {
|
|
48 |
/**
|
49 |
* Error message (When the old version of plugin installed) - Bootstrap Modal
|
50 |
*
|
51 |
-
* @since 4.
|
52 |
*/
|
53 |
function MCFunctions_error_message() {
|
54 |
|
55 |
$info = get_option( MCFUNC_SETTINGS . '_service_info' );
|
56 |
-
$old_version =
|
57 |
|
58 |
if ( $old_version != '1' ) {
|
59 |
return;
|
48 |
/**
|
49 |
* Error message (When the old version of plugin installed) - Bootstrap Modal
|
50 |
*
|
51 |
+
* @since 4.2
|
52 |
*/
|
53 |
function MCFunctions_error_message() {
|
54 |
|
55 |
$info = get_option( MCFUNC_SETTINGS . '_service_info' );
|
56 |
+
$old_version = !empty( $info['old_version'] ) ? $info['old_version'] : '0';
|
57 |
|
58 |
if ( $old_version != '1' ) {
|
59 |
return;
|
inc/php/page.php
CHANGED
@@ -15,8 +15,8 @@ defined( 'ABSPATH' ) or die( "Restricted access!" );
|
|
15 |
function MCFunctions_render_submenu_page() {
|
16 |
|
17 |
// Call messages
|
18 |
-
|
19 |
-
|
20 |
MCFunctions_successfull_message();
|
21 |
MCFunctions_parsing_error_message();
|
22 |
|
15 |
function MCFunctions_render_submenu_page() {
|
16 |
|
17 |
// Call messages
|
18 |
+
MCFunctions_hello_message();
|
19 |
+
MCFunctions_error_message();
|
20 |
MCFunctions_successfull_message();
|
21 |
MCFunctions_parsing_error_message();
|
22 |
|
inc/php/settings.php
CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) or die( "Restricted access!" );
|
|
10 |
/**
|
11 |
* Render Settings Tab
|
12 |
*
|
13 |
-
* @since 4.
|
14 |
*/
|
15 |
?>
|
16 |
<!-- SIDEBAR -->
|
@@ -63,12 +63,12 @@ defined( 'ABSPATH' ) or die( "Restricted access!" );
|
|
63 |
<?php settings_fields( MCFUNC_SETTINGS . '_settings_group' ); ?>
|
64 |
|
65 |
<?php
|
66 |
-
// Get options from the
|
67 |
$options = get_option( MCFUNC_SETTINGS . '_settings' );
|
68 |
|
69 |
-
// Set default value if
|
70 |
-
$content =
|
71 |
-
$enable =
|
72 |
?>
|
73 |
|
74 |
<div class="postbox">
|
10 |
/**
|
11 |
* Render Settings Tab
|
12 |
*
|
13 |
+
* @since 4.2
|
14 |
*/
|
15 |
?>
|
16 |
<!-- SIDEBAR -->
|
63 |
<?php settings_fields( MCFUNC_SETTINGS . '_settings_group' ); ?>
|
64 |
|
65 |
<?php
|
66 |
+
// Get options from the database
|
67 |
$options = get_option( MCFUNC_SETTINGS . '_settings' );
|
68 |
|
69 |
+
// Set default value if option is empty
|
70 |
+
$content = $options['anarcho_cfunctions-content'] ? $options['anarcho_cfunctions-content'] : '/* Enter your custom functions here */';
|
71 |
+
$enable = ( $options['enable'] == "on" ) ? 'checked' : ' ';
|
72 |
?>
|
73 |
|
74 |
<div class="postbox">
|
inc/php/upgrade.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Prevent Direct Access
|
5 |
+
*
|
6 |
+
* @since 0.1
|
7 |
+
*/
|
8 |
+
defined( 'ABSPATH' ) or die( "Restricted access!" );
|
inc/php/version.php
CHANGED
@@ -10,7 +10,7 @@ defined( 'ABSPATH' ) or die( "Restricted access!" );
|
|
10 |
/**
|
11 |
* Function for managing information about the version number of the plugin
|
12 |
*
|
13 |
-
* @since 4.
|
14 |
*/
|
15 |
function MCFunctions_plugin_version_number() {
|
16 |
|
@@ -23,13 +23,16 @@ function MCFunctions_plugin_version_number() {
|
|
23 |
if ( !is_array( $info ) ) {
|
24 |
$info = array();
|
25 |
}
|
26 |
-
$current_number =
|
27 |
$new_number = MCFUNC_VERSION;
|
28 |
|
29 |
-
//
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
33 |
|
34 |
// If the version number in the database is same as the new version number:
|
35 |
// - Reset the "old_version" marker in the database
|
@@ -71,10 +74,4 @@ function MCFunctions_plugin_version_number() {
|
|
71 |
}
|
72 |
|
73 |
}
|
74 |
-
|
75 |
-
|
76 |
-
// TEMPORARY FIX
|
77 |
-
function MCFunctions_plugin_temp_fix() {
|
78 |
-
delete_option( MCFUNC_SETTINGS . '_service_info' );
|
79 |
-
}
|
80 |
-
MCFunctions_plugin_temp_fix();
|
10 |
/**
|
11 |
* Function for managing information about the version number of the plugin
|
12 |
*
|
13 |
+
* @since 4.2
|
14 |
*/
|
15 |
function MCFunctions_plugin_version_number() {
|
16 |
|
23 |
if ( !is_array( $info ) ) {
|
24 |
$info = array();
|
25 |
}
|
26 |
+
$current_number = !empty( $info['version'] ) ? $info['version'] : '0';
|
27 |
$new_number = MCFUNC_VERSION;
|
28 |
|
29 |
+
// Update the "_service_info" data in the database if the version number is not number
|
30 |
+
if ( !is_numeric($current_number) ) {
|
31 |
+
|
32 |
+
$info['version'] = $new_number;
|
33 |
+
update_option( MCFUNC_SETTINGS . '_service_info', $info );
|
34 |
+
|
35 |
+
}
|
36 |
|
37 |
// If the version number in the database is same as the new version number:
|
38 |
// - Reset the "old_version" marker in the database
|
74 |
}
|
75 |
|
76 |
}
|
77 |
+
MCFunctions_plugin_version_number();
|
|
|
|
|
|
|
|
|
|
|
|
my-custom-functions.php
CHANGED
@@ -5,27 +5,25 @@
|
|
5 |
* Description: Easily and safely add your custom functions (PHP code) directly out of your WordPress Dashboard without need of an external editor.
|
6 |
* Author: Arthur Gareginyan
|
7 |
* Author URI: http://www.arthurgareginyan.com
|
8 |
-
* Version: 4.
|
9 |
* License: GPL3
|
10 |
* Text Domain: my-custom-functions
|
11 |
* Domain Path: /languages/
|
12 |
*
|
13 |
* Copyright 2014-2017 Arthur Gareginyan (email : arthurgareginyan@gmail.com)
|
14 |
*
|
15 |
-
* This
|
16 |
-
*
|
17 |
-
* "My Custom Functions" is free software: you can redistribute it and/or modify
|
18 |
* it under the terms of the GNU General Public License as published by
|
19 |
* the Free Software Foundation, either version 3 of the License, or
|
20 |
* (at your option) any later version.
|
21 |
*
|
22 |
-
*
|
23 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
25 |
* GNU General Public License for more details.
|
26 |
*
|
27 |
* You should have received a copy of the GNU General Public License
|
28 |
-
* along with
|
29 |
*
|
30 |
*
|
31 |
* █████╗ ██████╗ ████████╗██╗ ██╗██╗ ██╗██████╗
|
@@ -53,29 +51,36 @@
|
|
53 |
defined( 'ABSPATH' ) or die( "Restricted access!" );
|
54 |
|
55 |
/**
|
56 |
-
* Define constants
|
57 |
*
|
58 |
-
* @since 4.
|
59 |
*/
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
/**
|
72 |
* Load the plugin modules
|
73 |
*
|
74 |
-
* @since 4.
|
75 |
*/
|
76 |
require_once( MCFUNC_PATH . 'inc/php/core.php' );
|
77 |
-
require_once( MCFUNC_PATH . 'inc/php/
|
78 |
require_once( MCFUNC_PATH . 'inc/php/version.php' );
|
|
|
79 |
require_once( MCFUNC_PATH . 'inc/php/functional.php' );
|
80 |
require_once( MCFUNC_PATH . 'inc/php/page.php' );
|
81 |
require_once( MCFUNC_PATH . 'inc/php/messages.php' );
|
5 |
* Description: Easily and safely add your custom functions (PHP code) directly out of your WordPress Dashboard without need of an external editor.
|
6 |
* Author: Arthur Gareginyan
|
7 |
* Author URI: http://www.arthurgareginyan.com
|
8 |
+
* Version: 4.2
|
9 |
* License: GPL3
|
10 |
* Text Domain: my-custom-functions
|
11 |
* Domain Path: /languages/
|
12 |
*
|
13 |
* Copyright 2014-2017 Arthur Gareginyan (email : arthurgareginyan@gmail.com)
|
14 |
*
|
15 |
+
* This plugin is free software: you can redistribute it and/or modify
|
|
|
|
|
16 |
* it under the terms of the GNU General Public License as published by
|
17 |
* the Free Software Foundation, either version 3 of the License, or
|
18 |
* (at your option) any later version.
|
19 |
*
|
20 |
+
* This plugin is distributed in the hope that it will be useful,
|
21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
* GNU General Public License for more details.
|
24 |
*
|
25 |
* You should have received a copy of the GNU General Public License
|
26 |
+
* along with this plugin. If not, see <http://www.gnu.org/licenses/>.
|
27 |
*
|
28 |
*
|
29 |
* █████╗ ██████╗ ████████╗██╗ ██╗██╗ ██╗██████╗
|
51 |
defined( 'ABSPATH' ) or die( "Restricted access!" );
|
52 |
|
53 |
/**
|
54 |
+
* Define global constants
|
55 |
*
|
56 |
+
* @since 4.2
|
57 |
*/
|
58 |
+
$plugin_data = get_file_data( __FILE__, array( 'name'=>'Plugin Name', 'version'=>'Version', 'text'=>'Text Domain' ) );
|
59 |
+
function MCFunctions_define_constants( $constant_name, $value ) {
|
60 |
+
$constant_name = 'MCFUNC_' . $constant_name;
|
61 |
+
if ( !defined( $constant_name ) )
|
62 |
+
define( $constant_name, $value );
|
63 |
+
}
|
64 |
+
MCFunctions_define_constants( 'DIR', dirname( plugin_basename( __FILE__ ) ) );
|
65 |
+
MCFunctions_define_constants( 'BASE', plugin_basename( __FILE__ ) );
|
66 |
+
MCFunctions_define_constants( 'URL', plugin_dir_url( __FILE__ ) );
|
67 |
+
MCFunctions_define_constants( 'PATH', plugin_dir_path( __FILE__ ) );
|
68 |
+
MCFunctions_define_constants( 'SLUG', dirname( plugin_basename( __FILE__ ) ) );
|
69 |
+
MCFunctions_define_constants( 'NAME', $plugin_data['name'] );
|
70 |
+
MCFunctions_define_constants( 'VERSION', $plugin_data['version'] );
|
71 |
+
MCFunctions_define_constants( 'TEXT', $plugin_data['text'] );
|
72 |
+
MCFunctions_define_constants( 'PREFIX', 'MCFunctions' );
|
73 |
+
MCFunctions_define_constants( 'SETTINGS', 'anarcho_cfunctions' );
|
74 |
|
75 |
/**
|
76 |
* Load the plugin modules
|
77 |
*
|
78 |
+
* @since 4.2
|
79 |
*/
|
80 |
require_once( MCFUNC_PATH . 'inc/php/core.php' );
|
81 |
+
require_once( MCFUNC_PATH . 'inc/php/upgrade.php' );
|
82 |
require_once( MCFUNC_PATH . 'inc/php/version.php' );
|
83 |
+
require_once( MCFUNC_PATH . 'inc/php/enqueue.php' );
|
84 |
require_once( MCFUNC_PATH . 'inc/php/functional.php' );
|
85 |
require_once( MCFUNC_PATH . 'inc/php/page.php' );
|
86 |
require_once( MCFUNC_PATH . 'inc/php/messages.php' );
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: Arthur Gareginyan
|
|
3 |
Tags: code, php, function, snippet, custom, execute, edit, editing, editor, functionality plugin, codemirror, syntax highlighting, syntaxhighlighting, syntax highlighter, syntaxhighlighter, syntax,
|
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.
|
7 |
-
Stable tag: 4.
|
8 |
License: GPL3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -175,14 +175,22 @@ Commercial licensing (e.g. for projects that can’t use an open-source license)
|
|
175 |
|
176 |
== Changelog ==
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
= 4.1.1 =
|
179 |
-
* Fixed the bug due to which the
|
180 |
|
181 |
= 4.1 =
|
182 |
* Added new constants: "_SLUG", "_PREFIX", "_SETTINGS" and "_NAME".
|
183 |
* Value of the "_VERSION" constant replaced with information from the plugin header data.
|
184 |
* All references to the plugin name, slug, prefix are replaced with constants.
|
185 |
-
* The "name" attribute removed from the "
|
186 |
* Code formatting improved.
|
187 |
* F.A.Q. section updated.
|
188 |
|
3 |
Tags: code, php, function, snippet, custom, execute, edit, editing, editor, functionality plugin, codemirror, syntax highlighting, syntaxhighlighting, syntax highlighter, syntaxhighlighter, syntax,
|
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.2
|
8 |
License: GPL3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
175 |
|
176 |
== Changelog ==
|
177 |
|
178 |
+
= 4.2 =
|
179 |
+
* Compatibility with PHP version 5.2 improved.
|
180 |
+
* PHP shorthands improved.
|
181 |
+
* Added function for generating the plugin constants.
|
182 |
+
* Some constants now get the value from the plugin header data.
|
183 |
+
* The "_plugin_version_number" function improved.
|
184 |
+
* Added file "upgrade.php" for future upgrades.
|
185 |
+
|
186 |
= 4.1.1 =
|
187 |
+
* Fixed the bug due to which the "Warning: Constants may only evaluate to scalar values in" warning are displayed.
|
188 |
|
189 |
= 4.1 =
|
190 |
* Added new constants: "_SLUG", "_PREFIX", "_SETTINGS" and "_NAME".
|
191 |
* Value of the "_VERSION" constant replaced with information from the plugin header data.
|
192 |
* All references to the plugin name, slug, prefix are replaced with constants.
|
193 |
+
* The "name" attribute removed from the "form" tag.
|
194 |
* Code formatting improved.
|
195 |
* F.A.Q. section updated.
|
196 |
|