My Custom Functions - Version 3.2

Version Description

  • Added option for easy disable the custom code for cases of WSOD.
  • Style sheet of settings page improved.
  • On the settings page added an advertisement about the PRO version of this plugin.
  • The Readme.txt file improved.
  • Added the Readme.txt file for translation contribution.
Download this release

Release Info

Developer Arthur Gareginyan
Plugin Icon 128x128 My Custom Functions
Version 3.2
Comparing to
See all releases

Code changes from version 3.1 to 3.2

START ADDED
File without changes
inc/css/admin.css CHANGED
@@ -47,10 +47,6 @@ h3.title {
47
  text-align: center;
48
  }
49
 
50
- #side-sortables p {
51
- text-align: center;
52
- }
53
-
54
  #side-sortables #help p {
55
  margin: 0;
56
  }
47
  text-align: center;
48
  }
49
 
 
 
 
 
50
  #side-sortables #help p {
51
  margin: 0;
52
  }
inc/img/pro-version.png ADDED
Binary file
inc/js/admin.js CHANGED
@@ -25,14 +25,14 @@ jQuery(document).ready(function($) {
25
 
26
  // Refresh CodeMirror editor after 1 second
27
  setTimeout(function() {
28
- editor.refresh();
29
  },1);
30
  });
31
 
32
  // Remove the "successful" message after 3 seconds
33
  if (".updated") {
34
  setTimeout(function() {
35
- $(".updated").fadeOut();
36
  }, 3000);
37
  }
38
 
25
 
26
  // Refresh CodeMirror editor after 1 second
27
  setTimeout(function() {
28
+ editor.refresh();
29
  },1);
30
  });
31
 
32
  // Remove the "successful" message after 3 seconds
33
  if (".updated") {
34
  setTimeout(function() {
35
+ $(".updated").fadeOut();
36
  }, 3000);
37
  }
38
 
inc/php/settings_page.php CHANGED
@@ -10,7 +10,7 @@ defined('ABSPATH') or die("Restricted access!");
10
  /**
11
  * Render Settings Page
12
  *
13
- * @since 3.0
14
  */
15
  function MCFunctions_render_submenu_page() {
16
 
@@ -77,10 +77,19 @@ function MCFunctions_render_submenu_page() {
77
  </div>
78
  </div>
79
 
 
 
 
 
 
 
 
 
 
80
  <div id="donate" class="postbox">
81
  <h3 class="title"><?php _e( 'Donate', 'my-custom-functions' ); ?></h3>
82
  <div class="inside">
83
- <p><?php _e( 'If you like this plugin and find it useful, please help me to make this plugin even better and keep it up-to-date.', 'my-custom-functions' ); ?></p>
84
  <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8A88KC7TFF6CS" target="_blank" rel="nofollow">
85
  <img src="<?php echo plugins_url('../img/btn_donateCC_LG.gif', __FILE__); ?>" alt="Make a donation">
86
  </a>
10
  /**
11
  * Render Settings Page
12
  *
13
+ * @since 3.2
14
  */
15
  function MCFunctions_render_submenu_page() {
16
 
77
  </div>
78
  </div>
79
 
80
+ <div id="upgrade" class="postbox">
81
+ <h3 class="title"><?php _e( 'Upgrade', 'my-custom-functions' ); ?></h3>
82
+ <div class="inside">
83
+ <a href="https://www.arthurgareginyan.com/plugin-my-custom-functions-pro.html" target="_blank">
84
+ <img src="<?php echo plugins_url('../img/pro-version.png', __FILE__); ?>" alt="PRO">
85
+ </a>
86
+ </div>
87
+ </div>
88
+
89
  <div id="donate" class="postbox">
90
  <h3 class="title"><?php _e( 'Donate', 'my-custom-functions' ); ?></h3>
91
  <div class="inside">
92
+ <p><?php _e( '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.', 'my-custom-functions' ); ?></p>
93
  <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8A88KC7TFF6CS" target="_blank" rel="nofollow">
94
  <img src="<?php echo plugins_url('../img/btn_donateCC_LG.gif', __FILE__); ?>" alt="Make a donation">
95
  </a>
languages/Readme.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+
2
+ CONTRIBUTING YOUR TRANSLATION
3
+
4
+ If you want to help translate this plugin, please visit the [translation page](https://translate.wordpress.org/projects/wp-plugins/my-custom-functions).
5
+
6
+ Thanks for your contribution!
languages/my-custom-functions-ru_RU.mo CHANGED
Binary file
languages/my-custom-functions-ru_RU.po CHANGED
@@ -2,7 +2,7 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: My Custom Functions\n"
4
  "POT-Creation-Date: 2016-08-23 04:35+0300\n"
5
- "PO-Revision-Date: 2016-08-23 05:20+0300\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: ru\n"
@@ -32,7 +32,7 @@ msgstr ""
32
 
33
  #: inc/settings_page.php:35
34
  msgid "Please, check the code and try again."
35
- msgstr "Пожалуйста, проверьте код и попробуйте еще раз."
36
 
37
  #. Plugin Name of the plugin/theme
38
  #: inc/settings_page.php:45 my-custom-functions.php:82
@@ -69,7 +69,7 @@ msgid ""
69
  "simple!"
70
  msgstr ""
71
  "Для использования, введите ваши пользовательские функции, затем нажмите "
72
- "кнопку “Сохранить изменения”. Это так просто!"
73
 
74
  #: inc/settings_page.php:73
75
  msgid "Help"
@@ -120,7 +120,7 @@ msgid ""
120
  "Easily and safely add your custome functions (PHP code) directly out of your "
121
  "WordPress Dashboard without need of an external editor."
122
  msgstr ""
123
- "Просто и безопасно добавляйте ваши пользовательские функции ((PHP code) "
124
  "непосредственно из админ панели вашего WordPress вебсайта, без необходимости "
125
  "во внешнем редакторе."
126
 
2
  msgstr ""
3
  "Project-Id-Version: My Custom Functions\n"
4
  "POT-Creation-Date: 2016-08-23 04:35+0300\n"
5
+ "PO-Revision-Date: 2016-09-13 16:58+0300\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: ru\n"
32
 
33
  #: inc/settings_page.php:35
34
  msgid "Please, check the code and try again."
35
+ msgstr "Пожалуйста, проверьте код и попробуйте ещё раз."
36
 
37
  #. Plugin Name of the plugin/theme
38
  #: inc/settings_page.php:45 my-custom-functions.php:82
69
  "simple!"
70
  msgstr ""
71
  "Для использования, введите ваши пользовательские функции, затем нажмите "
72
+ "кнопку “Сохранить Изменения”. Это так просто!"
73
 
74
  #: inc/settings_page.php:73
75
  msgid "Help"
120
  "Easily and safely add your custome functions (PHP code) directly out of your "
121
  "WordPress Dashboard without need of an external editor."
122
  msgstr ""
123
+ "Просто и безопасно добавляйте ваши пользовательские функции (PHP код) "
124
  "непосредственно из админ панели вашего WordPress вебсайта, без необходимости "
125
  "во внешнем редакторе."
126
 
my-custom-functions.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Easily and safely add your custome 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: 3.1
9
  * License: GPL3
10
  * Text Domain: my-custom-functions
11
  * Domain Path: /languages/
@@ -178,10 +178,15 @@ function MCFunctions_duplicates($content) {
178
  /**
179
  * Execute the user entered code
180
  *
181
- * @since 2.5
182
  */
183
  function MCFunctions_exec() {
184
-
 
 
 
 
 
185
  // Read data from DB
186
  $options = get_option( 'anarcho_cfunctions_settings' );
187
  $content = isset( $options['anarcho_cfunctions-content'] ) && !empty( $options['anarcho_cfunctions-content'] ) ? $options['anarcho_cfunctions-content'] : ' ';
5
  * Description: Easily and safely add your custome 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: 3.2
9
  * License: GPL3
10
  * Text Domain: my-custom-functions
11
  * Domain Path: /languages/
178
  /**
179
  * Execute the user entered code
180
  *
181
+ * @since 3.2
182
  */
183
  function MCFunctions_exec() {
184
+
185
+ // If STOP file exist...
186
+ if ( file_exists( MCFUNC_PATH . 'STOP' ) ) {
187
+ return; // EXIT
188
+ }
189
+
190
  // Read data from DB
191
  $options = get_option( 'anarcho_cfunctions_settings' );
192
  $content = isset( $options['anarcho_cfunctions-content'] ) && !empty( $options['anarcho_cfunctions-content'] ) ? $options['anarcho_cfunctions-content'] : ' ';
readme.txt CHANGED
@@ -1,36 +1,35 @@
1
  === My Custom Functions ===
2
  Contributors: Arthur Gareginyan
3
- Tags: code, php, function, snippet, custom, execute, edit, editing, editor, functionality plugin, codemirror, syntax highlighting, syntaxhighlighting, syntax highlighter, syntaxhighlighter, syntax, highlighting, highlighter,
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.6
7
- Stable tag: 3.1
8
  License: GPL3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
- Easily and safely add your custome functions (PHP code) directly out of your WordPress Dashboard without need of an external editor.
12
 
13
 
14
  == Description ==
15
- An easy to use WordPress plugin that gives you the ability to easily and safely add your custome functions (PHP code) for execution in WordPress environment directly out of your WordPress Dashboard and without any need of an external editor.
16
 
17
 
18
  = Features =
19
 
20
  * Responsive & Mobile optimized settings page
21
  * Checks the entered code for fatal errors (simple checks)
 
 
22
  * Syntax highlighting (by CodeMirror)
23
  * Line numbering
24
  * Active line highlighting
25
  * Editor allow for tab indentation
26
- * Trigger for temporary disable the custom functions
27
  * Ready for translation (POT file included)
28
 
29
  **Coming soon:**
30
  * Reload the settings page at same position after pushing the save button
31
  * Multisite network support
32
- * Backup of all custom functions to file
33
- * Easier disable/enable option for WSOD
34
 
35
  = Translation =
36
 
@@ -38,15 +37,9 @@ Please keep in mind that not all translations are up to date. You are welcome to
38
 
39
  * English (default)
40
  * Russian
41
- * Chinese (Taiwan)
42
 
43
- >**Contribution**
44
- >
45
- >Developing plugins is long and tedious work. If you benefit or enjoy this plugin please take the time to:
46
- >
47
- >* [Donate](http://www.arthurgareginyan.com/donate.html) to support ongoing development. Your contribution would be greatly appreciated.
48
- >* [Rate and Review](https://wordpress.org/support/view/plugin-reviews/my-custom-functions?rate=5#postform) this plugin.
49
- >* [Share with me](mailto:arthurgareginyan@gmail.com) or view the [GitHub Repo](https://github.com/ArthurGareginyan/my-custom-functions) if you have any ideas or suggestions to make this plugin better.
50
 
51
 
52
  == Installation ==
@@ -54,17 +47,17 @@ Install "My Custom Functions" just as you would any other WordPress Plugin.
54
 
55
  Automatically via WordPress:
56
 
57
- 1. Log into WordPress Dashboard of your website.
58
- 2. Go to "`Plugins`" —> "`add new plugins`".
59
  3. Find this plugin and click install.
60
  4. Activate this plugin through the "`Plugins`" tab.
61
 
62
  Manual via FTP:
63
 
64
- 1. Download a copy (zip file) of this plugin from WordPress.org.
65
- 2. Unzip the zip file.
66
- 3. Upload the unzipped directory to your website's plugin directory (`/wp-content/plugins/`).
67
- 4. Log into WordPress Dashboard of your website.
68
  5. Activate this plugin through the "`Plugins`" tab.
69
 
70
  After installation, a "`Custom Functions`" menu item will appear in the "`Appearance`" section. Click on this in order to view plugin's administration page.
@@ -73,23 +66,37 @@ After installation, a "`Custom Functions`" menu item will appear in the "`Appear
73
 
74
 
75
  == Frequently Asked Questions ==
76
- = Q. Will this Plugin work on my WordPress.COM website? =
77
  A. Sorry, this plugin is available for use only on self-hosted (WordPress.org) websites.
78
 
79
- = Q. How much of PHP code (characters) I can enter in the text field? =
80
- A. I don't limit the number of characters.
81
-
82
  = Q. Can I use this plugin on my language? =
83
  A. Yes. But If your language is not available then you can make one. This plugin is ready for translation. The `.pot` file is included and placed in "`languages`" folder. Many of plugin users would be delighted if you shared your translation with the community. Just send the translation files (`*.po, *.mo`) to me at the arthurgareginyan@gmail.com and I will include the translation within the next plugin update.
84
 
85
  = Q. Does this plugin require modification to the theme? =
86
  A. Absolutely not. This plugin is added/configured entirely from the website's Admin section.
87
 
88
- = Q. It's not working. What could be wrong? =
89
- A. As with every plugin, it's possible that things don't work. The most common reason for this is that the plugin has a conflict with another plugin you're using. It's impossible to tell what could be wrong exactly, but if you post a support request in the plugin's support forum on WordPress.org, I'd be happy to give it a look and try to help out. Please include as much information as possible, including a link to your website where the problem can be seen.
 
90
 
91
- = Q. On the plugin settings page, an error message appears. What could be wrong? =
 
 
 
 
 
 
92
 
 
 
 
 
 
 
 
 
 
 
93
  A. Here are a few of the most likely causes of the error message:
94
 
95
  1. You make a syntax error in the code that you have entered. Check the syntax of your code and try again.
@@ -97,14 +104,15 @@ A. Here are a few of the most likely causes of the error message:
97
  3. You have entered function with a name that is already occupied by another function. Use a unique name for your function.
98
  4. You are trying to overwrite an existing function (of WordPress, theme, or plugin). Instead, use filters and hooks.
99
 
 
 
 
100
  = Q. What to do if this plugin caused the white screen? =
101
  A. This plugin is not perfect, so there are times when the entered custom code causes the error and white screen (WSOD). If this happened with you then do the following.
102
 
103
- Your code stored in the Database of your web-site. For getting your code, you can go to the `Database` —> Table "`wp_options`" —> Option "`anarcho_cfunctions_settings`" —> "`option_value`".
104
 
105
- Or you can use the FTP method, for access to plugin's settings page. Go to plugin's folder (in `wp-content/plugins/`). Open "`my-custom-functions.php`" file. Find this line of code:
106
- `MCFunctions_exec();`
107
- and comment it by placing two slashes (`//`) in beginning. Then you can go to plugin's settings page and edit your entered custom code. After editing, just delete two slashes which you written before.
108
 
109
  = Q. Where to report bug if found? =
110
  A. Please visit [Dedicated Plugin Page on GitHub](https://github.com/ArthurGareginyan/my-custom-functions) and report.
@@ -141,9 +149,16 @@ Commercial licensing (e.g. for projects that can’t use an open-source license)
141
 
142
  * [Developer Website](http://www.arthurgareginyan.com)
143
  * [Dedicated Plugin Page on GitHub](https://github.com/ArthurGareginyan/my-custom-functions)
 
144
 
145
 
146
  == Changelog ==
 
 
 
 
 
 
147
  = 3.1 =
148
  * Added prefixes to the stylesheet and script names when using wp_enqueue_style() and wp_enqueue_script().
149
  * Added constant for storing the plugin version number.
1
  === My Custom Functions ===
2
  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.6
7
+ Stable tag: 3.2
8
  License: GPL3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
+ Easily and safely add your custom functions (PHP code) directly out of your WordPress Dashboard without need of an external editor.
12
 
13
 
14
  == Description ==
15
+ An easy to use WordPress plugin that gives you the ability to easily and safely add your custome functions (PHP code) for execution in WordPress environment directly out of your WordPress Dashboard and without any need of an external editor.
16
 
17
 
18
  = Features =
19
 
20
  * Responsive & Mobile optimized settings page
21
  * Checks the entered code for fatal errors (simple checks)
22
+ * Trigger for temporary disable the custom functions
23
+ * Easy disable option for WSOD
24
  * Syntax highlighting (by CodeMirror)
25
  * Line numbering
26
  * Active line highlighting
27
  * Editor allow for tab indentation
 
28
  * Ready for translation (POT file included)
29
 
30
  **Coming soon:**
31
  * Reload the settings page at same position after pushing the save button
32
  * Multisite network support
 
 
33
 
34
  = Translation =
35
 
37
 
38
  * English (default)
39
  * Russian
40
+ * Chinese-Taiwan (Thanks Gordon Yu)
41
 
42
+ **Consider Going Pro For Additional Features!**
 
 
 
 
 
 
43
 
44
 
45
  == Installation ==
47
 
48
  Automatically via WordPress:
49
 
50
+ 1. Log into Dashboard of your WordPress website.
51
+ 2. Go to "`Plugins`" —> "`Add New`".
52
  3. Find this plugin and click install.
53
  4. Activate this plugin through the "`Plugins`" tab.
54
 
55
  Manual via FTP:
56
 
57
+ 1. Download a copy (ZIP file) of this plugin from WordPress.org.
58
+ 2. Unzip the ZIP file.
59
+ 3. Upload the unzipped catalog to your website's plugin directory (`/wp-content/plugins/`).
60
+ 4. Log into Dashboard of your WordPress website.
61
  5. Activate this plugin through the "`Plugins`" tab.
62
 
63
  After installation, a "`Custom Functions`" menu item will appear in the "`Appearance`" section. Click on this in order to view plugin's administration page.
66
 
67
 
68
  == Frequently Asked Questions ==
69
+ = Q. Will this plugin work on my WordPress.COM website? =
70
  A. Sorry, this plugin is available for use only on self-hosted (WordPress.org) websites.
71
 
 
 
 
72
  = Q. Can I use this plugin on my language? =
73
  A. Yes. But If your language is not available then you can make one. This plugin is ready for translation. The `.pot` file is included and placed in "`languages`" folder. Many of plugin users would be delighted if you shared your translation with the community. Just send the translation files (`*.po, *.mo`) to me at the arthurgareginyan@gmail.com and I will include the translation within the next plugin update.
74
 
75
  = Q. Does this plugin require modification to the theme? =
76
  A. Absolutely not. This plugin is added/configured entirely from the website's Admin section.
77
 
78
+ = Q. How does it work? =
79
+ A. Just place your PHP code to the field and click "Save Changes". Example of PHP code:
80
+ `function NameOfYourFunction {
81
 
82
+ // Content of your function
83
+
84
+ }`
85
+
86
+ = Q. Can I use HTML/CSS/JS code integrated in PHP code? =
87
+ A. Yes. But you need to do it properly, like this:
88
+ `function NameOfYourFunction {
89
 
90
+ echo "<script>
91
+ // Your JS code
92
+ </script>";
93
+
94
+ }`
95
+
96
+ = Q. How much of PHP code (characters) I can enter in the text field? =
97
+ A. I don't limit the number of characters.
98
+
99
+ = Q. On the plugin settings page, an error message appears. What could be wrong? =
100
  A. Here are a few of the most likely causes of the error message:
101
 
102
  1. You make a syntax error in the code that you have entered. Check the syntax of your code and try again.
104
  3. You have entered function with a name that is already occupied by another function. Use a unique name for your function.
105
  4. You are trying to overwrite an existing function (of WordPress, theme, or plugin). Instead, use filters and hooks.
106
 
107
+ = Q. It's not working. What could be wrong? =
108
+ A. As with every plugin, it's possible that things don't work. The most common reason for this is that the plugin has a conflict with another plugin you're using. It's impossible to tell what could be wrong exactly, but if you post a support request in the plugin's support forum on WordPress.org, I'd be happy to give it a look and try to help out. Please include as much information as possible, including a link to your website where the problem can be seen.
109
+
110
  = Q. What to do if this plugin caused the white screen? =
111
  A. This plugin is not perfect, so there are times when the entered custom code causes the error and white screen (WSOD). If this happened with you then do the following.
112
 
113
+ Go to plugin folder (in `wp-content/plugins/my-custom-functions/`). Rename the "`START`" file to "`STOP`". Then you can go to plugin settings page and edit your entered custom code. After editing, just rename the "`STOP`" file which you written before to "`START`".
114
 
115
+ This plugin stored you entered code in the Database of your website. For getting your code, you also can go to the `Database` —> Table "`wp_options`" —> Option "`anarcho_cfunctions_settings`" —> "`option_value`".
 
 
116
 
117
  = Q. Where to report bug if found? =
118
  A. Please visit [Dedicated Plugin Page on GitHub](https://github.com/ArthurGareginyan/my-custom-functions) and report.
149
 
150
  * [Developer Website](http://www.arthurgareginyan.com)
151
  * [Dedicated Plugin Page on GitHub](https://github.com/ArthurGareginyan/my-custom-functions)
152
+ * [Premium Version](https://www.arthurgareginyan.com/plugin-my-custom-functions-pro.html)
153
 
154
 
155
  == Changelog ==
156
+ = 3.2 =
157
+ * Added option for easy disable the custom code for cases of WSOD.
158
+ * Style sheet of settings page improved.
159
+ * On the settings page added an advertisement about the PRO version of this plugin.
160
+ * The Readme.txt file improved.
161
+ * Added the Readme.txt file for translation contribution.
162
  = 3.1 =
163
  * Added prefixes to the stylesheet and script names when using wp_enqueue_style() and wp_enqueue_script().
164
  * Added constant for storing the plugin version number.