public function __construct(QM_Collector $collector)
 {
     parent::__construct($collector);
     add_filter('qm/output/menus', array($this, 'admin_menu'), 20);
     add_filter('qm/output/title', array($this, 'admin_title'), 20);
     add_filter('qm/output/menu_class', array($this, 'admin_class'));
 }
Beispiel #2
0
 public function __construct(QM_Collector $collector)
 {
     parent::__construct($collector);
     add_filter('query_monitor_menus', array($this, 'admin_menu'), 20);
     add_filter('query_monitor_title', array($this, 'admin_title'), 20);
     add_filter('query_monitor_class', array($this, 'admin_class'));
 }
Beispiel #3
0
 public function __construct(QM_Collector $collector)
 {
     parent::__construct($collector);
     add_filter('qm/output/title', array($this, 'admin_title'), 10);
 }
Beispiel #4
0
 public function __construct(QM_Collector $collector)
 {
     parent::__construct($collector);
     add_filter('qm/output/menus', array($this, 'admin_menu'), 55);
 }
Beispiel #5
0
 public static function output_filename($text, $file, $line = 1)
 {
     # Further reading:
     # http://simonwheatley.co.uk/2012/07/clickable-stack-traces/
     # https://github.com/grych/subl-handler
     if (!isset(self::$file_link_format)) {
         $format = ini_get('xdebug.file_link_format');
         $format = apply_filters('qm/output/file_link_format', $format);
         if (empty($format)) {
             self::$file_link_format = false;
         } else {
             self::$file_link_format = str_replace(array('%f', '%l'), array('%1$s', '%2$d'), $format);
         }
     }
     if (false === self::$file_link_format) {
         return $text;
     }
     $link = sprintf(self::$file_link_format, urlencode($file), $line);
     return sprintf('<a href="%s">%s</a>', $link, $text);
 }
Beispiel #6
0
 /**
  * Returns a file path, name, and line number. Safe for output.
  *
  * If clickable file links are enabled, a link such as this is returned:
  *
  *     <a href="subl://open/?line={line}&url={file}">{text}</a>
  *
  * Otherwise, the display text and file details such as this is returned:
  *
  *     {text}<br>{file}:{line}
  *
  * @param  string $text The display text, such as a function name or file name.
  * @param  string $file The full file path and name.
  * @param  int    $line Optional. A line number, if appropriate.
  * @return string The fully formatted file link or file name, safe for output.
  */
 public static function output_filename($text, $file, $line = 0)
 {
     if (empty($file)) {
         return esc_html($text);
     }
     # Further reading:
     # http://simonwheatley.co.uk/2012/07/clickable-stack-traces/
     # https://github.com/grych/subl-handler
     $link_line = $line ? $line : 1;
     if (!isset(self::$file_link_format)) {
         $format = ini_get('xdebug.file_link_format');
         $format = apply_filters('qm/output/file_link_format', $format);
         if (empty($format)) {
             self::$file_link_format = false;
         } else {
             self::$file_link_format = str_replace(array('%f', '%l'), array('%1$s', '%2$d'), $format);
         }
     }
     if (false === self::$file_link_format) {
         $fallback = QM_Util::standard_dir($file, '');
         if ($line) {
             $fallback .= ':' . $line;
         }
         $return = esc_html($text);
         if ($fallback !== $text) {
             $return .= '<br><span class="qm-info">&nbsp;' . esc_html($fallback) . '</span>';
         }
         return $return;
     }
     $link = sprintf(self::$file_link_format, urlencode($file), intval($link_line));
     return sprintf('<a href="%s">%s</a>', esc_attr($link), esc_html($text));
 }