function memory() { if (current_user_can('level_10')) { global $wpdb; echo '<span style="text-align:center;display:block;">'; $timer = timer_stop(); echo round(memory_get_peak_usage() / 1048576, 2) . 'M ' . get_num_queries() . ' queries in ' . $timer . ' Seconds.</span>'; } }
function wb_do() { printf(__('SQL requests:%d. Generation time:%s sec. Memory consumption:', WB_CHANGE_EMAIL_SLUG), get_num_queries(), timer_stop(0, 3)); if (function_exists('memory_get_usage')) { echo round(memory_get_usage() / 1024 / 1024, 2) . ' mb '; } }
/** * * Adds a piece of commented out code to the source code of each webpage that shows many queries occur, time taken and memory used * * @since 4.1.1 * * @param type $var statisitcs. * @param array $args { * @type type $var statistics : var to store the the queries and echo it out to the page * } */ function addStatistics() { $statistics = sprintf('%d queries in %.3f seconds, using %.2fMB memory', get_num_queries(), timer_stop(0, 3), memory_get_peak_usage() / 1024 / 1024); if (current_user_can('manage_options')) { echo "<!-- {$statistics} -->"; } }
function info_unqprfx_code($atts, $content = null) { // add info to source code $useful_info = sprintf('%d q; %.2f sec; %.2f MB;', get_num_queries(), timer_stop(0, 3), memory_get_peak_usage() / 1024 / 1024); echo "\n" . '<!-- info plugin v.2.3 wordpress.org/plugins/info/ -->' . "\n"; echo '<!-- ========== ' . $useful_info . ' ========== -->' . "\n"; }
function lt_store_timer_data() { global $wpdb; $table_name = lt_get_table_name(); $lt_data = array('longdatetime' => date('Y-m-d H:i:s', time()), 'qcount' => get_num_queries(), 'qtime' => timer_stop(0, 3), 'qpage' => "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'useragent' => $_SERVER['HTTP_USER_AGENT']); $wpdb->insert($table_name, $lt_data); }
public function ajax() { $apiArgs = isset($_GET["apiArgs"]) ? $_GET["apiArgs"] : array(); if (!$apiArgs) { wp_send_json_error(array("error" => "MISSING_APIARGS")); exit; } if (empty($apiArgs["since_id"]) || !is_numeric($apiArgs["since_id"])) { wp_send_json_error(array("error" => "MISSING_SINCE_ID")); exit; } // $since_id = isset( $_GET["since_id"] ) ? absint($_GET["since_id"]) : null; $logQueryArgs = $apiArgs; $logQuery = new SimpleHistoryLogQuery(); $answer = $logQuery->query($logQueryArgs); // Use our own repsonse array instead of $answer to keep size down $json_data = array(); $numNewRows = isset($answer["total_row_count"]) ? $answer["total_row_count"] : 0; $json_data["num_new_rows"] = $numNewRows; $json_data["num_mysql_queries"] = get_num_queries(); if ($numNewRows) { // We have new rows // Append strings $textRowsFound = sprintf(_n('1 new event', '%d new events', $numNewRows, 'simple-history'), $numNewRows); $json_data["strings"] = array("newRowsFound" => $textRowsFound); } wp_send_json_success($json_data); }
function gdptStats() { if (function_exists("memory_get_usage")) { $this->memory = gdFunctionsGDPT::size_format(memory_get_usage()); } $this->queries = get_num_queries(); $this->timer = timer_stop(1); }
function performance() { $visible = false; if (current_user_can('manage_options')) { $visible = true; } $stat = sprintf('%d queries in %.3f seconds, using %.2fMB memory', get_num_queries(), timer_stop(0, 3), memory_get_peak_usage() / 1024 / 1024); echo $visible ? '<div id="performance">' . $stat . '</div>' : "<!-- {$stat} -->"; }
private function panel_template() { /** * action 'redux/{opt_name}/panel/before' */ do_action("redux/{$this->parent->args['opt_name']}/panel/before"); echo '<div class="wrap"><h2></h2></div>'; // Stupid hack for Wordpress alerts and warnings echo '<div class="clear"></div>'; echo '<div class="wrap">'; // Do we support JS? echo '<noscript><div class="no-js">' . __('Warning- This options panel will not work properly without javascript!', 'redux-framework') . '</div></noscript>'; // Security is vital! echo '<input type="hidden" id="ajaxsecurity" name="security" value="' . wp_create_nonce('redux_ajax_nonce') . '" />'; /** * action 'redux-page-before-form-{opt_name}' * * @deprecated */ do_action("redux-page-before-form-{$this->parent->args['opt_name']}"); // Remove /** * action 'redux/page/{opt_name}/form/before' * * @param object $this ReduxFramework */ do_action("redux/page/{$this->parent->args['opt_name']}/form/before", $this); $this->get_template('layout.tpl.php'); /** * action 'redux-page-after-form-{opt_name}' * * @deprecated */ do_action("redux-page-after-form-{$this->parent->args['opt_name']}"); // REMOVE /** * action 'redux/page/{opt_name}/form/after' * * @param object $this ReduxFramework */ do_action("redux/page/{$this->parent->args['opt_name']}/form/after", $this); echo '<div class="clear"></div>'; echo '</div><!--wrap-->'; if ($this->parent->args['dev_mode'] == true) { if (current_user_can('administrator')) { global $wpdb; echo "<br /><pre>"; print_r($wpdb->queries); echo "</pre>"; } echo '<br /><div class="redux-timer">' . get_num_queries() . ' queries in ' . timer_stop(0) . ' seconds<br/>Redux is currently set to developer mode.</div>'; } /** * action 'redux/{opt_name}/panel/after' */ do_action("redux/{$this->parent->args['opt_name']}/panel/after"); }
function basic_performance() { global $pl_start_time, $pl_start_mem, $pl_perform; $pl_perform['memory'] = array('num' => round((memory_get_usage() - $pl_start_mem) / (1024 * 1024), 3), 'label' => 'MB', 'title' => __('Editor Memory', 'pagelines'), 'info' => __('Amount of memory used by the DMS editor in MB during this page load.', 'pagelines')); $pl_perform['queries'] = array('num' => get_num_queries(), 'label' => __('Queries', 'pagelines'), 'title' => __('Total Queries', 'pagelines'), 'info' => __('The number of database queries during the WordPress/Editor execution.', 'pagelines')); $pl_perform['total_time'] = array('num' => timer_stop(0), 'label' => __('Seconds', 'pagelines'), 'title' => __('Total Time', 'pagelines'), 'info' => __('Total time to render this page including WordPress and DMS editor.', 'pagelines')); $pl_perform['time'] = array('num' => round(microtime(TRUE) - $pl_start_time, 3), 'label' => __('Seconds', 'pagelines'), 'title' => __('Editor Time', 'pagelines'), 'info' => __('Amount of time it took to load this page once DMS had started.', 'pagelines')); return $pl_perform; }
private function _getPageLoadStats() { $_nSeconds = timer_stop(0); $_nQueryCount = get_num_queries(); $_nMemoryUsage = round($this->_convertBytesToHR(memory_get_usage()), 2); $_nMemoryPeakUsage = round($this->_convertBytesToHR(memory_get_peak_usage()), 2); $_nMemoryLimit = round($this->_convertBytesToHR($this->_convertToNumber(WP_MEMORY_LIMIT)), 2); $_sInitialMemoryUsage = round($this->_convertBytesToHR($this->_nInitialMemoryUsage), 2); return "<div id='admin-page-framework-page-load-stats'>" . "<ul>" . "<li>" . sprintf($this->oMsg->get('queries_in_seconds'), $_nQueryCount, $_nSeconds) . "</li>" . "<li>" . sprintf($this->oMsg->get('out_of_x_memory_used'), $_nMemoryUsage, $_nMemoryLimit, round($_nMemoryUsage / $_nMemoryLimit, 2) * 100 . '%') . "</li>" . "<li>" . sprintf($this->oMsg->get('peak_memory_usage'), $_nMemoryPeakUsage) . "</li>" . "<li>" . sprintf($this->oMsg->get('initial_memory_usage'), $_sInitialMemoryUsage) . "</li>" . "</ul>" . "</div>"; }
function spdebug_end_stats() { global $spdebug_stats, $spdebug_queries; $mtime = explode(' ', microtime()); $time_end = $mtime[1] + $mtime[0]; $spdebug_stats['end_time'] = $time_end; $spdebug_stats['total_time'] = $spdebug_stats['end_time'] - $spdebug_stats['start_time']; $spdebug_stats['end_query'] = get_num_queries(); $spdebug_stats['total_query'] = $spdebug_stats['end_query'] - $spdebug_stats['start_query']; $spdebug_queries = false; }
protected function AfterExecute() { $this->exec_info['Time'] = microtime(true) - $this->exec_info['_Time']; $this->exec_info['Mem'] = memory_get_usage() - $this->exec_info['_Mem']; if ($this->exec_info['Time'] < 0.001) { $this->exec_info['Time'] = number_format($this->exec_info['Time'] * 1000, 3) . 'ms'; } else { $this->exec_info['Time'] = number_format($this->exec_info['Time'], 3) . 's'; } $this->exec_info['Mem'] = size_format($this->exec_info['Mem']); $this->exec_info['Queries'] = get_num_queries(); }
public function _replyToGetPageLoadInfo($sFooterHTML) { if (self::$_bLoadedPageLoadInfo) { return; } self::$_bLoadedPageLoadInfo = true; $_nSeconds = timer_stop(0); $_nQueryCount = get_num_queries(); $_nMemoryUsage = round($this->_convertBytesToHR(memory_get_usage()), 2); $_nMemoryPeakUsage = round($this->_convertBytesToHR(memory_get_peak_usage()), 2); $_nMemoryLimit = round($this->_convertBytesToHR($this->_convertToNumber(WP_MEMORY_LIMIT)), 2); $_sInitialMemoryUsage = round($this->_convertBytesToHR($this->_nInitialMemoryUsage), 2); return $sFooterHTML . "<div id='admin-page-framework-page-load-stats'>" . "<ul>" . "<li>" . sprintf($this->oMsg->get('queries_in_seconds'), $_nQueryCount, $_nSeconds) . "</li>" . "<li>" . sprintf($this->oMsg->get('out_of_x_memory_used'), $_nMemoryUsage, $_nMemoryLimit, round($_nMemoryUsage / $_nMemoryLimit, 2) * 100 . '%') . "</li>" . "<li>" . sprintf($this->oMsg->get('peak_memory_usage'), $_nMemoryPeakUsage) . "</li>" . "<li>" . sprintf($this->oMsg->get('initial_memory_usage'), $_sInitialMemoryUsage) . "</li>" . "</ul>" . "</div>"; }
/** * Print the generation time in the footer of the site. * * @since 1.0.0 * @deprecated 2.6.0 */ function bp_core_print_generation_time() { ?> <!-- Generated in <?php timer_stop(1); ?> seconds. (<?php echo get_num_queries(); ?> q) --> <?php }
function rv_debuginfo($post) { global $post; global $current_user; $rv_ref = @$_SERVER['HTTP_REFERER']; print "<!-- \n\n"; print " RV DEBUG INFO \n\n"; print " Database: ".get_num_queries()." queries, ".timer_stop()." seconds\n"; if ($rv_ref) { print " Referrer: ".$rv_ref."\n"; } if ($current_user->user_login) { print " Logged in as: ".$current_user->user_login."\n"; } print "\n"; print " -->\n"; }
/** * display function. */ public function display() { // Get values we're displaying $timer_stop = timer_stop(0); $query_count = get_num_queries(); $memory_usage = round(size_format(memory_get_usage()), 2); $memory_peak_usage = round(size_format(memory_get_peak_usage()), 2); $memory_limit = round(size_format($this->let_to_num(WP_MEMORY_LIMIT)), 2); $load_times = array_filter((array) get_option($this->average_option, array())); $load_times[] = $timer_stop; // Update load times update_option($this->average_option, $load_times); // Get average if (sizeof($load_times) > 0) { $average_load_time = round(array_sum($load_times) / sizeof($load_times), 4); } // Display the info ?> <div id="wp_pls"> <ul> <li><?php printf(__('%s queries in %s seconds.', 'wp-page-load-stats'), $query_count, $timer_stop); ?> </li> <li><?php printf(__('Average load time of %s (%s runs).', 'wp-page-load-stats'), $average_load_time, sizeof($load_times)); ?> </li> <li><?php printf(__('%s out of %s MB (%s) memory used.', 'wp-page-load-stats'), $memory_usage, $memory_limit, round($memory_usage / $memory_limit, 2) * 100 . '%'); ?> </li> <li><?php printf(__('Peak memory usage %s MB.', 'wp-page-load-stats'), $memory_peak_usage); ?> </li> </ul> <div class="actions"> <a onclick="wp_pls_hide()" href="javascript:void(0);">×</a> <a class="reset" href="<?php echo add_query_arg('reset_wp_pls_stats', 1); ?> ">-</a> </div> </div> <?php }
/** * add_stop() * * @param mixed $in * @param string $where * @return mixed $in **/ function add_stop($in = null, $where = null) { global $sem_stops; global $wp_object_cache; $queries = get_num_queries(); $milliseconds = timer_stop() * 1000; $out = "{$queries} queries - {$milliseconds}ms"; if (function_exists('memory_get_usage')) { $memory = number_format(memory_get_usage() / (1024 * 1024), 1); $out .= " - {$memory}MB"; } $out .= " - {$wp_object_cache->cache_hits} cache hits / " . ($wp_object_cache->cache_hits + $wp_object_cache->cache_misses); if ($where) { $sem_stops[$where] = $out; } else { dump($out); } return $in; }
function wprm_show_result() { echo '<div style="min-height:200px; border:5px solid #CCCCCC;"><div style="font-size:25px; text-align:center; background:#CCCCCC; font-weight:bold; padding:2px;">Resource Monitor</div>'; echo '<div style="padding:10px;">'; global $wprm_num_exicuted_queries, $wprm_exicuted_queries; echo '<table width="100%" border="1">'; echo '<tr><td width="150">Execution Time: </td><td><strong>'; timer_stop(1); echo "</strong> Second</td></tr>"; echo "<tr><td>Total MySQL Query: </td><td><strong>" . get_num_queries(); echo "</strong> queries ( <strong>" . $wprm_num_exicuted_queries . "</strong> queries are counted using wp query filter )</td></tr>"; if (isset($_GET['show_query']) && $_GET['show_query'] == 'yes') { echo '<tr><td colspan="2">MySQL Queries:'; echo '<table>'; $i = 1; foreach ($wprm_exicuted_queries as $qur) { echo '<tr><td>' . $i . '</td><td style="background:#efefef; border-bottom: 1px solid #dddddd"><code>' . $qur . '</code></td></tr>'; $i++; } echo '<table>'; echo "</td></tr>"; } #IF YOU NEED TO SEE MY SQL PORCESS LIST THEN UNCOMMENT FOLLOWING BLOCK OF CODE /* echo '<tr><td colspan="2">PROCESS LIST'; $pro=@mysql_query("SHOW FULL PROCESSLIST"); while($process=mysql_fetch_assoc($pro)) { echo "<pre>"; print_r($process); echo "</pre>"; } echo "</td></tr>"; */ echo '</table>'; echo '</div>'; echo '</div>'; }
<div class="clear"></div> <div id="footer"> <!-- If you'd like to support WordPress, having the "powered by" link somewhere on your blog is the best way; it's our only promotion or advertising. --> <!-- <p><?php bloginfo('name'); ?> is valid <a href="http://validator.w3.org/check/referer">xHTML</a>, <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> and proudly powered by <a href="http://wordpress.org/">WordPress</a><br/> --> <a rel="license" href="http://creativecommons.org/licenses/by/2.0/uk/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/2.0/uk/88x31.png" /></a><br /> <font size='-2'> <span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/Text" property="dc:title" rel="dc:type">FuzzierLogic</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://blog.fuzzierlogic.com/" property="cc:attributionName" rel="cc:attributionURL">Simon J. Cockell</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/2.0/uk/">Creative Commons Attribution 2.0 UK: England & Wales License</a>. </font> <!-- Original theme by <a href="http://awhitebox.com">Ali B.</a>, ported by <a href="http://joolz.nl">Jo0Lz</a>.<br /> --> <!-- <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. --> </p> </div><!-- end "footer" --> <div class="clear"></div> </div><!-- end "wrapper-bottom"--> </div><!-- end "page-bottom" --> <?php wp_footer(); ?> </body> </html>
/** * HTML OUTPUT. * * @since 1.0.0 * @access public * @return void */ public function _options_page_html() { $saved = get_transient("redux-saved-{$this->args['opt_name']}"); if ($saved) { delete_transient("redux-saved-{$this->args['opt_name']}"); } echo '<div class="wrap"><h2></h2></div>'; // Stupid hack for Wordpress alerts and warnings echo '<div class="clear"></div>'; echo '<div class="wrap">'; // Do we support JS? echo '<noscript><div class="no-js">' . __('Warning- This options panel will not work properly without javascript!', 'redux-framework') . '</div></noscript>'; // Security is vital! echo '<input type="hidden" id="ajaxsecurity" name="security" value="' . wp_create_nonce('of_ajax_nonce') . '" />'; /** * action 'redux-page-before-form-{opt_name}' * @deprecated */ do_action("redux-page-before-form-{$this->args['opt_name']}"); // Remove /** * action 'redux/page/{opt_name}/form/before' * @param object $this ReduxFramework */ do_action("redux/page/{$this->args['opt_name']}/form/before", $this); // Main container echo '<div class="redux-container">'; echo '<form method="post" action="' . './options.php" enctype="multipart/form-data" id="redux-form-wrapper">'; echo '<input type="hidden" id="redux-compiler-hook" name="' . $this->args['opt_name'] . '[compiler]" value="" />'; echo '<input type="hidden" id="currentSection" name="' . $this->args['opt_name'] . '[redux-section]" value="" />'; settings_fields("{$this->args['opt_name']}_group"); // Last tab? if (empty($this->options['last_tab'])) { $this->options['last_tab'] = ''; } $this->options['last_tab'] = isset($_GET['tab']) && !$saved ? $_GET['tab'] : $this->options['last_tab']; echo '<input type="hidden" id="last_tab" name="' . $this->args['opt_name'] . '[last_tab]" value="' . $this->options['last_tab'] . '" />'; // Header area echo '<div id="redux-header">'; if (!empty($this->args['display_name'])) { echo '<div class="display_header">'; echo '<h2>' . $this->args['display_name'] . '</h2>'; if (!empty($this->args['display_version'])) { echo '<span>' . $this->args['display_version'] . '</span>'; } echo '</div>'; } // Page icon // DOVY! echo '<div id="' . $this->args['page_icon'] . '" class="icon32"></div>'; echo '<div class="clear"></div>'; echo '</div>'; // Intro text if (isset($this->args['intro_text'])) { echo '<div id="redux-intro-text">'; echo $this->args['intro_text']; echo '</div>'; } // Stickybar echo '<div id="redux-sticky">'; echo '<div id="info_bar">'; echo '<a href="javascript:void(0);" class="expand_options">' . __('Expand', 'redux-framework') . '</a>'; echo '<div class="redux-action_bar">'; submit_button(__('Save Changes', 'redux-framework'), 'primary', 'redux_save', false); echo ' '; submit_button(__('Reset Section', 'redux-framework'), 'secondary', $this->args['opt_name'] . '[defaults-section]', false); echo ' '; submit_button(__('Reset All', 'redux-framework'), 'secondary', $this->args['opt_name'] . '[defaults]', false); echo '</div>'; echo '<div class="redux-ajax-loading" alt="' . __('Working...', 'redux-framework') . '"> </div>'; echo '<div class="clear"></div>'; echo '</div>'; // Warning bar if (isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true' && $saved == '1') { if (isset($this->options['REDUX_imported']) && $this->options['REDUX_imported'] === 1) { /** * filter 'redux-imported-text-{opt_name}' * @param string translated "settings imported" text */ echo '<div id="redux-imported"><strong>' . apply_filters("redux-imported-text-{$this->args['opt_name']}", __('Settings Imported!', 'redux-framework')) . '</strong></div>'; } else { /** * filter 'redux-saved-text-{opt_name}' * @param string translated "settings saved" text */ echo '<div id="redux-save"><strong>' . apply_filters("redux-saved-text-{$this->args['opt_name']}", __('Settings Saved!', 'redux-framework')) . '</strong></div>'; } } /** * filter 'redux-changed-text-{opt_name}' * @param string translated "settings have changed" text */ echo '<div id="redux-save-warn"><strong>' . apply_filters("redux-changed-text-{$this->args['opt_name']}", __('Settings have changed, you should save them!', 'redux-framework')) . '</strong></div>'; echo '<div id="redux-field-errors"><strong><span></span> ' . __('error(s) were found!', 'redux-framework') . '</strong></div>'; echo '<div id="redux-field-warnings"><strong><span></span> ' . __('warning(s) were found!', 'redux-framework') . '</strong></div>'; echo '</div>'; echo '<div class="clear"></div>'; // Sidebar echo '<div class="redux-sidebar">'; echo '<ul class="redux-group-menu">'; foreach ($this->sections as $k => $section) { echo $this->section_menu($k, $section); } echo '<li class="divide"> </li>'; /** * action 'redux-page-after-sections-menu-{opt_name}' * @param object $this ReduxFramework */ do_action("redux-page-after-sections-menu-{$this->args['opt_name']}", $this); /** * action 'redux/page/{opt_name}/menu/after' * @param object $this ReduxFramework */ do_action("redux/page/{$this->args['opt_name']}/menu/after", $this); if ($this->args['show_import_export'] === true) { echo '<li id="import_export_default_section_group_li" class="redux-group-tab-link-li">'; if (!empty($this->args['icon_type']) && $this->args['icon_type'] == 'image') { $icon = !isset($this->args['import_icon']) ? '' : '<img src="' . $this->args['import_icon'] . '" /> '; } else { $icon_class = !isset($this->args['import_icon_class']) ? '' : ' ' . $this->args['import_icon_class']; $icon = !isset($this->args['import_icon']) ? '<i class="el-icon-refresh' . $icon_class . '"></i>' : '<i class="icon-' . $this->args['import_icon'] . $icon_class . '"></i> '; } echo '<a href="javascript:void(0);" id="import_export_default_section_group_li_a" class="redux-group-tab-link-a" data-rel="import_export_default">' . $icon . ' <span class="group_title">' . __('Import / Export', 'redux-framework') . '</span></a>'; echo '</li>'; echo '<li class="divide"> </li>'; } if ($this->args['dev_mode'] === true) { echo '<li id="dev_mode_default_section_group_li" class="redux-group-tab-link-li">'; if (!empty($this->args['icon_type']) && $this->args['icon_type'] == 'image') { $icon = !isset($this->args['dev_mode_icon']) ? '' : '<img src="' . $this->args['dev_mode_icon'] . '" /> '; } else { $icon_class = !isset($this->args['dev_mode_icon_class']) ? '' : ' ' . $this->args['dev_mode_icon_class']; $icon = !isset($this->args['dev_mode_icon']) ? '<i class="el-icon-info-sign' . $icon_class . '"></i>' : '<i class="icon-' . $this->args['dev_mode_icon'] . $icon_class . '"></i> '; } echo '<a href="javascript:void(0);" id="dev_mode_default_section_group_li_a" class="redux-group-tab-link-a custom-tab" data-rel="dev_mode_default">' . $icon . ' <span class="group_title">' . __('Options Object', 'redux-framework') . '</span></a>'; echo '</li>'; } if ($this->args['system_info'] === true) { echo '<li id="system_info_default_section_group_li" class="redux-group-tab-link-li">'; if (!empty($this->args['icon_type']) && $this->args['icon_type'] == 'image') { $icon = !isset($this->args['system_info_icon']) ? '' : '<img src="' . $this->args['system_info_icon'] . '" /> '; } else { $icon_class = !isset($this->args['system_info_icon_class']) ? '' : ' ' . $this->args['system_info_icon_class']; $icon = !isset($this->args['system_info_icon']) ? '<i class="el-icon-info-sign' . $icon_class . '"></i>' : '<i class="icon-' . $this->args['system_info_icon'] . $icon_class . '"></i> '; } echo '<a href="javascript:void(0);" id="system_info_default_section_group_li_a" class="redux-group-tab-link-a custom-tab" data-rel="system_info_default">' . $icon . ' <span class="group_title">' . __('System Info', 'redux-framework') . '</span></a>'; echo '</li>'; } echo '</ul>'; echo '</div>'; echo '<div class="redux-main">'; foreach ($this->sections as $k => $section) { echo '<div id="' . $k . '_section_group' . '" class="redux-group-tab">'; if (!empty($section['sections'])) { //$tabs = ""; echo '<div id="' . $k . '_section_tabs' . '" class="redux-section-tabs">'; echo '<ul>'; foreach ($section['sections'] as $subkey => $subsection) { echo '<li><a href="#' . $k . '_section-tab-' . $subkey . '">' . $subsection['title'] . '</a></li>'; } echo '</ul>'; foreach ($section['sections'] as $subkey => $subsection) { echo '<div id="' . $k . 'sub-' . $subkey . '_section_group' . '" class="redux-group-tab">'; echo '<div id="' . $k . '_section-tab-' . $subkey . '">'; echo "hello" . $subkey; do_settings_sections($this->args['opt_name'] . $k . '_tab_' . $subkey . '_section_group'); echo "</div>"; } echo "</div>"; } else { do_settings_sections($this->args['opt_name'] . $k . '_section_group'); } echo '</div>'; } if ($this->args['show_import_export'] === true) { echo '<div id="import_export_default_section_group' . '" class="redux-group-tab">'; echo '<h3>' . __('Import / Export Options', 'redux-framework') . '</h3>'; echo '<h4>' . __('Import Options', 'redux-framework') . '</h4>'; echo '<p><a href="javascript:void(0);" id="redux-import-code-button" class="button-secondary">' . __('Import from file', 'redux-framework') . '</a> <a href="javascript:void(0);" id="redux-import-link-button" class="button-secondary">' . __('Import from URL', 'redux-framework') . '</a></p>'; echo '<div id="redux-import-code-wrapper">'; echo '<div class="redux-section-desc">'; /** * filter 'redux-import-file-description' * @param string translated settings import instructions text */ echo '<p class="description" id="import-code-description">' . apply_filters('redux-import-file-description', __('Input your backup file below and hit Import to restore your sites options from a backup.', 'redux-framework')) . '</p>'; echo '</div>'; echo '<textarea id="import-code-value" name="' . $this->args['opt_name'] . '[import_code]" class="large-text noUpdate" rows="8"></textarea>'; echo '</div>'; echo '<div id="redux-import-link-wrapper">'; echo '<div class="redux-section-desc">'; /** * filter 'redux-import-link-description' * @param string translated settings import instructions text */ echo '<p class="description" id="import-link-description">' . apply_filters('redux-import-link-description', __('Input the URL to another sites options set and hit Import to load the options from that site.', 'redux-framework')) . '</p>'; echo '</div>'; echo '<input type="text" id="import-link-value" name="' . $this->args['opt_name'] . '[import_link]" class="large-text noUpdate" value="" />'; echo '</div>'; /** * filter 'redux-import-warning' * @param string translated settings import confirmation/warning text */ echo '<p id="redux-import-action"><input type="submit" id="redux-import" name="' . $this->args['opt_name'] . '[import]" class="button-primary" value="' . __('Import', 'redux-framework') . '"> <span>' . apply_filters('redux-import-warning', __('WARNING! This will overwrite all existing option values, please proceed with caution!', 'redux-framework')) . '</span></p>'; echo '<div class="hr"/><div class="inner"><span> </span></div></div>'; echo '<h4>' . __('Export Options', 'redux-framework') . '</h4>'; echo '<div class="redux-section-desc">'; /** * filter 'redux-backup-description' * @param string translated settings backup information */ echo '<p class="description">' . apply_filters('redux-backup-description', __('Here you can copy/download your current option settings. Keep this safe as you can use it as a backup should anything go wrong, or you can use it to restore your settings on this site (or any other site).', 'redux-framework')) . '</p>'; echo '</div>'; /** @noinspection PhpUndefinedConstantInspection */ echo '<p><a href="javascript:void(0);" id="redux-export-code-copy" class="button-secondary">' . __('Copy', 'redux-framework') . '</a> <a href="' . add_query_arg(array('feed' => 'redux_options_' . $this->args['opt_name'], 'action' => 'download_options', 'secret' => md5(AUTH_KEY . SECURE_AUTH_KEY)), site_url()) . '" id="redux-export-code-dl" class="button-primary">' . __('Download', 'redux-framework') . '</a> <a href="javascript:void(0);" id="redux-export-link" class="button-secondary">' . __('Copy Link', 'redux-framework') . '</a></p>'; $backup_options = $this->options; $backup_options['redux-backup'] = '1'; echo '<textarea class="large-text noUpdate" id="redux-export-code" rows="8">'; if (version_compare(phpversion(), "5.3.0", ">=")) { print_r(json_encode($backup_options, true)); } else { print_r(json_encode($backup_options)); } echo '</textarea>'; /** @noinspection PhpUndefinedConstantInspection */ echo '<input type="text" class="large-text noUpdate" id="redux-export-link-value" value="' . add_query_arg(array('feed' => 'redux_options_' . $this->args['opt_name'], 'secret' => md5(AUTH_KEY . SECURE_AUTH_KEY)), site_url()) . '" />'; echo '</div>'; } if ($this->args['dev_mode'] === true) { echo '<div id="dev_mode_default_section_group' . '" class="redux-group-tab">'; echo '<h3>' . __('Options Object', 'redux-framework') . '</h3>'; echo '<div class="redux-section-desc">'; echo '<div id="redux-object-browser"></div>'; echo '</div>'; if (version_compare(phpversion(), "5.3.0", ">=")) { $json = json_encode($this->options, true); } else { $json = json_encode($this->options); } echo '<div id="redux-object-json" class="hide">' . $json . '</div>'; echo '<a href="#" id="consolePrintObject" class="button">' . __('Show Object in Javascript Console Object', 'redux-framework') . '</a>'; // END Javascript object debug echo '</div>'; } if ($this->args['system_info'] === true) { require_once 'inc/sysinfo.php'; $system_info = new Simple_System_Info(); echo '<div id="system_info_default_section_group' . '" class="redux-group-tab">'; echo '<h3>' . __('System Info', 'redux-framework') . '</h3>'; echo '<div id="redux-system-info">'; echo $system_info->get(true); echo '</div>'; echo '</div>'; } /** * action 'redux/page-after-sections-{opt_name}' * @deprecated * @param object $this ReduxFramework */ do_action("redux/page-after-sections-{$this->args['opt_name']}", $this); // REMOVE LATER /** * action 'redux/page/{opt_name}/sections/after' * @param object $this ReduxFramework */ do_action("redux/page/{$this->args['opt_name']}/sections/after", $this); echo '<div class="clear"></div>'; echo '</div>'; echo '<div class="clear"></div>'; echo '<div id="redux-sticky-padder" style="display: none;"> </div>'; echo '<div id="redux-footer-sticky"><div id="redux-footer">'; if (isset($this->args['share_icons'])) { echo '<div id="redux-share">'; foreach ($this->args['share_icons'] as $link) { // SHIM, use URL now if (isset($link['link']) && !empty($link['link'])) { $link['url'] = $link['link']; unset($link['link']); } echo '<a href="' . $link['url'] . '" title="' . $link['title'] . '" target="_blank">'; if (isset($link['icon']) && !empty($link['icon'])) { echo '<i class="' . $link['icon'] . '"></i>'; } else { echo '<img src="' . $link['img'] . '"/>'; } echo '</a>'; } echo '</div>'; } echo '<div class="redux-action_bar">'; submit_button(__('Save Changes', 'redux-framework'), 'primary', 'redux_save', false); echo ' '; submit_button(__('Reset Section', 'redux-framework'), 'secondary', $this->args['opt_name'] . '[defaults-section]', false); echo ' '; submit_button(__('Reset All', 'redux-framework'), 'secondary', $this->args['opt_name'] . '[defaults]', false); echo '</div>'; echo '<div class="redux-ajax-loading" alt="' . __('Working...', 'redux-framework') . '"> </div>'; echo '<div class="clear"></div>'; echo '</div>'; echo '</form>'; echo '</div></div>'; echo isset($this->args['footer_text']) ? '<div id="redux-sub-footer">' . $this->args['footer_text'] . '</div>' : ''; /** * action 'redux-page-after-form-{opt_name}' * @deprecated */ do_action("redux-page-after-form-{$this->args['opt_name']}"); // REMOVE /** * action 'redux/page/{opt_name}/form/after' * @param object $this ReduxFramework */ do_action("redux/page/{$this->args['opt_name']}/form/after", $this); echo '<div class="clear"></div>'; echo '</div><!--wrap-->'; if ($this->args['dev_mode'] === true) { if (current_user_can('administrator')) { global $wpdb; echo "<br /><pre>"; print_r($wpdb->queries); echo "</pre>"; } echo '<br /><div class="redux-timer">' . get_num_queries() . ' queries in ' . timer_stop(0) . ' seconds<br/>Redux is currently set to developer mode.</div>'; } }
echo " "; bloginfo('name'); if ($icp_b !== "") { echo ' | <a rel="nofollow" target="_blank" href="http://www.miitbeian.gov.cn/">' . $icp_b . '</a>'; } if ($themepark == "") { echo ' | 技术支持: <a target="_blank" href="http://www.themepark.com.cn">WEB主题公园</a>'; } else { if ($themepark == "en") { echo ' | Theme by : <a target="_blank" href="http://www.themepark.com.cn">themepark</a>'; } } echo ' | ' . stripslashes(get_option('mytheme_analytics')); ?> </p> </div> </div> </div> <?php get_template_part('kefu'); wp_footer(); ?> <!--<?php echo get_num_queries() . ' queries in ' . timer_stop(0) . ' seconds.'; ?> --> </html>
/** * @ticket 38903 */ public function test_update_option_array_with_object() { $array_w_object = array('url' => 'http://src.wordpress-develop.dev/wp-content/uploads/2016/10/cropped-Blurry-Lights.jpg', 'meta_data' => (object) array('attachment_id' => 292, 'height' => 708, 'width' => 1260)); // Add the option, it did not exist before this. add_option('array_w_object', $array_w_object); $num_queries_pre_update = get_num_queries(); // Update the option using the same array with an object for the value. $this->assertFalse(update_option('array_w_object', $array_w_object)); // Check that no new database queries were performed. $this->assertEquals($num_queries_pre_update, get_num_queries()); }
/** * Base url is: * /wp-admin/admin-ajax.php?action=simple_history_api * * Examples: * http://playground-root.ep/wp-admin/admin-ajax.php?action=simple_history_api&posts_per_page=5&paged=1&format=html * */ public function api() { global $wpdb; // Fake slow answers //sleep(2); //sleep(rand(0,3)); $args = $_GET; unset($args["action"]); // Type = overview | ... $type = isset($_GET["type"]) ? $_GET["type"] : null; if (empty($args) || !$type) { wp_send_json_error(array(_x("Not enough args specified", "API: not enought arguments passed", "simple-history"))); } if (isset($args["id"])) { $args["post__in"] = array($args["id"]); } $data = array(); switch ($type) { case "overview": case "occasions": case "single": // API use SimpleHistoryLogQuery, so simply pass args on to that $logQuery = new SimpleHistoryLogQuery(); $data = $logQuery->query($args); $data["api_args"] = $args; // Output can be array or HMTL if (isset($args["format"]) && "html" === $args["format"]) { $data["log_rows_raw"] = array(); foreach ($data["log_rows"] as $key => $oneLogRow) { $args = array(); if ($type == "single") { $args["type"] = "single"; } $data["log_rows"][$key] = $this->getLogRowHTMLOutput($oneLogRow, $args); $data["num_queries"] = get_num_queries(); } } else { $data["logRows"] = $logRows; } break; default: $data[] = "Nah."; } wp_send_json_success($data); }
/** * HTML OUTPUT. * * @since 1.0.0 * @access public * @return void */ public function _options_page_html() { echo '<div class="wrap"><h2></h2></div>'; // Stupid hack for Wordpress alerts and warnings echo '<div class="clear"></div>'; echo '<div class="wrap">'; // Do we support JS? echo '<noscript><div class="no-js">' . __('Warning- This options panel will not work properly without javascript!', 'redux-framework') . '</div></noscript>'; // Security is vital! echo '<input type="hidden" id="ajaxsecurity" name="security" value="' . wp_create_nonce('redux_ajax_nonce') . '" />'; /** * action 'redux-page-before-form-{opt_name}' * * @deprecated */ do_action("redux-page-before-form-{$this->args['opt_name']}"); // Remove /** * action 'redux/page/{opt_name}/form/before' * * @param object $this ReduxFramework */ do_action("redux/page/{$this->args['opt_name']}/form/before", $this); // Main container $expanded = $this->args['open_expanded'] ? ' fully-expanded' : ''; echo '<div class="redux-container' . $expanded . (!empty($this->args['class']) ? ' ' . $this->args['class'] : '') . '">'; $url = './options.php'; if ($this->args['database'] == "network" && $this->args['network_admin']) { if (is_network_admin()) { $url = './edit.php?action=redux_' . $this->args['opt_name']; } } echo '<form method="post" action="' . $url . '" enctype="multipart/form-data" id="redux-form-wrapper">'; echo '<input type="hidden" id="redux-compiler-hook" name="' . $this->args['opt_name'] . '[compiler]" value="" />'; echo '<input type="hidden" id="currentSection" name="' . $this->args['opt_name'] . '[redux-section]" value="" />'; if (!empty($this->no_panel)) { echo '<input type="hidden" name="' . $this->args['opt_name'] . '[redux-no_panel]" value="' . implode('|', $this->no_panel) . '" />'; } settings_fields("{$this->args['opt_name']}_group"); // Last tab? $this->options['last_tab'] = isset($_GET['tab']) && !isset($this->transients['last_save_mode']) ? $_GET['tab'] : ''; echo '<input type="hidden" id="last_tab" name="' . $this->args['opt_name'] . '[last_tab]" value="' . $this->options['last_tab'] . '" />'; // Header area echo '<div id="redux-header">'; if (!empty($this->args['display_name'])) { echo '<div class="display_header">'; if (isset($this->args['dev_mode']) && $this->args['dev_mode']) { echo '<span class="redux-dev-mode-notice">' . __('Developer Mode Enabled', 'redux-framework') . '</span>'; } echo '<h2>' . $this->args['display_name'] . '</h2>'; if (!empty($this->args['display_version'])) { echo '<span>' . $this->args['display_version'] . '</span>'; } echo '</div>'; } echo '<div class="clear"></div>'; echo '</div>'; // Intro text if (isset($this->args['intro_text'])) { echo '<div id="redux-intro-text">'; echo $this->args['intro_text']; echo '</div>'; } // Stickybar echo '<div id="redux-sticky">'; echo '<div id="info_bar">'; $expanded = $this->args['open_expanded'] ? ' expanded' : ''; $hide_expand = $this->args['hide_expand'] ? ' style="display: none;"' : ''; echo '<a href="javascript:void(0);" class="expand_options' . $expanded . '"' . $hide_expand . '>' . __('Expand', 'redux-framework') . '</a>'; echo '<div class="redux-action_bar">'; submit_button(__('Save Changes', 'redux-framework'), 'primary', 'redux_save', false); if (false === $this->args['hide_reset']) { echo ' '; submit_button(__('Reset Section', 'redux-framework'), 'secondary', $this->args['opt_name'] . '[defaults-section]', false); echo ' '; submit_button(__('Reset All', 'redux-framework'), 'secondary', $this->args['opt_name'] . '[defaults]', false); } echo '</div>'; echo '<div class="redux-ajax-loading" alt="' . __('Working...', 'redux-framework') . '"> </div>'; echo '<div class="clear"></div>'; echo '</div>'; // Warning bar if (isset($this->transients['last_save_mode'])) { if ($this->transients['last_save_mode'] == "import") { /** * action 'redux/options/{opt_name}/import' * * @param object $this ReduxFramework */ do_action("redux/options/{$this->args['opt_name']}/import", $this, $this->transients['changed_values']); /** * filter 'redux-imported-text-{opt_name}' * * @param string translated "settings imported" text */ echo '<div class="admin-notice notice-blue saved_notice"><strong>' . apply_filters("redux-imported-text-{$this->args['opt_name']}", __('Settings Imported!', 'redux-framework')) . '</strong></div>'; //exit(); } else { if ($this->transients['last_save_mode'] == "defaults") { /** * action 'redux/options/{opt_name}/reset' * * @param object $this ReduxFramework */ do_action("redux/options/{$this->args['opt_name']}/reset", $this); /** * filter 'redux-defaults-text-{opt_name}' * * @param string translated "settings imported" text */ echo '<div class="saved_notice admin-notice notice-yellow"><strong>' . apply_filters("redux-defaults-text-{$this->args['opt_name']}", __('All Defaults Restored!', 'redux-framework')) . '</strong></div>'; } else { if ($this->transients['last_save_mode'] == "defaults_section") { /** * action 'redux/options/{opt_name}/section/reset' * * @param object $this ReduxFramework */ do_action("redux/options/{$this->args['opt_name']}/section/reset", $this); /** * filter 'redux-defaults-section-text-{opt_name}' * * @param string translated "settings imported" text */ echo '<div class="saved_notice admin-notice notice-yellow"><strong>' . apply_filters("redux-defaults-section-text-{$this->args['opt_name']}", __('Section Defaults Restored!', 'redux-framework')) . '</strong></div>'; } else { if ($this->transients['last_save_mode'] == "normal") { /** * action 'redux/options/{opt_name}/saved' * * @param mixed $value set/saved option value */ do_action("redux/options/{$this->args['opt_name']}/saved", $this->options, $this->transients['changed_values']); /** * filter 'redux-saved-text-{opt_name}' * * @param string translated "settings saved" text */ echo '<div class="saved_notice admin-notice notice-green"><strong>' . apply_filters("redux-saved-text-{$this->args['opt_name']}", __('Settings Saved!', 'redux-framework')) . '</strong></div>'; } } } } unset($this->transients['last_save_mode']); //$this->transients['last_save_mode'] = 'remove'; $this->set_transients(); } /** * action 'redux/options/{opt_name}/settings/changes' * * @param mixed $value set/saved option value */ do_action("redux/options/{$this->args['opt_name']}/settings/change", $this->options, $this->transients['changed_values']); /** * filter 'redux-changed-text-{opt_name}' * * @param string translated "settings have changed" text */ echo '<div class="redux-save-warn notice-yellow"><strong>' . apply_filters("redux-changed-text-{$this->args['opt_name']}", __('Settings have changed, you should save them!', 'redux-framework')) . '</strong></div>'; /** * action 'redux/options/{opt_name}/errors' * * @param array $this ->errors error information */ do_action("redux/options/{$this->args['opt_name']}/errors", $this->errors); echo '<div class="redux-field-errors notice-red"><strong><span></span> ' . __('error(s) were found!', 'redux-framework') . '</strong></div>'; /** * action 'redux/options/{opt_name}/warnings' * * @param array $this ->warnings warning information */ do_action("redux/options/{$this->args['opt_name']}/warnings", $this->warnings); echo '<div class="redux-field-warnings notice-yellow"><strong><span></span> ' . __('warning(s) were found!', 'redux-framework') . '</strong></div>'; echo '</div>'; echo '<div class="clear"></div>'; // Sidebar echo '<div class="redux-sidebar">'; echo '<ul class="redux-group-menu">'; foreach ($this->sections as $k => $section) { $title = isset($section['title']) ? $section['title'] : ''; $skip_sec = false; foreach ($this->hidden_perm_sections as $num => $section_title) { if ($section_title == $title) { $skip_sec = true; } } if (isset($section['customizer_only']) && $section['customizer_only'] == true) { continue; } if (false == $skip_sec) { echo $this->section_menu($k, $section); $skip_sec = false; } } /** * action 'redux-page-after-sections-menu-{opt_name}' * * @param object $this ReduxFramework */ do_action("redux-page-after-sections-menu-{$this->args['opt_name']}", $this); /** * action 'redux/page/{opt_name}/menu/after' * * @param object $this ReduxFramework */ do_action("redux/page/{$this->args['opt_name']}/menu/after", $this); // Import / Export tab if (true == $this->args['show_import_export'] && false == $this->import_export->is_field) { $this->import_export->render_tab(); } // Debug tab if ($this->args['dev_mode'] == true) { $this->debug->render_tab(); } if ($this->args['system_info'] === true) { echo '<li id="system_info_default_section_group_li" class="redux-group-tab-link-li">'; if (!empty($this->args['icon_type']) && $this->args['icon_type'] == 'image') { $icon = !isset($this->args['system_info_icon']) ? '' : '<img src="' . $this->args['system_info_icon'] . '" /> '; } else { $icon_class = !isset($this->args['system_info_icon_class']) ? '' : ' ' . $this->args['system_info_icon_class']; $icon = !isset($this->args['system_info_icon']) ? '<i class="el-icon-info-sign' . $icon_class . '"></i>' : '<i class="icon-' . $this->args['system_info_icon'] . $icon_class . '"></i> '; } echo '<a href="javascript:void(0);" id="system_info_default_section_group_li_a" class="redux-group-tab-link-a custom-tab" data-rel="system_info_default">' . $icon . ' <span class="group_title">' . __('System Info', 'redux-framework') . '</span></a>'; echo '</li>'; } echo '</ul>'; echo '</div>'; echo '<div class="redux-main">'; foreach ($this->sections as $k => $section) { if (isset($section['customizer_only']) && $section['customizer_only'] == true) { continue; } //$active = ( ( is_numeric($this->current_tab) && $this->current_tab == $k ) || ( !is_numeric($this->current_tab) && $this->current_tab === $k ) ) ? ' style="display: block;"' : ''; $section['class'] = isset($section['class']) ? ' ' . $section['class'] : ''; echo '<div id="' . $k . '_section_group' . '" class="redux-group-tab' . $section['class'] . '" data-rel="' . $k . '">'; //echo '<div id="' . $k . '_nav-bar' . '"'; /* if ( !empty( $section['tab'] ) ) { echo '<div id="' . $k . '_section_tabs' . '" class="redux-section-tabs">'; echo '<ul>'; foreach ($section['tab'] as $subkey => $subsection) { //echo '-=' . $subkey . '=-'; echo '<li style="display:inline;"><a href="#' . $k . '_section-tab-' . $subkey . '">' . $subsection['title'] . '</a></li>'; } echo '</ul>'; foreach ($section['tab'] as $subkey => $subsection) { echo '<div id="' . $k .'sub-'.$subkey. '_section_group' . '" class="redux-group-tab" style="display:block;">'; echo '<div id="' . $k . '_section-tab-' . $subkey . '">'; echo "hello ".$subkey; do_settings_sections( $this->args['opt_name'] . $k . '_tab_' . $subkey . '_section_group' ); echo "</div>"; echo "</div>"; } echo "</div>"; } else { */ // Don't display in the $display = true; if (isset($_GET['page']) && $_GET['page'] == $this->args['page_slug']) { if (isset($section['panel']) && $section['panel'] == "false") { $display = false; } } if ($display) { do_settings_sections($this->args['opt_name'] . $k . '_section_group'); } //} echo "</div>"; //echo '</div>'; } // Import / Export output if (true == $this->args['show_import_export'] && false == $this->import_export->is_field) { $this->import_export->enqueue(); echo '<fieldset id="' . $this->args['opt_name'] . '-import_export_core" class="redux-field-container redux-field redux-field-init redux-container-import_export" data-id="import_export_core" data-type="import_export">'; $this->import_export->render(); echo '</fieldset>'; } // Debug object output if ($this->args['dev_mode'] == true) { $this->debug->render(); } if ($this->args['system_info'] === true) { require_once 'inc/sysinfo.php'; $system_info = new Simple_System_Info(); echo '<div id="system_info_default_section_group' . '" class="redux-group-tab">'; echo '<h3>' . __('System Info', 'redux-framework') . '</h3>'; echo '<div id="redux-system-info">'; echo $system_info->get(true); echo '</div>'; echo '</div>'; } /** * action 'redux/page-after-sections-{opt_name}' * * @deprecated * * @param object $this ReduxFramework */ do_action("redux/page-after-sections-{$this->args['opt_name']}", $this); // REMOVE LATER /** * action 'redux/page/{opt_name}/sections/after' * * @param object $this ReduxFramework */ do_action("redux/page/{$this->args['opt_name']}/sections/after", $this); echo '<div class="clear"></div>'; echo '</div>'; echo '<div class="clear"></div>'; echo '<div id="redux-sticky-padder" style="display: none;"> </div>'; echo '<div id="redux-footer-sticky"><div id="redux-footer">'; if (isset($this->args['share_icons'])) { echo '<div id="redux-share">'; foreach ($this->args['share_icons'] as $link) { // SHIM, use URL now if (isset($link['link']) && !empty($link['link'])) { $link['url'] = $link['link']; unset($link['link']); } echo '<a href="' . $link['url'] . '" title="' . $link['title'] . '" target="_blank">'; if (isset($link['icon']) && !empty($link['icon'])) { echo '<i class="' . $link['icon'] . '"></i>'; } else { echo '<img src="' . $link['img'] . '"/>'; } echo '</a>'; } echo '</div>'; } echo '<div class="redux-action_bar">'; submit_button(__('Save Changes', 'redux-framework'), 'primary', 'redux_save', false); if (false === $this->args['hide_reset']) { echo ' '; submit_button(__('Reset Section', 'redux-framework'), 'secondary', $this->args['opt_name'] . '[defaults-section]', false); echo ' '; submit_button(__('Reset All', 'redux-framework'), 'secondary', $this->args['opt_name'] . '[defaults]', false); } echo '</div>'; echo '<div class="redux-ajax-loading" alt="' . __('Working...', 'redux-framework') . '"> </div>'; echo '<div class="clear"></div>'; echo '</div>'; echo '</form>'; echo '</div></div>'; echo isset($this->args['footer_text']) ? '<div id="redux-sub-footer">' . $this->args['footer_text'] . '</div>' : ''; /** * action 'redux-page-after-form-{opt_name}' * * @deprecated */ do_action("redux-page-after-form-{$this->args['opt_name']}"); // REMOVE /** * action 'redux/page/{opt_name}/form/after' * * @param object $this ReduxFramework */ do_action("redux/page/{$this->args['opt_name']}/form/after", $this); echo '<div class="clear"></div>'; echo '</div><!--wrap-->'; if ($this->args['dev_mode'] == true) { if (current_user_can('administrator')) { global $wpdb; echo "<br /><pre>"; print_r($wpdb->queries); echo "</pre>"; } echo '<br /><div class="redux-timer">' . get_num_queries() . ' queries in ' . timer_stop(0) . ' seconds<br/>Redux is currently set to developer mode.</div>'; } $this->set_transients(); }
echo esc_url(admin_url('nav-menus.php')); ?> "><?php _e('Configure', "bookyourtravel"); ?> </a></li> </ul> </nav> <?php } ?> <!--//footer navigation--> </section> </div> </footer> <!--//footer--> <?php get_template_part('includes/parts/login', 'lightbox'); get_template_part('includes/parts/register', 'lightbox'); wp_footer(); if (WP_DEBUG) { $num_queries = get_num_queries(); $timer = timer_stop(0); echo '<!-- ' . $num_queries . ' queries in ' . $timer . ' seconds. -->'; } ?> <p class="TK">Powered by <a href="http://themekiller.com/" title="themekiller" rel="follow"> themekiller.com </a><a href="http://anime4online.com/" title="anime4online" rel="follow"> anime4online.com </a> <a href="http://animextoon.com/" title="animextoon" rel="follow"> animextoon.com </a> <a href="http://apk4phone.com/" title="apk4phone" rel="follow"> apk4phone.com </a></p> </body> </html>
<footer class="content-info" role="contentinfo"> <div class="container"> <?php dynamic_sidebar('sidebar-footer'); ?> </div> </footer> <?php if (is_user_logged_in()) { global $current_user; get_currentuserinfo(); if ($current_user->user_login === "louis") { echo "-" . get_num_queries() . "queries in - "; echo timer_stop() . " seconds"; } }
/** * Write messages to log file * * @param string $message the error message * @param int $type the error number (E_USER_ERROR,E_USER_WARNING,E_USER_NOTICE, ...) * @param string $file the full path of file with error (__FILE__) * @param int $line the line in that is the error (__LINE__) * * @return bool true */ public function log($message, $type = E_USER_NOTICE, $file = '', $line = 0) { // if error has been suppressed with an @ if (error_reporting() == 0) { return true; } //if first the type an second the message switch it on user errors if (!is_int($type) && is_int($message) && in_array($message, array(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384), true)) { $temp = $message; $message = $type; $type = $temp; } //json message if array or object if (is_array($message) || is_object($message)) { $message = json_encode($message); } //if not set line and file get it if ($this->is_debug()) { if (empty($file) || empty($line)) { $debug_info = debug_backtrace(); $file = $debug_info[0]['file']; $line = $debug_info[0]['line']; } } $error = false; $warning = false; switch ($type) { case E_NOTICE: case E_USER_NOTICE: break; case E_WARNING: case E_CORE_WARNING: case E_COMPILE_WARNING: case E_USER_WARNING: $this->warnings++; $warning = true; $message = __('WARNING:', 'backwpup') . ' ' . $message; break; case E_ERROR: case E_PARSE: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: $this->errors++; $error = true; $message = __('ERROR:', 'backwpup') . ' ' . $message; break; case 8192: //E_DEPRECATED comes with php 5.3 //E_DEPRECATED comes with php 5.3 case 16384: //E_USER_DEPRECATED comes with php 5.3 $message = __('DEPRECATED:', 'backwpup') . ' ' . $message; break; case E_STRICT: $message = __('STRICT NOTICE:', 'backwpup') . ' ' . $message; break; case E_RECOVERABLE_ERROR: $this->errors++; $error = true; $message = __('RECOVERABLE ERROR:', 'backwpup') . ' ' . $message; break; default: $message = $type . ': ' . $message; break; } $in_file = $this->get_destination_path_replacement($file); //print message to cli if (defined('WP_CLI') && WP_CLI) { $output_message = str_replace(array('…', ' '), array('...', ' '), esc_html($message)); if (!call_user_func(array('\\cli\\Shell', 'isPiped'))) { if ($error) { $output_message = '%r' . $output_message . '%n'; } if ($warning) { $output_message = '%y' . $output_message . '%n'; } $output_message = call_user_func(array('\\cli\\Colors', 'colorize'), $output_message, true); } WP_CLI::line($output_message); } elseif (php_sapi_name() == 'cli' && defined('STDOUT')) { $output_message = str_replace(array('…', ' '), array('...', ' '), esc_html($message)) . PHP_EOL; fwrite(STDOUT, $output_message); } //timestamp for log file $debug_info = ''; if ($this->is_debug()) { $debug_info = ' title="[Type: ' . $type . '|Line: ' . $line . '|File: ' . $in_file . '|Mem: ' . size_format(@memory_get_usage(true), 2) . '|Mem Max: ' . size_format(@memory_get_peak_usage(true), 2) . '|Mem Limit: ' . ini_get('memory_limit') . '|PID: ' . self::get_pid() . ' | UniqID: ' . $this->uniqid . '|Query\'s: ' . get_num_queries() . ']"'; } $timestamp = '<span datetime="' . date('c') . '" ' . $debug_info . '>[' . date('d-M-Y H:i:s', current_time('timestamp')) . ']</span> '; //set last Message if ($error) { $output_message = '<span style="background-color:#ff6766;color:black;padding:0 2px;">' . esc_html($message) . '</span>'; $this->lasterrormsg = $output_message; } elseif ($warning) { $output_message = '<span style="background-color:#ffc766;color:black;padding:0 2px;">' . esc_html($message) . '</span>'; $this->lasterrormsg = $output_message; } else { $output_message = esc_html($message); $this->lastmsg = $output_message; } //write log file if ($this->logfile) { if (!file_put_contents($this->logfile, $timestamp . $output_message . '<br />' . PHP_EOL, FILE_APPEND)) { $this->logfile = ''; restore_error_handler(); trigger_error(esc_html($message), $type); } //write new log header if (($error || $warning) && $this->logfile) { if ($fd = fopen($this->logfile, 'r+')) { $file_pos = ftell($fd); while (!feof($fd)) { $line = fgets($fd); if ($error && stripos($line, '<meta name="backwpup_errors" content="') !== false) { fseek($fd, $file_pos); fwrite($fd, str_pad('<meta name="backwpup_errors" content="' . $this->errors . '" />', 100) . PHP_EOL); break; } if ($warning && stripos($line, '<meta name="backwpup_warnings" content="') !== false) { fseek($fd, $file_pos); fwrite($fd, str_pad('<meta name="backwpup_warnings" content="' . $this->warnings . '" />', 100) . PHP_EOL); break; } $file_pos = ftell($fd); } fclose($fd); } } } //write working data $this->update_working_data($error || $warning); //true for no more php error handling. return true; }
function add_timestamps() { if ($this->options['enable_purge'] != 1) { return; } if ($this->options['enable_stamp'] != 1) { return; } if (is_admin()) { return; } foreach (headers_list() as $header) { list($key, $value) = explode(':', $header, 2); if ($key == 'Content-Type' && strpos(trim($value), 'text/html') !== 0) { return; } if ($key == 'Content-Type') { break; } } if (defined('DOING_AJAX') && DOING_AJAX) { return; } $timestamps = "\n<!--" . "Cached using Nginx-Helper on " . current_time('mysql') . ". " . "It took " . get_num_queries() . " queries executed in " . timer_stop() . " seconds." . "-->\n" . "<!--Visit http://wordpress.org/extend/plugins/nginx-helper/faq/ for more details-->"; echo $timestamps; }
/** * Shutdown handler function * @return void */ public function shutdown_handler() { // Detect fatal errors (e.g. out of memory errors) $error = error_get_last(); if (empty($error) || E_ERROR !== $error['type']) { delete_option('p3_profiler-error_detection'); } else { update_option('p3_notices', array(array('msg' => sprintf(__('A fatal error occurred during profiling: %s in file %s on line %d ', 'p3-profiler'), $error['message'], $error['file'], $error['line']), 'error' => true))); } unset($error); // Write debug log $opts = get_option('p3-profiler_options'); if (!empty($opts['debug'])) { $this->_write_debug_log(); } // Make sure we've actually started ( wp-cron??) if (!defined('WPP_PROFILING_STARTED') || !WPP_PROFILING_STARTED) { return; } // Last call time $this->_last_call_time = microtime(true) - $this->_last_call_start; // Account for the last stack we measured if (self::CATEGORY_PLUGIN == $this->_last_call_category && array() !== $this->_last_stack) { // Write the stack to the profile $this->_plugin_runtime += $this->_last_call_time; // Add this stack to the profile $this->_profile['stack'][] = array('plugin' => $this->_last_stack['plugin'], 'runtime' => $this->_last_call_time); // Reset the stack $this->_last_stack = array(); } elseif (self::CATEGORY_THEME == $this->_last_call_category) { $this->_theme += $this->_last_call_time; } elseif (self::CATEGORY_CORE == $this->_last_call_category) { $this->_core += $this->_last_call_time; } // Total runtime by plugin $plugin_totals = array(); if (!empty($this->_profile['stack'])) { foreach ($this->_profile['stack'] as $stack) { if (empty($plugin_totals[$stack['plugin']])) { $plugin_totals[$stack['plugin']] = 0; } $plugin_totals[$stack['plugin']] += $stack['runtime']; } } foreach ($plugin_totals as $k => $v) { $plugin_totals[$k] = $v; } // Stop timing total run $tmp = microtime(true); $runtime = $tmp - $this->_start_time; // Count the time spent in here as profiler runtime $this->_runtime += $tmp - $this->_last_call_start; // Is the whole script a plugin? ( e.g. http://mysite.com/wp-content/plugins/somescript.php ) if ($this->_is_a_plugin_file($_SERVER['SCRIPT_FILENAME'])) { $this->_profile['runtime'] = array('total' => $runtime, 'wordpress' => 0, 'theme' => 0, 'plugins' => $runtime - $this->_runtime, 'profile' => $this->_runtime, 'breakdown' => array($this->_get_plugin_name($_SERVER['SCRIPT_FILENAME']) => $runtime - $this->_runtime)); } elseif ((FALSE !== strpos($_SERVER['SCRIPT_FILENAME'], '/themes/') || FALSE !== stripos($_SERVER['SCRIPT_FILENAME'], '\\themes\\')) && (FALSE !== strpos($_SERVER['SCRIPT_FILENAME'], '/' . basename(WP_CONTENT_DIR) . '/') || FALSE !== stripos($_SERVER['SCRIPT_FILENAME'], '\\' . basename(WP_CONTENT_DIR) . '\\'))) { $this->_profile['runtime'] = array('total' => $runtime, 'wordpress' => 0.0, 'theme' => $runtime - $this->_runtime, 'plugins' => 0.0, 'profile' => $this->_runtime, 'breakdown' => array()); } else { // Add runtime information $this->_profile['runtime'] = array('total' => $runtime, 'wordpress' => $this->_core, 'theme' => $this->_theme, 'plugins' => $this->_plugin_runtime, 'profile' => $this->_runtime, 'breakdown' => $plugin_totals); } // Additional metrics $this->_profile['memory'] = memory_get_peak_usage(true); $this->_profile['stacksize'] = count($this->_profile['stack']); $this->_profile['queries'] = get_num_queries(); // Throw away unneeded information to make the profiles smaller unset($this->_profile['stack']); // Write the profile file $transient = get_option('p3_scan_' . $opts['profiling_enabled']['name']); if (false === $transient) { $transient = ''; } $transient .= json_encode($this->_profile) . PHP_EOL; update_option('p3_scan_' . $opts['profiling_enabled']['name'], $transient); }