示例#1
1
文件: debog.php 项目: ryanurban/Orbit
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>';
    }
}
 /**
  * From regenerate thumbnails plugin
  */
 public function regenerate_thumbnail()
 {
     @error_reporting(0);
     // Don't break the JSON result
     header('Content-type: application/json');
     $id = (int) $_REQUEST['id'];
     $image = get_post($id);
     if (!$image || 'attachment' != $image->post_type || 'image/' != substr($image->post_mime_type, 0, 6)) {
         die(json_encode(array('error' => sprintf(__('Failed resize: %s is an invalid image ID.', 'wc_csv_import'), esc_html($_REQUEST['id'])))));
     }
     if (!current_user_can('manage_woocommerce')) {
         $this->die_json_error_msg($image->ID, __("Your user account doesn't have permission to resize images", 'wc_csv_import'));
     }
     $fullsizepath = get_attached_file($image->ID);
     if (false === $fullsizepath || !file_exists($fullsizepath)) {
         $this->die_json_error_msg($image->ID, sprintf(__('The originally uploaded image file cannot be found at %s', 'wc_csv_import'), '<code>' . esc_html($fullsizepath) . '</code>'));
     }
     @set_time_limit(900);
     // 5 minutes per image should be PLENTY
     $metadata = wp_generate_attachment_metadata($image->ID, $fullsizepath);
     if (is_wp_error($metadata)) {
         $this->die_json_error_msg($image->ID, $metadata->get_error_message());
     }
     if (empty($metadata)) {
         $this->die_json_error_msg($image->ID, __('Unknown failure reason.', 'wc_csv_import'));
     }
     // If this fails, then it just means that nothing was changed (old value == new value)
     wp_update_attachment_metadata($image->ID, $metadata);
     die(json_encode(array('success' => sprintf(__('&quot;%1$s&quot; (ID %2$s) was successfully resized in %3$s seconds.', 'wc_csv_import'), esc_html(get_the_title($image->ID)), $image->ID, timer_stop()))));
 }
示例#3
0
 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 ';
     }
 }
示例#4
0
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);
}
示例#5
0
function spdebug_stats()
{
    global $wpdb, $spdebug_stats, $spdebug_queries;
    if (defined('SP_DEVFLAG') && SP_DEVFLAG == true && isset($spdebug_stats)) {
        $out = "\n\n<div class='spdebug'>\n";
        $out .= "\t<table>\n";
        if (isset($spdebug_stats['total_time'])) {
            $out .= "\t\t<tr>\n";
            $out .= "\t\t\t<td>Target section</td>\n";
            $out .= "\t\t\t<td>" . $spdebug_stats['total_query'] . " queries</td>\n";
            $out .= "\t\t\t<td>" . number_format($spdebug_stats['total_time'], 3) . " seconds</td>\n";
            $out .= "\t\t</tr>\n";
        }
        $out .= "\t\t<tr>\n";
        $out .= "\t\t\t<td>Total page</td>\n";
        $out .= "\t\t\t<td>" . (get_num_queries() - $spdebug_queries) . " queries</td>\n";
        $out .= "\t\t\t<td>" . timer_stop(0) . " seconds</td>\n";
        $out .= "\t\t</tr>\n";
        $out .= "\t</table>\n";
        $out .= "</div>\n\n";
        echo $out;
        show_log();
        show_control();
    }
}
/**
 *
 * 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} -->";
    }
}
示例#7
0
文件: info.php 项目: dauidus/woof
 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";
 }
示例#8
0
文件: classes.php 项目: hewu/blogwp
 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);
 }
示例#9
0
 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;
 }
示例#11
0
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 _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>";
 }
 public function collect()
 {
     foreach ($GLOBALS['timers'] as $name => &$timer) {
         if (isset($timer['start'])) {
             timer_stop($name);
         }
         foreach ($timer['measures'] as $measure) {
             call_user_func_array(array($this, 'addMeasure'), $measure);
         }
     }
     return parent::collect();
 }
 function endRequest()
 {
     if (is_page() || is_single() || is_category() || is_home() || is_archive()) {
         $url = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
         $requestName = $this->getRequestName();
         $startTime = $_SERVER["REQUEST_TIME"];
         $duration = timer_stop(0, 3) * 1000;
         $this->_telemetryClient->trackRequest($requestName, $url, $startTime, $duration);
         // Flush all telemetry items
         $this->_telemetryClient->flush();
     }
 }
 public function inicializador($phase)
 {
     static $phases = array(SITEBILDER_CONFIGURATION, SITEBILDER_LANGUAGE, SITEBILDER_ACCESS, SITEBILDER_PERFIL, SITEBILDER_SESSION, SITEBILDER_PAGE, SITEBILDER_SAJAX, SITEBILDER_FULL), $phase_index = 0;
     $this->unset_globals();
     timer_start('index.php');
     /* inicia as fazes de configuração. */
     while ($phase >= $phase_index && isset($phases[$phase_index])) {
         $current_phase = $phases[$phase_index];
         unset($phases[$phase_index++]);
         $this->sitebilder_inicializador($current_phase);
     }
     $this->debug['index.php'] = timer_stop('index.php');
 }
示例#16
0
 /**
  * 
  * @staticvar string $item
  * @param type $text
  * @return string
  */
 public static function mark($text)
 {
     static $item = '';
     if ($text === TRUE) {
         return $item;
     }
     static $last_time = 0;
     $current_time = timer_stop();
     $time_taken = $last_time > 0 ? $current_time - $last_time : 0;
     $time_taken = number_format($time_taken, 3);
     $last_time = $current_time;
     $item .= self::addAdminBarItem($current_time . '  (+' . $time_taken . ') - ' . $text);
 }
 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>";
 }
示例#18
0
/**
 * 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 
}
示例#19
0
function aitDisplayLoadTime()
{
    if (!(defined('DOING_AJAX') && DOING_AJAX)) {
        ?>
<div style="position:fixed;bottom:0;right:0;padding:0.2em;background:#fff;border:1px solid #ccc;border-radius:4px;"><?php 
        timer_stop(1);
        echo " | ";
        $unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
        $size = memory_get_usage(true);
        echo @round($size / pow(1024, $i = floor(log($size, 1024))), 2) . ' ' . $unit[$i];
        ?>
</div><?php 
    }
}
示例#20
0
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";
}
示例#21
0
    /**
     * 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);">&times;</a>
				<a class="reset" href="<?php 
        echo add_query_arg('reset_wp_pls_stats', 1);
        ?>
">-</a>
			</div>
		</div>
		<?php 
    }
示例#22
0
 /**
  * Shows number of database queries and the time it takes for a page to load
  */
 public function showQueriesAndTime($h)
 {
     if ($h->isDebug) {
         $mysql_version = $h->db->get_var("SELECT VERSION() AS VE");
         echo "<p class='debug'>";
         echo $h->lang['main_hotaru_db_queries'] . $h->db->num_queries . " | ";
         echo $h->lang['main_hotaru_page_load_time'] . timer_stop(1) . $h->lang['main_times_secs'] . " | ";
         echo $h->lang['main_hotaru_memory_usage'] . display_filesize(memory_get_usage()) . " | ";
         echo $h->lang['main_hotaru_php_version'] . phpversion() . " | ";
         echo $h->lang['main_hotaru_mysql_version'] . $mysql_version . " | ";
         echo $h->lang['main_hotaru_hotaru_version'] . $h->version;
         echo "</p>";
     }
     if ($h->currentUser->loggedIn) {
         echo "<span id='loggedIn' class='loggedIn_true'/>";
     } else {
         "<span id='loggedIn' class='loggedIn_false'/>";
     }
 }
/**
 * 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;
}
示例#24
0
 /**
  * Rebuild the given attribute with the given thumbnails
  *
  * @param $att_id
  * @param $thumbnails
  *
  * @return array
  * @author Nicolas Juen
  */
 public static function thumbnail_rebuild($att_id, $thumbnails = null)
 {
     // Time a the begining
     timer_start();
     // Check Id
     if ((int) $att_id <= 0) {
         return array('time' => timer_stop(false, 4), 'error' => __('No id given in POST datas.', 'simple-image-sizes'));
     }
     // Get the path
     $fullsizepath = get_attached_file($att_id);
     // Regen the attachment
     if (false !== $fullsizepath && file_exists($fullsizepath)) {
         if (false == wp_update_attachment_metadata($att_id, self::wp_generate_attachment_metadata_custom($att_id, $fullsizepath, $thumbnails))) {
             return array('src' => wp_get_attachment_thumb_url($att_id), 'time' => timer_stop(false, 4), 'message' => sprintf(__('This file already exists in this size and have not been regenerated :<br/><a target="_blank" href="%1$s" >%2$s</a>', 'simple-image-sizes'), get_edit_post_link($att_id), get_the_title($att_id)));
         }
     } else {
         return array('src' => wp_get_attachment_thumb_url($att_id), 'time' => timer_stop(false, 4), 'error' => sprintf(__('This file does not exists and have not been regenerated :<br/><a target="_blank" href="%1$s" >%2$s</a>', 'simple-image-sizes'), get_edit_post_link($att_id), get_the_title($att_id)));
     }
     // Display the attachment url for feedback
     return array('time' => timer_stop(false, 4), 'src' => wp_get_attachment_thumb_url($att_id), 'title' => get_the_title($att_id));
 }
示例#25
0
 /**
  * Shows number of database queries and the time it takes for a page to load
  */
 public function showQueriesAndTime($h)
 {
     if ($h->isDebug && $h->currentUser->isAdmin) {
         $mysql_version = $h->db->get_var("SELECT VERSION() AS VE");
         echo "<p class='debug'><span class='label label-default'>Admin Only</span> ";
         echo $h->lang('main_hotaru_db_queries') . $h->db->num_queries . " | ";
         echo $h->lang('main_hotaru_cache_queries') . $h->db->num_cache_queries . " | ";
         echo $h->lang('main_hotaru_page_load_time') . timer_stop(3, 'hotaru') . $h->lang('main_times_secs') . " | ";
         if (function_exists('memory_get_usage')) {
             echo $h->lang('main_hotaru_memory_usage') . display_filesize(memory_get_usage(true)) . " | ";
             //echo $h->lang('main_hotaru_memory_usage_peak') . display_filesize(memory_get_peak_usage(true)) . " | ";
         }
         //echo "h->vars: " . sizeofvar($h->vars) . " | ";
         echo $h->lang('main_hotaru_php_version') . phpversion() . " | ";
         echo $h->lang('main_hotaru_mysql_version') . $mysql_version . " | ";
         echo $h->lang('main_hotaru_hotaru_version') . $h->version;
         echo ' (' . $h->vars['debug']['db_driver'] . ') ';
         $h->pluginHook('debug_footer');
         echo "</p>";
     } else {
         if (!$h->adminPage && $h->pageTemplate && function_exists('file_get_contents')) {
             $filename = THEMES . THEME . $h->pageTemplate . '.php';
             if (file_exists($filename)) {
                 $template = file_get_contents($filename);
                 $hlink1 = stripos($template, "href='http://hotarucms.org'");
                 $hlink2 = stripos($template, "href=\"http://hotarucms.org\"");
                 if ($hlink1 === FALSE && $hlink2 === FALSE) {
                     // Hotaru link removed from footer so put it back in:
                     echo '<a href="http://hotarucms.org" title="' . $h->lang("main_theme_footer_hotaru_link") . '"><div id="hotaruFooterImg"></div></a>';
                 }
             }
         }
     }
     if ($h->currentUser->loggedIn) {
         echo "<span id='loggedIn' class='loggedIn_true'/>";
     } else {
         echo "<span id='loggedIn' class='loggedIn_false'/>";
     }
 }
示例#26
0
 /**
  * Log last request, if logging is enabled.
  *
  * @param ...
  *   A variable number of arguments, whose values will be redacted.
  */
 private function log()
 {
     if ($this->logging) {
         timer_stop('openruth_net');
         if ($this->log_timestamp) {
             $time = round(microtime(TRUE) - $this->log_timestamp, 2);
             $this->log_timestamp = NULL;
         }
         $sensitive = func_get_args();
         // For some reason PHP doesn't have array_flatten, and this is the
         // shortest alternative.
         $replace_values = array();
         foreach (new RecursiveIteratorIterator(new RecursiveArrayIterator($sensitive)) as $value) {
             $replace_values['>' . $value . '<'] = '>' . drupal_substr(md5($value . self::$salt), 0, drupal_strlen($value)) . '<';
         }
         if (isset($time)) {
             watchdog('openruth', 'Sending request (@seconds sec): @xml', array('@xml' => strtr($this->client->__getLastRequest(), $replace_values), '@seconds' => $time), WATCHDOG_DEBUG);
         } else {
             watchdog('openruth', 'Sending request: @xml', array('@xml' => strtr($this->client->__getLastRequest(), $replace_values)), WATCHDOG_DEBUG);
         }
         watchdog('openruth', 'Response: @xml', array('@xml' => strtr($this->client->__getLastResponse(), $replace_values)), WATCHDOG_DEBUG);
     }
 }
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>';
}
示例#28
0
 /**
  * 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 '&nbsp;';
     submit_button(__('Reset Section', 'redux-framework'), 'secondary', $this->args['opt_name'] . '[defaults-section]', false);
     echo '&nbsp;';
     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') . '">&nbsp;</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">&nbsp;</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">&nbsp;</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') . '">&nbsp;&nbsp;<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>&nbsp;</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;">&nbsp;</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 '&nbsp;';
     submit_button(__('Reset Section', 'redux-framework'), 'secondary', $this->args['opt_name'] . '[defaults-section]', false);
     echo '&nbsp;';
     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') . '">&nbsp;</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>';
     }
 }
示例#29
0
 /**
  * Spit out the generated sitemap and relevant headers and encoding information.
  */
 function output()
 {
     header('HTTP/1.1 200 OK', true, 200);
     // Prevent the search engines from indexing the XML Sitemap.
     header('X-Robots-Tag: noindex, follow', true);
     header('Content-Type: text/xml');
     echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?>';
     if ($this->stylesheet) {
         echo apply_filters('wpseo_stylesheet_url', $this->stylesheet) . "\n";
     }
     echo $this->sitemap;
     echo "\n" . '<!-- XML Sitemap generated by Yoast WordPress SEO -->';
     if (WP_DEBUG) {
         echo "\n" . '<!-- Built in ' . timer_stop() . ' seconds | ' . memory_get_peak_usage() . ' | ' . count($GLOBALS['wpdb']->queries) . ' -->';
     }
 }
示例#30
0
		<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 &amp; 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>