PHP Settings - Version 1.0.0

Version Description

  • Initial release

=

Download this release

Release Info

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

Version 1.0.0

Files changed (11) hide show
  1. hourglass.svg +1 -0
  2. ini-file.php +91 -0
  3. options-page.php +90 -0
  4. options-page.phtml +58 -0
  5. php-settings.php +27 -0
  6. phpinfo.php +70 -0
  7. phpinfo.phtml +20 -0
  8. process-button.js +55 -0
  9. readme.txt +76 -0
  10. script.js +92 -0
  11. style.css +186 -0
hourglass.svg ADDED
@@ -0,0 +1 @@
 
1
+ <?xml version="1.0" encoding="utf-8"?><svg width='48px' height='48px' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-hourglass"><rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect><g><path fill="none" stroke="#007282" stroke-width="5" stroke-miterlimit="10" d="M58.4,51.7c-0.9-0.9-1.4-2-1.4-2.3s0.5-0.4,1.4-1.4 C70.8,43.8,79.8,30.5,80,15.5H70H30H20c0.2,15,9.2,28.1,21.6,32.3c0.9,0.9,1.4,1.2,1.4,1.5s-0.5,1.6-1.4,2.5 C29.2,56.1,20.2,69.5,20,85.5h10h40h10C79.8,69.5,70.8,55.9,58.4,51.7z" class="glass"></path><clipPath id="uil-hourglass-clip1"><rect x="15" y="20" width="70" height="25" class="clip"><animate attributeName="height" from="25" to="0" dur="1s" repeatCount="indefinite" vlaues="25;0;0" keyTimes="0;0.5;1"></animate><animate attributeName="y" from="20" to="45" dur="1s" repeatCount="indefinite" vlaues="20;45;45" keyTimes="0;0.5;1"></animate></rect></clipPath><clipPath id="uil-hourglass-clip2"><rect x="15" y="55" width="70" height="25" class="clip"><animate attributeName="height" from="0" to="25" dur="1s" repeatCount="indefinite" vlaues="0;25;25" keyTimes="0;0.5;1"></animate><animate attributeName="y" from="80" to="55" dur="1s" repeatCount="indefinite" vlaues="80;55;55" keyTimes="0;0.5;1"></animate></rect></clipPath><path d="M29,23c3.1,11.4,11.3,19.5,21,19.5S67.9,34.4,71,23H29z" clip-path="url(#uil-hourglass-clip1)" fill="#ffab00" class="sand"></path><path d="M71.6,78c-3-11.6-11.5-20-21.5-20s-18.5,8.4-21.5,20H71.6z" clip-path="url(#uil-hourglass-clip2)" fill="#ffab00" class="sand"></path><animateTransform attributeName="transform" type="rotate" from="0 50 50" to="180 50 50" repeatCount="indefinite" dur="1s" values="0 50 50;0 50 50;180 50 50" keyTimes="0;0.7;1"></animateTransform></g></svg>
ini-file.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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
10
+ */
11
+
12
+ 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
+
30
+ static function write( $filepath, $content )
31
+ {
32
+ $fd = fopen( $filepath, 'w+' );
33
+ if( false !== $fd )
34
+ {
35
+ $success = fwrite( $fd, $content );
36
+ fclose( $fd );
37
+
38
+ if( false === $success )
39
+ {
40
+ throw new Exception( 'Unable to write to file' );
41
+ }
42
+ }
43
+ else throw new Exception( 'Unable to open file' );
44
+ }
45
+
46
+ static function read( $filepath )
47
+ {
48
+ if( !file_exists( $filepath ) ) return;
49
+
50
+ $filesize = filesize( $filepath );
51
+ if( $filesize === 0 ) return;
52
+
53
+ $fd = fopen( $filepath, 'r' );
54
+ if( false !== $fd )
55
+ {
56
+ $content = fread( $fd, $filesize );
57
+ fclose( $fd );
58
+ return $content;
59
+ }
60
+ // throw error
61
+ }
62
+
63
+ static function delete( $filepath )
64
+ {
65
+ if( !file_exists( $filepath ) ) return;
66
+ if( false === unlink( $filepath ) )
67
+ throw new Exception('Unable to delete file');
68
+ }
69
+
70
+ static function get_content()
71
+ {
72
+ $files = self::get_ini_file_names();
73
+ return self::read( $files[0] );
74
+ }
75
+
76
+ static function set_content( $content )
77
+ {
78
+ foreach( self::get_ini_file_names() as $filepath )
79
+ {
80
+ self::write( $filepath, $content );
81
+ }
82
+ }
83
+
84
+ static function remove_files()
85
+ {
86
+ foreach( self::get_ini_file_names() as $filepath )
87
+ {
88
+ self::delete( $filepath );
89
+ }
90
+ }
91
+ }
options-page.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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
10
+ */
11
+
12
+
13
+ class OptionsPage
14
+ {
15
+ private $title = 'PHP Settings';
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' ) );
23
+ add_action( 'wp_ajax_refresh_table', array( $this, 'refresh_table' ) );
24
+ }
25
+
26
+ function admin_menu()
27
+ {
28
+ add_submenu_page(
29
+ 'tools.php',
30
+ $this->title,
31
+ $this->title,
32
+ 'manage_options',
33
+ strtolower(str_replace(' ', '_', $this->title)),
34
+ array(
35
+ $this,
36
+ 'render'
37
+ )
38
+ );
39
+ }
40
+
41
+ function save()
42
+ {
43
+ $content = filter_input( INPUT_POST, 'ini_settings' );
44
+ try {
45
+ INIFile::set_content( $content );
46
+ echo 'success';
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()
54
+ {
55
+ try {
56
+ INIFile::remove_files();
57
+ echo 'success';
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()
65
+ {
66
+ PHPInfo::render('Core');
67
+ wp_die();
68
+ }
69
+
70
+ function render()
71
+ {
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();
options-page.phtml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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">
12
+ <div id="editor-wrapper">
13
+ <textarea id="php-settings"><?php echo INIFile::get_content(); ?></textarea>
14
+ </div>
15
+ <div class="controls">
16
+ <button type="submit" name="submit" id="save-php-settings" class="button button-primary process-button" data-icon="upload" data-processing-text="Saving..." data-done-text="Saved!">
17
+ Save Settings
18
+ </button>
19
+ <button type="submit" name="submit" id="delete-files" class="button button-danger process-button" data-icon="no" data-processing-text="Deleting..." data-done-text="Done!">
20
+ Delete .ini Files
21
+ </button>
22
+ </div>
23
+ </div>
24
+ <div class="tab-description">
25
+ <p>Use the editor on the left to add directives to a local <code>.ini</code> file.
26
+ You can copy directives from the table in the "PHP Info" tab.</p>
27
+ <p>If you don't have sufficient permissions to create files in the WordPress root directory, then a <code>.ini</code> file will not be created and this won't work.</p>
28
+ <p>Additionally, not all the settings in the main php.ini file can be overridden by a local ini file. See <a href="http://www.php.net/manual/en/ini.list.php">this table</a> for a list of directive that can be overridden locally (anything in the "Changeable" column not labeled as <strong>PHP_INI_SYSTEM</strong>)</p>
29
+ <p><strong>NOTE</strong>: Some hosting companies setup their servers to ignore settings in a local <code>.ini</code> file, in which case your only option is to contact them and ask them to manually change the settings.</p>
30
+ <ul class="ul-square">
31
+ <li>For more information about the INI syntax, <a href="http://php.net/manual/en/configuration.file.php">click here</a></li>
32
+ <li>For more information about local <code>.user.ini</code> files, <a href="http://php.net/manual/en/configuration.file.per-user.php">click here</a></li>
33
+ </ul>
34
+ </div>
35
+ </div>
36
+ </div>
37
+
38
+ <div id="tab2" class="tab">
39
+ <div class="tab-wrapper">
40
+ <div class="tab-content">
41
+ <div id="phpinfo-wrapper">
42
+ <?php PHPInfo::render('Core') ?>
43
+ </div>
44
+ <div class="controls">
45
+ <button type="submit" name="submit" id="refresh-table" class="button button-primary process-button" data-icon="update" data-processing-text="Refreshing..." data-done-text="Done!">
46
+ Refresh Table
47
+ </button>
48
+ </div>
49
+ </div>
50
+ <div class="tab-description">
51
+ <p>Use this table to see which core PHP settings were locally overridden (their row becomes highlighted).</p>
52
+ <p>You can click on a setting row to copy it to the editor.</p>
53
+ <p><strong>NOTE</strong>: In certain hosting platforms it may take a few minutes for the system to update the settings. You can click on "Refresh Table" to load the most resent PHP settings from the server.</p>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ <p>If you like this plugin, please give it <a target="_blank" href="https://wordpress.org/support/view/plugin-reviews/php-settings?filter=5#postform">★★★★★</a> rating on WordPress.org. Thanks!</p>
58
+ </div>
php-settings.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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>
9
+ * @link http://products.askupasoftware.com/php-settings
10
+ * @copyright 2016 Askupa Software
11
+ *
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
20
+ * Domain Path: /languages
21
+ */
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');
phpinfo.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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
10
+ */
11
+
12
+
13
+ class PHPInfo
14
+ {
15
+ static $info_array;
16
+
17
+ private function __construct() {}
18
+
19
+ /**
20
+ * @see http://php.net/manual/en/function.phpinfo.php#87463
21
+ */
22
+ static function get_as_array()
23
+ {
24
+ if( !isset( self::$info_array ) )
25
+ {
26
+ ob_start();
27
+ phpinfo(-1);
28
+
29
+ $pi = preg_replace(
30
+ array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms',
31
+ '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#',
32
+ "#[ \t]+#", '#&nbsp;#', '# +#', '# class=".*?"#', '%&#039;%',
33
+ '#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>'
34
+ .'<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#',
35
+ '#<h1><a href="(?:.*?)\?=(.*?)">PHP Credits</a></h1>#',
36
+ '#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)Zend Engine (.*?),(?:.*?)</tr>#',
37
+ "# +#", '#<tr>#', '#</tr>#'),
38
+ array('$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ',
39
+ '<h2>PHP Configuration</h2>'."\n".'<tr><td>PHP Version</td><td>$2</td></tr>'.
40
+ "\n".'<tr><td>PHP Egg</td><td>$1</td></tr>',
41
+ '<tr><td>PHP Credits Egg</td><td>$1</td></tr>',
42
+ '<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" .
43
+ '<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'),
44
+ ob_get_clean());
45
+
46
+ $sections = explode('<h2>', strip_tags($pi, '<h2><th><td>'));
47
+ unset($sections[0]);
48
+
49
+ $pi = array();
50
+ foreach($sections as $section){
51
+ $n = substr($section, 0, strpos($section, '</h2>'));
52
+ preg_match_all(
53
+ '#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#',
54
+ $section, $askapache, PREG_SET_ORDER);
55
+ foreach($askapache as $m)
56
+ $pi[$n][$m[1]]=(!isset($m[3])||@$m[2]==$m[3])?@$m[2]:array_slice($m,2);
57
+ }
58
+
59
+ self::$info_array = $pi;
60
+ }
61
+ return self::$info_array;
62
+ }
63
+
64
+ static function render( $section )
65
+ {
66
+ $array = self::get_as_array();
67
+ $phpinfo_section = $array[$section];
68
+ include('phpinfo.phtml');
69
+ }
70
+ }
phpinfo.phtml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <table id="phpinfo">
2
+ <tbody>
3
+ <?php foreach( $phpinfo_section as $key => $val ): ?>
4
+ <?php if(is_array($val) ): ?>
5
+ <tr class='local-override'>
6
+ <th><?php echo $key ?></th>
7
+ <td>
8
+ <?php echo $val[0]; ?>
9
+ <span>Locally Overridden</span>
10
+ </td>
11
+ </tr>
12
+ <?php else: ?>
13
+ <tr>
14
+ <th><?php echo $key ?></th>
15
+ <td><span class="value"><?php echo $val ?></span><span class="button button-primary">Copy to Editor</span></td>
16
+ </tr>
17
+ <?php endif ?>
18
+ <?php endforeach ?>
19
+ </tbody>
20
+ </table>
process-button.js ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
8
+ */
9
+
10
+ (function($){
11
+ $.fn.processButton = function( callback ) {
12
+ return this.each(function(){
13
+ var self = this,
14
+ $self = $(this),
15
+ $icon = $('<i>').addClass('dashicons dashicons-'+$self.attr('data-icon')),
16
+ $loader = $('<i>').addClass('loader').hide(),
17
+ title = $self.text(),
18
+ $title = $('<span>').text(title),
19
+ processing = false;
20
+
21
+ $self.html($icon).append($loader, $title);
22
+
23
+ $self.click(function(){
24
+ if(processing) return;
25
+ processing = true;
26
+ $icon.hide();
27
+ $loader.css('display', 'inline-block');
28
+ $self.addClass('loading');
29
+ $title.text($self.attr('data-processing-text'));
30
+ callback.call(self);
31
+ });
32
+
33
+ this.done = function() {
34
+ $loader.hide();
35
+ $self.removeClass('loading');
36
+ $self.addClass('success');
37
+ $title.text($self.attr('data-done-text'));
38
+ setTimeout(function(){
39
+ $title.text(title);
40
+ $self.removeClass('success');
41
+ $icon.show();
42
+ processing = false;
43
+ },2000);
44
+ }
45
+
46
+ this.abort = function() {
47
+ $loader.hide();
48
+ $title.text(title);
49
+ $self.removeClass('loading');
50
+ $icon.show();
51
+ processing = false;
52
+ }
53
+ });
54
+ };
55
+ })(jQuery);
readme.txt ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
14
+ This plugin provides a simple user interface with a code editor to edit your local `.ini` settings.
15
+ This can be used to change settings like `upload_max_filesize` or `max_execution_time` which are often set to very low values by the hosting companies.
16
+ Clicking on "Save Settings" creates 3 files: `.user.ini`, `php.ini` and `php5.ini` and saves your settings asynchronously without reloading the page.
17
+
18
+ The plugin also features a table containing a list of all the core PHP settings and their active values.
19
+ Settings that are successfully overridden become highlighted in the table.
20
+ Additionally, you can click on any one of the settings in the table to automatically copy it to the editor.
21
+ This makes it extremely easy to add or remove directives in a local `.ini` file.
22
+
23
+ **Features**
24
+
25
+ * Code editor with syntax highlighting
26
+ * A table showing all PHP core settings and their values
27
+ * Settings that are locally overridden become highlighted in the table
28
+ * Click on any setting field in the table to automatically copy it to the editor
29
+ * Save the settings to local `.ini` files asynchronously (no page reload)
30
+ * Delete local `.ini` files created by the plugin
31
+ * Refresh the PHP settings table asynchronously (no page reload)
32
+
33
+ **Usage**
34
+
35
+ 1. Got to Tools -> PHP Settings
36
+ 1. Use the editor to manually add PHP settings (For example, `max_execution_time = 120`), or
37
+ 1. Click on "Settings" and then click on one of the settings in the table to automatically copy it to the editor
38
+ 1. Click on "Save Settings" to save the editor contents to local `.ini` files. If the files do not exist, they will be created.
39
+ 1. Click on "Settings" again and then click "Refresh Table" to see the changes take effect. You might need to wait a few minutes before the changes are updated in the system.
40
+ 1. To delete the `.ini` files created by the program, click on "Delete .ini Files". This will restore the master PHP settings.
41
+
42
+ **Useful Links**
43
+
44
+ * [Official Page](http://products.askupasoftware.com/php-settings/)
45
+ * [List of changeable ini settings](http://www.php.net/manual/en/ini.list.php)
46
+ * [The PHP configuration file](http://php.net/manual/en/configuration.file.php)
47
+ * [Local .user.ini files](http://php.net/manual/en/configuration.file.per-user.php)
48
+
49
+ == Installation ==
50
+
51
+ 1. Download and activate the plugin.
52
+ 1. Navigate to Tools->PHP Settings
53
+ 1. Use the INI editor to add/remove php.ini directives
54
+ 1. Click "Save Settings" to save the contents of the INI editor to a local .ini file
55
+
56
+ == Frequently Asked Questions ==
57
+
58
+ = My PHP Settings remained unchanged after saving the changes =
59
+
60
+ This can happen for multiple reasons.
61
+ 1. You are trying to set a directive that cannot be locally overridden (see [this table](http://www.php.net/manual/en/ini.list.php))
62
+ 1. You need to recycle your application pool
63
+ 1. Your hosting company set your PHP to ignore local .ini files
64
+
65
+ == Screenshots ==
66
+
67
+ 1. INI Settings Editor
68
+ 2. PHP Core Setting Table
69
+
70
+ == Changelog ==
71
+
72
+ = 1.0.0 =
73
+ * Initial release
74
+
75
+ == Upgrade Notice ==
76
+
script.js ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
8
+ */
9
+
10
+ jQuery(document).ready(function($) {
11
+ var editor = ace.edit("php-settings");
12
+ editor.setTheme("ace/theme/kuroir");
13
+ editor.getSession().setMode("ace/mode/php");
14
+
15
+ $('#save-php-settings').processButton(function(){
16
+ var self = this;
17
+ $.post(
18
+ ajaxurl, // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
19
+ {
20
+ 'action': 'save_php_settings',
21
+ 'ini_settings': editor.getValue()
22
+ },
23
+ function(response) {
24
+ if( 'success' === response ) self.done();
25
+ else
26
+ {
27
+ alert(response);
28
+ self.abort();
29
+ }
30
+ }
31
+ );
32
+ });
33
+
34
+ $('#delete-files').processButton(function(){
35
+ var self = this;
36
+ $.post(
37
+ ajaxurl, // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
38
+ {
39
+ 'action': 'delete_ini_files'
40
+ },
41
+ function(response) {
42
+ if( 'success' === response )
43
+ {
44
+ self.done();
45
+ editor.setValue('',1);
46
+ }
47
+ else
48
+ {
49
+ alert(response);
50
+ self.abort();
51
+ }
52
+ }
53
+ );
54
+ });
55
+
56
+ $('#refresh-table').processButton(function(){
57
+ var self = this;
58
+ $.post(
59
+ ajaxurl, // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
60
+ {
61
+ 'action': 'refresh_table'
62
+ },
63
+ function(response) {
64
+ $('#phpinfo-wrapper').html(response);
65
+ self.done();
66
+ }
67
+ );
68
+ });
69
+
70
+ show_tab( $('.nav-tab').first().attr('href') );
71
+ $('.nav-tab').click(function(e){
72
+ e.preventDefault();
73
+ show_tab( $(this).attr('href') );
74
+ });
75
+
76
+ function show_tab( id )
77
+ {
78
+ $('.tab').hide();
79
+ $('.nav-tab').removeClass('nav-tab-active');
80
+ $(id).show();
81
+ $('[href="'+id+'"]').addClass('nav-tab-active');
82
+ }
83
+
84
+ $('#phpinfo-wrapper').on('click','#phpinfo tr',function(){
85
+ var directive = $(this).children('th').text(),
86
+ value = $(this).find('td .value').text();
87
+
88
+ editor.setValue(editor.getValue() + '\n'+directive+' = '+value, 1);
89
+ show_tab( '#tab1' );
90
+ editor.focus();
91
+ });
92
+ });
style.css ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*-------------------------------*\
2
+ * Editor
3
+ \*-------------------------------*/
4
+
5
+ #php-settings-page #editor-wrapper {
6
+ position: relative;
7
+ height: 400px;
8
+ width: 100%;
9
+ border: 1px solid #CCCCCC;
10
+ margin-bottom: 15px;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ #php-settings-page .ace_editor {
15
+ position: absolute;
16
+ top: 0;
17
+ right: 0;
18
+ bottom: 0;
19
+ left: 0;
20
+ margin: 0;
21
+ }
22
+
23
+ /*-------------------------------*\
24
+ * Buttons
25
+ \*-------------------------------*/
26
+
27
+ .controls {
28
+ border: 1px solid #CCCCCC;
29
+ padding: 10px;
30
+ }
31
+
32
+ .button.process-button.success,
33
+ .button.process-button.success:hover,
34
+ .button.process-button.success:focus {
35
+ background: #3ED48F;
36
+ border-color: #37C584 #289E68 #289E68;
37
+ -webkit-box-shadow: 0 1px 0 #289E68;
38
+ box-shadow: 0 1px 0 #289E68;
39
+ color: #fff;
40
+ text-decoration: none;
41
+ text-shadow: 0 -1px 1px #289E68,1px 0 1px #289E68;
42
+ }
43
+
44
+ .button.process-button.loading,
45
+ .button.process-button.loading:hover,
46
+ .button.process-button.loading:focus {
47
+ background: white;
48
+ color: #208391;
49
+ border-color: #D7DFE2 #BBCED8 #BBCED8;
50
+ -webkit-box-shadow: 0 1px 0 #C0CCD2;
51
+ box-shadow: 0 1px 0 #C0CCD2;
52
+ text-decoration: none;
53
+ text-shadow: 0 -1px 1px #D1DBE0,1px 0 1px #D1DBE0;
54
+ }
55
+
56
+ .process-button .loader {
57
+ background-image: url('hourglass.svg');
58
+ width: 26px;
59
+ height: 26px;
60
+ background-size: 26px;
61
+ margin-top: -4px;
62
+ margin-left: -4px;
63
+ vertical-align: middle;
64
+ }
65
+
66
+ .process-button .dashicons {
67
+ vertical-align: middle;
68
+ line-height: 16px;
69
+ margin-left: -4px;
70
+ }
71
+
72
+ .button.button-danger {
73
+ background: #F15E5E;
74
+ border-color: #E83B3B;
75
+ -webkit-box-shadow: 0 1px 0 #821818;
76
+ box-shadow: 0 1px 0 #821818;
77
+ color: #fff;
78
+ text-decoration: none;
79
+ text-shadow: 0 -1px 1px #821818,1px 0 1px #821818, 1px 1px #821818,-1px 0 1px #821818;
80
+ }
81
+
82
+ .button.button-danger:hover,
83
+ .button.button-danger:focus {
84
+ background: #EF7979;
85
+ border-color: #E83B3B;
86
+ color: white;
87
+ }
88
+
89
+ /*-------------------------------*\
90
+ * Tabbed content
91
+ \*-------------------------------*/
92
+
93
+ .nav-tab:focus {
94
+ outline: 0;
95
+ box-shadow: none;
96
+ }
97
+
98
+ .nav-tab .dashicons {
99
+ line-height: 16px;
100
+ vertical-align: middle;
101
+ }
102
+
103
+ .tab {
104
+ padding: 15px;
105
+ border: 1px solid #CCCCCC;
106
+ border-top: none;
107
+ display: none;
108
+ }
109
+
110
+ .tab-wrapper {
111
+ display: table;
112
+ width: 100%;
113
+ }
114
+
115
+ .tab-content {
116
+ display: table-cell;
117
+ vertical-align: top;
118
+ padding-right: 15px;
119
+ }
120
+
121
+ .tab-description {
122
+ display: table-cell;
123
+ vertical-align: top;
124
+ width: 350px;
125
+ background-color: white;
126
+ padding: 0 15px;
127
+ border: 1px solid #cccccc;
128
+ }
129
+
130
+ /*-------------------------------*\
131
+ * PHP Info Table
132
+ \*-------------------------------*/
133
+
134
+ #phpinfo {
135
+ background-color: #CCCCCC;
136
+ width: 100%;
137
+ }
138
+
139
+ #phpinfo tr.local-override th,
140
+ #phpinfo tr.local-override td
141
+ {
142
+ background-color: #6AFDB2;
143
+ }
144
+
145
+ #phpinfo tr.local-override span {
146
+ background-color: #FFEA56;
147
+ padding: 2px 6px;
148
+ border-radius: 4px;
149
+ float: right;
150
+ }
151
+
152
+ #phpinfo tr .button.button-primary {
153
+ display: none;
154
+ line-height: 14px;
155
+ height: auto;
156
+ float: right;
157
+ font-size: 11px;
158
+ }
159
+
160
+ #phpinfo tr:not(.local-override):hover td,
161
+ #phpinfo tr:not(.local-override):hover th {
162
+ background-color: white;
163
+ cursor: pointer;
164
+ }
165
+
166
+ #phpinfo tr:hover td > .button.button-primary {
167
+ display: inline;
168
+ }
169
+
170
+ #phpinfo th {
171
+ background-color: #F1F1F1;
172
+ padding: 3px 6px;
173
+ text-align: left;
174
+ }
175
+
176
+ #phpinfo td {
177
+ background-color: #F1F1F1;
178
+ padding: 3px 6px;
179
+ }
180
+
181
+ #phpinfo-wrapper {
182
+ height: 500px;
183
+ margin-bottom: 15px;
184
+ overflow-y: auto;
185
+ border: 1px solid #CCCCCC;
186
+ }