Changeset 1436092
- Timestamp:
- 06/13/2016 09:39:46 PM (10 years ago)
- Location:
- multitool/trunk
- Files:
-
- 16 edited
-
classes/class-configuration.php (modified) (1 diff)
-
classes/class-files.php (modified) (1 diff)
-
classes/class-globalui.php (modified) (2 diffs)
-
classes/class-install.php (modified) (2 diffs)
-
classes/class-multitool.php (modified) (5 diffs)
-
classes/class-options.php (modified) (6 diffs)
-
classes/class-pluginmenu.php (modified) (1 diff)
-
classes/class-requests.php (modified) (2 diffs)
-
classes/class-security.php (modified) (1 diff)
-
classes/class-ui.php (modified) (9 diffs)
-
classes/class-wpdb.php (modified) (2 diffs)
-
functions/functions.debug.php (modified) (14 diffs)
-
multitool.php (modified) (5 diffs)
-
readme.txt (modified) (1 diff)
-
views/developersection.php (modified) (1 diff)
-
views/userssection.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
multitool/trunk/classes/class-configuration.php
r1431029 r1436092 79 79 // WTG Cron main hourly job processes all scheduled actions. 80 80 array( 'init', array( 'multitool', 'webtechglobal_hourly_cron_function', 1 ), 'cron', null ), 81 // When admin logged in runs constantly. 82 array( 'init', array( 'multitool', 'administrator_triggered_automation', 1 ), 'administrator', null ), 83 81 array( 'admin_init', array( 'multitool', 'administrator_triggered_automation', 1 ), 'administrator', null ), 82 84 83 ################################################################ 85 84 # # -
multitool/trunk/classes/class-files.php
r1173545 r1436092 91 91 if ( $test_type ) { 92 92 $wp_filetype = wp_check_filetype( $file_array['name'], false ); 93 94 // TODO: remove use of extract() as it is depreciated 93 95 extract( $wp_filetype ); 94 96 -
multitool/trunk/classes/class-globalui.php
r1428502 r1436092 64 64 * @author Ryan R. Bayne 65 65 * @package WebTechGlobal WordPress Plugins 66 * @version 1.0 66 * 67 * @version 1.5 67 68 */ 68 69 function developer_toolbar_webtechglobaladmin() { … … 113 114 $args = array( 114 115 'id' => 'webtechglobal-toolbarmenu-postdisplay', 116 'parent' => 'webtechglobal-toolbarmenu-debugtools', 117 'title' => $title, 118 'href' => $href, 119 ); 120 121 $wp_admin_bar->add_menu( $args ); 122 123 // Trace display. 124 $href = wp_nonce_url( admin_url() . 'admin.php?page=' . $_GET['page'] . '&multitoolaction=' . 'tracedisplay' . '', 'tracedisplay' ); 125 $switch = MULTITOOL_Options::get_option( 'debugtracedisplay', false ); 126 if( $switch ){ 127 $title = __( 'Hide Trace', 'multitool' ); 128 } else { 129 $title = __( 'Display Trace', 'multitool' ); 130 } 131 132 $args = array( 133 'id' => 'webtechglobal-toolbarmenu-tracedisplay', 134 'parent' => 'webtechglobal-toolbarmenu-debugtools', 135 'title' => $title, 136 'href' => $href, 137 ); 138 139 $wp_admin_bar->add_menu( $args ); 140 141 // Trace log. 142 $href = wp_nonce_url( admin_url() . 'admin.php?page=' . $_GET['page'] . '&multitoolaction=' . 'tracelog' . '', 'tracelog' ); 143 $switch = MULTITOOL_Options::get_option( 'debugtracelog', false ); 144 if( $switch ){ 145 $title = __( 'Start Trace Log', 'multitool' ); 146 } else { 147 $title = __( 'Stop Trace Log', 'multitool' ); 148 } 149 150 $args = array( 151 'id' => 'webtechglobal-toolbarmenu-tracelog', 115 152 'parent' => 'webtechglobal-toolbarmenu-debugtools', 116 153 'title' => $title, -
multitool/trunk/classes/class-install.php
r1428502 r1436092 17 17 18 18 class MULTITOOL_Install { 19 19 20 20 /** 21 21 * Install __construct persistently registers database tables and is the 22 22 * first point to monitoring installation state 23 23 */ 24 public function __construct() { 24 public function __construct() { 25 25 // load class used at all times 26 $this->DB = MULTITOOL::load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes');26 $this->DB = new MULTITOOL_DB(); 27 27 $this->PHP = new MULTITOOL_PHP(); 28 28 } … … 126 126 function create_tables() { 127 127 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 128 var_dump(__FUNCTION__); 128 129 129 self::webtechglobal_projects(); 130 130 self::webtechglobal_projectsmeta(); -
multitool/trunk/classes/class-multitool.php
r1431029 r1436092 52 52 53 53 /** 54 * This class is being introduced gradually, we will move various lines and config functions from the main file to load here eventually 54 * This class is being introduced gradually, we will move various 55 * lines and config functions from the main file to load here eventually. 56 * 57 * @version 1.2 55 58 */ 56 59 public function __construct() { 57 60 global $multitool_settings; 58 61 59 // TODO: can we add some of these objects to $MULTITOOL_Class for other classes to use.60 62 $this->DB = self::load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes' ); 61 63 $this->PHP = self::load_class( 'MULTITOOL_PHP', 'class-phplibrary.php', 'classes' ); … … 72 74 $this->FOOWIDGET = self::load_class( 'Foo_Widget', 'class-widgets.php', 'classes' ); 73 75 74 // None WebTechGlobal Class76 // Load all none WebTechGlobal Class when required. 75 77 $this->TGM = MULTITOOL::load_class( 'TGM_Plugin_Activation', 'class-tgm-plugin-activation.php', 'classes' ); 76 78 79 // TODO: strictly not admin only settings, function needs renamed. 77 80 $multitool_settings = self::adminsettings(); 78 81 … … 81 84 $this->add_filters(self::filters()); 82 85 86 // Admin only stuff. 83 87 if( is_admin() ){ 84 88 85 // admin globals89 // Get the options array. 86 90 global $multitool_notice_array; 87 88 $multitool_notice_array = array();// set notice array for storing new notices in (not persistent notices) 89 90 // load class used from admin only 91 $multitool_notice_array = MULTITOOL_Options::get_option( 'notifications' ); 92 91 93 $this->UI = self::load_class( 'MULTITOOL_UI', 'class-ui.php', 'classes' ); 92 94 $this->Helparray = self::load_class( 'MULTITOOL_Help', 'class-help.php', 'classes' ); … … 123 125 return false;// User has not activated admin triggered automation. 124 126 } 127 128 // Get the time of the last admin triggered event, ensure 15 minute delay. 129 $last_auto_time = get_option( 'webtechglobal_autoadmin_lasttime'); 130 131 // Might need to initiate the value. 132 if( !$last_auto_time ) 133 { 134 update_option( 'webtechglobal_autoadmin_lasttime', time() ); 135 return; 136 } 137 138 $next_earliest_time = $last_auto_time + 900; 139 if( $next_earliest_time > time() ) 140 { 141 142 $message = sprintf( __( 'Administrator triggered automation did not run as it has 143 run within the last 15 minutes. The last time administration 144 automation was run was at %s and it cannot run again until %s or 145 later. The current time is %s', 'multitool' ), 146 date( "Y-m-d H:i:s", $last_auto_time ), 147 date( "Y-m-d H:i:s", $next_earliest_time ), 148 date( "Y-m-d H:i:s", time() ) 149 ); 150 151 multitool_trace_primary( 152 'admintrigauto', 153 $message, 154 array(), 155 false, 156 false, 157 true 158 ); 159 160 return false;// 15 minutes have not passed since the last event. 161 } 162 163 // Update the last auto admin time. 164 update_option( 'webtechglobal_autoadmin_lasttime', time() ); 125 165 126 166 // Encorce maximum number of administration accounts. … … 226 266 wp_enqueue_script( 'jquery-ui-datepicker' ); 227 267 wp_enqueue_script( 'jquery-ui-datetimepicker', plugins_url( 'multitool/js/datetimepicker/jquery.datetimepicker.full.min.js' ), __FILE__ ); 268 269 wp_enqueue_script( 'jquery' ); 270 271 // Trello 272 $trello_key = 'c3edd889433c851194664930e6958e01'; 273 // TODO: only enqueue when Trello service activated. 274 275 wp_deregister_script('trello-client1'); 276 wp_register_script('trello-client1', "https://trello.com/1/client.js?key=$trello_key" ); 277 wp_enqueue_script('trello-client1'); 278 279 wp_deregister_script('trello-userauth'); 280 wp_register_script('trello-userauth', plugins_url( 'multitool/js/trello/trellouserauth.js' ), 'Trello', false ); 281 wp_enqueue_script('trello-userauth'); 282 228 283 } 229 284 -
multitool/trunk/classes/class-options.php
r1431029 r1436092 41 41 'capabilities', // (array) individual admin view capability requirements. 42 42 'adm_trig_auto', // (bool) switch for administrator triggered automation. 43 'securityevent_admincap', // (array) details about a security event related to maximum admin accounts. 43 'securityevent_admincap', // (array) details about a security event related to maximum admin accounts. 44 44 ); 45 45 46 46 47 //Add security sensitive options here i.e. tokens, keys. 47 48 case 'private' : … … 54 55 'postdump', // (boolean) switch in Developer Menu for displaying $_POST. 55 56 'getdump', // (boolean) switch in Developer Menu for displaying $_GET. 57 'debugtracedisplay', 58 'debugtracelog' 56 59 ); 57 60 } … … 132 135 'webtechglobal_auto_lasttime' => array( 1,0,1, time() ),// (time()) The last time an automated event was run by WTG plugins. 133 136 'webtechglobal_auto_actionssettings' => array( 1,0,1, array() ),// (array) User condfiguration for automated actions, overwriting defaults. 137 'webtechglobal_autoadmin_lasttime' => array( 1,1,1, time() ),// (array) The last time auto administration ran. 134 138 ); 135 139 … … 140 144 141 145 $merged_options = array( 142 'mergedexample' => array( 'merged',0,0,0, array() ),// an example private option. 143 'postdump' => array( 'merged',1,1,1, false ),// an example private option. 144 'getdump' => array( 'merged',1,1,1, false ),// an example private option. 146 'postdump' => array( 'merged',1,1,1, false ),// (boolean) Switch in Developer menu for displaying $_POST data. 147 'getdump' => array( 'merged',1,1,1, false ),// (boolean) Switch in Developer menu for displaying $_GET dump. 148 'debugtracedisplay' => array( 'merged',1,1,1, false ),// (boolean) Switch in Developer menu for displaying trace for the current page load. 149 'debugtracelog' => array( 'merged',1,1,1, false ),// (boolean) Switch in Developer menu for logging trace for the current page load. 145 150 ); 146 151 … … 251 256 * or multitool_$name as appropriate. 252 257 * 258 * @version 1.2 253 259 * @param string $name Option name 254 260 * @param mixed $default (optional) … … 259 265 * error advising the developer to change the option name. 260 266 */ 261 public static function get_option( $name, $default = false ) {262 267 public static function get_option( $name, $default = false, $maybe_unserialize = true ) { 268 263 269 // First check if the requested option is a non_compact one. 264 270 if ( self::is_valid( $name, 'non_compact' ) ) { 265 return get_option( "multitool_$name", $default ); 271 $option_value = get_option( "multitool_$name", $default ); 272 if( $maybe_unserialize ) 273 { 274 return maybe_unserialize( $option_value ); 275 } 266 276 } 267 277 -
multitool/trunk/classes/class-pluginmenu.php
r1420327 r1436092 419 419 $menu_array['developercoretable']['parent'] = 'developersection'; 420 420 $menu_array['developercoretable']['tabmenu'] = true; 421 422 // wp core table example 423 $menu_array['developertrello']['groupname'] = 'developertools'; 424 $menu_array['developertrello']['slug'] = 'multitool_developertrello'; 425 $menu_array['developertrello']['menu'] = __( 'Trello', 'multitool' ); 426 $menu_array['developertrello']['pluginmenu'] = __( 'Trello', 'multitool' ); 427 $menu_array['developertrello']['name'] = "developertrello"; 428 $menu_array['developertrello']['title'] = __( 'Trello', 'multitool' ); 429 $menu_array['developertrello']['parent'] = 'developersection'; 430 $menu_array['developertrello']['tabmenu'] = true; 421 431 422 432 return $menu_array; -
multitool/trunk/classes/class-requests.php
r1428502 r1436092 1493 1493 $delay = $_POST['nextjobdelay']; 1494 1494 } 1495 1496 1495 1497 1496 $next_event_time = microtime( true ) + $delay; 1498 1497 … … 1766 1765 return; 1767 1766 } 1767 1768 /** 1769 * Switch for Trace display which allows trace to be seen by administrators. 1770 * 1771 * @version 1.0 1772 */ 1773 public function tracedisplay () { 1774 $new = null; 1775 $current = MULTITOOL_Options::get_option( 'debugtracedisplay' ); 1776 if( $current === true ) 1777 { 1778 MULTITOOL_Options::update_option( 'debugtracedisplay', false ); 1779 $this->UI->create_notice( 1780 __( 'Trace display has been switched off and trace information will be hidden. 1781 This does not switch of trace logging which may still add entries to your server 1782 or WordPress log file.', 'multitool' ), 1783 'success', 1784 'Small', 1785 __( 'Now Hiding Trace', 'multitool' ) 1786 ); 1787 } 1788 elseif( $current === false ) 1789 { 1790 MULTITOOL_Options::update_option( 'debugtracedisplay', true ); 1791 $this->UI->create_notice( 1792 __( 'Trace display has been switched on and you will see information 1793 for any traces that are included in each page load.', 'multitool' ), 1794 'success', 1795 'Small', 1796 __( 'Now Displaying Trace', 'multitool' ) 1797 ); 1798 } 1799 1800 return; 1801 } 1802 1803 /** 1804 * Deletes redundant user meta "wp_capabilities" data which causes 1805 * incorrect count of each role. 1806 * 1807 * @version 1.0 1808 * 1809 * @todo break this down into individual queries for each role so that 1810 * the output explains more about what was deleted. 1811 */ 1812 public function rolecountvalidation () { 1813 global $wpdb; 1814 1815 $total_meta_deleted = 0; 1816 1817 $result = MULTITOOL_DB::selectwherearray( 1818 $wpdb->usermeta, 1819 'meta_key = "wp_capabilities"' 1820 ); 1821 1822 foreach( $result as $key => $user ) 1823 { 1824 // Avoid doing anything with accounts likely to be key holders. 1825 if( $user['user_id'] < 3 ) 1826 { 1827 continue; 1828 } 1829 1830 // Get the expected user that may not actually exist anymore. 1831 $got_user = get_user_by( 'user_id', $user['user_id'] ); 1832 1833 // If no user for the meta lets delete the meta - cleanup time! 1834 if( !$got_user ) 1835 { 1836 delete_user_meta( $user['user_id'], 'wp_capabilities', $user['user_id'] ); 1837 ++$total_meta_deleted; 1838 } 1839 } 1840 1841 $this->UI->create_notice( 1842 sprintf( __( 'A total of %s meta values were deleted with the key 1843 wp_capabilities due to no longer have a user.', 'multitool' ), $total_meta_deleted ), 1844 'success', 1845 'Small', 1846 __( 'User Meta (wp_capabilities) Cleanup Results', 'multitool' ) 1847 ); 1848 1849 return; 1850 } 1768 1851 1769 1852 }// MULTITOOL_Requests -
multitool/trunk/classes/class-security.php
r1431029 r1436092 60 60 // return admin and NEAR admin and a count of result (array) 61 61 $total_admin_accounts = MULTITOOL_Users::total_administrators( true, true ); 62 62 63 multitool_trace_primary( 64 'admincapdebug', 65 'Total Admin Accounts: ' . $total_admin_accounts, 66 array(),// $atts 67 true,// $errorlog 68 true,// $wperror 69 true 70 ); 71 63 72 // As the administration limit been broken - a security matter! 64 73 if( $total_admin_accounts > $cap ) { -
multitool/trunk/classes/class-ui.php
r1431029 r1436092 43 43 * @author Ryan R. Bayne 44 44 * @package WebTechGlobal WordPress Plugins 45 * @version 1. 045 * @version 1.5 46 46 * 47 47 * @deprecated … … 119 119 120 120 $wp_admin_bar->add_menu( $args ); 121 121 122 // Trace display. 123 $href = wp_nonce_url( admin_url() . 'admin.php?page=' . $_GET['page'] . '&multitoolaction=' . 'tracedisplay' . '', 'tracedisplay' ); 124 $switch = MULTITOOL_Options::get_option( 'debugtracedisplay', false ); 125 126 if( $switch ){ 127 $title = __( 'Hide Trace', 'multitool' ); 128 } else { 129 $title = __( 'Display Trace', 'multitool' ); 130 } 131 132 $args = array( 133 'id' => 'webtechglobal-toolbarmenu-tracedisplay', 134 'parent' => 'webtechglobal-toolbarmenu-debugtools', 135 'title' => $title, 136 'href' => $href, 137 ); 138 139 $wp_admin_bar->add_menu( $args ); 140 141 // Trace log. 142 $href = wp_nonce_url( admin_url() . 'admin.php?page=' . $_GET['page'] . '&multitoolaction=' . 'tracelog' . '', 'tracelog' ); 143 $switch = MULTITOOL_Options::get_option( 'debugtracelog', false ); 144 if( $switch ){ 145 $title = __( 'Start Trace Log', 'multitool' ); 146 } else { 147 $title = __( 'Stop Trace Log', 'multitool' ); 148 } 149 150 $args = array( 151 'id' => 'webtechglobal-toolbarmenu-tracelog', 152 'parent' => 'webtechglobal-toolbarmenu-debugtools', 153 'title' => $title, 154 'href' => $href, 155 ); 156 157 $wp_admin_bar->add_menu( $args ); 158 122 159 // Group - Configuration Options 123 160 $args = array( … … 1292 1329 } 1293 1330 1294 public function update_notice_array() { 1331 /** 1332 * Updates the notifications array. This needs to be replaced by 1333 * class-options.php methods. 1334 * 1335 * @version 1.3 1336 * 1337 * @todo depreciate and replace using methods in new options class. 1338 */ 1339 private static function update_notice_array() { 1295 1340 global $multitool_notice_array; 1296 1341 return update_option( 'multitool_notifications',maybe_serialize( $multitool_notice_array ) ); … … 1303 1348 * @package Multitool 1304 1349 * @since 0.0.11 1305 * @version 1. 21350 * @version 1.3 1306 1351 * 1307 1352 * @returns HTML notice … … 1335 1380 // this class causes the notice to appear at the top of screen so is not suitable for use deep inside content 1336 1381 $output = '<div class="' . $type . '"> 1337 <h 4>' . $title . '</h4>1382 <h3>' . $title . '</h3> 1338 1383 <p>' . $message . '</p> 1339 1384 </div>'; … … 1362 1407 * in the $notice_array it does not output. 1363 1408 * 1364 * a) use create_prompt() to get an action from the current user based on conditions i.e. configuration issue 1365 * b) use create_message() to create a notice for another user for when they login 1409 * a) use create_prompt() to get an action from the current user based on 1410 * conditions i.e. configuration issue 1411 * 1412 * b) use create_message() to create a notice for another user 1413 * for when they login. 1366 1414 * 1367 1415 * @param mixed $message … … 1370 1418 * @param mixed $title 1371 1419 * @param mixed $sensitive 1372 * 1373 * @version 1.2 1374 */ 1375 public function create_notice( $message, $type = 'info', $size = 'Small', $title = false, $helpurl = false ){ 1420 * @param boolean $hash generate hash to prevent duplicate notices, important within automation being triggered often. 1421 * 1422 * @version 1.4 1423 */ 1424 public static function create_notice( $message, $type = 'info', $size = 'Small', $title = false, $helpurl = false, $hash = false ){ 1376 1425 global $multitool_notice_array, $current_user; 1377 1426 … … 1383 1432 $key = time() . rand(10000,99999); 1384 1433 1434 // Re-init this option if it is not valid. Currently it becomes unset and requires this. 1435 if( !is_array( $multitool_notice_array ) ) 1436 { 1437 $multitool_notice_array = array(); 1438 } 1439 1385 1440 $multitool_notice_array['notices'][$current_user->ID][$key]['sensitive'] = false; 1386 1441 $multitool_notice_array['notices'][$current_user->ID][$key]['message'] = $message; … … 1390 1445 $multitool_notice_array['notices'][$current_user->ID][$key]['created'] = time(); 1391 1446 $multitool_notice_array['notices'][$current_user->ID][$key]['helpurl'] = $helpurl; 1392 1393 return $this->update_notice_array( $multitool_notice_array ); 1447 $multitool_notice_array['notices'][$current_user->ID][$key]['time'] = time(); 1448 1449 return self::update_notice_array( $multitool_notice_array ); 1394 1450 } 1395 1451 -
multitool/trunk/classes/class-wpdb.php
r1428502 r1436092 60 60 * @package Multitool 61 61 * @since 7.0.0 62 * @version 1. 062 * @version 1.1 63 63 * 64 64 * @param mixed $tablename … … 67 67 * @param mixed $select 68 68 */ 69 public function selectwherearray( $tablename, $condition=null, $orderby=null, $select = '*', $object = 'ARRAY_A', $sort = null ){69 public static function selectwherearray( $tablename, $condition=null, $orderby=null, $select = '*', $object = 'ARRAY_A', $sort = null ){ 70 70 global $wpdb; 71 71 $condition = empty ( $condition)? '' : ' WHERE ' . $condition; -
multitool/trunk/functions/functions.debug.php
r1428502 r1436092 66 66 67 67 /** 68 * Log an error. Initially using error_log() but this method is 69 * expected to grow in later versions of the class and will offer 70 * extra options for storing debugging information. 68 * Log an error with extra information. 71 69 * 72 70 * Feel free to use error_log() on its own however keep in mind that … … 90 88 $message .= ' (get help@webtechglobal.co.uk)'; 91 89 92 return error_log( $message, $message_type, $destination, $extra_headers );90 return error_log( $message, $message_type, $destination, $extra_headers ); 93 91 } 94 92 … … 125 123 * @version 1.0 126 124 */ 127 function multitool_get_error_codes() { 128 $classobject = new WP_Error(); 125 function multitool_get_error_codes( $classobject ) { 129 126 return $classobject->get_error_codes(); 130 127 } … … 136 133 * @version 1.0 137 134 */ 138 function multitool_get_error_code() { 139 $classobject = new WP_Error(); 135 function multitool_get_error_code( $classobject ) { 140 136 return $classobject->get_error_code(); 141 137 } … … 148 144 * @version 1.0 149 145 */ 150 function multitool_get_error_messages( $code ) { 151 $classobject = new WP_Error(); 146 function multitool_get_error_messages( $classobject, $code ) { 152 147 return $classobject->get_error_messages( $code ); 153 148 } … … 160 155 * @version 1.0 161 156 */ 162 function multitool_get_error_message( $code ) { 163 $classobject = new WP_Error(); 157 function multitool_get_error_message( $classobject, $code ) { 164 158 return $classobject->get_error_messages( $code ); 165 159 } … … 170 164 * @version 1.0 171 165 */ 172 function multitool_get_error_data( $code ) { 173 $classobject = new WP_Error(); 166 function multitool_get_error_data( $classobject, $code ) { 174 167 return $classobject->get_error_data( $code ); 175 168 } … … 180 173 * @version 1.1 181 174 */ 182 function multitool_error_append( $code, $message, $data ) { 183 $classobject = new WP_Error(); 175 function multitool_error_append( $classobject, $code, $message, $data ) { 184 176 return $classobject->add( $code, $message, $data ); 185 177 } … … 191 183 * @version 1.1 192 184 */ 193 function multitool_error_add_data( $data, $code ) { 194 $classobject = new WP_Error(); 185 function multitool_error_add_data( $classobject, $data, $code ) { 195 186 return $classobject->add_data( $data, $code ); 196 187 } … … 201 192 * @version 1.1 202 193 */ 203 function multitool_error_remove( $code ) { 204 $classobject = new WP_Error(); 194 function multitool_error_remove( $classobject, $code ) { 205 195 return $classobject->remove( $code ); 206 196 } … … 230 220 /** 231 221 * Restore error handler to the previous/server configured one. 222 * 223 * @version 1.0 232 224 */ 233 225 function multitool_error_handler_restore() { … … 238 230 * restore_exception_handler Restores the previously defined 239 231 * exception handler function. 232 * 233 * @version 1.0 240 234 */ 241 235 function multitool_exception_handler_restore () { … … 246 240 /** 247 241 * set_exception_handler Sets a user-defined exception handler function. 242 * 243 * @version 1.0 248 244 */ 249 245 function multitool_exception_handler_set() { … … 251 247 return; 252 248 } 249 250 /** 251 * Display and log traces. One function that can do both or either. The idea is 252 * to setup extensive traces then control all of them with global settings. 253 * 254 * @version 1.0 255 * 256 * @param string $code pass __FUNCTION__ or a unique code i.e. 22JAN2016-ryanbayne 257 * @param string $message 258 * @param int $message_type 0=PHP logger|1=Email|2=Depreciated|3=Append to file|4=SAPI logging handler 259 * @param string $destination 260 * @param string $extra_headers 261 * @param mixed $line 262 * @param mixed $function 263 * @param mixed $class 264 * @param mixed $time 265 */ 266 function multitool_trace_primary( $code, $message, $atts = array(), $errorlog = false, $wperror = false, $adminnotice = false ) { 267 268 $trace_display = MULTITOOL_Options::get_option( 'debugtracedisplay' ); 269 $trace_log = MULTITOOL_Options::get_option( 'debugtracelog' ); 270 if( !$trace_display && !$trace_log ){ return; } 271 272 // Start with some debug_backtrace() values. 273 $debug_backtrace = debug_backtrace(); 274 $file_one = ''; 275 $line_one = ''; 276 $func_one = ''; 277 $args_one = ''; 278 $file_two = ''; 279 $file_two = ''; 280 $file_two = ''; 281 $file_two = ''; 282 if( $debug_backtrace ) 283 { 284 $file_one = $debug_backtrace[0]['file']; 285 $line_one = $debug_backtrace[0]['line']; 286 $func_one = $debug_backtrace[0]['function']; 287 $args_one = $debug_backtrace[0]['args']; 288 289 // TODO: these values appear as arrays in the notice. 290 $file_two = $debug_backtrace[1]['file']; 291 $file_two = $debug_backtrace[1]['line']; 292 $file_two = $debug_backtrace[1]['function']; 293 $file_two = $debug_backtrace[1]['args']; 294 } 295 296 // Extract $atts which will be used in each of the methods below. 297 $args = shortcode_atts( 298 array( 299 'message_type' => 0,// error_log() parameter 300 'destination' => null,// error_log() parameter 301 'extra_headers' => null,// error_log() parameter 302 ), 303 $atts 304 ); 305 306 307 // Display the trace in a notice with formatting. 308 // TODO: consider being able to add information to existing trace notice much like in WP_Error(). 309 if( $adminnotice ) 310 { 311 $notice_message = ''; 312 313 // Default message acts as the traces description. 314 $notice_message .= '<h4>Main Information</h4>'; 315 $notice_message .= $message; 316 317 // Add extra information for the developer debugging. 318 $notice_message .= '<h4>Backtrace Information (debug_backtrace())</h4>'; 319 $notice_message .= '<ul>'; 320 $notice_message .= '<li>File One: '. $file_one .'</li>'; 321 $notice_message .= '<li>Line One: '. $line_one .'</li>'; 322 $notice_message .= '<li>Function One: '. $func_one .'</li>'; 323 $notice_message .= '<li>File Two: '. $file_two .'</li>'; 324 $notice_message .= '<li>Line Two: '. $line_two .'</li>'; 325 $notice_message .= '<li>Function Two: '. $function_two .'</li>'; 326 $notice_message .= '</ul>'; 327 328 // Create the notice which is stored before being displayed. 329 $title = __( 'Trace Results Code: ' . $code, 'multitool' ); 330 // TODO: improve notice to allow specific trade to be disabled, by code 331 // may require a list of trace to undo the action of hiding specific trace. 332 MULTITOOL_UI::create_notice( $notice_message,'info','Large',$title ); 333 } 334 335 // Create new WP_Error(). 336 if( $wperror ) 337 { 338 new WP_Error( $code, $message, array(/* array */)); 339 } 340 341 // Default server logging method using error_log(). 342 if( $errorlog ) 343 { 344 $message = 'Multitool: '; 345 $message .= $message; 346 $message .= ' (get help@webtechglobal.co.uk)'; 347 348 return error_log( 349 $message, 350 $args['message_type'], 351 $args['destination'], 352 $args['extra_headers'] 353 ); 354 355 } 356 } 253 357 ?> -
multitool/trunk/multitool.php
r1431029 r1436092 2 2 /* 3 3 Plugin Name: Multitool Beta 4 Version: 1.0. 64 Version: 1.0.7 5 5 Plugin URI: http://www.webtechglobal.co.uk/wtg-plugin-framework-wordpress/ 6 6 Description: Multitool does a little bit of everything. … … 27 27 See <http://www.gnu.org/licenses/>. 28 28 */ 29 29 30 30 // Prohibit direct script loading 31 31 defined( 'ABSPATH' ) || die( 'Direct script access is not allowed!' ); … … 41 41 42 42 // define package constants... 43 if(!defined( "MULTITOOL_VERSION") ){define( "MULTITOOL_VERSION", '1.0. 6' );}43 if(!defined( "MULTITOOL_VERSION") ){define( "MULTITOOL_VERSION", '1.0.7' );} 44 44 if(!defined( "MULTITOOL_RELEASENAME") ){define( "MULTITOOL_RELEASENAME", 'Beta' );} 45 45 if(!defined( "MULTITOOL_TITLE") ){define( "MULTITOOL_TITLE", 'Multitool' );} … … 76 76 77 77 // Class required on loading. 78 require_once( MULTITOOL_DIR_PATH . 'classes/class-wpdb.php' ); 78 79 require_once( MULTITOOL_DIR_PATH . 'classes/class-install.php'); 79 80 require_once( MULTITOOL_DIR_PATH . 'classes/class-options.php'); 80 require_once( MULTITOOL_DIR_PATH . 'classes/class-wpdb.php' );81 81 require_once( MULTITOOL_DIR_PATH . 'classes/class-configuration.php' ); 82 82 require_once( MULTITOOL_DIR_PATH . 'classes/class-multitool.php' ); … … 100 100 $install = new MULTITOOL_Install(); 101 101 register_activation_hook( __FILE__, array( $install, 'install_plugin' ) ); 102 register_deactivation_hook( __FILE__, array( $install, 'deactivate_plugin' ) ); 102 register_deactivation_hook( __FILE__, array( $install, 'deactivate_plugin' ) ); 103 103 ?> -
multitool/trunk/readme.txt
r1431029 r1436092 75 75 76 76 == Changelog == 77 = 1.0.7 = 78 * Feature Changes 79 * Developer menu now offers ability to display trace. 80 * Developer menu now offers ability to log trace. 81 * Added a tool to delete redundant wp_capabilities user-meta data and fix problems with incorrect role count. 82 * Technical Notes 83 * New function for creating a trace with the ability to display and log using server and WordPress. 84 * New "lib" folder added. 85 * Guzzle extensible PHP HTTP client added to "lib". 86 * Trello package by Steven Maguire from GitHub added to "lib" 87 * trelloclient.js added to "js" folder. 88 * Trello integration partly reversed and not ready. 89 77 90 = 1.0.6 = 78 91 * Feature Changes -
multitool/trunk/views/developersection.php
r1420327 r1436092 308 308 $this->UI->postbox_content_footer(); 309 309 } 310 }?> 310 } 311 ?> -
multitool/trunk/views/userssection.php
r1431029 r1436092 138 138 $this->UI->postbox_content_header( $box['title'], $box['args']['formid'], $intro, false ); 139 139 140 //$this->FORMS->form_start( $box['args']['formid'], $box['args']['formid'], $box['title'] );140 $this->FORMS->form_start( $box['args']['formid'], $box['args']['formid'], $box['title'] ); 141 141 ?> 142 142 … … 162 162 echo '</table>'; 163 163 164 // TODO: add other roles to this list, consider custom roles. 164 // TODO: add other roles to this list, consider custom roles. 165 166 // TODO: compare totals and display notice if there is mismatch. 165 167 ?> 166 168 … … 169 171 <?php 170 172 171 //$this->UI->postbox_content_footer();173 $this->UI->postbox_content_footer(); 172 174 } 173 175 }?>
Note: See TracChangeset
for help on using the changeset viewer.