My Custom Functions - Version 4.10

Version Description

  • At the request of some users, plugin settings page moved to the submenu item in the top-level menu item "Settings", like before.
  • In the "register_submenu_page" function, "$capability" changed from the 'edittheme_options' to 'manage_options'.
Download this release

Release Info

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

Code changes from version 4.9 to 4.10

inc/php/core.php CHANGED
@@ -20,7 +20,7 @@ add_action( 'init', 'spacexchimp_p001_textdomain' );
20
  * and inserts a link to the plugin admin page
21
  */
22
  function spacexchimp_p001_settings_link( $links ) {
23
- $page = '<a href="' . admin_url( 'admin.php?page=spacexchimp/' . SPACEXCHIMP_P001_SLUG ) .'">' . __( 'Settings', SPACEXCHIMP_P001_TEXT ) . '</a>';
24
  array_unshift( $links, $page );
25
  return $links;
26
  }
@@ -55,55 +55,20 @@ function spacexchimp_p001_plugin_row_meta( $links, $file ) {
55
  add_filter( 'plugin_row_meta', 'spacexchimp_p001_plugin_row_meta', 10, 2 );
56
 
57
  /**
58
- * Register brand menu item in the Admin Menu
59
- */
60
- function spacexchimp_p001_register_admin_menu() {
61
-
62
- // Return if the brand menu item is already existed
63
- if ( !empty ( $GLOBALS['admin_page_hooks']['spacexchimp'] ) ) return;
64
-
65
- $page_title = 'Space X-Chimp';
66
- $menu_title = 'Space X-Chimp';
67
- $capability = 'manage_options';
68
- $menu_slug = 'spacexchimp';
69
- $function = null;
70
- $icon_url = 'dashicons-star-filled';
71
- $position = 66;
72
-
73
- add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );
74
- }
75
- add_action( 'admin_menu', 'spacexchimp_p001_register_admin_menu' );
76
-
77
- /**
78
- * Register plugin's submenu item in the brand menu item
79
  */
80
  function spacexchimp_p001_register_submenu_page() {
81
 
82
- $parent_slug = 'spacexchimp';
83
  $page_title = SPACEXCHIMP_P001_NAME;
84
  $menu_title = __( 'PHP Inserter', SPACEXCHIMP_P001_TEXT );
85
- $capability = 'edit_theme_options';
86
- $menu_slug = 'spacexchimp/' . SPACEXCHIMP_P001_SLUG;
87
  $function = 'spacexchimp_p001_render_submenu_page';
88
 
89
- add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function);
90
  }
91
  add_action( 'admin_menu', 'spacexchimp_p001_register_submenu_page' );
92
 
93
- /**
94
- * Remove the 'Space X-Chimp' sub menu item in the brand menu item
95
- */
96
- function spacexchimp_p001_remove_submenu_item() {
97
-
98
- // Read global variable
99
- global $submenu;
100
-
101
- if ( isset( $submenu['spacexchimp'] ) ) {
102
- unset( $submenu['spacexchimp'][0] );
103
- }
104
- }
105
- add_action( 'admin_menu', 'spacexchimp_p001_remove_submenu_item' );
106
-
107
  /**
108
  * Register settings
109
  */
@@ -123,7 +88,7 @@ function spacexchimp_p001_admin_footer_text() {
123
  $current_screen = get_current_screen();
124
 
125
  // Return if the page is not a settings page of this plugin
126
- $settings_page = 'space-x-chimp_page_spacexchimp/' . SPACEXCHIMP_P001_SLUG;
127
  if ( $settings_page != $current_screen->id ) return;
128
 
129
  // Filter footer text
20
  * and inserts a link to the plugin admin page
21
  */
22
  function spacexchimp_p001_settings_link( $links ) {
23
+ $page = '<a href="' . admin_url( 'options-general.php?page=' . SPACEXCHIMP_P001_SLUG . '.php' ) .'">' . __( 'Settings', SPACEXCHIMP_P001_TEXT ) . '</a>';
24
  array_unshift( $links, $page );
25
  return $links;
26
  }
55
  add_filter( 'plugin_row_meta', 'spacexchimp_p001_plugin_row_meta', 10, 2 );
56
 
57
  /**
58
+ * Register a submenu item in the top-level menu item "Settings"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  */
60
  function spacexchimp_p001_register_submenu_page() {
61
 
 
62
  $page_title = SPACEXCHIMP_P001_NAME;
63
  $menu_title = __( 'PHP Inserter', SPACEXCHIMP_P001_TEXT );
64
+ $capability = 'manage_options';
65
+ $menu_slug = SPACEXCHIMP_P001_SLUG;
66
  $function = 'spacexchimp_p001_render_submenu_page';
67
 
68
+ add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function );
69
  }
70
  add_action( 'admin_menu', 'spacexchimp_p001_register_submenu_page' );
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  /**
73
  * Register settings
74
  */
88
  $current_screen = get_current_screen();
89
 
90
  // Return if the page is not a settings page of this plugin
91
+ $settings_page = 'settings_page_' . SPACEXCHIMP_P001_SLUG;
92
  if ( $settings_page != $current_screen->id ) return;
93
 
94
  // Filter footer text
inc/php/enqueue.php CHANGED
@@ -16,7 +16,7 @@ function spacexchimp_p001_load_scripts_admin( $hook ) {
16
  $url = SPACEXCHIMP_P001_URL;
17
 
18
  // Return if the page is not a settings page of this plugin
19
- $settings_page = 'space-x-chimp_page_spacexchimp/' . $slug;
20
  if ( $settings_page != $hook ) return;
21
 
22
  // Load jQuery library
16
  $url = SPACEXCHIMP_P001_URL;
17
 
18
  // Return if the page is not a settings page of this plugin
19
+ $settings_page = 'settings_page_' . $slug;
20
  if ( $settings_page != $hook ) return;
21
 
22
  // Load jQuery library
languages/my-custom-functions-es_ES.mo CHANGED
Binary file
languages/my-custom-functions-es_ES.po CHANGED
@@ -3,8 +3,8 @@
3
  msgid ""
4
  msgstr ""
5
  "Project-Id-Version: Plugins - My Custom Functions - Development Readme (trunk)\n"
6
- "POT-Creation-Date: 2017-09-15 14:26+0300\n"
7
- "PO-Revision-Date: 2017-09-15 14:26+0300\n"
8
  "Last-Translator: \n"
9
  "Language-Team: \n"
10
  "Language: es\n"
@@ -33,7 +33,7 @@ msgstr ""
33
  msgid "Donate"
34
  msgstr "Donar"
35
 
36
- #: inc/php/core.php:84
37
  msgid "PHP Inserter"
38
  msgstr "PHP Inserter"
39
 
3
  msgid ""
4
  msgstr ""
5
  "Project-Id-Version: Plugins - My Custom Functions - Development Readme (trunk)\n"
6
+ "POT-Creation-Date: 2017-09-23 04:52+0300\n"
7
+ "PO-Revision-Date: 2017-09-23 04:52+0300\n"
8
  "Last-Translator: \n"
9
  "Language-Team: \n"
10
  "Language: es\n"
33
  msgid "Donate"
34
  msgstr "Donar"
35
 
36
+ #: inc/php/core.php:63
37
  msgid "PHP Inserter"
38
  msgstr "PHP Inserter"
39
 
languages/my-custom-functions-fr_FR.mo CHANGED
Binary file
languages/my-custom-functions-fr_FR.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: My Custom Functions\n"
4
- "POT-Creation-Date: 2017-09-15 14:26+0300\n"
5
- "PO-Revision-Date: 2017-09-15 14:26+0300\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: fr_FR\n"
@@ -32,7 +32,7 @@ msgstr ""
32
  msgid "Donate"
33
  msgstr "Faire un don"
34
 
35
- #: inc/php/core.php:84
36
  msgid "PHP Inserter"
37
  msgstr "PHP Inserter"
38
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: My Custom Functions\n"
4
+ "POT-Creation-Date: 2017-09-23 04:52+0300\n"
5
+ "PO-Revision-Date: 2017-09-23 04:52+0300\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: fr_FR\n"
32
  msgid "Donate"
33
  msgstr "Faire un don"
34
 
35
+ #: inc/php/core.php:63
36
  msgid "PHP Inserter"
37
  msgstr "PHP Inserter"
38
 
languages/my-custom-functions-ru_RU.mo CHANGED
Binary file
languages/my-custom-functions-ru_RU.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: My Custom Functions\n"
4
- "POT-Creation-Date: 2017-09-15 14:17+0300\n"
5
- "PO-Revision-Date: 2017-09-15 14:17+0300\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: ru_RU\n"
@@ -33,7 +33,7 @@ msgstr "Обновить до PRO"
33
  msgid "Donate"
34
  msgstr "Пожертвовать"
35
 
36
- #: inc/php/core.php:84
37
  msgid "PHP Inserter"
38
  msgstr "PHP Inserter"
39
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: My Custom Functions\n"
4
+ "POT-Creation-Date: 2017-09-23 04:52+0300\n"
5
+ "PO-Revision-Date: 2017-09-23 04:52+0300\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: ru_RU\n"
33
  msgid "Donate"
34
  msgstr "Пожертвовать"
35
 
36
+ #: inc/php/core.php:63
37
  msgid "PHP Inserter"
38
  msgstr "PHP Inserter"
39
 
languages/my-custom-functions-zh_TW.mo CHANGED
Binary file
languages/my-custom-functions-zh_TW.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: My Custom Functions\n"
4
- "POT-Creation-Date: 2017-09-15 14:26+0300\n"
5
- "PO-Revision-Date: 2017-09-15 14:26+0300\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: zh_TW\n"
@@ -32,7 +32,7 @@ msgstr ""
32
  msgid "Donate"
33
  msgstr "捐款"
34
 
35
- #: inc/php/core.php:84
36
  msgid "PHP Inserter"
37
  msgstr ""
38
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: My Custom Functions\n"
4
+ "POT-Creation-Date: 2017-09-23 04:52+0300\n"
5
+ "PO-Revision-Date: 2017-09-23 04:52+0300\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: zh_TW\n"
32
  msgid "Donate"
33
  msgstr "捐款"
34
 
35
+ #: inc/php/core.php:63
36
  msgid "PHP Inserter"
37
  msgstr ""
38
 
languages/my-custom-functions.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
  "Project-Id-Version: My Custom Functions\n"
6
- "POT-Creation-Date: 2017-09-15 14:07+0300\n"
7
  "PO-Revision-Date: 2015-08-30 16:22+0300\n"
8
  "Last-Translator: \n"
9
  "Language-Team: \n"
@@ -32,7 +32,7 @@ msgstr ""
32
  msgid "Donate"
33
  msgstr ""
34
 
35
- #: inc/php/core.php:84
36
  msgid "PHP Inserter"
37
  msgstr ""
38
 
3
  msgstr ""
4
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
  "Project-Id-Version: My Custom Functions\n"
6
+ "POT-Creation-Date: 2017-09-23 04:49+0300\n"
7
  "PO-Revision-Date: 2015-08-30 16:22+0300\n"
8
  "Last-Translator: \n"
9
  "Language-Team: \n"
32
  msgid "Donate"
33
  msgstr ""
34
 
35
+ #: inc/php/core.php:63
36
  msgid "PHP Inserter"
37
  msgstr ""
38
 
my-custom-functions.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Easily and safely add your custom functions (PHP code) directly out of your WordPress Admin area, without the need to have an external editor.
6
  * Author: Arthur Gareginyan
7
  * Author URI: https://www.arthurgareginyan.com
8
- * Version: 4.9
9
  * License: GPL3
10
  * Text Domain: my-custom-functions
11
  * Domain Path: /languages/
5
  * Description: Easily and safely add your custom functions (PHP code) directly out of your WordPress Admin area, without the need to have an external editor.
6
  * Author: Arthur Gareginyan
7
  * Author URI: https://www.arthurgareginyan.com
8
+ * Version: 4.10
9
  * License: GPL3
10
  * Text Domain: my-custom-functions
11
  * Domain Path: /languages/
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: code, php, function, snippet, custom, execute, edit, editing, editor, func
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.9
8
  License: GPL3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -89,7 +89,7 @@ Manually via FTP access:
89
  4. Log into Admin Panel of your WordPress website.
90
  5. Activate this plugin through the "`Plugins`" tab.
91
 
92
- After installation and activation, the "`PHP Inserter`" menu item will appear in the "`Space X-Chimp`" section of Admin Panel. Click on it in order to view the plugin settings page.
93
 
94
  [More help installing plugins](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins "WordPress Codex: Installing Plugins")
95
 
@@ -104,7 +104,7 @@ A. Yes. This plugin is ready for translation and has already been translated int
104
 
105
  = Q. How does it work? =
106
  A. Simply go to the plugin settings page, place your PHP code in the field, switch the toggle to the "ON" position and click the "Save changes" button. Enjoy the result of applying your PHP code. It's that simple!
107
- You can find the plugin settings page at "`WP Admin Panel`" -> "`Space X-Chimp`" -> "`PHP Inserter`".
108
 
109
  = Q. Can I use HTML/CSS/JS code integrated in PHP code? =
110
  A. Yes. But you need to do it properly, like this:
@@ -196,6 +196,10 @@ Commercial licensing (e.g. for projects that can’t use an open-source license)
196
 
197
  == Changelog ==
198
 
 
 
 
 
199
  = 4.9 =
200
  * Fixed the issue due tof which the 'Space X-Chimp' sub menu item in the brand menu item was displayed.
201
  * Added branded footer text on the plugin's settings page.
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.10
8
  License: GPL3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
89
  4. Log into Admin Panel of your WordPress website.
90
  5. Activate this plugin through the "`Plugins`" tab.
91
 
92
+ After installation and activation, the "`PHP Inserter`" menu item will appear in the "`Settings`" section of Admin Panel. Click on it in order to view the plugin settings page.
93
 
94
  [More help installing plugins](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins "WordPress Codex: Installing Plugins")
95
 
104
 
105
  = Q. How does it work? =
106
  A. Simply go to the plugin settings page, place your PHP code in the field, switch the toggle to the "ON" position and click the "Save changes" button. Enjoy the result of applying your PHP code. It's that simple!
107
+ You can find the plugin settings page at "`WP Admin Panel`" -> "`Settings`" -> "`PHP Inserter`".
108
 
109
  = Q. Can I use HTML/CSS/JS code integrated in PHP code? =
110
  A. Yes. But you need to do it properly, like this:
196
 
197
  == Changelog ==
198
 
199
+ = 4.10 =
200
+ * At the request of some users, plugin settings page moved to the submenu item in the top-level menu item "Settings", like before.
201
+ * In the "_register_submenu_page" function, "$capability" changed from the 'edit_theme_options' to 'manage_options'.
202
+
203
  = 4.9 =
204
  * Fixed the issue due tof which the 'Space X-Chimp' sub menu item in the brand menu item was displayed.
205
  * Added branded footer text on the plugin's settings page.