PHP Settings - Version 1.0.1

Version Description

  • (NEW) An error message will be shown if PHP does not have sufficient permissions to write files
  • (IMPROVED) Error handling & displaying
  • (IMPROVED) Scripts/Styles loading
Download this release

Release Info

Developer Askupa Software
Plugin Icon 128x128 PHP Settings
Version 1.0.1
Comparing to
See all releases

Code changes from version 1.0.0 to 1.0.1

Files changed (11) hide show
  1. askupa-logo.png +0 -0
  2. icon-256x256.png +0 -0
  3. ini-file.php +12 -7
  4. options-page.php +14 -13
  5. options-page.phtml +17 -3
  6. php-settings.php +6 -3
  7. phpinfo.php +2 -2
  8. process-button.js +2 -2
  9. readme.txt +8 -3
  10. script.js +12 -4
  11. style.css +79 -0
askupa-logo.png ADDED
Binary file
icon-256x256.png ADDED
Binary file
ini-file.php CHANGED
@@ -2,8 +2,8 @@
2
 
3
  /**
4
  * @package PHP Settings
5
- * @date 2016-03-06
6
- * @version 1.0.0
7
  * @author Askupa Software <contact@askupasoftware.com>
8
  * @link http://products.askupasoftware.com/php-settings
9
  * @copyright 2016 Askupa Software
@@ -13,17 +13,17 @@ class INIFile
13
  {
14
  private function __construct() {}
15
 
16
- static function get_admin_path()
17
  {
18
- return ABSPATH.'/';
19
  }
20
 
21
  static function get_ini_file_names()
22
  {
23
  return array(
24
- self::get_admin_path().'.user.ini',
25
- self::get_admin_path().'php.ini',
26
- self::get_admin_path().'php5.ini'
27
  );
28
  }
29
 
@@ -88,4 +88,9 @@ class INIFile
88
  self::delete( $filepath );
89
  }
90
  }
 
 
 
 
 
91
  }
2
 
3
  /**
4
  * @package PHP Settings
5
+ * @date 2016-03-09
6
+ * @version 1.0.1
7
  * @author Askupa Software <contact@askupasoftware.com>
8
  * @link http://products.askupasoftware.com/php-settings
9
  * @copyright 2016 Askupa Software
13
  {
14
  private function __construct() {}
15
 
16
+ static function get_dir_path()
17
  {
18
+ return ABSPATH;
19
  }
20
 
21
  static function get_ini_file_names()
22
  {
23
  return array(
24
+ self::get_dir_path().'.user.ini',
25
+ self::get_dir_path().'php.ini',
26
+ self::get_dir_path().'php5.ini'
27
  );
28
  }
29
 
88
  self::delete( $filepath );
89
  }
90
  }
91
+
92
+ static function is_writable()
93
+ {
94
+ return is_writable(self::get_dir_path());
95
+ }
96
  }
options-page.php CHANGED
@@ -2,8 +2,8 @@
2
 
3
  /**
4
  * @package PHP Settings
5
- * @date 2016-03-06
6
- * @version 1.0.0
7
  * @author Askupa Software <contact@askupasoftware.com>
8
  * @link http://products.askupasoftware.com/php-settings
9
  * @copyright 2016 Askupa Software
@@ -16,7 +16,6 @@ class OptionsPage
16
 
17
  function __construct() {
18
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
19
- add_action( 'admin_init', array( $this, 'enqueue_styles' ) );
20
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
21
  add_action( 'wp_ajax_save_php_settings', array( $this, 'save' ) );
22
  add_action( 'wp_ajax_delete_ini_files', array( $this, 'delete' ) );
@@ -47,7 +46,7 @@ class OptionsPage
47
  } catch (Exception $ex) {
48
  echo $ex->getMessage();
49
  }
50
- wp_die(); // this is required to terminate immediately and return a proper response
51
  }
52
 
53
  function delete()
@@ -58,7 +57,7 @@ class OptionsPage
58
  } catch (Exception $ex) {
59
  echo $ex->getMessage();
60
  }
61
- wp_die(); // this is required to terminate immediately and return a proper response
62
  }
63
 
64
  function refresh_table()
@@ -72,19 +71,21 @@ class OptionsPage
72
  include('options-page.phtml');
73
  }
74
 
75
- function enqueue_styles()
76
- {
77
- wp_enqueue_style( 'php-settings', plugins_url( 'style.css', __FILE__ ) );
78
- }
79
-
80
  function enqueue_scripts( $hook )
81
  {
82
  if( 'tools_page_php_settings' === $hook )
83
  {
84
- wp_enqueue_script( 'php-settings-callback', plugins_url( 'script.js', __FILE__ ), array('jquery') );
85
- wp_enqueue_script( 'process-button', plugins_url( 'process-button.js', __FILE__ ), array('jquery') );
86
- wp_enqueue_script( 'ace-editor', 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ace.js', array('jquery') );
 
 
87
  }
88
  }
 
 
 
 
 
89
  }
90
  new OptionsPage();
2
 
3
  /**
4
  * @package PHP Settings
5
+ * @date 2016-03-09
6
+ * @version 1.0.1
7
  * @author Askupa Software <contact@askupasoftware.com>
8
  * @link http://products.askupasoftware.com/php-settings
9
  * @copyright 2016 Askupa Software
16
 
17
  function __construct() {
18
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
 
19
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
20
  add_action( 'wp_ajax_save_php_settings', array( $this, 'save' ) );
21
  add_action( 'wp_ajax_delete_ini_files', array( $this, 'delete' ) );
46
  } catch (Exception $ex) {
47
  echo $ex->getMessage();
48
  }
49
+ wp_die();
50
  }
51
 
52
  function delete()
57
  } catch (Exception $ex) {
58
  echo $ex->getMessage();
59
  }
60
+ wp_die();
61
  }
62
 
63
  function refresh_table()
71
  include('options-page.phtml');
72
  }
73
 
 
 
 
 
 
74
  function enqueue_scripts( $hook )
75
  {
76
  if( 'tools_page_php_settings' === $hook )
77
  {
78
+ wp_enqueue_script( 'php-settings-callback', PHP_SETTINGS_URL.'script.js', array('jquery'), PHP_SETTINGS_VERSION );
79
+ wp_enqueue_script( 'process-button', PHP_SETTINGS_URL.'process-button.js', array('jquery'), PHP_SETTINGS_VERSION );
80
+ wp_enqueue_script( 'ace-editor', 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ace.js', array('jquery'), '1.2.3' );
81
+ wp_enqueue_style( 'php-settings', PHP_SETTINGS_URL.'style.css', array(), PHP_SETTINGS_VERSION );
82
+ add_filter('admin_footer_text', array( $this, 'footer_text' ) );
83
  }
84
  }
85
+
86
+ function footer_text()
87
+ {
88
+ echo 'Proudly developed by <a class="askupa-logo" href="http://askupasoftware.com/"><img height="30" src="'.PHP_SETTINGS_URL.'askupa-logo.png"/></a>';
89
+ }
90
  }
91
  new OptionsPage();
options-page.phtml CHANGED
@@ -1,11 +1,25 @@
1
  <div class="wrap" id="php-settings-page">
2
 
3
- <h1>PHP Settings</h1>
 
 
 
 
4
 
5
  <h2 class="nav-tab-wrapper">
6
- <a class="nav-tab" href="#tab1"><span class="dashicons dashicons-editor-code"></span> Editor</a>
7
- <a class="nav-tab" href="#tab2"><span class="dashicons dashicons-admin-generic"></span> Settings</a>
8
  </h2>
 
 
 
 
 
 
 
 
 
 
9
  <div id="tab1" class="tab">
10
  <div class="tab-wrapper">
11
  <div class="tab-content">
1
  <div class="wrap" id="php-settings-page">
2
 
3
+ <div class="plugin-banner">
4
+ <img height="128" src="<?php echo PHP_SETTINGS_URL ?>icon-256x256.png" />
5
+ <h1>PHP Settings <span>V <?php echo PHP_SETTINGS_VERSION ?></span><br/><span>Easily edit you INI settings</span></h1>
6
+ </div>
7
+
8
 
9
  <h2 class="nav-tab-wrapper">
10
+ <a class="nav-tab" href="#tab1"><span class="dashicons dashicons-editor-code"></span> Editor</a>
11
+ <a class="nav-tab" href="#tab2"><span class="dashicons dashicons-admin-generic"></span> Settings</a>
12
  </h2>
13
+
14
+ <div class="nav-tab-notifications">
15
+ <?php if( !INIFile::is_writable() ): ?>
16
+ <div class="nav-tab-notification nav-tab-error">
17
+ <i class="dashicons dashicons-no"></i>
18
+ <p><strong>ERROR:</strong> The directory <code><?php echo INIFile::get_dir_path(); ?></code> is not writable. This plugin requires writing permission to create <code>.ini</code> files.</p>
19
+ </div>
20
+ <?php endif; ?>
21
+ </div>
22
+
23
  <div id="tab1" class="tab">
24
  <div class="tab-wrapper">
25
  <div class="tab-content">
php-settings.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * PHP Settings
4
  *
5
- * This plugin provides a simple user interface with a code editor to edit your local `.ini` settings.
6
  *
7
  * @package php-settings
8
  * @author Askupa Software <contact@askupasoftware.com>
@@ -12,8 +12,8 @@
12
  * @wordpress-plugin
13
  * Plugin Name: PHP Settings
14
  * Plugin URI: http://products.askupasoftware.com/php-settings
15
- * Description: This plugin provides a simple user interface with a code editor to edit your local `.ini` settings.
16
- * Version: 1.0.0
17
  * Author: Askupa Software
18
  * Author URI: http://www.askupasoftware.com
19
  * Text Domain: php-settings
@@ -22,6 +22,9 @@
22
 
23
  defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
24
 
 
 
 
25
  include('options-page.php');
26
  include('ini-file.php');
27
  include('phpinfo.php');
2
  /**
3
  * PHP Settings
4
  *
5
+ * This plugin provides a simple user interface with a code editor to edit your local php.ini settings.
6
  *
7
  * @package php-settings
8
  * @author Askupa Software <contact@askupasoftware.com>
12
  * @wordpress-plugin
13
  * Plugin Name: PHP Settings
14
  * Plugin URI: http://products.askupasoftware.com/php-settings
15
+ * Description: This plugin provides a simple user interface with a code editor to edit your local php.ini settings.
16
+ * Version: 1.0.1
17
  * Author: Askupa Software
18
  * Author URI: http://www.askupasoftware.com
19
  * Text Domain: php-settings
22
 
23
  defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
24
 
25
+ define( 'PHP_SETTINGS_VERSION', '1.0.1' );
26
+ define( 'PHP_SETTINGS_URL', plugins_url( '/', __FILE__ ) );
27
+
28
  include('options-page.php');
29
  include('ini-file.php');
30
  include('phpinfo.php');
phpinfo.php CHANGED
@@ -2,8 +2,8 @@
2
 
3
  /**
4
  * @package PHP Settings
5
- * @date 2016-03-06
6
- * @version 1.0.0
7
  * @author Askupa Software <contact@askupasoftware.com>
8
  * @link http://products.askupasoftware.com/php-settings
9
  * @copyright 2016 Askupa Software
2
 
3
  /**
4
  * @package PHP Settings
5
+ * @date 2016-03-09
6
+ * @version 1.0.1
7
  * @author Askupa Software <contact@askupasoftware.com>
8
  * @link http://products.askupasoftware.com/php-settings
9
  * @copyright 2016 Askupa Software
process-button.js CHANGED
@@ -1,7 +1,7 @@
1
  /**
2
  * @package PHP Settings
3
- * @date 2016-03-06
4
- * @version 1.0.0
5
  * @author Askupa Software <contact@askupasoftware.com>
6
  * @link http://products.askupasoftware.com/php-settings
7
  * @copyright 2016 Askupa Software
1
  /**
2
  * @package PHP Settings
3
+ * @date 2016-03-09
4
+ * @version 1.0.1
5
  * @author Askupa Software <contact@askupasoftware.com>
6
  * @link http://products.askupasoftware.com/php-settings
7
  * @copyright 2016 Askupa Software
readme.txt CHANGED
@@ -1,13 +1,13 @@
1
  === PHP Settings ===
2
  Contributors: Askupa Software
3
- Tags: php settings, user.ini, ini rules, php.ini, php5.ini, post max size, post_max_size, upload limit, upload max filesize, upload_max_filesize, max_execution_time, max execution time
4
  Requires at least: 3.0
5
  Tested up to: 4.4.2
6
- Stable tag: 1.0.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- This plugin provides a simple user interface with a code editor to edit your local `.ini` settings.
11
 
12
  == Description ==
13
 
@@ -69,6 +69,11 @@ This can happen for multiple reasons.
69
 
70
  == Changelog ==
71
 
 
 
 
 
 
72
  = 1.0.0 =
73
  * Initial release
74
 
1
  === PHP Settings ===
2
  Contributors: Askupa Software
3
+ Tags: admin, php settings, user.ini, ini rules, php.ini, php5.ini, post max size, post_max_size, upload limit, upload max filesize, upload_max_filesize, max_execution_time, max execution time
4
  Requires at least: 3.0
5
  Tested up to: 4.4.2
6
+ Stable tag: 1.0.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ This plugin provides a simple user interface with a code editor to edit your local php.ini settings.
11
 
12
  == Description ==
13
 
69
 
70
  == Changelog ==
71
 
72
+ = 1.0.1 =
73
+ * (NEW) An error message will be shown if PHP does not have sufficient permissions to write files
74
+ * (IMPROVED) Error handling & displaying
75
+ * (IMPROVED) Scripts/Styles loading
76
+
77
  = 1.0.0 =
78
  * Initial release
79
 
script.js CHANGED
@@ -1,7 +1,7 @@
1
  /**
2
  * @package PHP Settings
3
- * @date 2016-03-06
4
- * @version 1.0.0
5
  * @author Askupa Software <contact@askupasoftware.com>
6
  * @link http://products.askupasoftware.com/php-settings
7
  * @copyright 2016 Askupa Software
@@ -24,7 +24,7 @@ jQuery(document).ready(function($) {
24
  if( 'success' === response ) self.done();
25
  else
26
  {
27
- alert(response);
28
  self.abort();
29
  }
30
  }
@@ -46,7 +46,7 @@ jQuery(document).ready(function($) {
46
  }
47
  else
48
  {
49
- alert(response);
50
  self.abort();
51
  }
52
  }
@@ -89,4 +89,12 @@ jQuery(document).ready(function($) {
89
  show_tab( '#tab1' );
90
  editor.focus();
91
  });
 
 
 
 
 
 
 
 
92
  });
1
  /**
2
  * @package PHP Settings
3
+ * @date 2016-03-09
4
+ * @version 1.0.1
5
  * @author Askupa Software <contact@askupasoftware.com>
6
  * @link http://products.askupasoftware.com/php-settings
7
  * @copyright 2016 Askupa Software
24
  if( 'success' === response ) self.done();
25
  else
26
  {
27
+ notify(response, 'error');
28
  self.abort();
29
  }
30
  }
46
  }
47
  else
48
  {
49
+ notify(response, 'error');
50
  self.abort();
51
  }
52
  }
89
  show_tab( '#tab1' );
90
  editor.focus();
91
  });
92
+
93
+ function notify( message, type )
94
+ {
95
+ var $notification = $('<div>').addClass('nav-tab-notification nav-tab-'+type),
96
+ $icon = $('<i>').addClass('dashicons dashicons-no'),
97
+ $text = $('<p>').html(message);
98
+ $('.nav-tab-notifications').html($notification.append($icon,$text));
99
+ }
100
  });
style.css CHANGED
@@ -100,6 +100,47 @@
100
  vertical-align: middle;
101
  }
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  .tab {
104
  padding: 15px;
105
  border: 1px solid #CCCCCC;
@@ -183,4 +224,42 @@
183
  margin-bottom: 15px;
184
  overflow-y: auto;
185
  border: 1px solid #CCCCCC;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  }
100
  vertical-align: middle;
101
  }
102
 
103
+ .nav-tab-notifications {
104
+ border-left: 1px solid #CCCCCC;
105
+ border-right: 1px solid #CCCCCC;
106
+ overflow: auto;
107
+ padding: 0 15px 0;
108
+ }
109
+
110
+ .nav-tab-notification {
111
+ position: relative;
112
+ padding: 5px 15px 5px 55px;
113
+ margin-top: 15px;
114
+ }
115
+
116
+ .nav-tab-notification p {
117
+ margin: 10px;
118
+ }
119
+
120
+ .nav-tab-notification.nav-tab-error {
121
+ background-color: #FF9B9B;
122
+ border: 1px solid #E05252;
123
+ }
124
+
125
+ .nav-tab-notification .dashicons {
126
+ position: absolute;
127
+ display: flex;
128
+ justify-content: center;
129
+ flex-direction: column;
130
+ font-size: 2em;
131
+ width: 45px;
132
+ text-align: center;
133
+ top: 5px;
134
+ left: 5px;
135
+ bottom: 5px;
136
+ height: auto;
137
+ }
138
+
139
+ .nav-tab-notification .dashicons-no {
140
+ background-color: #E05252;
141
+ color: #FF9B9B;
142
+ }
143
+
144
  .tab {
145
  padding: 15px;
146
  border: 1px solid #CCCCCC;
224
  margin-bottom: 15px;
225
  overflow-y: auto;
226
  border: 1px solid #CCCCCC;
227
+ }
228
+
229
+ /*-------------------------------*\
230
+ * Misc
231
+ \*-------------------------------*/
232
+
233
+ .askupa-logo {
234
+ display: inline-block;
235
+ vertical-align: middle;
236
+ margin-left: 10px;
237
+ }
238
+
239
+ .plugin-banner {
240
+ background-color: white;
241
+ padding: 0 10px;
242
+ margin-bottom: 20px;
243
+ border: 1px solid #CCCCCC;
244
+ margin-top: 25px;
245
+ }
246
+
247
+ .plugin-banner img {
248
+ display: inline-block;
249
+ vertical-align: middle;
250
+ margin-right: 20px;
251
+ }
252
+
253
+ .plugin-banner h1 {
254
+ display: inline-block;
255
+ vertical-align: middle;
256
+ color: #485254;
257
+ border-left: 8px solid #ED7964;
258
+ padding: 15px 0 15px 25px;
259
+ line-height: 0.9em;
260
+ }
261
+
262
+ .plugin-banner h1 span {
263
+ color: #AFAFAF;
264
+ font-size: 0.6em;
265
  }