WordPress.org

Plugin Directory

Changeset 1790744


Ignore:
Timestamp:
12/21/17 16:01:44 (5 weeks ago)
Author:
bobbingwide
Message:

oik-bwtrace v2.1.1 2017/12/21 - tested with PHP 7.2. 100% internationalized.

Location:
oik-bwtrace/trunk
Files:
8 added
17 edited

Legend:

Unmodified
Added
Removed
  • oik-bwtrace/trunk/admin/oik-bwtrace.inc

    r1345819 r1790744  
    1 <?php  
    2 /* 
    3  
    4     Copyright 2012-2016 Bobbing Wide (email : herb@bobbingwide.com ) 
    5  
    6     This program is free software; you can redistribute it and/or modify 
    7     it under the terms of the GNU General Public License version 2, 
    8     as published by the Free Software Foundation. 
    9  
    10     You may NOT assume that you can use any other version of the GPL. 
    11  
    12     This program is distributed in the hope that it will be useful, 
    13     but WITHOUT ANY WARRANTY; without even the implied warranty of 
    14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    15     GNU General Public License for more details. 
    16  
    17     The license for this software can likely be found here: 
    18     http://www.gnu.org/licenses/gpl-2.0.html 
    19  
    20 */ 
    21  
    22  
    23 /** 
    24  * Register bw_trace_options 
    25  * 
    26  * Init plugin options to white list our options 
    27  *  
    28  */ 
    29 function bw_trace_options_init(){ 
    30   register_setting( 'bw_trace_options_options', 'bw_trace_options', 'bw_trace_options_validate' ); 
    31    
    32   add_action( "activated_plugin", "bw_this_plugin_first", 10, 2 ); 
     1<?php // (C) Copyright Bobbing Wide 2011-2017 
     2if ( function_exists( "_deprecated_file" ) ) { 
     3    _deprecated_file( __FILE__, "2.1.1", "admin/oik-bwtrace.php", 'Please use oik_require( "admin/oik-bwtrace.php", "oik-bwtrace");' );  
    334} 
    34  
    35 /** 
    36  * Register bw_action_options 
    37  * 
    38  */ 
    39 function bw_action_options_init(){ 
    40   register_setting( 'bw_action_options_options', 'bw_action_options', 'bw_action_options_validate' ); 
    41 } 
    42  
    43 /** 
    44  * Register the trace options page 
    45  * 
    46  * Only available if the "oik-admin" library is available. 
    47  * 
    48  */ 
    49 function bw_trace_options_add_page() { 
    50     if ( oik_require_lib( "oik-admin" ) ) { 
    51         add_options_page( __('oik trace options', 'oik-bwtrace' ), __( 'oik trace options', 'oik-bwtrace' ), 'manage_options', 'bw_trace_options', 'bw_trace_options_do_page'); 
    52     } 
    53 } 
    54  
    55  
    56 /** 
    57  * Register the action options page 
    58  * 
    59  */ 
    60 function bw_action_options_add_page() { 
    61     add_options_page( __('oik action options', 'oik-bwtrace') , __( 'oik action options', 'oik-bwtrace' ), 'manage_options', 'bw_action_options', 'bw_action_options_do_page'); 
    62 } 
    63  
    64 /**  
    65  * Settings page for oik actions logging 
    66  * 
    67  *  
    68  *  
    69  */ 
    70 function bw_action_options_do_page() { 
    71   oik_menu_header( "action options", "w70pc" ); 
    72   oik_box( null, null, "Options", "oik_action_options" );  
    73   //oik_box( null, null, "Notes about oik actions", "oik_action_notes" );  
    74   //ecolumn(); 
    75   //scolumn( "w30pc" ); 
    76   //oik_box( null, null, "Action reset button", "oik_action_reset_notes" );  
    77   //oik_box( NULL, NULL, "oik documentation", "oik_documentation" ); 
    78   //oik_box( NULL, NULL, "support oik", "oik_support" ); 
    79   //ecolumn(); 
    80   // scolumn(); 
    81   //oik_box( null, null, "Action summary", "oik_action_summary" );  
    82   //oik_box( null, null, "PHP Info", "phpinfo" ); 
    83   oik_menu_footer(); 
    84   bw_flush(); 
    85 } 
    86  
    87 /** 
    88  * Display the action options form 
    89  * 
    90  * 2015/05/23 Disabled 'immediate' tracing 
    91  * Relabelled 'Count immediate actions' to 'Count action hooks and filters' 
    92  *  
    93  */ 
    94 function oik_action_options() {   
    95   bw_form( "options.php" ); 
    96   $options = get_option('bw_action_options');      
    97   stag( 'table class="form-table"' ); 
    98   bw_flush(); 
    99   settings_fields('bw_action_options_options');  
    100    
    101   //bw_textfield_arr( "bw_action_options", "Action file", $options, 'file', 60 ); 
    102   //bw_checkbox_arr( "bw_action_options", "Trace actions", $options, 'actions' ); 
    103   //bw_checkbox_arr( "bw_action_options", "Trace immediate actions", $options, 'immediate' ); 
    104   bw_checkbox_arr( "bw_action_options", "Count action hooks and filters", $options, 'count' ); 
    105   bw_checkbox_arr( "bw_action_options", "Trace deprecated messages", $options, 'trace_deprecated' ); 
    106     bw_checkbox_arr( "bw_action_options", "Trace Error, Warning and Notice messages", $options, 'trace_errors' ); 
    107   bw_checkbox_arr( "bw_action_options", "Trace 'wp' action", $options, 'trace_wp_action' ); 
    108   bw_checkbox_arr( "bw_action_options", "Trace 'wp' global wp_rewrite ", $options, 'trace_wp_rewrite' ); 
    109   bw_checkbox_arr( "bw_action_options", "Trace 'shutdown' included files", $options, 'trace_included_files' ); 
    110   bw_checkbox_arr( "bw_action_options", "Trace 'shutdown' saved queries", $options, 'trace_saved_queries' ); 
    111   bw_checkbox_arr( "bw_action_options", "Trace 'shutdown' output buffer", $options, 'trace_output_buffer' ); 
    112   bw_checkbox_arr( "bw_action_options", "Trace 'shutdown' trace functions count", $options, 'trace_functions' ); 
    113   bw_checkbox_arr( "bw_action_options", "Trace 'shutdown' status report and log in summary file", $options, 'trace_status_report' ); 
    114      
    115     bw_textarea_arr( "bw_action_options", "Other hooks to trace", $options, "hooks", 80 ); 
    116     bw_textarea_arr( "bw_action_options", "Filter results to trace", $options, "results", 80 ); 
    117     bw_textarea_arr( "bw_action_options", "Trace the global post object", $options, "post_hooks", 80 ); 
    118     bw_textarea_arr( "bw_action_options", "Trace attached hook functions", $options, "hook_funcs", 80 ); 
    119     bw_textarea_arr( "bw_action_options", "Hooks to debug backtrace", $options, "backtrace", 80 ); 
    120      
    121    
    122   //bw_tablerow( array( "", "<input type=\"submit\" name=\"ok\" value=\"Save changes\" class=\"button-primary\"/>") );  
    123   etag( "table" );           
    124   p( isubmit( "ok", "Save changes", null, "button-primary" ) ); 
    125   etag( "form" ); 
    126  
    127    
    128 function oik_action_notes() {   
    129   p( "The actions output produced by " .bw_oik(). " actions can be used to find the sequence that actions are performed." ); 
    130   p( "It needs to be used in conjunction with the trace facility."); 
    131   //p( "The oik actions should <b>not</b> need to be activated on a live site."); 
    132   //p( "If you do need to activate it, only do so for a short period of time." ); 
    133   
    134   //p( "You will need to specify the action file name (e.g. bwaction.loh )" ); 
    135   //p( "Set actions to 'on' when you want to trace action processing, 'off' otherwise."); 
    136   p( "Set Count action hooks and filters to count the number of times each action or filter hook is invoked" ); 
    137   //p( "Set immediate actions to 'on' when you want to trace ALL actions and filters." ); 
    138   //p( "Note: Immediate action tracing will replace the current version of wp-includes/plugin.php with one that has been modified to include tracing." ); 
    139   //p( "When you deselect the check box then the original file is restored." ); 
    140   //p( "The code should not break your site after a WordPress upgrade." );  
    141    
    142   p( "You may find the most recent trace action output at..." ); 
    143   $bw_action_url = bw_trace_url( 'bw_action_options' ); 
    144    
    145   alink( NULL, $bw_action_url, $bw_action_url, "View action output in your browser."); 
    146   p( "The trace action log is reset at the same time as the trace log." ); 
    147    
    148   bw_flush(); 
    149 } 
    150  
    151 /** 
    152  * Display the oik trace options page 
    153  *  
    154  */ 
    155 function bw_trace_options_do_page() {  
    156   oik_menu_header( "trace options" ); 
    157   oik_box( null, null, "Options", "oik_trace_options" );  
    158   oik_box( null, null, "Notes about oik trace", "oik_trace_notes" );  
    159   oik_box( null, null, "Trace options and reset button", "oik_trace_reset_notes" );  
    160   //ecolumn(); 
    161    
    162   //scolumn( "w30pc" ); 
    163   //oik_box( NULL, NULL, "oik documentation", "oik_documentation" ); 
    164   //oik_box( NULL, NULL, "support oik", "oik_support" ); 
    165   oik_menu_footer(); 
    166   bw_flush(); 
    167 } 
    168  
    169 /** 
    170  * Display the trace options box 
    171  * 
    172  * Note: The fields suffixed _ajax apply when the DOING_AJAX constant is true. 
    173  
    174  * 
    175  */ 
    176 function oik_trace_options() { 
    177   bw_form( "options.php" ); 
    178    
    179   $options = get_option('bw_trace_options');      
    180   
    181   stag( 'table class="form-table"' ); 
    182   bw_flush(); 
    183   settings_fields('bw_trace_options_options');  
    184    
    185   bw_textfield_arr( "bw_trace_options", "Trace file", $options, 'file', 60 ); 
    186   bw_checkbox_arr( "bw_trace_options", "Reset trace file every transaction", $options, 'reset' ); 
    187   bw_checkbox_arr( "bw_trace_options", "Trace enabled", $options, 'trace' ); 
    188      
    189   bw_textfield_arr( "bw_trace_options", "AJAX Trace file", $options, 'file_ajax', 60 ); 
    190   bw_checkbox_arr( "bw_trace_options", "Reset AJAX trace file every AJAX transaction", $options, 'reset_ajax' ); 
    191   bw_checkbox_arr( "bw_trace_options", "AJAX Trace enabled", $options, 'trace_ajax' ); 
    192      
    193     // Does this need includes/bwtrace.php? 
    194     $trace_levels = bw_list_trace_levels(); 
    195     // Do we need to default this after upgrade? 
    196     //$options['level'] = bw_trace_level(); 
    197     bw_select_arr( "bw_trace_options", "Trace level", $options, 'level', array( "#options" => $trace_levels ) ); 
    198   bw_checkbox_arr( "bw_trace_options", "Fully qualified file names", $options, 'qualified' ); 
    199   bw_checkbox_arr( "bw_trace_options", "Include trace record count", $options, 'count' ); 
    200   bw_checkbox_arr( "bw_trace_options", "Include timestamp", $options, 'date' ); 
    201   bw_checkbox_arr( "bw_trace_options", "Include current filter", $options, 'filters' ); 
    202   bw_checkbox_arr( "bw_trace_options", "Include number of queries", $options, "num_queries" ); 
    203   bw_checkbox_arr( "bw_trace_options", "Include post ID", $options, "post_id" ); 
    204   bw_checkbox_arr( "bw_trace_options", "Include memory/peak usage", $options, 'memory' ); 
    205   bw_checkbox_arr( "bw_trace_options", "Include files loaded count", $options, 'files' ); 
    206   $current_ip = "<br />Current IP: "; 
    207   $current_ip .= bw_array_get( $_SERVER, "REMOTE_ADDR", null ); 
    208   bw_textfield_arr( "bw_trace_options", "Trace specific IP $current_ip", $options, 'ip', 20 ); 
    209    
    210   // Trace error processing is not yet enabled. 
    211   // textfield( "bw_trace_options[errors]", 1 ,"Trace errors (0=no,-1=all,1=E_ERROR,2=E_WARNING,4=E_PARSE, etc)", $options['errors'] ); 
    212   // bw_tablerow( array( "", "<input type=\"submit\" name=\"ok\" value=\"Save changes\" class=\"button-primary\"/>") );  
    213  
    214   etag( "table" ); 
    215   p( isubmit( "ok", __( "Save changes", 'oik-bwtrace' ), null, "button-primary" ) ); 
    216   etag( "form" ); 
    217    
    218   bw_flush(); 
    219 } 
    220  
    221 /** 
    222  * Display trace notes 
    223  */ 
    224 function oik_trace_notes() { 
    225   p( "The tracing output produced by oik-bwtrace can be used for problem determination."); 
    226   p( "It's not for the faint hearted."); 
    227   p( "The oik-bwtrace plugin should <b>not</b> need to be activated on a live site."); 
    228   p( "If you do need to activate it, only do so for a short period of time." ); 
    229   
    230   p( "You will need to specify the trace file name (e.g. bwtrace.loh )" ); 
    231   p( "When you want to trace processing check 'Trace enabled'" ); 
    232   p( "Check 'Reset trace file every transaction' to cause the trace file to be cleared for every request, including AJAX requests." ); 
    233      
    234    
    235   p("You may find the most recent trace output at..." ); 
    236   $bw_trace_url = bw_trace_url(); 
    237    
    238   alink( NULL, $bw_trace_url, $bw_trace_url, "View trace output in your browser."); 
    239    
    240   p("If you want to trace processing within some content you can use two shortcodes: [bwtron] to turn trace on and [bwtroff] to turn it off" ); 
    241    
    242   bw_flush(); 
    243  
    244 } 
    245  
    246 /** 
    247  * Display trace reset 
    248  * 
    249  */ 
    250 function oik_trace_reset_notes() { 
    251     $oik_sc_help = oik_require_lib( "oik-sc-help" );  
    252     if ( $oik_sc_help && !is_wp_error( $oik_sc_help ) ) { 
    253         bw_trace2( $oik_sc_help, "oik-sc-help", false, BW_TRACE_DEBUG ); 
    254         bw_invoke_shortcode( "bwtrace", null, "Use the [bwtrace] shortcode in a widget to provide an instant trace reset and page reload." ); 
    255     } else { 
    256         p( "Activate the oik base plugin to enable the [bwtrace] shortcode" ); 
    257     } 
    258 } 
    259  
    260 /** 
    261  * Sanitize and validate trace options input 
    262  *  
    263  * @param $input array Accepts an array,  
    264  * @return array sanitized array. 
    265  */ 
    266 function bw_trace_options_validate($input) { 
    267         $input['ip'] = trim( $input['ip']); 
    268     return $input; 
    269 } 
    270  
    271 /**  
    272  * Validate the bw_action_options 
    273  *  
    274  * Note: If the validation function does not exist then no value is returned and the options don't get saved. 
    275  * WordPress does not produce a warning message.  
    276  *  
    277  * @param array $input the options to be saved 
    278  * @return array validated input 
    279  */  
    280 function bw_action_options_validate( $input ) { 
    281   bw_trace2( $input );  
    282   // oik_require( "admin/oik-replace.inc", "oik-bwtrace" ); 
    283   // $immediate = bw_array_get( $input, "immediate", false ); 
    284   // $result = bw_enable_action_trace( $immediate ) ; 
    285   return $input; 
    286 } 
    287  
    288 /** 
    289  * Return the trace file URL 
    290  * 
    291  * May not return the correct URL for WordPress MultiSite 
    292  * 
    293  * @param string $option the option set. 
    294  * @return string the trace file URL 
    295  */   
    296 function bw_trace_url( $option='bw_trace_options', $ajax=false ) { 
    297   $options = get_option( $option );  
    298     $file = bw_trace_file_name( $options, $ajax ); 
    299   $bw_trace_url = get_site_url( NULL, $file ); 
    300   return( $bw_trace_url ); 
    301 } 
    302  
    303 /** 
    304  *  
    305  * Implement "activated_plugin" action for oik-bwtrace 
    306  * 
    307  * Arrange for the "oik-bwtrace/oik-bwtrace.php" plugin to be loaded first 
    308  * regardless of which plugin has been activated. 
    309  * 
    310  * @TODO If it's network activated this should be first in "active_sitewide_plugins" 
    311  *  
    312  * 
    313  * @param string $plugin path to main plugin file 
    314  * @param bool $network_wide true if network activated 
    315  */ 
    316 function bw_this_plugin_first( $plugin, $network_wide ) { 
    317   if ( false == $network_wide ) { 
    318         $this_plugin = "oik-bwtrace/oik-bwtrace.php";         
    319     $active_plugins = get_option( 'active_plugins' ); 
    320     $this_plugin_key = array_search( $this_plugin, $active_plugins ); 
    321     if ( $this_plugin_key ) { // if it's 0 it's the first plugin already, no need to continue 
    322         array_splice( $active_plugins, $this_plugin_key, 1 ); 
    323         array_unshift( $active_plugins, $this_plugin ); 
    324         update_option( 'active_plugins', $active_plugins ); 
    325     } 
    326   }                 
    327 } 
    328  
    329  
     5require_once( __DIR__ . '/oik-bwtrace.php' ); 
  • oik-bwtrace/trunk/includes/bwtrace-actions.php

    r1345819 r1790744  
    1 <?php // (C) Copyright Bobbing Wide 2015 
     1<?php // (C) Copyright Bobbing Wide 2015-2017 
    22  
    33/** 
     
    101101    bw_trace_add_trace_selected_hooks_attached_hooks(); 
    102102    bw_trace_add_trace_selected_hooks_backtrace(); 
     103    bw_trace_add_trace_stringwatch(); 
     104    //bw_trace_add_trace_anychange(); 
    103105} 
    104106 
     
    196198} 
    197199 
     200 
     201/**  
     202 * Return string representation of the $errno  
     203 *  
     204 * | $errno | constant | string | 
     205 * | --- | --- | --- | 
     206 * | 1 | E_ERROR | Error | 
     207 * | 2 | E_WARNING | Warning | 
     208 * | 4 | E_PARSE | Parsing Error | 
     209 * | 8 | E_NOTICE | Notice | 
     210 * | 16 | E_CORE_ERROR | Core Error | 
     211 * | 32 | E_CORE_WARNING | Core Warning | 
     212 * | 64 | E_COMPILE_ERROR | Compile Error | 
     213 * | 128 | E_COMPILE_WARNING | Compile Warning | 
     214 * | 256 | E_USER_ERROR | User Error | 
     215 * | 512 | E_USER_WARNING | User Warning | 
     216 * | 1024 | E_USER_NOTICE | User Notice | 
     217 * | 2048 | E_STRICT | Runtime Notice | 
     218 * | 4096 | E_RECOVERABLE_ERROR | Catchable Fatal Error | 
     219 * | 8192 | E_DEPRECATED | Deprecated | 
     220 * | 16384 | E_USER_DEPRECATED | User Deprecated | 
     221 * 
     222 * @param integer $errno 
     223 * @return string the string representation 
     224 */ 
     225function bw_trace_errno( $errno ) { 
     226    $strings = array( E_ERROR => "Error" 
     227 , E_WARNING => "Warning" 
     228 , E_PARSE => "Parsing Error" 
     229 , E_NOTICE => "Notice" 
     230 , E_CORE_ERROR => "Core Error" 
     231 , E_CORE_WARNING => "Core Warning" 
     232 , E_COMPILE_ERROR => "Compile Error" 
     233 , E_COMPILE_WARNING => "Compile Warning" 
     234 , E_USER_ERROR => "User Error" 
     235 , E_USER_WARNING => "User Warning" 
     236 , E_USER_NOTICE => "User Notice" 
     237 , E_STRICT => "Runtime Notice" 
     238 , E_RECOVERABLE_ERROR => "Catchable Fatal Error" 
     239 , E_DEPRECATED => "Deprecated" 
     240 , E_USER_DEPRECATED => "User Deprecated" 
     241 ); 
     242    $string = bw_array_get( $strings, $errno, $errno ); 
     243    return( $string ); 
     244} 
     245     
     246 
    198247/** 
    199248 * Trace catchable errors 
     
    214263 */ 
    215264function bw_trace_error_handler( $errno, $errstr, $errfile=null, $errline=null, $errcontext=null ) { 
    216     $err = array( $errno, $errstr, $errfile, $errline ); 
     265    $err_string = bw_trace_errno( $errno ); 
     266    $err_string .= ": "; 
     267    $err_string .= $errstr; 
     268    $err = array( $errno, $err_string, $errfile, $errline ); 
    217269    bw_trace2( $err, "err", false, BW_TRACE_ALWAYS ); 
    218270    bw_trace2( $errcontext, "errcontext", false, BW_TRACE_VERBOSE ); 
     
    382434 
    383435/** 
     436 * Add stringwatch logic if required 
     437 * 
     438 * Since this won't get used often it's in a separate file 
     439 * ... that might get loaded earlier by the MU plugin 
     440 *  
     441 */ 
     442function bw_trace_add_trace_stringwatch() { 
     443    global $bw_action_options; 
     444    $stringwatch = bw_array_get( $bw_action_options, "stringwatch", null );  
     445    if ( $stringwatch || defined( "BW_TRACE_STRINGWATCH" ) ) { 
     446        oik_require( "includes/bwtrace-stringwatch.php", "oik-bwtrace" ); 
     447    } 
     448} 
     449 
     450/** 
     451 * Adds anychange logic if required 
     452 */ 
     453 
     454function bw_trace_add_trace_anychange() { 
     455    global $bw_action_options; 
     456    $anychange = bw_array_get( $bw_action_options, "anychange", null ); 
     457    if ( $anychange || defined( "BW_TRACE_ANYCHANGE" ) ) { 
     458        oik_require( "includes/bwtrace-anychange.php", "oik-bwtrace" ); 
     459    } 
     460} 
     461 
     462/** 
    384463 * Trace the global post object 
    385464 * 
     
    410489    bw_trace2( $hooks, $cf, false, BW_TRACE_ALWAYS ); 
    411490    return( $arg ); 
     491} 
     492 
     493/** 
     494 * Traces all attached hooks 
     495 */ 
     496function bw_trace_all_attached_hooks() { 
     497    global $wp_filter; 
     498    $count = count( $wp_filter ); 
     499    $hooks = array(); 
     500    foreach ( $wp_filter as $tag => $hook_object ) { 
     501        $hooks[ $tag ] = bw_trace_get_attached_hooks( $tag ); 
     502    } 
     503    bw_trace2( $hooks, "All $count hooks" ); 
    412504} 
    413505 
  • oik-bwtrace/trunk/includes/bwtrace.php

    r1345819 r1790744  
    1 <?php // (C) Copyright Bobbing Wide 2011-2016 
     1<?php // (C) Copyright Bobbing Wide 2011-2017 
    22if ( !defined( 'OIK_BWTRACE_INCLUDES_INCLUDED' ) )  { 
    33define( 'OIK_BWTRACE_INCLUDES_INCLUDED', true ); 
     
    4343 * 
    4444 * When trace is invoked during startup processing we can't access the wp_options table so we have to use hardcoded values. 
     45 *  
    4546 * @TODO Use values of trace constants instead? 
    4647 *  
     
    5253  if ( !empty( $_REQUEST['_bw_trace_reset'] ) ) { 
    5354    bw_trace_reset(); 
    54   }   
     55  } 
    5556}  
    5657 
     
    110111 */ 
    111112function bw_trace_anonymize_symlinked_file( $file ) { 
     113     
    112114  $fil = str_replace( "\\", "/", $file ); 
    113115    //$fil = strtolower( $fil ); 
    114116  global $wp_plugin_paths; 
    115117     
    116     if ( count( $wp_plugin_paths ) ) { 
     118    if ( is_array( $wp_plugin_paths) && count( $wp_plugin_paths ) ) { 
    117119      foreach ( $wp_plugin_paths as $plugin => $real_plugin ) { 
    118120            if ( !$real_plugin ) { 
     
    286288    $id = $GLOBALS['id']; 
    287289    if ( $id <> $post_id ) {  
    288       $post_id .= "<>" . $id;  
     290            if ( is_scalar( $id ) ) { 
     291                $post_id .= "<>" . $id;  
     292            } 
    289293    } 
    290294  } 
     
    310314 * Trace the current memory/peak usage, if required 
    311315 *  
     316 * Now traces real memory usages, not just that allocated by emalloc() 
     317 *  
     318 * Optionally, trace the current value of the memory_limit 
     319 *  
    312320 */ 
    313321function bw_get_memory_usage() { 
     
    315323    $memory = null; 
    316324    if ( $bw_trace_memory ) { 
    317         $memory .= memory_get_usage();  
    318         $peak = memory_get_peak_usage(); 
     325        $memory .= memory_get_usage( true );  
     326        $peak = memory_get_peak_usage( true ); 
    319327        $memory .= "/$peak"; 
     328        $memory .= " "; 
     329        $memory .= ini_get( "memory_limit" ); 
    320330        $memory .= " ";  
    321331    } 
     
    339349  if ( $saved != $bwechos ) { 
    340350    $ret = "@#:"; 
    341     $ret .= count( $bwecho_array);  
     351        if ( is_array( $bwecho_array ) ) { 
     352            $ret .= count( $bwecho_array);  
     353        } else { 
     354            $ret .= "0"; 
     355        } 
    342356    $ret .= " $bwechos "; 
    343357    $ret .= strlen( $bwecho );  
     
    437451 */ 
    438452function bw_trace_print_r( $text ) { 
    439  
     453    //echo "counting handlers" . PHP_EOL; 
    440454    $handlers = ob_list_handlers(); 
     455    //echo "handlers:" . count( $handlers ) . PHP_EOL; 
    441456    if ( count( $handlers ) > 1 ) { 
    442457    // if ( ob_get_level() ) { 
     
    447462    return( $output ); 
    448463} 
    449  
    450  
    451 /** 
    452464 
    453465/** 
     
    480492    } 
    481493     
    482     if (is_array($var)) { 
     494    if ( is_array( $var ) ) { 
    483495        $title = "Array"; 
    484     } elseif (is_object($var)) { 
    485         $title = get_class($var)." Object"; 
     496    } elseif ( is_object( $var ) ) { 
     497        $title = get_class( $var )." Object"; 
    486498        $var = (array) $var; 
    487499    } else { 
     
    491503        $output = $title . $newline . $newline; 
    492504        foreach ($var as $key => $value) { 
    493             if (is_array($value) || is_object($value)) { 
    494                 if ( $value instanceof Closure ) { 
    495                  $value = 'Closure'; 
     505         
     506            if (is_array( $value ) || is_object( $value) ) { 
     507                if ( is_array( $value ) && 0 == count( $value ) ) { 
     508                        $value = "Array"; 
     509                }   elseif ( is_object( $value ) && $value instanceof Closure ) { 
     510                     $value = 'Closure'; 
    496511                } else { 
    497                     if (isset($visitedVars[md5(serialize($value))])) { 
    498                         $value = '*RECURSION*'; 
     512                    try { 
     513                        $md5_serialize = md5( serialize( $value ) ); 
     514                    } 
     515                    catch   ( Exception $e ) { 
     516                        $md5_serialize = "Nested closure? $key"; 
     517                    } 
     518                    if ( isset( $visitedVars[ $md5_serialize ] ) ) { 
     519                        $value = "*RECURSION* " . $visitedVars[ $md5_serialize] ; 
    499520                    } else { 
    500                         $visitedVars[md5(serialize($value))] = true; 
     521                        $visitedVars[ $md5_serialize ] = "$key $level"; 
    501522                        $level++; 
    502523                        $value = bw_trace_obsafe_print_r( $value, $level, $visitedVars); 
    503524                        $level--; 
    504525                    } 
    505                 }    
     526                }        
    506527            } else { 
    507528                $value = '('.gettype($value).') '.(is_string($value) ? '"' : '').$value.(is_string($value) ? '"' : ''); 
     
    770791}  
    771792 
    772  
    773793/** 
    774794 * Perform a trace reset 
    775795 * 
    776  * We shouldn't do this if we're not tracing the specific IP 
    777  * 
     796 * If the trace file exists and is writable then we can attempt to unlink it. 
     797 * We precede the call to unlink with an @ to attempt to avoid getting warning messages. 
     798 *  
     799 * This file may not exist so we have two choices. 1. precede with an @, 2. test for it 
     800 * but if $file is not set then we should test 
     801  
     802 * Note: We shouldn't be doing this if we're not tracing the specific IP. 
    778803 *  
    779804 */ 
    780805function bw_trace_reset() { 
    781   static $reset_done = false;  
    782    
    783   //global $bw_trace_options;    
    784   //$reset_done = bw_array_get( $bw_trace_options, 'reset_done', false ); 
    785   if ( ! $reset_done ) { 
    786     $file = bw_trace_file(); 
    787     // This file may not exist so we have two choices. 1. precede with an @, 2. test for it 
    788     // but if $file is not set then we should test 
    789     if ( is_file($file) ) { 
    790       unlink( $file );  
    791        
    792     } 
    793     // echo( "<p>Attempted to unlink: $file</p>" );   
    794     //$bw_trace_options['reset_done'] = true;  
    795   }  
    796   $reset_done = true; 
    797        
     806    static $reset_done = false;  
     807    if ( ! $reset_done ) { 
     808        $file = bw_trace_file(); 
     809        if ( is_file($file) ) { 
     810            if ( is_writable( $file ) ) { 
     811                @unlink( $file ); 
     812            } else { 
     813                // We can't unlink the file at the moment - never mind eh? 
     814            }  
     815        } 
     816    }  
     817    $reset_done = true; 
    798818}  
    799819 
    800  
    801  
     820/** 
     821 *  
     822 */ 
    802823function bw_trace_errors( $level ) { 
    803824  error_reporting( $level ); 
    804    
    805825  @ini_set('display_errors', 1); 
    806826} 
     
    845865 * 
    846866 * The output from debug_backtrace() is an array - from 0 to n of the calls 
    847  * [file] is the file name 
    848  * [line] is the line number 
    849  * [function] is the method used to get the file: include, require_once 
    850  * [args] are parameters 
    851  * [class] 
    852  * [object] 
    853  * [type] -> = method call,  :: = static method call, nothing for function call 
    854  *  
    855  
     867 *  
     868 * - [file] is the file name 
     869 * - [line] is the line number 
     870 * - [function] is the method used to get the file: include, require_once 
     871 * - [args] are parameters 
     872 * - [class] 
     873 * - [object] 
     874 * - [type] -> = method call,  :: = static method call, nothing for function call 
     875 *  
     876 * ` 
    856877 C:\apache\htdocs\wordpress\wp-content\themes\hsoh0922bp\functions.php(12:0) 2011-09-27T16:22:49+00:00   backtrace Array 
    857878( 
     
    912933 
    913934) 
     935 `  
    914936*/ 
    915937function bw_lazy_backtrace() { 
     
    944966            } elseif ( is_array( $targ ) ) { 
    945967              $function .= $sep."array"; 
    946             } else {  
     968            } elseif ( is_scalar( $targ ) ) { 
    947969              $function .= $sep.$targ ; 
     970                        } else { 
     971                            $function .= $sep."unsupported" ; 
    948972            }   
    949973            $sep = ','; 
     
    10371061 * 
    10381062 * Recommended level is "Information level" 
    1039  * as this will included Notice, Warning and Error level trace records as well 
     1063 * as this will include Notice, Warning and Error level trace records as well 
    10401064 * 
    10411065 * @return array Trace levels  
    10421066 */ 
    10431067function bw_list_trace_levels() { 
    1044     $levels = array( BW_TRACE_DEBUG => "Debug level" 
    1045                    , BW_TRACE_INFO => "Information level - standard" 
    1046                                  , BW_TRACE_NOTICE => "Notice level" 
    1047                                  , BW_TRACE_WARNING => "Warning level"  
    1048                                  , BW_TRACE_ERROR => "Error level" 
    1049                                  , BW_TRACE_VERBOSE => "Verbose level - noisier than Debug" 
     1068    $levels = array( BW_TRACE_DEBUG => __( "Debug level", "oik-bwtrace" ) 
     1069                                 , BW_TRACE_INFO => __( "Information level - standard", "oik-bwtrace" ) 
     1070                                 , BW_TRACE_NOTICE => __( "Notice level", "oik-bwtrace" ) 
     1071                                 , BW_TRACE_WARNING => __( "Warning level" , "oik-bwtrace" ) 
     1072                                 , BW_TRACE_ERROR => __( "Error level", "oik-bwtrace" ) 
     1073                                 , BW_TRACE_VERBOSE => __( "Verbose level - noisier than Debug", "oik-bwtrace" ) 
    10501074                                 ); 
    10511075    return( $levels ); 
    10521076} 
    10531077 
     1078/** 
     1079 * Trace the trace startup 
     1080 * 
     1081 * Notes:  
     1082 * - The merging of $_GET and $_POST data into $_REQUEST depends on php.ini settings. @link http://php.net/request-order 
     1083 * - wp_magic_quotes() is normally called after this function has been run, since it's invoked after plugins have been loaded. 
     1084 * - wp_magic_quotes() adds the 'sometimes unwanted' backslashes to $_GET, $_POST, $_COOKIE and $_SERVER. 
     1085 * - wp_magic_quotes() also remerges $_GET and $_POST into $_REQUEST. 
     1086 * - Other plugins and themes can fiddle with these superglobals. 
     1087 */ 
    10541088function bw_trace_trace_startup() { 
    10551089    global $bw_trace_level, $bw_trace_options, $bw_action_options; 
     
    10571091    $trace_level_text = bw_array_get( $levels, $bw_trace_level, "Unknown" ); 
    10581092    bw_trace2( $bw_trace_level, "Trace level: $trace_level_text", false ); 
     1093    //bw_lazy_backtrace(  ); 
    10591094    bw_lazy_trace( $_SERVER, __FUNCTION__, __LINE__, __FILE__, "_SERVER" ); 
    10601095    bw_lazy_trace( $_REQUEST, __FUNCTION__, __LINE__, __FILE__, "_REQUEST" ); 
    1061     //bw_lazy_trace( $_POST, __FUNCTION__, __LINE__, __FILE__, "_POST" ); 
    1062     //bw_lazy_trace( $_GET, __FUNCTION__, __LINE__, __FILE__, "_GET" ); 
    10631096    if ( $bw_trace_level >= BW_TRACE_DEBUG ) { 
     1097        bw_lazy_trace( $_GET, __FUNCTION__, __LINE__, __FILE__, "_GET" ); 
     1098        bw_lazy_trace( $_POST, __FUNCTION__, __LINE__, __FILE__, "_POST" ); 
     1099        if ( $bw_trace_level >= BW_TRACE_VERBOSE ) { 
     1100            bw_lazy_trace( $_COOKIE, __FUNCTION__, __LINE__, __FILE__, "_COOKIE" ); 
     1101        } 
    10641102        bw_lazy_trace( ABSPATH . $bw_trace_options['file'], __FUNCTION__, __LINE__, __FILE__, 'tracelog' ); 
    10651103        bw_lazy_trace( bw_getlocale(), __FUNCTION__, __LINE__, __FILE__, "locale" ); 
  • oik-bwtrace/trunk/includes/oik-action-counts.php

    r1253490 r1790744  
    1 <?php // (C) Copyright Bobbing Wide 2014, 2015 
     1<?php // (C) Copyright Bobbing Wide 2014-2016 
    22 
    33/** 
     
    4343/** 
    4444 * Turn on action hook and filter counting  
     45 *  
     46 *  
    4547 */ 
    4648function bw_trace_count_on() { 
     
    4951  if ( !isset( $bw_action_counts ) ) { 
    5052    $bw_action_counts = array(); 
    51         bw_trace2( "reset bw_action_counts", null, false, BW_TRACE_DEBUG ); 
     53        bw_trace2( "reset bw_action_counts", null, false, BW_TRACE_VERBOSE ); 
    5254  } 
    5355  $bw_count_on = true; 
     
    6870 */ 
    6971function bw_lazy_trace_count() { 
    70   bw_trace2( "Initialising action counts", null, false, BW_TRACE_DEBUG ); 
    71   add_action( "all", "bw_trace_count_all", 10, 2 ); 
    72   add_action( "shutdown", "bw_trace_count_report" );  
     72    bw_trace2( "Initialising action counts", null, false, BW_TRACE_VERBOSE ); 
     73    oik_require( "includes/oik-actions.php", "oik-bwtrace" ); 
     74    add_action( "all", "bw_trace_count_all", 10, 2 ); 
     75    add_action( "shutdown", "bw_trace_count_report" );  
    7376} 
    7477 
     
    8285    bw_action_options(); 
    8386    bw_trace_add_selected_actions(); 
    84      
    8587} 
    8688 
     
    9698 * We subtract 1 from the number of args passed to this function; it gives the value needed when registering an action hook or filter. 
    9799 *  
     100 * @param string $tag the action or filter hook 
     101 * @param array $args2 - doesn't matter - we use func_num_args() 
    98102 */ 
    99103function bw_trace_count_all( $tag, $args2=null ) { 
     
    149153     
    150154        arsort( $merged ); 
    151         bw_trace( $merged, __FUNCTION__, __LINE__, __FILE__, "most used" ); 
     155        //bw_trace( $merged, __FUNCTION__, __LINE__, __FILE__, "most used" ); 
     156        bw_trace_create_hook_links( $merged, "most used", true ); 
    152157     
    153158        ksort( $merged ); 
    154         bw_trace( $merged, __FUNCTION__, __LINE__, __FILE__, "by hook name" ); 
     159        //bw_trace( $merged, __FUNCTION__, __LINE__, __FILE__, "by hook name" ); 
     160        bw_trace_create_hook_links( $merged, "by hook name" ); 
    155161     
    156162        bw_trace( count( $merged), __FUNCTION__, __LINE__, __FILE__, "count hooks" ); 
     
    164170} 
    165171 
    166 /**  
    167  * Return the hook type 
    168  *  
    169  */  
    170 function bw_trace_get_hook_type( $hook ) { 
    171     global $wp_actions; 
    172     if ( isset( $wp_actions[ $hook ] ) ){ 
    173         $type = "action"; 
    174     } else { 
    175         $type = "filter"; 
    176     } 
    177     return( $type ); 
    178 } 
     172// Moved bw_trace_get_hook_type to includes\oik-actions.php 
    179173 
    180174/** 
     
    182176 * 
    183177 * It should not be ? 
     178 *  
     179 * @param $hook the hook name 
     180 * @return integer 
    184181 */ 
    185182function bw_trace_get_hook_num_args( $hook ) { 
     
    187184    if ( isset( $bw_action_parms[ $hook ] ) ) { 
    188185        $num_args = $bw_action_parms[ $hook ]; 
    189         if ( 0 === $num_args ) { 
    190             $num_args = ''; 
    191         } 
     186        //if ( 0 === $num_args ) { 
     187        //  $num_args = ''; 
     188        //} 
    192189  } else { 
    193190        $num_args = '?';  
     
    200197 *  
    201198 * @param array $action_counts - array of action counts, which may also contain filter counts 
    202  * @param string $heading - a heading for this sections 
    203  *  
    204  */ 
    205 function bw_trace_create_hook_links( $action_counts, $heading ) { 
     199 * @param string $heading - a heading for this section 
     200 * @param bool $implemented - restrict output to hooks which are implemented 
     201 */ 
     202function bw_trace_create_hook_links( $action_counts, $heading, $implemented=false ) { 
    206203    $hook_links = "<h3>$heading</h3>"; 
    207     $hook_links .= "[bw_csv]Hook,Invoked"; 
     204    $hook_links .= bw_trace_get_hook_links( $action_counts, $implemented ); 
     205    bw_trace2( $hook_links, "hook_links", false );  
     206} 
     207 
     208/** 
     209 * Return the number of attached hooks 
     210 * 
     211 * If we know that there are attached hooks then we can probably 
     212 * save some time by removing them. It depends what they do. 
     213 * You can find out more about the attached hooks by using ad hoc trace 
     214 *   
     215 * @param string $hook 
     216 * @return integer the number of attached hook functions 
     217 */ 
     218function bw_trace_get_attached_hook_count( $hook ) { 
     219    $count_hooks = 0; 
     220    global $wp_filter; 
     221    $hooks = bw_array_get( $wp_filter, $hook, array() ); 
     222    //print_r( $hooks ); 
     223    if ( is_array( $hooks ) ) {  
     224        $count_hooks = count( $hooks ); 
     225    }    
     226    if ( $count_hooks ) { 
     227        $count_hooks = 0; 
     228        foreach ( $hooks as $priority => $functions ) { 
     229            $count_hooks += count( $functions ); 
     230        } 
     231    } 
     232    //echo $count_hooks; 
     233    //print_r( $hooks ); 
     234    //bog(); 
     235    return( $count_hooks ); 
     236} 
     237 
     238/** 
     239 * Return the [hook] links shortcodes 
     240 *  
     241 * The implemented parameter allows us to reduce the output to only those hooks where 
     242 * an action hook is implemeted. This makes it a lot easier to find things that actually do things. 
     243 * 
     244 * @param array $action_counts 
     245 * @param bool $implemented true to restricted output to hooks which are implemented 
     246 * @return string bw_csv shortcode with hook link shortcode 
     247 */ 
     248function bw_trace_get_hook_links( $action_counts, $implemented=false ) { 
     249    //$hook_links = "[bw_csv]Hook,Invoked"; 
     250    $hook_links = null; 
    208251    $type = null; 
    209252    $num_args = null; 
    210253    if ( count( $action_counts ) ) { 
    211254        foreach ( $action_counts as $hook => $count ) { 
    212             $hook_links .= PHP_EOL; 
    213255            $hooks = explode( ";", $hook ); 
    214256            $end_hook = end( $hooks ); 
    215             $type = bw_trace_get_hook_type( $end_hook ); 
    216             $num_args = bw_trace_get_hook_num_args( $end_hook ); 
    217             $hook_links .= "[hook $hook $type $num_args],$count"; 
     257            $attached = bw_trace_get_attached_hook_count( $end_hook );  
     258            if ( $attached || ( false === $implemented ) ) { 
     259                $type = bw_trace_get_hook_type( $end_hook ); 
     260                $num_args = bw_trace_get_hook_num_args( $end_hook ); 
     261                $hook_links .= PHP_EOL; 
     262                $hook_links .= "[hook $hook $type $num_args $count $attached]"; 
     263            }    
    218264        } 
    219265    } 
    220 $hook_links .= "[/bw_csv]"; 
    221 bw_trace2( $hook_links, "hook_links", false );  
    222  
    223 } 
     266    //$hook_links .= "[/bw_csv]"; 
     267    return( $hook_links ); 
     268}    
    224269 
    225270/** 
  • oik-bwtrace/trunk/includes/oik-actions.php

    r1345819 r1790744  
    7474 */ 
    7575function bw_trace_included_files() {  
     76    $files = PHP_EOL; 
     77  $files .= "<h3>Files</h3>";  
     78    $files .= bw_trace_get_included_files(); 
     79  bw_trace( $files, __FUNCTION__, __LINE__, __FILE__, "included files" ); 
     80} 
     81 
     82/** 
     83 * Return the shortcode for included files 
     84 * 
     85 * @return string shortcode for included files 
     86 */ 
     87function bw_trace_get_included_files() { 
    7688  $included_files = get_included_files(); 
    77     bw_trace2( $included_files, "included_files", false, BW_TRACE_DEBUG ); 
     89    bw_trace2( $included_files, "included_files", false, BW_TRACE_VERBOSE ); 
    7890  global $bw_trace_anonymous; 
    7991  $anon = $bw_trace_anonymous; 
    8092  $bw_trace_anonymous = true; 
    81     $files = PHP_EOL; 
    82   $files .= "<h3>Files</h3>";  
    83     $files .= PHP_EOL; 
    84     $files .= "[bw_csv uo=u]File"; 
     93    //$files = "[bw_csv uo=u]File"; 
    8594  //$lose = str_replace( "/", "\\", ABSPATH ); 
     95    $files = null; 
    8696  foreach ( $included_files as $file ) { 
    8797        $original = $file; 
     
    97107    $files .= PHP_EOL . "[file $file $original]"; 
    98108  } 
    99     $files .= PHP_EOL . "[/bw_csv]"; 
     109    //$files .= PHP_EOL . "[/bw_csv]"; 
    100110  $bw_trace_anonymous = $anon; 
    101   bw_trace( $files, __FUNCTION__, __LINE__, __FILE__, "included files" ); 
     111    return( $files ); 
    102112} 
    103113 
     
    121131 */ 
    122132function bw_trace_saved_queries() { 
    123     global $wpdb; 
    124     $elapsed_query_time = 0; 
    125   if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES == true ) { 
    126  
    127  
    128     bw_trace2( $wpdb, "saved queries", false );  
    129     if ( count( $wpdb->queries ) ) { 
    130       $count = 0; 
    131       $record = "<h3>Queries</h3>" . PHP_EOL; 
    132       $record .= "[bw_csv]#,Elapsed,Query" . PHP_EOL; 
    133       foreach ( $wpdb->queries as $key => $query ) { 
    134         $count++; 
    135         $execution = $query[1]; 
    136         $query_string = $query[0]; 
    137         $record .= $count; 
    138         $record .= ','; 
    139         $record .= number_format( $execution, 6 );  
    140         $record .= ','; 
    141         $record .= str_replace( ",", "&comma;", $query_string); 
    142         $record .= PHP_EOL; 
    143         $elapsed_query_time += $execution; 
    144       } 
    145       $record .= $count . ',' . $elapsed_query_time . ",Total" . PHP_EOL; 
    146       $record .= "[/bw_csv]"; 
    147       bw_trace2( $record, "Queries: {$wpdb->num_queries} in $elapsed_query_time", false ); 
    148     } 
    149  
    150   } 
    151     $wpdb->elapsed_query_time = $elapsed_query_time; 
     133    global $wpdb; 
     134    if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES == true ) { 
     135        bw_trace2( $wpdb, "saved queries", false );  
     136        $record = PHP_EOL . "<h3>Queries</h3>" . PHP_EOL; 
     137        $record .= bw_trace_get_saved_queries(); 
     138        bw_trace2( $record, "Queries: {$wpdb->num_queries} in {$wpdb->elapsed_query_time}", false ); 
     139    } 
     140} 
     141 
     142/** 
     143 * Return the saved queries 
     144 * 
     145 * Create a set of [bw_sql] shortcodes with format as in this example 
     146 *  
     147 * ` 
     148 * [bw_sql 1 1.2 get_post_meta]SELECT option_value FROM wp_options WHERE option_name = 'auto_core_update_failed' LIMIT 1,get_option[/bw_sql] 
     149 * ` 
     150 * 
     151 * @return string saved queries  
     152 */ 
     153function bw_trace_get_saved_queries() { 
     154    global $wpdb; 
     155    $elapsed_query_time = 0; 
     156    $wpdb->elapsed_query_time = $elapsed_query_time; 
     157    $record = null; 
     158    if ( count( $wpdb->queries ) ) { 
     159        $count = 0; 
     160        //$record .= "[bw_csv]#,Elapsed,Query,Function" . PHP_EOL; 
     161        foreach ( $wpdb->queries as $key => $query ) { 
     162            $count++; 
     163            $execution = $query[1]; 
     164            $query_string = $query[0]; 
     165            $query_string = str_replace( array( ",", "\n") , array( "&comma; ", " " ), $query_string); 
     166            $record .= "[bw_sql "; 
     167            $record .= $count; 
     168            $record .= ' '; 
     169            $record .= number_format( $execution, 6 );  
     170            $record .= ' '; 
     171            $record .= bw_trace_get_last_query_function( $query[2] ); 
     172            $record .= ']'; 
     173            $record .= $query_string; 
     174            $record .= '[/bw_sql]'; 
     175            $record .= PHP_EOL; 
     176            $elapsed_query_time += $execution; 
     177        } 
     178        //$record .= $count . ',' . $elapsed_query_time . ",Total" . PHP_EOL; 
     179        //$record .= "[/bw_csv]"; 
     180    } 
     181     
     182    $wpdb->elapsed_query_time = $elapsed_query_time; 
     183    return( $record ); 
     184} 
     185 
     186/** 
     187 * Find the function that performed the query 
     188 * 
     189 * @param string $backtrace the formatted backtrace from $wpdb 
     190 * @return string the function or method with '->' converted to '::' 
     191 */ 
     192function bw_trace_get_last_query_function( $backtrace ) { 
     193    $functions = explode( ",", $backtrace ); 
     194    $last = end( $functions ); 
     195    $last = trim( $last ); 
     196    $last = str_replace( "->", "::", $last ); 
     197    return( $last ); 
    152198} 
    153199 
     
    167213 * Trace the results and echo a comment? 
    168214 * 
     215 * @param string $value 
     216 * @param string $text 
     217 * @param bool $extra   - 3rd parm to bw_trace2() 
    169218 */ 
    170219function bw_trace_trace2( $value, $text, $extra=false ) { 
     
    178227 * But only when it's safe to do so. 
    179228 * 
    180  * * When the request is not an AJAX request 
    181  * * When the request is not a JSON request 
    182  * * When the request is not for robots.txt 
    183  * * When the request is not an aysnc-upload of a new file ( $_REQUEST contains "short" ) 
    184  * * Or a SiteGround cach check 
    185  * * and other situations we don't yet know about 
    186  * 
    187  * Uses c()?   
     229 * Uses c()?... which requires libs/bobbfunc.php  
     230 * 
     231 * @param string $value value to be written 
     232 * @param string $text contextual label  
     233 * @param string $extra 3rd parm to bw_trace2() - future use 
    188234 */  
    189235function bw_trace_c3( $value, $text, $extra=false ) { 
    190   //  bw_trace2( DOING_AJAX, "doing_ajax?", false ); 
    191   //bw_trace2( $_REQUEST, "request", false );   
    192   if ( defined('DOING_AJAX') && DOING_AJAX ) { 
    193     // Not safe to echo here 
    194   } elseif ( defined( 'JSON_REQUEST' ) && JSON_REQUEST ) { 
    195     // Nor here 
    196   } elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { 
    197     } elseif ( did_action( "do_robotstxt" ) ) { 
    198   } else { 
    199     $short = bw_array_get( $_REQUEST, "short", null ); 
    200     if ( !$short ) { 
    201       $short = bw_array_get( $_REQUEST, "sgCacheCheck", null ); 
    202     } 
    203     if ( $short ) { 
    204       // Not safe here either! 
    205     } else { 
    206       c( "$text:$value\n"); 
    207     }  
    208       
    209   } 
     236    if ( bw_trace_ok_to_echo() ) { 
     237        if ( function_exists( "c" ) ) { 
     238            c( "$text:$value\n"); 
     239        }    
     240  }  
    210241  bw_trace_vt( $value, $text ); 
    211242} 
     
    429460 * 
    430461 * Note: The columns are dynamically created from the fields recorded by bw_trace_status_report() 
    431  *  
    432  * 0 - request 
    433  * 1 - AJAX action 
    434  * 2 - elapsed ( final figure ) 
    435  * 3 - PHP version 
    436  * 4 - PHP functions 
    437  * 5 - User functions 
    438  * 6 - Classes 
    439  * 7 - Plugins 
    440  * 8 - Files 
    441  * 9 - Registered Widgets 
    442  * 10 - Post types 
    443  * 11 - Taxonomies 
    444  * 12 - Queries 
    445  * 13 - Query time 
    446  * 14 - Trace file 
    447  * 15 - Trace records 
    448  * 16 - Remote address ( IP address ) 
    449  * 17 - Elapsed 
    450  * 18 - Date - ISO 8601 date  
     462 * 
     463 * Index | Field 
     464 * ----- | -----------  
     465 * 0 | request 
     466 * 1 | AJAX action 
     467 * 2 | elapsed ( final figure ) 
     468 * 3 | PHP version 
     469 * 4 | PHP functions 
     470 * 5 | User functions 
     471 * 6 | Classes 
     472 * 7 | Plugins 
     473 * 8 | Files 
     474 * 9 | Registered Widgets 
     475 * 10 | Post types 
     476 * 11 | Taxonomies 
     477 * 12 | Queries 
     478 * 13 | Query time 
     479 * 14 | Trace file 
     480 * 15 | Trace records 
     481 * 16 | Remote address ( IP address ) 
     482 * 17 | Elapsed 
     483 * 18 | Date - ISO 8601 date  
     484 * 19 | HTTP user agent 
     485 * 20 | REQUEST_METHOD 
    451486 */ 
    452487function bw_record_vt( $vnoisy=false ) { 
     
    470505     
    471506  $line .= PHP_EOL; 
    472   $file = ABSPATH . "bwtrace.vt." .  date( "md" ); 
     507    $file = bw_trace_vt_file(); 
    473508  bw_write( $file, $line ); 
    474509} 
     510 
     511/** 
     512 * Returns the 'vt' file name 
     513 *  
     514 * Format: bwtrace.vt.ccyymmdd 
     515 *  
     516 * For WPMS this includes the blog ID, but not the site ID 
     517 * 
     518 * Format: bwtrace.vt.mmdd.blog_ID 
     519 * 
     520 * @return string Fully qualified file name 
     521 */ 
     522function bw_trace_vt_file() { 
     523  $file = ABSPATH . "bwtrace.vt." .  date( "Ymd" ); 
     524    global $blog_id;  
     525    bw_trace2( $blog_id, "blog_id !$blog_id!", false, BW_TRACE_VERBOSE ); 
     526    if ( $blog_id != 1 ) { 
     527        $file .= ".$blog_id"; 
     528    }  
     529    return( $file ); 
     530} 
     531 
    475532 
    476533/** 
     
    497554    */ 
    498555    return( $http_user_agent ); 
    499 }    
     556} 
     557 
     558/**  
     559 * Return the hook type 
     560 * 
     561 * We can tell it's an 'action' hook if it's listed in $wp_actions 
     562 * If not it's a 'filter'. 
     563 * 
     564 * @param string $hook 
     565 * @return string "action" | "filter"  
     566 */  
     567function bw_trace_get_hook_type( $hook ) { 
     568    global $wp_actions; 
     569    if ( isset( $wp_actions[ $hook ] ) ){ 
     570        $type = "action"; 
     571    } else { 
     572        $type = "filter"; 
     573    } 
     574    return( $type ); 
     575} 
     576 
     577/** 
     578 * Return true if it's OK to echo HTML comments and such 
     579 * 
     580 * It's not safe to echo when: 
     581 * 
     582 * * the request is an AJAX request 
     583 * * the request is a JSON request 
     584 * * the request is for robots.txt 
     585 * * the request is an async|upload  
     586 * * the request is an async-upload of a new file ( $_REQUEST contains "short" ) 
     587 * * the request is a SiteGround cache check 
     588 * * and other situations we don't yet know about 
     589 * * the request was implemented as a REST API ! 
     590 */ 
     591function bw_trace_ok_to_echo() { 
     592    $ok = true; 
     593  if ( defined('DOING_AJAX') && DOING_AJAX ) { 
     594        $ok = false; 
     595  } elseif ( defined( 'JSON_REQUEST' ) && JSON_REQUEST ) { 
     596    $ok = false; 
     597  } elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { 
     598        $ok = false; 
     599  } elseif ( defined( 'REST_REQUEST' ) && REST_REQUEST ) { 
     600        $ok = false; 
     601    } elseif ( did_action( "do_robotstxt" ) ) { 
     602        $ok = false; 
     603    } elseif ( did_action( "load-async-upload.php" ) ) { 
     604        $ok = false; 
     605  } else { 
     606    $short = bw_array_get( $_REQUEST, "short", null ); 
     607    if ( !$short ) { 
     608      $short = bw_array_get( $_REQUEST, "sgCacheCheck", null ); 
     609    } 
     610    if ( $short ) { 
     611      $ok = false; 
     612    } else { 
     613            $ok = true; 
     614        } 
     615    } 
     616    return( $ok ); 
     617} 
    500618 
    501619 
  • oik-bwtrace/trunk/languages/oik-bwtrace-bb_BB.po

    r1253492 r1790744  
    1 # Copyright (C) 2015 oik bwtrace 
     1# Copyright (C) 2017 oik bwtrace 
    22# This file is distributed under the same license as the oik bwtrace package. 
    33msgid "" 
    44msgstr "" 
    5 "Project-Id-Version: oik bwtrace 2.0.6\n" 
     5"Project-Id-Version: oik bwtrace 2.1.1-beta-20171023\n" 
    66"Report-Msgid-Bugs-To: http://wordpress.org/tag/oik-bwtrace\n" 
    7 "POT-Creation-Date: 2015-09-14 20:21:59+00:00\n" 
     7"POT-Creation-Date: 2017-12-20 17:01:03+00:00\n" 
    88"MIME-Version: 1.0\n" 
    99"Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;\n" 
     
    1111"Content-Type: text/plain; charset=UTF-8\n" 
    1212"Content-Transfer-Encoding: 8bit\n" 
    13 "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n" 
     13"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n" 
    1414"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
    1515"Language-Team: LANGUAGE <LL@li.org>\n" 
    16 #: admin/oik-bwaction.inc:35 
    17 msgid " to be written" 
    18 msgstr " tO bE wrtietn" 
    19  
    20 #: admin/oik-bwaction.inc:264 
    21 msgid "Action" 
    22 msgstr "Aitocn" 
    23  
    24 #: admin/oik-bwaction.inc:265 
    25 msgid "Invocations" 
    26 msgstr "Iivtocnonas" 
    27  
    28 #: admin/oik-bwaction.inc:266 
    29 msgid "Elapsed" 
    30 msgstr "Eesalpd" 
    31  
    32 #: admin/oik-bwaction.inc:267 
    33 msgid "Average" 
    34 msgstr "Arveage" 
    35  
    36 #: admin/oik-bwtrace.inc:51 
     16#: admin/class-oik-trace-info.php:25 
     17msgid "Field" 
     18msgstr "Feild" 
     19 
     20 
     21#: admin/class-oik-trace-info.php:25 
     22msgid "Value" 
     23msgstr "Vlaue" 
     24 
     25 
     26#: admin/class-oik-trace-info.php:25 
     27msgid "Notes" 
     28msgstr "Ntoes" 
     29 
     30 
     31#: admin/class-oik-trace-info.php:50 
     32msgid "WordPress version" 
     33msgstr "WroPderss vreison" 
     34 
     35 
     36#: admin/class-oik-trace-info.php:59 
     37msgid "Set to off for better detection of Notice: Undefined messages" 
     38msgstr "SEt tO Off fOr bteetr dteceiton Of Ntocie: Udnfenied mseasegs" 
     39 
     40 
     41#: admin/class-oik-trace-info.php:67 
     42msgid "Multisite" 
     43msgstr "Mluitiste" 
     44 
     45 
     46#: admin/oik-bwtrace.php:51 
    3747msgid "oik trace options" 
    38 msgstr "OIk tacre opiotns" 
    39  
    40 #: admin/oik-bwtrace.inc:61 
     48msgstr "OIk tarce otpoins" 
     49 
     50 
     51#: admin/oik-bwtrace.php:61 
    4152msgid "oik action options" 
    42 msgstr "OIk aicton optoins" 
    43  
    44 #: admin/oik-bwtrace.inc:71 
     53msgstr "OIk atcoin otpoins" 
     54 
     55 
     56#: admin/oik-bwtrace.php:72 
    4557msgid "action options" 
    46 msgstr "atoicn otoipns" 
    47  
    48 #: admin/oik-bwtrace.inc:72 admin/oik-bwtrace.inc:156 
     58msgstr "atcoin otpoins" 
     59 
     60 
     61#: admin/oik-bwtrace.php:73 admin/oik-bwtrace.php:121 
    4962msgid "Options" 
    50 msgstr "Opinots" 
    51  
    52 #: admin/oik-bwtrace.inc:115 
     63msgstr "Otpoins" 
     64 
     65 
     66#: admin/oik-bwtrace.php:74 admin/oik-bwtrace.php:122 
     67msgid "Information" 
     68msgstr "Ifnroamiton" 
     69 
     70 
     71#: admin/oik-bwtrace.php:93 
     72msgid "Count action hooks and filters" 
     73msgstr "Cuont atcoin hooks And flietrs" 
     74 
     75 
     76#: admin/oik-bwtrace.php:94 
     77msgid "Trace deprecated messages" 
     78msgstr "Tarce dpeeracetd mseasegs" 
     79 
     80 
     81#: admin/oik-bwtrace.php:95 
     82msgid "Trace Error, Warning and Notice messages" 
     83msgstr "Tarce Error, Wrainng And Ntocie mseasegs" 
     84 
     85 
     86#: admin/oik-bwtrace.php:96 
     87msgid "Trace 'wp' action" 
     88msgstr "Tarce 'wp' atcoin" 
     89 
     90 
     91#: admin/oik-bwtrace.php:97 
     92msgid "Trace 'wp' global wp_rewrite " 
     93msgstr "Tarce 'wp' golabl wp_rweirte " 
     94 
     95 
     96#: admin/oik-bwtrace.php:98 
     97msgid "Trace 'shutdown' included files" 
     98msgstr "Tarce 'suhdtwon' icnuledd flies" 
     99 
     100 
     101#: admin/oik-bwtrace.php:99 
     102msgid "Trace 'shutdown' saved queries" 
     103msgstr "Tarce 'suhdtwon' svaed qeuires" 
     104 
     105 
     106#: admin/oik-bwtrace.php:100 
     107msgid "Trace 'shutdown' output buffer" 
     108msgstr "Tarce 'suhdtwon' otuupt bfuefr" 
     109 
     110 
     111#: admin/oik-bwtrace.php:101 
     112msgid "Trace 'shutdown' trace functions count" 
     113msgstr "Tarce 'suhdtwon' tarce fnutcoins cuont" 
     114 
     115 
     116#: admin/oik-bwtrace.php:102 
     117msgid "Trace 'shutdown' status report and log in summary file" 
     118msgstr "Tarce 'suhdtwon' satuts rperot And lOg In smuamry flie" 
     119 
     120 
     121#: admin/oik-bwtrace.php:104 
    53122msgid "Other hooks to trace" 
    54 msgstr "Ohetr hokos tO tcrae" 
    55  
    56 #: admin/oik-bwtrace.inc:116 
     123msgstr "Ohter hooks tO tarce" 
     124 
     125 
     126#: admin/oik-bwtrace.php:105 
    57127msgid "Filter results to trace" 
    58 msgstr "Fetilr rltsues tO tcare" 
    59  
    60 #: admin/oik-bwtrace.inc:117 
     128msgstr "Flietr rseluts tO tarce" 
     129 
     130 
     131#: admin/oik-bwtrace.php:106 
    61132msgid "Trace the global post object" 
    62 msgstr "Tarce thE golbal psot obecjt" 
    63  
    64 #: admin/oik-bwtrace.inc:118 
     133msgstr "Tarce thE golabl psot ojbcet" 
     134 
     135 
     136#: admin/oik-bwtrace.php:107 
    65137msgid "Trace attached hook functions" 
    66 msgstr "Tcare ahtetcad hook funonicts" 
    67  
    68 #: admin/oik-bwtrace.inc:129 
    69 msgid "It needs to be used in conjunction with the trace facility." 
    70 msgstr "It nedes tO bE uesd In cntiocnojun wtih thE trcae falitciy." 
    71  
    72 #: admin/oik-bwtrace.inc:135 
    73 msgid "" 
    74 "Set Count action hooks and filters to count the number of times each action " 
    75 "or filter hook is invoked" 
    76 msgstr "" 
    77 "SEt Cnout atcoin hokos And friltes tO conut thE nebmur Of temis each aotcin " 
    78 "Or fietlr hook Is invkeod" 
    79  
    80 #: admin/oik-bwtrace.inc:141 
    81 msgid "You may find the most recent trace action output at..." 
    82 msgstr "YOU mAy fnid thE msot rnceet tacre aciotn optuut At..." 
    83  
    84 #: admin/oik-bwtrace.inc:145 
    85 msgid "The trace action log is reset at the same time as the trace log." 
    86 msgstr "ThE tarce atocin lOg Is reest At thE smae tmie As thE tarce lOg." 
    87  
    88 #: admin/oik-bwtrace.inc:155 
     138msgstr "Tarce attcaehd hook fnutcoins" 
     139 
     140 
     141#: admin/oik-bwtrace.php:108 
     142msgid "Hooks to debug backtrace" 
     143msgstr "Hooks tO dbeug bcatkarce" 
     144 
     145 
     146#: admin/oik-bwtrace.php:109 
     147msgid "'String watch' for this string" 
     148msgstr "'Srtnig wtach' fOr tihs srtnig" 
     149 
     150 
     151#: admin/oik-bwtrace.php:111 admin/oik-bwtrace.php:180 
     152msgid "Save changes" 
     153msgstr "Svae cahgnes" 
     154 
     155 
     156#: admin/oik-bwtrace.php:120 
    89157msgid "trace options" 
    90 msgstr "tcare opniots" 
    91  
    92 #: admin/oik-bwtrace.inc:157 
     158msgstr "tarce otpoins" 
     159 
     160 
     161#: admin/oik-bwtrace.php:123 
    93162msgid "Notes about oik trace" 
    94 msgstr "Notes aubot OIk tcare" 
    95  
    96 #: admin/oik-bwtrace.inc:158 
     163msgstr "Ntoes aobut OIk tarce" 
     164 
     165 
     166#: admin/oik-bwtrace.php:124 
    97167msgid "Trace options and reset button" 
    98 msgstr "Tacre oiponts And rseet botutn" 
    99  
    100 #: admin/oik-bwtrace.inc:181 
     168msgstr "Tarce otpoins And rseet btuotn" 
     169 
     170 
     171#: admin/oik-bwtrace.php:145 
    101172msgid "Trace file" 
    102 msgstr "Tcare flie" 
    103  
    104 #: admin/oik-bwtrace.inc:190 
     173msgstr "Tarce flie" 
     174 
     175 
     176#: admin/oik-bwtrace.php:146 
     177msgid "Reset trace file every transaction" 
     178msgstr "Rseet tarce flie eevry tarsncaiton" 
     179 
     180 
     181#: admin/oik-bwtrace.php:147 
     182msgid "Trace enabled" 
     183msgstr "Tarce eanlbed" 
     184 
     185 
     186#: admin/oik-bwtrace.php:149 
     187msgid "AJAX Trace file" 
     188msgstr "AAJX Tarce flie" 
     189 
     190 
     191#: admin/oik-bwtrace.php:150 
     192msgid "Reset AJAX trace file every AJAX transaction" 
     193msgstr "Rseet AAJX tarce flie eevry AAJX tarsncaiton" 
     194 
     195 
     196#: admin/oik-bwtrace.php:151 
     197msgid "AJAX Trace enabled" 
     198msgstr "AAJX Tarce eanlbed" 
     199 
     200 
     201#: admin/oik-bwtrace.php:157 
    105202msgid "Trace level" 
    106203msgstr "Tarce lveel" 
    107204 
    108 #: admin/oik-bwtrace.inc:218 
     205 
     206#: admin/oik-bwtrace.php:158 
     207msgid "Fully qualified file names" 
     208msgstr "Fluly qauilifed flie nmaes" 
     209 
     210 
     211#: admin/oik-bwtrace.php:159 
     212msgid "Include trace record count" 
     213msgstr "Icnulde tarce rcerod cuont" 
     214 
     215 
     216#: admin/oik-bwtrace.php:160 
     217msgid "Include timestamp" 
     218msgstr "Icnulde tmiseatmp" 
     219 
     220 
     221#: admin/oik-bwtrace.php:161 
     222msgid "Include current filter" 
     223msgstr "Icnulde cruernt flietr" 
     224 
     225 
     226#: admin/oik-bwtrace.php:162 
     227msgid "Include number of queries" 
     228msgstr "Icnulde nmuebr Of qeuires" 
     229 
     230 
     231#: admin/oik-bwtrace.php:163 
     232msgid "Include post ID" 
     233msgstr "Icnulde psot ID" 
     234 
     235 
     236#: admin/oik-bwtrace.php:166 
     237msgid "Include memory/peak usage ( limit %1$s )" 
     238msgstr "Icnulde mmeroy/paek uasge ( lmiit %1$s )" 
     239 
     240 
     241#: admin/oik-bwtrace.php:167 
     242msgid "Include files loaded count" 
     243msgstr "Icnulde flies laoedd cuont" 
     244 
     245 
     246#: admin/oik-bwtrace.php:171 
     247msgid "Current IP: %1$s" 
     248msgstr "Cruernt IP: %1$s" 
     249 
     250 
     251#: admin/oik-bwtrace.php:173 
     252msgid "Trace specific IP" 
     253msgstr "Tarce sepicifc IP" 
     254 
     255 
     256#: admin/oik-bwtrace.php:190 
    109257msgid "" 
    110258"The tracing output produced by oik-bwtrace can be used for problem " 
    111259"determination." 
    112260msgstr "" 
    113 "ThE tcriang otpuut pecrdoud by OIk-brctawe cAn bE uesd fOr peorblm " 
    114 "draoientmietn." 
    115  
    116 #: admin/oik-bwtrace.inc:219 
     261"ThE taricng otuupt porudecd by OIk-btwarce cAn bE uesd fOr porlbem " 
     262"dtereimaniton." 
     263 
     264 
     265#: admin/oik-bwtrace.php:191 
    117266msgid "It's not for the faint hearted." 
    118 msgstr "It's nOt fOr thE fniat hareetd." 
    119  
    120 #: admin/oik-bwtrace.inc:220 
     267msgstr "It's nOt fOr thE fiant haetred." 
     268 
     269 
     270#: admin/oik-bwtrace.php:192 
    121271msgid "" 
    122272"The oik-bwtrace plugin should <b>not</b> need to be activated on a live site." 
    123273msgstr "" 
    124 "ThE OIk-bwrtcae pugiln sulhod <b>not</b> need tO bE acetatvid On A lvie site." 
    125  
    126 #: admin/oik-bwtrace.inc:221 
     274"ThE OIk-btwarce pulign sohlud <b>not</b> need tO bE atcvitaed On A lvie stie." 
     275 
     276 
     277#: admin/oik-bwtrace.php:193 
    127278msgid "If you do need to activate it, only do so for a short period of time." 
    128 msgstr "If yOU dO need tO aivctate It, only dO sO fOr A shrot poreid Of tmie." 
    129  
    130 #: admin/oik-bwtrace.inc:223 
     279msgstr "If yOU dO need tO atcvitae It, olny dO sO fOr A sohrt preoid Of tmie." 
     280 
     281 
     282#: admin/oik-bwtrace.php:195 
    131283msgid "You will need to specify the trace file name (e.g. bwtrace.loh )" 
    132 msgstr "YOU wlil need tO sfpeciy thE tarce file name (E.g. bcawtre.lOh )" 
    133  
    134 #: admin/oik-bwtrace.inc:224 
     284msgstr "YOU wlil need tO sepicfy thE tarce flie nmae (E.g. btwarce.lOh )" 
     285 
     286 
     287#: admin/oik-bwtrace.php:196 
    135288msgid "When you want to trace processing check 'Trace enabled'" 
    136 msgstr "When yOU wnat tO trcae psncirsoeg ccehk 'Tacre eleanbd'" 
    137  
    138 #: admin/oik-bwtrace.inc:225 
     289msgstr "Wehn yOU wnat tO tarce porecssnig cehck 'Tarce eanlbed'" 
     290 
     291 
     292#: admin/oik-bwtrace.php:197 
    139293msgid "" 
    140294"Check 'Reset trace file every transaction' to cause the trace file to be " 
    141295"cleared for every request, including AJAX requests." 
    142296msgstr "" 
    143 "Cchek 'Reest tcrae flie erevy tairnotcsan' tO cuase thE tcrae file tO bE " 
    144 "cerlaed fOr eevry rsqeeut, icdiunlng AAJX ruesetqs." 
    145  
    146 #: admin/oik-bwtrace.inc:228 
     297"Cehck 'Rseet tarce flie eevry tarsncaiton' tO cuase thE tarce flie tO bE " 
     298"celraed fOr eevry rqeeust, icnulidng AAJX rqeeutss." 
     299 
     300 
     301#: admin/oik-bwtrace.php:200 
    147302msgid "You may find the most recent trace output at..." 
    148 msgstr "YOU mAy fnid thE msot rneect trcae ouuptt At..." 
    149  
    150 #: admin/oik-bwtrace.inc:233 
     303msgstr "YOU mAy fnid thE msot rcenet tarce otuupt At..." 
     304 
     305 
     306#: admin/oik-bwtrace.php:203 
     307msgid "View trace output in your browser." 
     308msgstr "Veiw tarce otuupt In yuor borswer." 
     309 
     310 
     311#: admin/oik-bwtrace.php:205 
    151312msgid "" 
    152313"If you want to trace processing within some content you can use two " 
    153314"shortcodes: [bwtron] to turn trace on and [bwtroff] to turn it off" 
    154315msgstr "" 
    155 "If yOU wnat tO tacre pirsseoncg witihn smoe cneotnt yOU cAn UsE twO " 
    156 "sedrohotcs: [bwtron] tO turn tcrae On And [bwtroff] tO trun It Off" 
    157  
    158 #: admin/oik-bwtrace.inc:249 
     316"If yOU wnat tO tarce porecssnig wtiihn smoe cnoetnt yOU cAn UsE twO " 
     317"sohtroceds: [bwtron] tO trun tarce On And [bwtroff] tO trun It Off" 
     318 
     319 
     320#: admin/oik-bwtrace.php:220 
     321msgid "" 
     322"Use the [bwtrace] shortcode in a widget to provide an instant trace reset " 
     323"and page reload." 
     324msgstr "" 
     325"UsE thE [bwtrace] sohtrocde In A wdiegt tO porivde An isnatnt tarce rseet " 
     326"And pgae rleaod." 
     327 
     328 
     329#: admin/oik-bwtrace.php:226 
    159330msgid "Activate the oik base plugin to enable the [bwtrace] shortcode" 
    160 msgstr "Acitvate thE OIk base piulgn tO ealnbe thE [bwtrace] srodcohte" 
    161  
    162 #: libs/bobbforms.php:462 
     331msgstr "Atcvitae thE OIk bsae pulign tO eanlbe thE [bwtrace] sohtrocde" 
     332 
     333 
     334#: includes/bwtrace.php:1068 
     335msgid "Debug level" 
     336msgstr "Dbeug lveel" 
     337 
     338 
     339#: includes/bwtrace.php:1069 
     340msgid "Information level - standard" 
     341msgstr "Ifnroamiton lveel - satdnrad" 
     342 
     343 
     344#: includes/bwtrace.php:1070 
     345msgid "Notice level" 
     346msgstr "Ntocie lveel" 
     347 
     348 
     349#: includes/bwtrace.php:1071 
     350msgid "Warning level" 
     351msgstr "Wrainng lveel" 
     352 
     353 
     354#: includes/bwtrace.php:1072 
     355msgid "Error level" 
     356msgstr "Error lveel" 
     357 
     358 
     359#: includes/bwtrace.php:1073 
     360msgid "Verbose level - noisier than Debug" 
     361msgstr "Vreobse lveel - nioiser tahn Dbeug" 
     362 
     363 
     364#: libs/bobbforms.php:510 
    163365msgid "None" 
    164366msgstr "Nnoe" 
    165367 
    166 #: libs/oik-admin.php:50 
    167 msgid "Click to toggle" 
    168 msgstr "Ccilk tO tgolge" 
     368 
     369#: libs/class-BW-.php:108 libs/oik-admin.php:69 
     370msgid "Toggle panel: %s" 
     371msgstr "Tgolge pnael: %s" 
     372 
    169373 
    170374#. Plugin Name of the plugin/theme 
    171375msgid "oik bwtrace" 
    172 msgstr "OIk brtwcae" 
     376msgstr "OIk btwarce" 
     377 
    173378 
    174379#. Plugin URI of the plugin/theme 
    175 msgid "http://www.oik-plugins.com/oik-plugins/oik-bwtrace" 
    176 msgstr "http://www.oik-plugins.com/oik-plugins/oik-bwtrace" 
     380msgid "https://www.oik-plugins.com/oik-plugins/oik-bwtrace" 
     381msgstr "https://www.oik-plugins.com/oik-plugins/oik-bwtrace" 
     382 
    177383 
    178384#. Description of the plugin/theme 
    179385msgid "Debug trace for WordPress, including action and filter tracing" 
    180 msgstr "Dubeg tcare fOr WdPoserrs, iucnndilg atiocn And fteilr tanricg" 
     386msgstr "Dbeug tarce fOr WroPderss, icnulidng atcoin And flietr taricng" 
     387 
    181388 
    182389#. Author of the plugin/theme 
    183390msgid "bobbingwide" 
    184 msgstr "bbinogibwde" 
     391msgstr "bboibgniwde" 
     392 
    185393 
    186394#. Author URI of the plugin/theme 
    187 msgid "http://www.oik-plugins.com/author/bobbingwide" 
    188 msgstr "http://www.oik-plugins.com/author/bobbingwide" 
    189  
     395msgid "https://www.oik-plugins.com/author/bobbingwide" 
     396msgstr "https://www.oik-plugins.com/author/bobbingwide" 
     397 
  • oik-bwtrace/trunk/languages/oik-bwtrace-en_GB.po

    r1253492 r1790744  
    1 # Copyright (C) 2015 oik bwtrace 
     1# Copyright (C) 2017 oik bwtrace 
    22# This file is distributed under the same license as the oik bwtrace package. 
    33msgid "" 
    44msgstr "" 
    5 "Project-Id-Version: oik bwtrace 1.28\n" 
     5"Project-Id-Version: oik bwtrace 2.1.1-beta-20171023\n" 
    66"Report-Msgid-Bugs-To: http://wordpress.org/tag/oik-bwtrace\n" 
    7 "POT-Creation-Date: 2015-07-22 12:12:46+00:00\n" 
     7"POT-Creation-Date: 2017-12-20 17:01:03+00:00\n" 
    88"MIME-Version: 1.0\n" 
    99"Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;\n" 
     
    1111"Content-Type: text/plain; charset=UTF-8\n" 
    1212"Content-Transfer-Encoding: 8bit\n" 
    13 "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n" 
     13"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n" 
    1414"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
    1515"Language-Team: LANGUAGE <LL@li.org>\n" 
    16 #: admin/oik-bwaction.inc:35 
    17 msgid " to be written" 
    18 msgstr "" 
    19  
    20 #: admin/oik-bwaction.inc:264 
    21 msgid "Action" 
    22 msgstr "" 
    23  
    24 #: admin/oik-bwaction.inc:265 
    25 msgid "Invocations" 
    26 msgstr "" 
    27  
    28 #: admin/oik-bwaction.inc:266 
    29 msgid "Elapsed" 
    30 msgstr "" 
    31  
    32 #: admin/oik-bwaction.inc:267 
    33 msgid "Average" 
    34 msgstr "" 
    35  
    36 #: admin/oik-bwtrace.inc:51 
     16#: admin/class-oik-trace-info.php:25 
     17msgid "Field" 
     18msgstr "Field" 
     19 
     20#: admin/class-oik-trace-info.php:25 
     21msgid "Value" 
     22msgstr "Value" 
     23 
     24#: admin/class-oik-trace-info.php:25 
     25msgid "Notes" 
     26msgstr "Notes" 
     27 
     28#: admin/class-oik-trace-info.php:50 
     29msgid "WordPress version" 
     30msgstr "WordPress version" 
     31 
     32#: admin/class-oik-trace-info.php:59 
     33msgid "Set to off for better detection of Notice: Undefined messages" 
     34msgstr "Set to off for better detection of Notice: Undefined messages" 
     35 
     36#: admin/class-oik-trace-info.php:67 
     37msgid "Multisite" 
     38msgstr "Multisite" 
     39 
     40#: admin/oik-bwtrace.php:51 
    3741msgid "oik trace options" 
    38 msgstr "" 
    39  
    40 #: admin/oik-bwtrace.inc:61 
     42msgstr "oik trace options" 
     43 
     44#: admin/oik-bwtrace.php:61 
    4145msgid "oik action options" 
    42 msgstr "" 
    43  
    44 #: admin/oik-bwtrace.inc:71 
     46msgstr "oik action options" 
     47 
     48#: admin/oik-bwtrace.php:72 
    4549msgid "action options" 
    46 msgstr "" 
    47  
    48 #: admin/oik-bwtrace.inc:72 admin/oik-bwtrace.inc:148 
     50msgstr "action options" 
     51 
     52#: admin/oik-bwtrace.php:73 admin/oik-bwtrace.php:121 
    4953msgid "Options" 
    50 msgstr "" 
    51  
    52 #: admin/oik-bwtrace.inc:121 
    53 msgid "It needs to be used in conjunction with the trace facility." 
    54 msgstr "" 
    55  
    56 #: admin/oik-bwtrace.inc:127 
    57 msgid "" 
    58 "Set Count action hooks and filters to count the number of times each action " 
    59 "or filter hook is invoked" 
    60 msgstr "" 
    61  
    62 #: admin/oik-bwtrace.inc:133 
    63 msgid "You may find the most recent trace action output at..." 
    64 msgstr "" 
    65  
    66 #: admin/oik-bwtrace.inc:137 
    67 msgid "The trace action log is reset at the same time as the trace log." 
    68 msgstr "" 
    69  
    70 #: admin/oik-bwtrace.inc:147 
     54msgstr "Options" 
     55 
     56#: admin/oik-bwtrace.php:74 admin/oik-bwtrace.php:122 
     57msgid "Information" 
     58msgstr "Information" 
     59 
     60#: admin/oik-bwtrace.php:93 
     61msgid "Count action hooks and filters" 
     62msgstr "Count action hooks and filters" 
     63 
     64#: admin/oik-bwtrace.php:94 
     65msgid "Trace deprecated messages" 
     66msgstr "Trace deprecated messages" 
     67 
     68#: admin/oik-bwtrace.php:95 
     69msgid "Trace Error, Warning and Notice messages" 
     70msgstr "Trace Error, Warning and Notice messages" 
     71 
     72#: admin/oik-bwtrace.php:96 
     73msgid "Trace 'wp' action" 
     74msgstr "Trace 'wp' action" 
     75 
     76#: admin/oik-bwtrace.php:97 
     77msgid "Trace 'wp' global wp_rewrite " 
     78msgstr "Trace 'wp' global wp_rewrite " 
     79 
     80#: admin/oik-bwtrace.php:98 
     81msgid "Trace 'shutdown' included files" 
     82msgstr "Trace 'shutdown' included files" 
     83 
     84#: admin/oik-bwtrace.php:99 
     85msgid "Trace 'shutdown' saved queries" 
     86msgstr "Trace 'shutdown' saved queries" 
     87 
     88#: admin/oik-bwtrace.php:100 
     89msgid "Trace 'shutdown' output buffer" 
     90msgstr "Trace 'shutdown' output buffer" 
     91 
     92#: admin/oik-bwtrace.php:101 
     93msgid "Trace 'shutdown' trace functions count" 
     94msgstr "Trace 'shutdown' trace functions count" 
     95 
     96#: admin/oik-bwtrace.php:102 
     97msgid "Trace 'shutdown' status report and log in summary file" 
     98msgstr "Trace 'shutdown' status report and log in summary file" 
     99 
     100#: admin/oik-bwtrace.php:104 
     101msgid "Other hooks to trace" 
     102msgstr "Other hooks to trace" 
     103 
     104#: admin/oik-bwtrace.php:105 
     105msgid "Filter results to trace" 
     106msgstr "Filter results to trace" 
     107 
     108#: admin/oik-bwtrace.php:106 
     109msgid "Trace the global post object" 
     110msgstr "Trace the global post object" 
     111 
     112#: admin/oik-bwtrace.php:107 
     113msgid "Trace attached hook functions" 
     114msgstr "Trace attached hook functions" 
     115 
     116#: admin/oik-bwtrace.php:108 
     117msgid "Hooks to debug backtrace" 
     118msgstr "Hooks to debug backtrace" 
     119 
     120#: admin/oik-bwtrace.php:109 
     121msgid "'String watch' for this string" 
     122msgstr "'String watch' for this string" 
     123 
     124#: admin/oik-bwtrace.php:111 admin/oik-bwtrace.php:180 
     125msgid "Save changes" 
     126msgstr "Save changes" 
     127 
     128#: admin/oik-bwtrace.php:120 
    71129msgid "trace options" 
    72 msgstr "" 
    73  
    74 #: admin/oik-bwtrace.inc:149 
     130msgstr "trace options" 
     131 
     132#: admin/oik-bwtrace.php:123 
    75133msgid "Notes about oik trace" 
    76 msgstr "" 
    77  
    78 #: admin/oik-bwtrace.inc:150 
     134msgstr "Notes about oik trace" 
     135 
     136#: admin/oik-bwtrace.php:124 
    79137msgid "Trace options and reset button" 
    80 msgstr "" 
    81  
    82 #: admin/oik-bwtrace.inc:174 
     138msgstr "Trace options and reset button" 
     139 
     140#: admin/oik-bwtrace.php:145 
    83141msgid "Trace file" 
    84 msgstr "" 
    85  
    86 #: admin/oik-bwtrace.inc:205 
     142msgstr "Trace file" 
     143 
     144#: admin/oik-bwtrace.php:146 
     145msgid "Reset trace file every transaction" 
     146msgstr "Reset trace file every transaction" 
     147 
     148#: admin/oik-bwtrace.php:147 
     149msgid "Trace enabled" 
     150msgstr "Trace enabled" 
     151 
     152#: admin/oik-bwtrace.php:149 
     153msgid "AJAX Trace file" 
     154msgstr "AJAX Trace file" 
     155 
     156#: admin/oik-bwtrace.php:150 
     157msgid "Reset AJAX trace file every AJAX transaction" 
     158msgstr "Reset AJAX trace file every AJAX transaction" 
     159 
     160#: admin/oik-bwtrace.php:151 
     161msgid "AJAX Trace enabled" 
     162msgstr "AJAX Trace enabled" 
     163 
     164#: admin/oik-bwtrace.php:157 
     165msgid "Trace level" 
     166msgstr "Trace level" 
     167 
     168#: admin/oik-bwtrace.php:158 
     169msgid "Fully qualified file names" 
     170msgstr "Fully qualified file names" 
     171 
     172#: admin/oik-bwtrace.php:159 
     173msgid "Include trace record count" 
     174msgstr "Include trace record count" 
     175 
     176#: admin/oik-bwtrace.php:160 
     177msgid "Include timestamp" 
     178msgstr "Include timestamp" 
     179 
     180#: admin/oik-bwtrace.php:161 
     181msgid "Include current filter" 
     182msgstr "Include current filter" 
     183 
     184#: admin/oik-bwtrace.php:162 
     185msgid "Include number of queries" 
     186msgstr "Include number of queries" 
     187 
     188#: admin/oik-bwtrace.php:163 
     189msgid "Include post ID" 
     190msgstr "Include post ID" 
     191 
     192#: admin/oik-bwtrace.php:166 
     193msgid "Include memory/peak usage ( limit %1$s )" 
     194msgstr "Include memory/peak usage ( limit %1$s )" 
     195 
     196#: admin/oik-bwtrace.php:167 
     197msgid "Include files loaded count" 
     198msgstr "Include files loaded count" 
     199 
     200#: admin/oik-bwtrace.php:171 
     201msgid "Current IP: %1$s" 
     202msgstr "Current IP: %1$s" 
     203 
     204#: admin/oik-bwtrace.php:173 
     205msgid "Trace specific IP" 
     206msgstr "Trace specific IP" 
     207 
     208#: admin/oik-bwtrace.php:190 
    87209msgid "" 
    88210"The tracing output produced by oik-bwtrace can be used for problem " 
    89211"determination." 
    90 msgstr "" 
    91  
    92 #: admin/oik-bwtrace.inc:206 
     212msgstr "The tracing output produced by oik-bwtrace can be used for problem determination." 
     213 
     214#: admin/oik-bwtrace.php:191 
    93215msgid "It's not for the faint hearted." 
    94 msgstr "" 
    95  
    96 #: admin/oik-bwtrace.inc:207 
     216msgstr "It's not for the faint hearted." 
     217 
     218#: admin/oik-bwtrace.php:192 
    97219msgid "" 
    98220"The oik-bwtrace plugin should <b>not</b> need to be activated on a live site." 
    99 msgstr "" 
    100  
    101 #: admin/oik-bwtrace.inc:208 
     221msgstr "The oik-bwtrace plugin should <b>not</b> need to be activated on a live site." 
     222 
     223#: admin/oik-bwtrace.php:193 
    102224msgid "If you do need to activate it, only do so for a short period of time." 
    103 msgstr "" 
    104  
    105 #: admin/oik-bwtrace.inc:210 
     225msgstr "If you do need to activate it, only do so for a short period of time." 
     226 
     227#: admin/oik-bwtrace.php:195 
    106228msgid "You will need to specify the trace file name (e.g. bwtrace.loh )" 
    107 msgstr "" 
    108  
    109 #: admin/oik-bwtrace.inc:211 
     229msgstr "You will need to specify the trace file name (e.g. bwtrace.loh )" 
     230 
     231#: admin/oik-bwtrace.php:196 
    110232msgid "When you want to trace processing check 'Trace enabled'" 
    111 msgstr "" 
    112  
    113 #: admin/oik-bwtrace.inc:212 
     233msgstr "When you want to trace processing check 'Trace enabled'" 
     234 
     235#: admin/oik-bwtrace.php:197 
    114236msgid "" 
    115237"Check 'Reset trace file every transaction' to cause the trace file to be " 
    116238"cleared for every request, including AJAX requests." 
    117 msgstr "" 
    118  
    119 #: admin/oik-bwtrace.inc:215 
     239msgstr "Check 'Reset trace file every transaction' to cause the trace file to be cleared for every request, including AJAX requests." 
     240 
     241#: admin/oik-bwtrace.php:200 
    120242msgid "You may find the most recent trace output at..." 
    121 msgstr "" 
    122  
    123 #: admin/oik-bwtrace.inc:220 
     243msgstr "You may find the most recent trace output at..." 
     244 
     245#: admin/oik-bwtrace.php:203 
     246msgid "View trace output in your browser." 
     247msgstr "View trace output in your browser." 
     248 
     249#: admin/oik-bwtrace.php:205 
    124250msgid "" 
    125251"If you want to trace processing within some content you can use two " 
    126252"shortcodes: [bwtron] to turn trace on and [bwtroff] to turn it off" 
    127 msgstr "" 
    128  
    129 #: admin/oik-bwtrace.inc:236 
     253msgstr "If you want to trace processing within some content you can use two shortcodes: [bwtron] to turn trace on and [bwtroff] to turn it off" 
     254 
     255#: admin/oik-bwtrace.php:220 
     256msgid "" 
     257"Use the [bwtrace] shortcode in a widget to provide an instant trace reset " 
     258"and page reload." 
     259msgstr "Use the [bwtrace] shortcode in a widget to provide an instant trace reset and page reload." 
     260 
     261#: admin/oik-bwtrace.php:226 
    130262msgid "Activate the oik base plugin to enable the [bwtrace] shortcode" 
    131 msgstr "" 
    132  
    133 #: libs/bobbforms.php:457 
     263msgstr "Activate the oik base plugin to enable the [bwtrace] shortcode" 
     264 
     265#: includes/bwtrace.php:1068 
     266msgid "Debug level" 
     267msgstr "Debug level" 
     268 
     269#: includes/bwtrace.php:1069 
     270msgid "Information level - standard" 
     271msgstr "Information level - standard" 
     272 
     273#: includes/bwtrace.php:1070 
     274msgid "Notice level" 
     275msgstr "Notice level" 
     276 
     277#: includes/bwtrace.php:1071 
     278msgid "Warning level" 
     279msgstr "Warning level" 
     280 
     281#: includes/bwtrace.php:1072 
     282msgid "Error level" 
     283msgstr "Error level" 
     284 
     285#: includes/bwtrace.php:1073 
     286msgid "Verbose level - noisier than Debug" 
     287msgstr "Verbose level - noisier than Debug" 
     288 
     289#: libs/bobbforms.php:510 
    134290msgid "None" 
    135 msgstr "" 
    136  
    137 #: libs/oik-admin.php:50 
    138 msgid "Click to toggle" 
    139 msgstr "" 
     291msgstr "None" 
     292 
     293#: libs/class-BW-.php:108 libs/oik-admin.php:69 
     294msgid "Toggle panel: %s" 
     295msgstr "Toggle panel: %s" 
    140296 
    141297#. Plugin Name of the plugin/theme 
    142298msgid "oik bwtrace" 
    143 msgstr "" 
     299msgstr "oik bwtrace" 
    144300 
    145301#. Plugin URI of the plugin/theme 
    146 msgid "http://www.oik-plugins.com/oik-plugins/oik-bwtrace" 
    147 msgstr "http://www.oik-plugins.com/oik-plugins/oik-bwtrace" 
     302msgid "https://www.oik-plugins.com/oik-plugins/oik-bwtrace" 
     303msgstr "https://www.oik-plugins.com/oik-plugins/oik-bwtrace" 
    148304 
    149305#. Description of the plugin/theme 
    150306msgid "Debug trace for WordPress, including action and filter tracing" 
    151 msgstr "" 
     307msgstr "Debug trace for WordPress, including action and filter tracing" 
    152308 
    153309#. Author of the plugin/theme 
    154310msgid "bobbingwide" 
    155 msgstr "" 
     311msgstr "bobbingwide" 
    156312 
    157313#. Author URI of the plugin/theme 
    158 msgid "http://www.oik-plugins.com/author/bobbingwide" 
    159 msgstr "http://www.oik-plugins.com/author/bobbingwide" 
    160  
     314msgid "https://www.oik-plugins.com/author/bobbingwide" 
     315msgstr "https://www.oik-plugins.com/author/bobbingwide" 
     316 
  • oik-bwtrace/trunk/languages/oik-bwtrace.pot

    r1240803 r1790744  
    1 # Copyright (C) 2015 oik bwtrace 
     1# Copyright (C) 2017 oik bwtrace 
    22# This file is distributed under the same license as the oik bwtrace package. 
    33msgid "" 
    44msgstr "" 
    5 "Project-Id-Version: oik bwtrace 1.28\n" 
     5"Project-Id-Version: oik bwtrace 2.1.1-beta-20171023\n" 
    66"Report-Msgid-Bugs-To: http://wordpress.org/tag/oik-bwtrace\n" 
    7 "POT-Creation-Date: 2015-07-11 09:35:40+00:00\n" 
     7"POT-Creation-Date: 2017-12-20 17:01:03+00:00\n" 
    88"MIME-Version: 1.0\n" 
    99"Content-Type: text/plain; charset=UTF-8\n" 
    1010"Content-Transfer-Encoding: 8bit\n" 
    11 "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n" 
     11"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n" 
    1212"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
    1313"Language-Team: LANGUAGE <LL@li.org>\n" 
    1414 
    15 #: admin/oik-bwaction.inc:35 
    16 msgid " to be written" 
    17 msgstr "" 
    18  
    19 #: admin/oik-bwaction.inc:264 
    20 msgid "Action" 
    21 msgstr "" 
    22  
    23 #: admin/oik-bwaction.inc:265 
    24 msgid "Invocations" 
    25 msgstr "" 
    26  
    27 #: admin/oik-bwaction.inc:266 
    28 msgid "Elapsed" 
    29 msgstr "" 
    30  
    31 #: admin/oik-bwaction.inc:267 
    32 msgid "Average" 
    33 msgstr "" 
    34  
    35 #: admin/oik-bwtrace.inc:51 
     15#: admin/class-oik-trace-info.php:25 
     16msgid "Field" 
     17msgstr "" 
     18 
     19#: admin/class-oik-trace-info.php:25 
     20msgid "Value" 
     21msgstr "" 
     22 
     23#: admin/class-oik-trace-info.php:25 
     24msgid "Notes" 
     25msgstr "" 
     26 
     27#: admin/class-oik-trace-info.php:50 
     28msgid "WordPress version" 
     29msgstr "" 
     30 
     31#: admin/class-oik-trace-info.php:59 
     32msgid "Set to off for better detection of Notice: Undefined messages" 
     33msgstr "" 
     34 
     35#: admin/class-oik-trace-info.php:67 
     36msgid "Multisite" 
     37msgstr "" 
     38 
     39#: admin/oik-bwtrace.php:51 
    3640msgid "oik trace options" 
    3741msgstr "" 
    3842 
    39 #: admin/oik-bwtrace.inc:61 
     43#: admin/oik-bwtrace.php:61 
    4044msgid "oik action options" 
    4145msgstr "" 
    4246 
    43 #: admin/oik-bwtrace.inc:71 
     47#: admin/oik-bwtrace.php:72 
    4448msgid "action options" 
    4549msgstr "" 
    4650 
    47 #: admin/oik-bwtrace.inc:72 admin/oik-bwtrace.inc:148 
     51#: admin/oik-bwtrace.php:73 admin/oik-bwtrace.php:121 
    4852msgid "Options" 
    4953msgstr "" 
    5054 
    51 #: admin/oik-bwtrace.inc:121 
    52 msgid "It needs to be used in conjunction with the trace facility." 
    53 msgstr "" 
    54  
    55 #: admin/oik-bwtrace.inc:127 
    56 msgid "" 
    57 "Set Count action hooks and filters to count the number of times each action " 
    58 "or filter hook is invoked" 
    59 msgstr "" 
    60  
    61 #: admin/oik-bwtrace.inc:133 
    62 msgid "You may find the most recent trace action output at..." 
    63 msgstr "" 
    64  
    65 #: admin/oik-bwtrace.inc:137 
    66 msgid "The trace action log is reset at the same time as the trace log." 
    67 msgstr "" 
    68  
    69 #: admin/oik-bwtrace.inc:147 
     55#: admin/oik-bwtrace.php:74 admin/oik-bwtrace.php:122 
     56msgid "Information" 
     57msgstr "" 
     58 
     59#: admin/oik-bwtrace.php:93 
     60msgid "Count action hooks and filters" 
     61msgstr "" 
     62 
     63#: admin/oik-bwtrace.php:94 
     64msgid "Trace deprecated messages" 
     65msgstr "" 
     66 
     67#: admin/oik-bwtrace.php:95 
     68msgid "Trace Error, Warning and Notice messages" 
     69msgstr "" 
     70 
     71#: admin/oik-bwtrace.php:96 
     72msgid "Trace 'wp' action" 
     73msgstr "" 
     74 
     75#: admin/oik-bwtrace.php:97 
     76msgid "Trace 'wp' global wp_rewrite " 
     77msgstr "" 
     78 
     79#: admin/oik-bwtrace.php:98 
     80msgid "Trace 'shutdown' included files" 
     81msgstr "" 
     82 
     83#: admin/oik-bwtrace.php:99 
     84msgid "Trace 'shutdown' saved queries" 
     85msgstr "" 
     86 
     87#: admin/oik-bwtrace.php:100 
     88msgid "Trace 'shutdown' output buffer" 
     89msgstr "" 
     90 
     91#: admin/oik-bwtrace.php:101 
     92msgid "Trace 'shutdown' trace functions count" 
     93msgstr "" 
     94 
     95#: admin/oik-bwtrace.php:102 
     96msgid "Trace 'shutdown' status report and log in summary file" 
     97msgstr "" 
     98 
     99#: admin/oik-bwtrace.php:104 
     100msgid "Other hooks to trace" 
     101msgstr "" 
     102 
     103#: admin/oik-bwtrace.php:105 
     104msgid "Filter results to trace" 
     105msgstr "" 
     106 
     107#: admin/oik-bwtrace.php:106 
     108msgid "Trace the global post object" 
     109msgstr "" 
     110 
     111#: admin/oik-bwtrace.php:107 
     112msgid "Trace attached hook functions" 
     113msgstr "" 
     114 
     115#: admin/oik-bwtrace.php:108 
     116msgid "Hooks to debug backtrace" 
     117msgstr "" 
     118 
     119#: admin/oik-bwtrace.php:109 
     120msgid "'String watch' for this string" 
     121msgstr "" 
     122 
     123#: admin/oik-bwtrace.php:111 admin/oik-bwtrace.php:180 
     124msgid "Save changes" 
     125msgstr "" 
     126 
     127#: admin/oik-bwtrace.php:120 
    70128msgid "trace options" 
    71129msgstr "" 
    72130 
    73 #: admin/oik-bwtrace.inc:149 
     131#: admin/oik-bwtrace.php:123 
    74132msgid "Notes about oik trace" 
    75133msgstr "" 
    76134 
    77 #: admin/oik-bwtrace.inc:150 
     135#: admin/oik-bwtrace.php:124 
    78136msgid "Trace options and reset button" 
    79137msgstr "" 
    80138 
    81 #: admin/oik-bwtrace.inc:174 
     139#: admin/oik-bwtrace.php:145 
    82140msgid "Trace file" 
    83141msgstr "" 
    84142 
    85 #: admin/oik-bwtrace.inc:205 
     143#: admin/oik-bwtrace.php:146 
     144msgid "Reset trace file every transaction" 
     145msgstr "" 
     146 
     147#: admin/oik-bwtrace.php:147 
     148msgid "Trace enabled" 
     149msgstr "" 
     150 
     151#: admin/oik-bwtrace.php:149 
     152msgid "AJAX Trace file" 
     153msgstr "" 
     154 
     155#: admin/oik-bwtrace.php:150 
     156msgid "Reset AJAX trace file every AJAX transaction" 
     157msgstr "" 
     158 
     159#: admin/oik-bwtrace.php:151 
     160msgid "AJAX Trace enabled" 
     161msgstr "" 
     162 
     163#: admin/oik-bwtrace.php:157 
     164msgid "Trace level" 
     165msgstr "" 
     166 
     167#: admin/oik-bwtrace.php:158 
     168msgid "Fully qualified file names" 
     169msgstr "" 
     170 
     171#: admin/oik-bwtrace.php:159 
     172msgid "Include trace record count" 
     173msgstr "" 
     174 
     175#: admin/oik-bwtrace.php:160 
     176msgid "Include timestamp" 
     177msgstr "" 
     178 
     179#: admin/oik-bwtrace.php:161 
     180msgid "Include current filter" 
     181msgstr "" 
     182 
     183#: admin/oik-bwtrace.php:162 
     184msgid "Include number of queries" 
     185msgstr "" 
     186 
     187#: admin/oik-bwtrace.php:163 
     188msgid "Include post ID" 
     189msgstr "" 
     190 
     191#: admin/oik-bwtrace.php:166 
     192msgid "Include memory/peak usage ( limit %1$s )" 
     193msgstr "" 
     194 
     195#: admin/oik-bwtrace.php:167 
     196msgid "Include files loaded count" 
     197msgstr "" 
     198 
     199#: admin/oik-bwtrace.php:171 
     200msgid "Current IP: %1$s" 
     201msgstr "" 
     202 
     203#: admin/oik-bwtrace.php:173 
     204msgid "Trace specific IP" 
     205msgstr "" 
     206 
     207#: admin/oik-bwtrace.php:190 
    86208msgid "" 
    87209"The tracing output produced by oik-bwtrace can be used for problem " 
     
    89211msgstr "" 
    90212 
    91 #: admin/oik-bwtrace.inc:206 
     213#: admin/oik-bwtrace.php:191 
    92214msgid "It's not for the faint hearted." 
    93215msgstr "" 
    94216 
    95 #: admin/oik-bwtrace.inc:207 
     217#: admin/oik-bwtrace.php:192 
    96218msgid "" 
    97219"The oik-bwtrace plugin should <b>not</b> need to be activated on a live site." 
    98220msgstr "" 
    99221 
    100 #: admin/oik-bwtrace.inc:208 
     222#: admin/oik-bwtrace.php:193 
    101223msgid "If you do need to activate it, only do so for a short period of time." 
    102224msgstr "" 
    103225 
    104 #: admin/oik-bwtrace.inc:210 
     226#: admin/oik-bwtrace.php:195 
    105227msgid "You will need to specify the trace file name (e.g. bwtrace.loh )" 
    106228msgstr "" 
    107229 
    108 #: admin/oik-bwtrace.inc:211 
     230#: admin/oik-bwtrace.php:196 
    109231msgid "When you want to trace processing check 'Trace enabled'" 
    110232msgstr "" 
    111233 
    112 #: admin/oik-bwtrace.inc:212 
     234#: admin/oik-bwtrace.php:197 
    113235msgid "" 
    114236"Check 'Reset trace file every transaction' to cause the trace file to be " 
     
    116238msgstr "" 
    117239 
    118 #: admin/oik-bwtrace.inc:215 
     240#: admin/oik-bwtrace.php:200 
    119241msgid "You may find the most recent trace output at..." 
    120242msgstr "" 
    121243 
    122 #: admin/oik-bwtrace.inc:220 
     244#: admin/oik-bwtrace.php:203 
     245msgid "View trace output in your browser." 
     246msgstr "" 
     247 
     248#: admin/oik-bwtrace.php:205 
    123249msgid "" 
    124250"If you want to trace processing within some content you can use two " 
     
    126252msgstr "" 
    127253 
    128 #: admin/oik-bwtrace.inc:236 
     254#: admin/oik-bwtrace.php:220 
     255msgid "" 
     256"Use the [bwtrace] shortcode in a widget to provide an instant trace reset " 
     257"and page reload." 
     258msgstr "" 
     259 
     260#: admin/oik-bwtrace.php:226 
    129261msgid "Activate the oik base plugin to enable the [bwtrace] shortcode" 
    130262msgstr "" 
    131263 
    132 #: libs/bobbforms.php:457 
     264#: includes/bwtrace.php:1068 
     265msgid "Debug level" 
     266msgstr "" 
     267 
     268#: includes/bwtrace.php:1069 
     269msgid "Information level - standard" 
     270msgstr "" 
     271 
     272#: includes/bwtrace.php:1070 
     273msgid "Notice level" 
     274msgstr "" 
     275 
     276#: includes/bwtrace.php:1071 
     277msgid "Warning level" 
     278msgstr "" 
     279 
     280#: includes/bwtrace.php:1072 
     281msgid "Error level" 
     282msgstr "" 
     283 
     284#: includes/bwtrace.php:1073 
     285msgid "Verbose level - noisier than Debug" 
     286msgstr "" 
     287 
     288#: libs/bobbforms.php:510 
    133289msgid "None" 
    134290msgstr "" 
    135291 
    136 #: libs/oik-admin.php:50 
    137 msgid "Click to toggle" 
     292#: libs/class-BW-.php:108 libs/oik-admin.php:69 
     293msgid "Toggle panel: %s" 
    138294msgstr "" 
    139295 
     
    143299 
    144300#. Plugin URI of the plugin/theme 
    145 msgid "http://www.oik-plugins.com/oik-plugins/oik-bwtrace" 
     301msgid "https://www.oik-plugins.com/oik-plugins/oik-bwtrace" 
    146302msgstr "" 
    147303 
     
    155311 
    156312#. Author URI of the plugin/theme 
    157 msgid "http://www.oik-plugins.com/author/bobbingwide" 
    158 msgstr "" 
     313msgid "https://www.oik-plugins.com/author/bobbingwide" 
     314msgstr "" 
  • oik-bwtrace/trunk/libs/bobbforms.php

    r1240803 r1790744  
    1 <?php // (C) Copyright Bobbing Wide 2009-2015 
     1<?php // (C) Copyright Bobbing Wide 2009-2017 
    22if ( !defined( "BOBBFORMS_INCLUDED" ) ) { 
    3 define( "BOBBFORMS_INCLUDED", "2.6" ); 
     3define( "BOBBFORMS_INCLUDED", "3.2.0" ); 
    44 
    55/** 
     
    99 *  
    1010 * Note: This file uses functions from the bobbfunc library. You must ensure this is already loaded 
    11  * e.g. use oik_require_lib() 
     11 * e.g. use oik_require_lib( "bobbfunc" ) 
    1212 */ 
    1313 
    1414/** 
    1515 * Create a form tag 
     16 *  
    1617 * @param string $action - action to perform 
    1718 * @param string $method - post/get 
    1819 * @param string $class - CSS class name 
     20 * @param string $extras - additional tag parameters 
    1921 * @return string - HTML form tag 
    2022 */ 
    21 function form( $action="", $method="post", $class=null ) { 
    22   $form = "<form"; 
    23   $form .= kv( "method", $method ); 
    24   $form .= kv( "action", $action ); 
    25   $form .= kv( "class", $class ); 
    26   $form .= ">"; 
    27   return( $form );  
     23function form( $action="", $method="post", $class=null, $extras=null ) { 
     24    $form = "<form"; 
     25    $form .= kv( "method", $method ); 
     26    $form .= kv( "action", $action ); 
     27    $form .= kv( "class", $class ); 
     28    $form .= $extras; 
     29    $form .= ">"; 
     30    return( $form ); 
    2831} 
    2932 
     
    3437 * @param string $method - defaults to "post". other value is "get" 
    3538 * @param string $class - CSS class name 
     39 * @param string $extras - additional tag parameters 
    3640*/ 
    37 function bw_form( $action="", $method="post", $class=null ) { 
    38   e( form( $action, $method, $class ) ); 
     41function bw_form( $action="", $method="post", $class=null, $extras=null ) { 
     42    e( form( $action, $method, $class, $extras ) ); 
    3943} 
    4044 
    4145/** 
    4246 * Create a field label 
     47 *  
     48 * @Uses bw_translate() from bobbfunc 
     49 *  
    4350 * @param string $name - field name 
    4451 * @param string $text - label to display 
    4552 * @return string - the HTML label tag 
    4653 *  
    47  * @Uses bw_translate() from bobbfunc.inc 
    4854 */ 
    4955function label( $name, $text ) { 
    50   $lab = "<label for=\""; 
    51   $lab.= $name; 
    52   $lab.= "\">"; 
    53   $lab.= bw_translate( $text ); 
    54   $lab.= "</label>"; 
    55   return( $lab ); 
     56    $lab = "<label for=\""; 
     57    $lab.= $name; 
     58    $lab.= "\">"; 
     59    $lab.= bw_translate( $text ); 
     60    $lab.= "</label>"; 
     61    return( $lab ); 
    5662} 
    5763 
    5864/** 
    5965 * Return a hidden input field for a form 
     66 *  
    6067 * @param string $name - the field name e.g. my_field or my_field[1] 
    6168 * @param string $value - the value of the field 
     
    7784 * @param string $name - the field name  
    7885 * @param integer $len - the field length 
     86 * @param string $value - the field value 
    7987 * @param string $class - any class name to apply 
    8088 * @param string $extras - additional values for the HTML input tag 
     
    8391 */ 
    8492function itext( $name, $len, $value, $class=null, $extras=null, $args=null ) { 
    85   //bw_trace2(); 
    86   //bw_backtrace(); 
    87   //$width = ($len * 20) ; 
    88   $type = bw_array_get( $args, "#type", "text" ); 
    89    
    90   $it = "<input"; 
    91   $it.= kv( "type", $type ); 
    92   $it.= kv( "size", $len ); 
    93   //$it.= "width=\"".$width; 
    94   //$it.= "\"  
    95   $it.= "name=\""; 
    96   $it.= $name; 
    97   $it.= "\" id=\""; 
    98   $it.= $name; 
    99   $it.= "\" value=\""; 
    100   $it.= esc_attr( $value ); 
    101   $it.= "\" class=\""; 
    102   $it.= $class; 
    103   $it.= "\""; 
    104   $it.= $extras; 
    105   $it.= " />";  
    106   return $it; 
    107 } 
    108  
    109 /** 
    110  * Create an HTML textarea field  
     93    $type = bw_array_get( $args, "#type", "text" ); 
     94    $it = "<input"; 
     95    $it.= kv( "type", $type ); 
     96    $it.= kv( "size", $len ); 
     97    $it.= "name=\""; 
     98    $it.= $name; 
     99    $it.= "\" id=\""; 
     100    $it.= $name; 
     101    $it.= "\" value=\""; 
     102    $it.= esc_attr( $value ); 
     103    $it.= "\" class=\""; 
     104    $it.= $class; 
     105    $it.= "\""; 
     106    $it.= $extras; 
     107    $it.= " />";  
     108    return $it; 
     109} 
     110 
     111/** 
     112 * Create an HTML textarea field 
     113 *   
    111114 * @param string $name - the field name 
    112115 * @param integer $len - the length of each row 
    113116 * @param string $value - the textarea content 
    114117 * @param integer $rows - the number of rows 
     118 * @param string $extras - any other parameters - a pre-concatenated string of kv()s 
    115119 * @return string - the HTML textarea tag 
    116120 */ 
    117 function iarea( $name, $len, $value, $rows=10 ) { 
    118   $it = "<textarea"; 
    119   $it .= kv( "rows", $rows); 
    120   $it .= kv( "cols", $len ); 
    121   $it .= kv( "name", $name ); 
    122   $it .= ">"; 
    123   $it .= $value; 
    124   $it .= "</textarea>"; 
    125   return( $it ); 
     121function iarea( $name, $len, $value, $rows=10, $extras=null ) { 
     122    $it = "<textarea"; 
     123    $it .= kv( "rows", $rows); 
     124    $it .= kv( "cols", $len ); 
     125    $it .= kv( "name", $name ); 
     126    $it .= $extras; 
     127    $it .= ">"; 
     128    $it .= $value; 
     129    $it .= "</textarea>"; 
     130    return( $it ); 
    126131} 
    127132 
    128133/** 
    129134 * Create an email field  
     135 *  
    130136 * @link http://www.w3.org/TR/html-markup/input.email.html 
     137 *  
     138 * @param string $name field name 
     139 * @param integer $len the field length 
     140 * @param string $value field value 
     141 * @param string $class CSS classes 
     142 * @param string $extras any additional parameters 
     143 * @return string the HTML 
    131144 */ 
    132145function iemail( $name, $len, $value, $class=null, $extras=null ) { 
    133   $it = "<input"; 
    134   $it .= kv( "type", "email" ); 
    135   $it .= kv( "name", $name ); 
    136   $it .= kv( "value", $value ); 
    137   $it .= kv( "size", $len ); 
    138   $it .= kv( "class", $class ); 
    139   $it.= $extras; 
    140   $it .= " />"; 
    141   return( $it ); 
     146    $it = "<input"; 
     147    $it .= kv( "type", "email" ); 
     148    $it .= kv( "name", $name ); 
     149    $it .= kv( "value", $value ); 
     150    $it .= kv( "size", $len ); 
     151    $it .= kv( "class", $class ); 
     152    $it .= $extras; 
     153    $it .= " />"; 
     154    return( $it ); 
    142155} 
    143156 
    144157/** 
    145158 * Create a submit button 
     159 *  
     160 * @param string $name field name 
     161 * @param string $value field value 
     162 * @param string $id unique button ID 
     163 * @param string $class CSS classes 
     164 * @param string $extras any additional parameters 
     165 * @return string the HTML for the submit button 
    146166 */ 
    147167function isubmit( $name, $value, $id=null, $class=null, $extras=null ) { 
    148   $it = "<input"; 
    149   $it .= kv( "type", "submit" ); 
    150   $it .= kv( "name", $name ); 
    151   $it .= kv( "value", $value ); 
    152   $it .= kv( "id", $id ); 
    153   $it .= kv( "class", $class ); 
    154   $it .= $extras; 
    155   $it .= " />"; 
    156   return( $it ); 
    157 }  
    158  
    159 /** 
    160  * Create a radio button  
     168        $it = "<input"; 
     169        $it .= kv( "type", "submit" ); 
     170        $it .= kv( "name", $name ); 
     171        $it .= kv( "value", $value ); 
     172        $it .= kv( "id", $id ); 
     173        $it .= kv( "class", $class ); 
     174        $it .= $extras; 
     175        $it .= " />"; 
     176        return( $it ); 
     177} 
     178 
     179/** 
     180 * Create a radio button 
     181 *  
     182 * @param string $name field name 
     183 * @param string $id unique button ID 
     184 * @param string $value field value 
     185 * @param string $class CSS classes 
     186 * @param string $extras any additional parameters 
     187 * @return string the HTML for the radio button 
     188  
    161189 */ 
    162190function iradio( $name, $id, $value, $class, $extras ) { 
    163   $it = "<input"; 
    164   $it .= kv( "type", "radio" ); 
    165   $it .= kv( "name", $name ); 
    166   $it .= kv( "id", $id ); 
    167   $it .= kv( "value", $value ); 
    168   $it .= kv( "class", $class ); 
    169   $it .= $extras; 
    170   $it .= " />"; 
    171   return( $it ); 
     191    $it = "<input"; 
     192    $it .= kv( "type", "radio" ); 
     193    $it .= kv( "name", $name ); 
     194    $it .= kv( "id", $id ); 
     195    $it .= kv( "value", $value ); 
     196    $it .= kv( "class", $class ); 
     197    $it .= $extras; 
     198    $it .= " />"; 
     199    return( $it ); 
    172200} 
    173201 
    174202/** 
    175203 * Create a simple table row 
     204 *  
     205 * @TODO Does this get used at all? 
    176206 *  
    177207 * @param string $td1 - contents of first cell 
     
    179209 */   
    180210function tablerow( $td1, $td2 ) {   
    181    echo '<tr>'; 
    182    echo '<td>'.$td1.'</td>'; 
    183    echo '<td>'.$td2.'</td>'; 
    184    echo '</tr>'; 
    185    return 0; 
     211    echo '<tr>'; 
     212    echo '<td>'.$td1.'</td>'; 
     213    echo '<td>'.$td2.'</td>'; 
     214    echo '</tr>'; 
     215    return 0; 
    186216} 
    187217 
     
    195225 * If the cell is an array we treat it as a simple array. 
    196226 * @TODO Since this array may be partially associative we need to unassoc it first 
    197  *  
    198  *   
    199227 * 
    200228 * @param string $text - cell contents 
     
    204232 */ 
    205233function bw_td( $text=NULL, $class=NULL, $id=NULL ) { 
    206     stag( "td", $class, $id ); 
    207         if ( is_array( $text ) ) { 
    208             $text = implode( ", ",  $text ); 
    209         } 
    210         e( $text ); 
    211     etag( "td"); 
     234    stag( "td", $class, $id ); 
     235    if ( is_array( $text ) ) { 
     236        $text = implode( ", ",  $text ); 
     237    } 
     238    e( $text ); 
     239    etag( "td"); 
    212240} 
    213241 
     
    224252 */ 
    225253function bw_th( $text=NULL, $class=NULL, $id=NULL ) { 
    226   //if ( $text ) { 
    227     stag( "th", $class, $id ); 
    228     e( $text ); 
    229     etag( "th"); 
    230   //} 
     254    stag( "th", $class, $id ); 
     255    e( $text ); 
     256    etag( "th"); 
    231257} 
    232258 
     
    240266 * @param string $trtag "tr" or ? 
    241267 * @param string $tdtag "td" or "th" or ?  
    242  *  
    243268 */ 
    244269function bw_tablerow( $td_array=array(), $trtag="tr", $tdtag="td" ) { 
    245   if ( count( $td_array ) ) { 
    246     stag( $trtag ); 
    247     foreach ( $td_array as $td ) { 
    248       if ( $tdtag == "th" ) { 
    249         bw_th( $td ); 
    250       } else { 
    251         bw_td( $td ); 
    252        
    253     } 
    254     etag( $trtag );  
    255   }   
     270    if ( count( $td_array ) ) { 
     271        stag( $trtag ); 
     272        foreach ( $td_array as $td ) { 
     273            if ( $tdtag == "th" ) { 
     274                bw_th( $td ); 
     275            } else { 
     276                bw_td( $td ); 
     277             
     278        } 
     279        etag( $trtag );  
     280    } 
    256281} 
    257282 
    258283/** 
    259284 * Create a text input field 
     285 *  
     286 * @TODO Confirm this is used 
    260287 * 
    261288 * Create a text field with a label formatted as two columns using tablerow 
     
    263290 * @param string $name the field name e.g. myfield 
    264291 * @param integer $len field length 
     292 * @param string $text the label text 
    265293 * @param string $value the field value... it doesn't have to be escaped 
    266294 * @param string $class CSS classes to apply 
     
    269297 */ 
    270298function textfield( $name, $len, $text, $value, $class=null, $extras=null, $args=null ) { 
    271   $lab = label( $name, $text ); 
    272   $itext = itext( $name, $len, $value, $class, $extras, $args );  
    273   tablerow( $lab, $itext ); 
    274   return; 
     299    $lab = label( $name, $text ); 
     300    $itext = itext( $name, $len, $value, $class, $extras, $args );  
     301    tablerow( $lab, $itext ); 
     302    return; 
    275303} 
    276304 
    277305/** 
    278306 * Create a textarea field 
    279  */ 
    280 function textarea( $name, $len, $text, $value, $rows=10 ) { 
    281   $lab = label( $name, $text ); 
    282   $itext = iarea( $name, $len, $value, $rows );  
    283   tablerow( $lab, $itext ); 
    284   return; 
    285 } 
    286    
     307 * 
     308 * @TODO Confirm this is used 
     309 */ 
     310function textarea( $name, $len, $text, $value, $rows=10, $args) { 
     311    $lab = label( $name, $text ); 
     312    $itext = iarea( $name, $len, $value, $rows );  
     313    tablerow( $lab, $itext ); 
     314    return; 
     315} 
     316 
    287317/** 
    288318 * Form a text field 
     
    299329 */ 
    300330function bw_textfield( $name, $len, $text, $value, $class=null, $extras=null, $args=null ) { 
    301   $lab = label( $name, $text ); 
    302   if ( $value === null ) { 
    303     $value = bw_array_get( $_REQUEST, $name, null ); 
    304   } 
    305   $itext = itext( $name, $len, $value, $class, $extras, $args );  
    306   bw_tablerow( array( $lab, $itext ) ); 
    307   return; 
    308 } 
    309  
    310 /** 
    311  * Form an "email" field  
     331    $lab = label( $name, $text ); 
     332    if ( $value === null ) { 
     333        $value = bw_array_get( $_REQUEST, $name, null ); 
     334    } 
     335    $itext = itext( $name, $len, $value, $class, $extras, $args );  
     336    bw_tablerow( array( $lab, $itext ) ); 
     337    return; 
     338} 
     339 
     340/** 
     341 * Form an "email" field 
     342 * 
     343 * @param string $name - the name of the field 
     344 * @param integer $len - the length of the field 
     345 * @param string $text - the label for the field 
     346 * @param string $value - the value of the field 
     347 * @param string $class - CSS class name 
     348 * @param string $extras - the extras passed to itext() is expected to be a string 
    312349 */ 
    313350function bw_emailfield( $name, $len, $text, $value, $class=null, $extras=null ) { 
    314   $lab = label( $name, $text ); 
    315   if ( $value === null ) { 
    316     $value = bw_array_get( $_REQUEST, $name, null ); 
    317   } 
    318   $itext = iemail( $name, $len, $value, $class, $extras );  
    319   bw_tablerow( array( $lab, $itext ) ); 
    320   return; 
     351    $lab = label( $name, $text ); 
     352    if ( $value === null ) { 
     353        $value = bw_array_get( $_REQUEST, $name, null ); 
     354    } 
     355    $itext = iemail( $name, $len, $value, $class, $extras );  
     356    bw_tablerow( array( $lab, $itext ) ); 
     357    return; 
    321358} 
    322359 
     
    330367 * @param numeric $rows - the number of rows for the textarea field 
    331368 */ 
    332 function bw_textarea( $name, $len, $text, $value, $rows=10 ) { 
    333   $lab = label( $name, $text ); 
    334   if ( $value === null ) { 
    335     $value = bw_array_get( $_REQUEST, $name, null ); 
    336     bw_trace2( $value, "bw_textarea value" ); 
    337     $value = wp_strip_all_tags( $value ); 
    338   } 
    339   $itext = iarea( $name, $len, $value, $rows );  
    340   bw_tablerow( array( $lab, $itext) ); 
    341   return; 
     369function bw_textarea( $name, $len, $text, $value, $rows=10, $args=null ) { 
     370    $lab = label( $name, $text ); 
     371    if ( $value === null ) { 
     372        $value = bw_array_get( $_REQUEST, $name, null ); 
     373        bw_trace2( $value, "bw_textarea value" ); 
     374        $value = wp_strip_all_tags( $value ); 
     375        $value = stripslashes( $value ); 
     376    } 
     377     
     378    $spellcheck = bw_array_get( $args, "#spellcheck", null ); 
     379    if ( null !== $spellcheck ) { 
     380        $spellcheck = kv( "spellcheck", $spellcheck ); 
     381    } 
     382    $itext = iarea( $name, $len, $value, $rows, $spellcheck );  
     383    bw_tablerow( array( $lab, $itext) ); 
     384    return; 
    342385} 
    343386 
     
    354397*/  
    355398function bw_radio( $name, $text, $values, $labels, $class=null, $extras=null ) { 
    356   $iradios = null; 
    357   foreach ( $values as $id => $value ) { 
    358     $label = bw_array_get( $labels, $id, $value ); 
    359     $extra = bw_array_get( $extras, $id, null ); 
    360     $iradios .= label( $name, $label ); 
    361     $iradios .= iradio( $name, $id, $value, $class, $extra ); 
    362   }    
    363   $lab = label( $name, $text ); 
    364   bw_tablerow( array( $lab, $iradios ) ); 
     399    $iradios = null; 
     400    foreach ( $values as $id => $value ) { 
     401        $label = bw_array_get( $labels, $id, $value ); 
     402        $extra = bw_array_get( $extras, $id, null ); 
     403        $iradios .= label( $name, $label ); 
     404        $iradios .= iradio( $name, $id, $value, $class, $extra ); 
     405    }    
     406    $lab = label( $name, $text ); 
     407    bw_tablerow( array( $lab, $iradios ) ); 
    365408} 
    366409 
    367410/**  
     411 * Is this option selected? 
     412 *  
    368413 * Return the selected value if the $option_key or $option_value == $value or the $option_key is IN the $value array 
    369414 * 
    370  <pre> 
    371   
     415 * ` 
    372416    [0] => _oik_api_calls 
    373417    [1] => Array 
     
    388432                    [6409] => aclass() - aclass 
    389433                     
    390  </pre> 
     434 * ` 
     435 *  
     436 * @param string $option_key 
     437 * @param string $option_value 
     438 * @param mixed $value 
    391439 */  
    392440function is_selected( $option_key, $option_value, $value ) { 
    393   if ( is_array( $value ) ) { 
    394     $vals = bw_assoc( $value ); 
    395     $val = bw_array_get( $vals, $option_key, null ); 
    396   } else { 
    397     $val = $value; 
    398   } 
    399   $selected = selected( $option_key, $val, false ); 
    400   if  ( !$selected ) { 
    401     $selected = selected( $option_value, $val, false ); 
    402   } 
    403   return( $selected ); 
     441    if ( is_array( $value ) ) { 
     442        $vals = bw_assoc( $value ); 
     443        $val = bw_array_get( $vals, $option_key, null ); 
     444    } else { 
     445        $val = $value; 
     446    } 
     447    $selected = selected( $option_key, $val, false ); 
     448    if  ( !$selected ) { 
     449        $selected = selected( $option_value, $val, false ); 
     450    } 
     451    return( $selected ); 
    404452} 
    405453 
     
    415463 */ 
    416464function bw_query_shorten( $args=null ) { 
    417   bw_backtrace( BW_TRACE_DEBUG ); 
    418   $shorten = 0; 
    419   if ( $args ) { 
    420     $shorten = bw_array_get( $args, "#length", 0 ); 
    421   } 
    422   return( $shorten ); 
    423 } 
    424  
    425 /** 
    426  * shorten a string 
     465    bw_backtrace( BW_TRACE_DEBUG ); 
     466    $shorten = 0; 
     467    if ( $args ) { 
     468        $shorten = bw_array_get( $args, "#length", 0 ); 
     469    } 
     470    return( $shorten ); 
     471} 
     472 
     473/** 
     474 * Shorten a string 
    427475 * 
    428476 * @param string|null $string  
    429  * @param integer $shorten 
    430  * @return 
     477 * @param integer $shorten maximum allowed length 
     478 * @return the shortened string with trailing ellipsis 
    431479 */ 
    432480function bw_shorten( $string, $shorten ) { 
    433   if ( strlen( $string ) > ( $shorten + 3) ) { 
    434     $string = substr( $string, 0, $shorten ); 
    435     $string .= "..."; 
    436   } 
    437   return( $string ); 
     481    if ( strlen( $string ) > ( $shorten + 3) ) { 
     482        $string = substr( $string, 0, $shorten ); 
     483        $string .= "..."; 
     484    } 
     485    return( $string ); 
    438486} 
    439487 
     
    450498 */ 
    451499function iselect( $name, $value, $args ) { 
    452   //bw_trace2(); 
    453   $multiple = bw_array_get( $args, "#multiple", false ); 
    454   if ( $multiple ) { 
    455     $iselect = "<select name=\"${name}[]\" multiple size=\"$multiple\">" ; 
    456   } else { 
    457     $iselect = "<select name=\"$name\">" ; 
    458   } 
    459   $options = bw_as_array( $args['#options'] ); 
    460   $optional = bw_array_get( $args, "#optional", false ); 
    461   if ( $optional ) { 
    462     $options = array( __( "None" ) ) + $options; 
    463   } 
    464   //bw_trace2( $options, "options" ); 
    465   $bw_shorten = bw_query_shorten( $args ); 
    466   foreach ( $options as $option_key => $option_value ) { 
    467     $selected = is_selected( $option_key, $option_value, $value ); 
    468     if ( $bw_shorten ) { 
    469       $option_value = bw_shorten( $option_value, $bw_shorten ); 
    470     } 
    471     $option = "<option value=\"$option_key\" $selected>$option_value</option>"; 
    472     $iselect .= $option;  
    473   } 
    474   $iselect .= "</select>" ; 
    475   return( $iselect ); 
    476 }  
     500    //bw_trace2(); 
     501    $multiple = bw_array_get( $args, "#multiple", false ); 
     502    if ( $multiple ) { 
     503        $iselect = "<select name=\"${name}[]\" multiple size=\"$multiple\">" ; 
     504    } else { 
     505        $iselect = "<select name=\"$name\">" ; 
     506    } 
     507    $options = bw_as_array( $args['#options'] ); 
     508    $optional = bw_array_get( $args, "#optional", false ); 
     509    if ( $optional ) { 
     510        $options = array( __( "None" ) ) + $options; 
     511    } 
     512    //bw_trace2( $options, "options" ); 
     513    $bw_shorten = bw_query_shorten( $args ); 
     514    foreach ( $options as $option_key => $option_value ) { 
     515        $selected = is_selected( $option_key, $option_value, $value ); 
     516        if ( $bw_shorten ) { 
     517            $option_value = bw_shorten( $option_value, $bw_shorten ); 
     518        } 
     519        $option = "<option value=\"$option_key\" $selected>$option_value</option>"; 
     520        $iselect .= $option;  
     521    } 
     522    $iselect .= "</select>" ; 
     523    return( $iselect ); 
     524} 
    477525 
    478526/**  
    479527 * Create a select field for a form-table 
     528 *  
    480529 * @param string $name - field name 
    481530 * @param string $text - label for the field 
     
    484533 */ 
    485534function bw_select( $name, $text, $value, $args ) { 
    486   $lab = label( $name, $text ); 
    487   $iselect = iselect( $name, $value, $args );  
    488   bw_tablerow( array( $lab, $iselect ) ); 
    489   return; 
     535    $lab = label( $name, $text ); 
     536    $iselect = iselect( $name, $value, $args );  
     537    bw_tablerow( array( $lab, $iselect ) ); 
     538    return; 
    490539} 
    491540 
    492541/**  
    493  * Create a checkbox input field 
     542 * Create a checkbox input field  
     543 *  
     544 * Note: In order to obtain a value when the checkbox is unticked 
     545 * we add a hidden field with a value of off 
     546 * See http://iamcam.wordpress.com/2008/01/15/unchecked-checkbox-values/ 
     547 * When the value is set then the checkbox is checked 
     548 *  
    494549 * @param string $name the name for the checkbox input field 
    495550 * @param string $value the value of the checkbox - default NOT checked 
    496551 * @param bool whether or not the checkbox should be disabled. default: false 
    497  * When the value is set then the checkbox is checked 
    498   
    499  * Note: In order to obtain a value when the checkbox is unticked 
    500  * we add a hidden field with a vale of off 
    501  * See http://iamcam.wordpress.com/2008/01/15/unchecked-checkbox-values/ 
    502   
    503552 */ 
    504553function icheckbox( $name, $value=NULL, $disabled=false ) { 
    505   $it = ihidden( $name, "0" ); 
    506   $it .= "<input type=\"checkbox\" "; 
    507   $it.= "name=\""; 
    508   $it.= $name; 
    509   $it.= "\" id=\""; 
    510   $it.= $name; 
    511   $it.= '"'; 
    512   if ( $value && $value != "0" ) { 
    513     $it.= " checked=\"checked\""; 
    514   }  
    515   if ( $disabled ) { 
    516     $it .= kv( "disabled", "disabled" ); 
    517   }    
    518   $it.= "/>";  
    519   return $it; 
     554    $it = ihidden( $name, "0" ); 
     555    $it .= "<input type=\"checkbox\" "; 
     556    $it.= "name=\""; 
     557    $it.= $name; 
     558    $it.= "\" id=\""; 
     559    $it.= $name; 
     560    $it.= '"'; 
     561    if ( $value && $value != "0" ) { 
     562        $it.= " checked=\"checked\""; 
     563    }  
     564    if ( $disabled ) { 
     565        $it .= kv( "disabled", "disabled" ); 
     566    }    
     567    $it.= "/>";  
     568    return $it; 
    520569} 
    521570 
    522571/** 
    523572 * Create a checkbox field given a field name and value 
     573 * 
     574 * @param string $name field name 
     575 * @param string $text field label 
     576 * @param integer $value 1 for checked 
     577 * @param array $args future use 
    524578 */ 
    525579function bw_checkbox( $name, $text, $value=1, $args=NULL ) { 
    526   $lab = label( $name, $text ); 
    527   $icheckbox = icheckbox( $name, $value ); 
    528   bw_tablerow( array( $lab, $icheckbox )); 
    529   return; 
     580    $lab = BW_::label( $name, $text ); 
     581    $icheckbox = icheckbox( $name, $value ); 
     582    bw_tablerow( array( $lab, $icheckbox )); 
     583    return; 
    530584} 
    531585 
    532586/** 
    533587 * Create a checkbox for an array options field  
     588 *  
     589 * @param string $name field name 
     590 * @param string $text field label 
     591 * @param array $array  
     592 * @param integer $index 
    534593 */ 
    535594function bw_checkbox_arr( $name, $text, $array, $index ) { 
    536   $name_index = $name.'['.$index.']'; 
    537   $value = bw_array_get( $array, $index, NULL ); 
    538   bw_checkbox( $name_index, $text, $value ); 
    539 }   
     595    $name_index = $name.'['.$index.']'; 
     596    $value = bw_array_get( $array, $index, NULL ); 
     597    bw_checkbox( $name_index, $text, $value ); 
     598} 
    540599 
    541600/** 
    542601 * Create a textfield for an array options field  
     602 * 
     603 * @param string $name field name 
     604 * @param string $text field label 
     605 * @param array $array  
     606 * @param integer $index 
     607 * @param integer $len 
     608 * @param string $class 
     609 * @param string $extras 
    543610 */ 
    544611function bw_textfield_arr( $name, $text, $array, $index, $len, $class=null, $extras=null ) { 
    545   $name_index = $name.'['.$index.']'; 
    546   $value = bw_array_get( $array, $index, NULL ); 
    547   bw_textfield( $name_index, $len, $text, $value, $class, $extras ); 
     612    $name_index = $name.'['.$index.']'; 
     613    $value = bw_array_get( $array, $index, NULL ); 
     614    bw_textfield( $name_index, $len, $text, $value, $class, $extras ); 
    548615} 
    549616 
    550617/** 
    551618 * Create an emailfield for an array options field  
     619 * 
     620 * @param string $name field name 
     621 * @param string $text field label 
     622 * @param array $array  
     623 * @param integer $index 
     624 * @param integer $len 
     625 * @param string $class 
     626 * @param string $extras 
    552627 */ 
    553628function bw_emailfield_arr( $name, $text, $array, $index, $len, $class=null, $extras=null ) { 
    554   $name_index = $name.'['.$index.']'; 
    555   $value = bw_array_get( $array, $index, NULL ); 
    556   bw_emailfield( $name_index, $len, $text, $value, $class, $extras ); 
    557 }  
    558  
    559 /** 
    560  * Create a textarea for an array options field  
     629    $name_index = $name.'['.$index.']'; 
     630    $value = bw_array_get( $array, $index, NULL ); 
     631    bw_emailfield( $name_index, $len, $text, $value, $class, $extras ); 
     632} 
     633 
     634/** 
     635 * Create a textarea for an array options field 
     636 * 
     637 * @param string $name field name 
     638 * @param string $text field label 
     639 * @param array $array  
     640 * @param integer $index 
     641 * @param integer $len 
     642 * @param integer $rows  
    561643 */ 
    562644function bw_textarea_arr( $name, $text, $array, $index, $len, $rows=5 ) { 
    563   $name_index = $name.'['.$index.']'; 
    564   $value = bw_array_get( $array, $index, NULL ); 
    565   bw_textarea( $name_index, $len, $text, $value, $rows ); 
     645    $name_index = $name.'['.$index.']'; 
     646    $value = bw_array_get( $array, $index, NULL ); 
     647    bw_textarea( $name_index, $len, $text, $value, $rows ); 
    566648} 
    567649 
    568650/** 
    569651 * Create a select for an array options field 
    570 */  
     652 * 
     653 * @param string $name field name 
     654 * @param string $text field label 
     655 * @param array $array  
     656 * @param integer $index 
     657 * @param array $args 
     658 */  
    571659function bw_select_arr( $name, $text, $array, $index, $args ) { 
    572   $name_index = $name.'['.$index.']'; 
    573   $value = bw_array_get( $array, $index, NULL ); 
    574   bw_select( $name_index, $text, $value, $args ); 
     660    $name_index = $name.'['.$index.']'; 
     661    $value = bw_array_get( $array, $index, NULL ); 
     662    bw_select( $name_index, $text, $value, $args ); 
    575663} 
    576664 
     
    584672 *   bw_textarea_arr( $option, "Introduction", $text, 'intro', 60, 5 ); 
    585673 * 
    586  * TODO: In this version the checkbox appears next to the label. It might be nicer to have it next to the textarea.  
     674 * @TODO: In this version the checkbox appears next to the label. It might be nicer to have it next to the textarea.  
    587675 * Note: We need to call bw_translate() here since the modified text won't be recognised when it reaches the label() function 
    588676 * as it will have had the nbsp and checkbox HTML added by then. 
    589  *  
     677 * 
     678 * @param string $name field name 
     679 * @param string $text field label 
     680 * @param array $array  
     681 * @param integer $index 
     682 * @param integer $len 
     683 * @param integer $rows  
    590684 */ 
    591685function bw_textarea_cb_arr( $name, $text, $array, $index, $len, $rows=5 ) { 
    592   $name_index = $name.'['.$index.'_cb]'; 
    593   $cb_value = bw_array_get( $array, $index.'_cb', "on" ); 
    594   $cb_text = bw_translate( $text );  
    595   $cb_text .= "&nbsp;"; 
    596   $cb_text .= icheckbox( $name_index, $cb_value ); 
    597   bw_textarea_arr( $name, $cb_text, $array, $index, $len, $rows ); 
    598 }   
     686    $name_index = $name.'['.$index.'_cb]'; 
     687    $cb_value = bw_array_get( $array, $index.'_cb', "on" ); 
     688    $cb_text = bw_translate( $text );  
     689    $cb_text .= "&nbsp;"; 
     690    $cb_text .= icheckbox( $name_index, $cb_value ); 
     691    bw_textarea_arr( $name, $cb_text, $array, $index, $len, $rows ); 
     692} 
    599693 
    600694/** 
    601695 * Start of a WordPress form for options fields 
     696 *  
    602697 * @param string $option - name of the options field e.g. "bw_privacy_policy" ( 2nd parm to register_setting()) 
    603698 * @param string $settings - name of the "settings" e.g. "oik_privacy_policy_options" (1st parm to register_setting()) 
     
    606701 */ 
    607702if ( !function_exists( "bw_form_start" ) ) {  
    608 function bw_form_start( $option, $settings, $action="options.php" ) { 
    609   bw_form( $action ); 
    610   $options = get_option( $option );    
    611   stag( 'table', "form-table" ); 
    612   bw_flush(); 
    613   settings_fields( $settings ); 
    614   return( $options ); 
    615 } 
    616 } 
    617    
     703    function bw_form_start( $option, $settings, $action="options.php" ) { 
     704        bw_form( $action ); 
     705        $options = get_option( $option );    
     706        stag( 'table', "form-table" ); 
     707        bw_flush(); 
     708        settings_fields( $settings ); 
     709        return( $options ); 
     710    } 
     711} 
     712 
    618713/** 
    619714 * Reset the options to the default fields 
     715 *  
     716 * Note: There really should be some security/nonce checking here **?**  
     717 *  
    620718 * @param string $option - option name 
    621719 * @param array $options - options  
     
    623721 * @param string $request_field - the field name that triggers the reset 
    624722 *  
    625  * Note: There really should be some security/nonce checking here **?**  
    626723 */ 
    627724function bw_reset_options( $option, $options, $default_cb, $request_field ) {      
    628   $reset = bw_array_get( $_REQUEST, $request_field, null ); 
    629   if ( $reset ) { 
    630     delete_option( $option ); 
    631     $options = FALSE; 
    632   }   
    633   if ( $options == FALSE ) {   
    634     $options = $default_cb(); 
    635   } else {  
    636     $options = array_merge( $default_cb(), $options ); 
    637   }  
    638   return( $options ); 
     725    $reset = bw_array_get( $_REQUEST, $request_field, null ); 
     726    if ( $reset ) { 
     727        delete_option( $option ); 
     728        $options = FALSE; 
     729    } 
     730    if ( $options == FALSE ) {   
     731        $options = $default_cb(); 
     732    } else {  
     733        $options = array_merge( $default_cb(), $options ); 
     734    } 
     735    return( $options ); 
    639736} 
    640737  
    641738/** 
    642  * Return the current URL - fully qualified so that it can be passed as a parameter to another site 
    643  * Code copied from WordPress-SEO and @link http://webcheatsheet.com/PHP/get_current_page_url.php 
    644  * 
     739 * Return the current URL 
     740 * 
     741 * Fully qualified so that it can be passed as a parameter to another site 
     742 * Code copied from WordPress-SEO and {@link http://webcheatsheet.com/PHP/get_current_page_url.php} 
     743 * 
     744 * @return string URL made up from global fields 
    645745 */ 
    646746function bw_current_url() { 
    647   $pageURL = 'http'; 
    648   // Does it matter what it's set to? "on" or 1 **?** 
    649   if ( isset( $_SERVER["HTTPS"] ) ) {   
    650     $pageURL .= "s"; 
    651   } 
    652   $pageURL .= "://"; 
    653   $pageURL .= $_SERVER["SERVER_NAME"]; 
    654   // We know that SERVER_PORT is set by apache 
    655   if ($_SERVER["SERVER_PORT"] != "80") { 
    656     $pageURL .= $_SERVER["SERVER_PORT"]; 
    657   } 
    658   $pageURL .= $_SERVER["REQUEST_URI"]; 
    659   bw_trace2( $pageURL, "pageURL", false ); 
    660   return( $pageURL ); 
     747    $pageURL = 'http'; 
     748    // Does it matter what it's set to? "on" or 1 **?** 
     749    if ( isset( $_SERVER["HTTPS"] ) ) {   
     750        $pageURL .= "s"; 
     751    } 
     752    $pageURL .= "://"; 
     753    $pageURL .= $_SERVER["SERVER_NAME"]; 
     754    // We know that SERVER_PORT is set by apache 
     755    if ($_SERVER["SERVER_PORT"] != "80") { 
     756        $pageURL .= $_SERVER["SERVER_PORT"]; 
     757    } 
     758    $pageURL .= $_SERVER["REQUEST_URI"]; 
     759    bw_trace2( $pageURL, "pageURL", false ); 
     760    return( $pageURL ); 
    661761} 
    662762 
    663763/** 
    664764 * Verify the nonce field 
     765 * 
    665766 * @param string $action - the action passed on the call to wp_nonce_field() 
    666767 * @param string $name - the name passed on the call to wp_nonce_field()  
    667  * @return bool - 1 or 2 if verified, false if not 
    668  *  
     768 * @return integer - 1 or 2 if verified, false if not 
    669769 */ 
    670770if ( !function_exists( "bw_verify_nonce" ) ) { 
    671 function bw_verify_nonce( $action, $name ) { 
    672   $nonce_field = bw_array_get( $_REQUEST, $name, null ); 
    673   $verified = wp_verify_nonce( $nonce_field, $action ); 
    674   bw_trace2( $verified, "wp_verify_nonce?" ); 
    675   return( $verified ); 
    676  
     771    function bw_verify_nonce( $action, $name ) { 
     772        $nonce_field = bw_array_get( $_REQUEST, $name, null ); 
     773        $verified = wp_verify_nonce( $nonce_field, $action ); 
     774        bw_trace2( $verified, "wp_verify_nonce?" ); 
     775        return( $verified ); 
     776    } 
    677777} 
    678778 
  • oik-bwtrace/trunk/libs/bobbfunc.php

    r1265295 r1790744  
    1 <?php // (C) Copyright Bobbing Wide 2009-2015 
     1<?php // (C) Copyright Bobbing Wide 2009-2017 
    22if ( !defined( "BOBBFUNC_INCLUDED" ) ) { 
    3 define( "BOBBFUNC_INCLUDED", "3.0.0" ); 
     3define( "BOBBFUNC_INCLUDED", "3.2.1" ); 
    44 
    55/** 
     
    77 *  
    88 * Library: bobbfunc 
    9  * Depends: oik_boot, bwtrace, bobbcomp 
     9 * Depends: oik_boot, bwtrace, class-bobbcomp 
     10 * Deferred dependencies: oik-sc-help 
    1011 * Provides: bobbfunc 
    1112 * 
    1213 * These functions were part of the oik base plugin in bobbfunc.inc and bobbcomp.inc 
    1314 * Some functions may now be unused. This hasn't yet been confirmed. 
    14  *  
    15  *  
     15 * 
     16 * 
    1617 */ 
    1718 
     
    181182/** 
    182183 * Format a sanitized title= parameter  
     184 *  
     185 * Note: More often than not, for a11y, the title= parameter is not recommended. 
     186 * 
    183187 * @param $string - the title 
    184188 * @return $string 
     
    223227 * @param string $url - the fully formed URL e.g. http://www.oik-plugins.com 
    224228 * @param string $linktori - is the text or image 
    225  * @param string $alt - if NULL will use $linktori 
     229 * @param string $alt - text for title= attribute. a11y recommendations are to leave this null 
    226230 * @param string $id - the unique ID for the anchor tag 
    227231 * @param string $extra - anything else that needs to go in the <a> tag. e.g. 'onclick=then some javascript'  
     
    238242 * Return a well formed link 
    239243 * 
    240  * Parameters as for alink() 
    241 */ 
     244 * Parameters as for `alink()` 
     245 * 
     246 * @param string $class - the classes for the anchor tag 
     247 * @param string $url - the fully formed URL e.g. https://www.oik-plugins.com 
     248 * @param string $linktori - is the text or image 
     249 * @param string $alt - text for title= attribute. a11y recommendations are to leave this null 
     250 * @param string $id - the unique ID for the anchor tag 
     251 * @param string $extra - anything else that needs to go in the <a> tag. e.g. 'onclick=then some javascript'  
     252 * @return string the link 
     253 *  
     254 */ 
    242255function retlink( $class=NULL, $url, $linktori=NULL, $alt=NULL, $id=NULL, $extra=NULL  ) { 
    243   if ( is_null( $linktori ) ) 
     256  if ( is_null( $linktori ) )   { 
    244257    $linktori = $url; 
     258    } 
    245259  $link = "<a" ; 
    246   $link .= kv( "class", $class ); // aclass( $class ); 
    247   $link .= kv( "id", $id ); // aid( $id ); 
    248   $link .= kv( "href", $url ); // ahref( $url ); 
    249   if ( is_null( $alt ) ) 
    250      $alt = $linktori; 
    251   // Is alt= allowed with XHTML Strict 1.0?     
    252   // aalt( $alt ); 
    253   $link .= atitle( $alt ); 
    254   if ( $extra ) 
    255     $link .= $extra ; 
     260  $link .= kv( "class", $class );  
     261  $link .= kv( "id", $id );  
     262  $link .= kv( "href", $url );  
     263  if ( !is_null( $alt ) ) { 
     264        if ( $alt != $linktori ) { 
     265            $link .= atitle( $alt ); 
     266        } 
     267    } 
     268  if ( $extra ) { 
     269    $link .= $extra; 
     270    } 
    256271  $link .= ">"; 
    257   if ( $linktori ) 
     272  if ( $linktori ) { 
    258273    $link .= $linktori; 
     274    } 
    259275  $link .= "</a>"; 
    260276  return( $link ); 
     
    309325/** 
    310326 * Start an ordered list 
    311  */ 
    312 function sol( $class=NULL, $id=NULL ) { 
    313    stag( "ol", $class, $id ); 
    314 }         
     327 * 
     328 * @param string $class CSS class name(s) 
     329 * @param string $id CSS id name 
     330 * @param string $extra - additional NVPs 
     331 */ 
     332function sol( $class=null, $id=null, $extra=null ) { 
     333    //bw_trace2(); 
     334    stag( "ol", $class, $id, $extra ); 
     335} 
    315336 
    316337/**  
    317338 * Start an unordered list 
     339 * 
     340 * @param string $class CSS class name(s) 
     341 * @param string $id CSS id name 
     342 * @param string $extra - additional NVPs 
    318343 */  
    319344function sul( $class=NULL, $id=NULL, $extra=null ) { 
    320    stag( "ul", $class, $id, $extra ); 
     345    stag( "ul", $class, $id, $extra ); 
    321346}  
    322347 
    323348/** 
    324349 * Start a div 
     350 * 
     351 * @param string $class CSS class name(s) 
     352 * @param string $id CSS id name 
     353 * @param string $extra - additional NVPs 
    325354 */        
    326355function sdiv( $class=NULL, $id=NULL, $extra=NULL ) { 
    327    stag( "div", $class, $id, $extra ); 
     356    stag( "div", $class, $id, $extra ); 
    328357} 
    329358 
     
    375404  return( $ret );    
    376405} 
    377  
    378406/** 
    379407 * Return an end tag  
     
    382410   return( '</'.$tag.'>'); 
    383411 
    384  
    385412/**  
    386413 * Output an end tag 
     
    390417  bw_echo( '</'.$tag.'>' ); 
    391418}     
    392  
    393419/** 
    394420 * Start a paragraph 
     
    462488 * Output some translated text 
    463489 *  
    464  * Function e() replaces the original t() function used in Bobbing Wide custom code 
     490 * Function `e()` replaces the original t() function used in Bobbing Wide custom code 
    465491 * since for Drupal t() is already defined for translatable text. 
    466492 * 
    467  * Function bwt() does a similar job but also performs some strange filtering if required. 
     493 * Function `bwt()` does a similar job but also performs some strange filtering if required. 
    468494 * 
    469495 * When you want to output text that is translatable use:  
    470  *   bwt( $text );  
     496 *   `bwt( $text );`  
    471497 * 
    472498 * When you want to output text that is NOT translatable use: 
    473  *   e( $text ); 
     499 *   `e( $text );` 
    474500 * 
    475501 * Within functions where the $text parameter is translatable use: 
    476  *   e( bw_translate( $text ) ) 
     502 *   `e( __( "translatable text", "plugn-text-domain" ) );` 
     503 *  
     504 * Note: This function will be deprecated. 
    477505 *  
    478506 */   
     
    488516 
    489517/** 
    490  * @func e for bw_echo( if not NULL 
     518 * Outputs some translated / non-translatable text 
     519 *  
     520 * @param string $text any translated text or non translatable HTML 
    491521 */ 
    492522function e( $text = NULL ) { 
    493   if ( !is_null( $text )) 
    494     bw_echo( $text ); 
     523    if ( !is_null( $text )) { 
     524        bw_echo( $text ); 
     525    } 
    495526} 
    496527 
     
    566597  bwt( $data ); 
    567598  etag( "th" ); 
    568 }          
    569  
    570 // This routine finds the subdirectory under which this local version of the website is installed 
    571 // we need to remove this from index lookups but add it to links!  
    572 // Example: on betterbfar in the twentyte directory it's set: 
    573 // $docroot_suffix = "/twentyte/" ; 
    574  
     599}  
     600 
     601/** 
     602 * Get the document root suffix 
     603 *  
     604 * This routine finds the subdirectory under which this local version of the website is installed. 
     605 * Sometimes we need to remove this from index lookups but add it to links!  
     606 * 
     607 * @TODO Shouldn't this function be deprecated? 
     608 */ 
    575609function bw_get_docroot_suffix() { 
    576   bw_backtrace(); 
    577   //gobang(); 
     610  bw_backtrace( BW_TRACE_DEBUG ); 
    578611  $docroot_suffix = "/"; 
    579612  if ( $_SERVER['SERVER_NAME'] == bw_get_option( "betterbyfar") ) 
     
    581614     $exdr = explode( '/', $_SERVER["DOCUMENT_ROOT"] ); 
    582615     $exsf = explode( '/', $_SERVER['SCRIPT_FILENAME'] ); 
    583       
    584616     $docroot_suffix = '/' . $exsf[ count( $exdr) ] . '/'; 
    585617      
     
    716748  { 
    717749    if ( $oktop ) 
    718       p( $bw_debug_on . $text ); 
     750      BW_::p( $bw_debug_on . $text ); 
    719751    else 
    720752      _bw_c( $text );  
     
    860892 */ 
    861893function bw_sc_help( $shortcode="oik" ) { 
    862   oik_require( "includes/oik-sc-help.inc" ); 
    863   bw_lazy_sc_help( $shortcode ); 
     894  oik_require_lib( "oik-sc-help" ); 
     895    if ( function_exists( "bw_lazy_sc_help" ) ) { 
     896        bw_lazy_sc_help( $shortcode ); 
     897    } 
    864898} 
    865899 
     
    871905 */ 
    872906function bw_sc_syntax( $shortcode="oik", $callback=null ) { 
    873   oik_require( "includes/oik-sc-help.inc" ); 
    874   bw_lazy_sc_syntax( $shortcode, $callback ); 
     907  oik_require_lib( "oik-sc-help" ); 
     908    if ( function_exists( "bw_lazy_sc_syntax" ) ) { 
     909        bw_lazy_sc_syntax( $shortcode, $callback ); 
     910    } 
    875911} 
    876912 
     
    879915 */ 
    880916function bw_sc_example( $shortcode="oik", $atts=null ) { 
    881   oik_require( "includes/oik-sc-help.inc" ); 
    882   bw_lazy_sc_example( $shortcode, $atts ); 
     917  oik_require_lib( "oik-sc-help" ); 
     918    if ( function_exists( "bw_lazy_sc_example" ) ) { 
     919        bw_lazy_sc_example( $shortcode, $atts ); 
     920    } 
    883921} 
    884922 
     
    887925 */ 
    888926function bw_sc_snippet( $shortcode="oik" ) { 
    889   oik_require( "includes/oik-sc-help.inc" ); 
    890   bw_lazy_sc_snippet( $shortcode ); 
    891 } 
    892  
    893 /** 
    894   * Dynamic jQuery setting the selector, function and option parameters 
    895   * When should we use? 
    896   *  
    897   * jQuery(window).load(function() - when you need to wait for images to load? 
    898   * jQuery(function() 
    899   * jQuery(document).ready(function() 
    900   * 
    901 */   
     927  oik_require_lib( "oik-sc-help" ); 
     928    if ( function_exists( "bw_lazy_sc_snippet" ) ) { 
     929        bw_lazy_sc_snippet( $shortcode ); 
     930    } 
     931} 
     932 
     933/** 
     934 * Dynamic jQuery setting the selector, function and option parameters 
     935 * 
     936 * Note: jQuery(document).ready( fn ) has been deprecated in jQuery 3.0 
     937 * 
     938 * @param string $selector - the jQuery selector 
     939 * @param string $method - the jQuery method to invoke 
     940 * @param string $parms - parameters overriding the method's defaults 
     941 * @param bool $windowload - use true when you need to wait for images to load 
     942 */   
    902943if ( !function_exists( "bw_jquery" ) ) { 
    903944function bw_jquery( $selector, $method, $parms=null, $windowload=false ) { 
    904   bw_jq( "<script type=\"text/javascript\">" ); 
    905   if ( $windowload ) { 
    906     $jqfn = "jQuery(window).load(function()"; 
    907   } else { 
    908     $jqfn = "jQuery(document).ready(function()";  
    909   }     
    910   $function = "$jqfn { jQuery( \"$selector\" ).$method( $parms ); });"; 
    911   bw_jq( $function ); 
    912   bw_jq( "</script>" ); 
     945    if ( defined('DOING_AJAX') && DOING_AJAX ) { 
     946        return; 
     947    }  
     948    bw_jq( "<script type=\"text/javascript\">" ); 
     949    if ( $windowload ) { 
     950        $jqfn = 'jQuery(window).on( "load", function()'; 
     951    } else { 
     952        $jqfn = "jQuery( function()";  
     953    }     
     954    $function = "$jqfn { jQuery( \"$selector\" ).$method( $parms ); });"; 
     955    bw_jq( $function ); 
     956    bw_jq( "</script>" ); 
    913957}  
    914958} 
     
    920964 */ 
    921965function bw_jq_flush() { 
    922   global $bw_jq; 
    923   echo $bw_jq; 
    924   $bw_jq = null; 
     966    global $bw_jq; 
     967    echo $bw_jq; 
     968    $bw_jq = null; 
    925969 
    926970 
    927971/** 
    928  * Append some more jQuery code to be output later 
     972 * Appends some more jQuery code to be output later 
     973 * 
     974 * If it's not already set then we need to enqueue jquery and ensure that all the jQuery gets flushed at the end of processing. 
     975 * Note:  
    929976 *  
    930977 * @param $text - some well formed jQuery code 
     
    932979 */ 
    933980function bw_jq( $text ) { 
    934   global $bw_jq; 
    935   if ( !isset( $bw_jq ) ) { 
    936     wp_enqueue_script( 'jquery' );  
    937     if ( !is_admin() ) { 
    938       add_action( 'wp_footer', "bw_jq_flush", 25 ); 
    939     }   
    940     //bw_trace2( $bw_jq, "bw_jq not set" );   
    941   } 
    942   $bw_jq .=$text; 
    943   //bw_trace2( $bw_jq, "bw_jq", false );   
    944  
    945   if ( is_admin() ) { 
    946     bw_jq_flush(); 
    947   }   
     981    global $bw_jq; 
     982    if ( !isset( $bw_jq ) ) { 
     983        wp_enqueue_script( 'jquery' );  
     984        if ( !is_admin() ) { 
     985            add_action( 'wp_footer', "bw_jq_flush", 25 ); 
     986        } else { 
     987            add_action( "admin_print_footer_scripts", "bw_jq_flush", 25 ); 
     988        } 
     989     //bw_trace2( $bw_jq, "bw_jq not set" );   
     990    } 
     991    $bw_jq .=$text; 
     992} 
     993 
     994/** 
     995 * Returns any queued jQuery 
     996 * 
     997 * @return string queued jQuery 
     998 */ 
     999function bw_jq_get() { 
     1000    global $bw_jq; 
     1001    if ( isset( $bw_jq ) ) {     
     1002        return $bw_jq; 
     1003    } 
     1004    return null; 
    9481005} 
    9491006 
     
    11461203 * 
    11471204 * @param string $domain the plugin name 
     1205 * @return bool  
    11481206 */ 
    11491207function bw_load_plugin_textdomain( $domain="oik" ) { 
    11501208  $languages_dir =  "$domain/languages"; 
    1151   //bw_trace2( $languages_dir, "languages dir" ); 
    1152   load_plugin_textdomain( $domain, false, $languages_dir ); 
     1209  bw_trace2( $languages_dir, "languages dir" ); 
     1210  $loaded = load_plugin_textdomain( $domain, false, $languages_dir ); 
     1211    return $loaded; 
    11531212 
    11541213 
     
    12101269/**  
    12111270 * Return the global post ID 
     1271 *  
     1272 * In WordPress 4.9 new logic hides the globals $post from widgets. 
     1273 *  
    12121274 * @return ID - the global post ID or 0 
    12131275 */ 
     
    12151277  if ( isset( $GLOBALS['post'] )) { 
    12161278    $post_id = $GLOBALS['post']->ID; 
    1217   } else { 
     1279  } elseif ( isset( $GLOBALS['id'] ) ) { 
     1280        $post_id = $GLOBALS['id']; 
     1281    } else { 
    12181282    $post_id = 0; 
    12191283  }   
     
    12391303    $current_post_id = bw_global_post_id(); 
    12401304  } 
    1241   //bw_trace2( $current_post_id, "current_post_id" ); 
     1305  //bw_trace2( $current_post_id, "current_post_id", true ); 
    12421306  return( $current_post_id );  
    12431307} 
     
    12691333 
    12701334/** 
    1271  * Wrapper to translate - well it was! Herb 2013/10/31  
    1272  * 
    1273  * Similar to __() but with overriding logic to disable translation 
     1335 * Wrapper to translate  
     1336 *  
     1337 * - Similar to __() but with overriding logic to disable translation 
     1338 * - translation can be disabled by using bw_translation_off() 
     1339 * - translation can be re-enabled by using bw_translation_on() 
     1340 * - the textdomain can be set using bw_context( "textdomain", 'plugin-slug' ); 
     1341 * - the textdomain can be reset to the default ( 'oik' ) using bw_context( "textdomain", false ); 
    12741342 *  
    12751343 * @param string $text - text to be translated 
     
    12771345 */ 
    12781346function bw_translate( $text ) { 
     1347    if ( function_exists( "_deprecated_function" ) ) { 
     1348        if ( defined( 'BW_TRANSLATE_DEPRECATED' ) && BW_TRANSLATE_DEPRECATED ) { 
     1349            _deprecated_function( __FUNCTION__, "oik v3.2.0", "a suitable replacement method from class BW_" ); 
     1350        } 
     1351    } else { 
     1352        //  Perhaps it's not WordPress; 
     1353        bw_trace2(); 
     1354        bw_backtrace();  
     1355    } 
    12791356  $translation = bw_context( "bw_translation" ); 
    12801357  if ( $translation == "off" ) { 
     
    12901367      $translations = get_translations_for_domain( $textdomain ); 
    12911368      $text = $translations->translate( $text ); 
     1369            bw_trace2( $text, "Translation for: $textdomain", true, BW_TRACE_VERBOSE );   
    12921370    //}   
    1293   }   
     1371  } 
    12941372  return( $text ); 
    12951373}  
    12961374 
    12971375/** 
    1298  * Turn off translation performed by bw_translate() 
    1299  *  
    1300  * Helper function for bw_translate() 
     1376 * Turn off translation performed by `bw_translate()` 
     1377 *  
     1378 * Helper function for `bw_translate()` 
    13011379 */ 
    13021380function bw_translation_off() { 
     
    13051383 
    13061384/** 
    1307  * Turn on translation performed by bw_translate() 
     1385 * Turn on translation performed by `bw_translate()` 
    13081386 */ 
    13091387function bw_translation_on() { 
     
    13151393 * 
    13161394 * Part of the internationalization process is to ensure text is translatable. 
    1317  * We use bw_dtt() to register strings of text destined for internationalization. 
     1395 * We use `bw_dtt()` to register strings of text destined for internationalization. 
    13181396 * This enables makepot/makeoik to extract the strings into the plugin's .pot file 
    13191397 * from which localized versions can be created. 
  • oik-bwtrace/trunk/libs/bwtrace.php

    r1265295 r1790744  
    1 <?php // (C) Copyright Bobbing Wide 2011-2015 
     1<?php // (C) Copyright Bobbing Wide 2011-2016 
    22if ( !defined( "BWTRACE_INCLUDED" ) ) { 
    3 define( "BWTRACE_INCLUDED", "2.0.7" ); 
     3define( "BWTRACE_INCLUDED", "2.0.12" ); 
    44define( "BWTRACE_FILE", __FILE__ ); 
    55 
     
    6969if ( !function_exists( "bw_trace" ) ) {  
    7070    function bw_trace( $text, $function=__FUNCTION__, $lineno=__LINE__, $file=__FILE__, $text_label=null, $level=BW_TRACE_ALWAYS ) { 
    71         global $bw_trace_on; 
    72         if ( $bw_trace_on ) { 
     71        global $bw_trace_on, $bw_trace_level; 
     72        if ( $bw_trace_on && ( $level <= $bw_trace_level ) ) { 
    7373            bw_lazy_trace( $text, $function, $lineno, $file, $text_label, $level ); 
    7474        }   
  • oik-bwtrace/trunk/libs/oik-admin.php

    r1240803 r1790744  
    1 <?php // (C) Copyright Bobbing Wide 2011-2015 
     1<?php // (C) Copyright Bobbing Wide 2011-2017 
    22if ( !defined( "OIK_ADMIN_INCLUDED" ) ) { 
    3 define( "OIK_ADMIN_INCLUDED", "3.0.1" ); 
     3define( "OIK_ADMIN_INCLUDED", "3.2.0" ); 
    44 
    55/** 
     
    77 * Library: oik-admin 
    88 * Provides: oik-admin 
    9  * Depends: bobbfunc, bobbforms 
     9 * Depends: bobbfunc, bobbforms, class-bobbcomp 
    1010 * 
    1111 * Functions that support the display of admin pages 
     
    2121 * This function implements a simple "load module" until such a time as  
    2222 * either a) modules are implemented, b) the logic is replaced with library logic 
     23 *  
     24 * @param string $set the option set 
     25 * @param string $option the option within the set 
     26 * @param string $plugin null for the default file extension 
    2327 */ 
    2428function bw_load_plugin( $set="bw_buttons", $option="oik-button-shortcodes", $plugin=NULL ) { 
    25   $checkbox = bw_get_option( $option, $set ); 
    26   bw_trace2( $checkbox, "checkbox", true, BW_TRACE_DEBUG ); 
    27   if ( $checkbox == "on"  ) { 
    28     if ( $plugin == NULL ) { 
    29       $plugin = $option.".php" ; 
    30      
    31     bw_trace2( $plugin, "plugin", false, BW_TRACE_DEBUG ); 
    32     oik_require( $plugin ); 
    33   } 
    34 }     
     29    $checkbox = bobbcomp::bw_get_option( $option, $set ); 
     30    bw_trace2( $checkbox, "checkbox", true, BW_TRACE_DEBUG ); 
     31    if ( $checkbox == "on"  ) { 
     32        if ( $plugin == NULL ) { 
     33            $plugin = $option.".php" ; 
     34         
     35        bw_trace2( $plugin, "plugin", false, BW_TRACE_DEBUG ); 
     36        oik_require( $plugin ); 
     37    } 
     38} 
    3539 
    3640 
    37 /** 
    38  * Create a postbox widget on the admin pages  
    39  * 
    40  *  
    41  * Notes: Similar to Yoast's potbox (sic) 
    42  * 
    43  *  
    44  */ 
    45 function oik_box( $class=NULL, $id=NULL, $title=NULL, $callback='oik_callback' ) { 
    46   if ( $id == NULL ) { 
    47     $id = $callback; 
    48   }   
    49   sdiv( "postbox $class", $id ); 
    50   sdiv( "handlediv", NULL, kv( 'title', __( "Click to toggle" ) ) ); 
    51   br(); 
    52   ediv(); 
    53   h3( bw_translate( $title ), "hndle" ); 
    54   sdiv( "inside" ); 
    55   call_user_func( $callback ); 
    56   ediv( "inside" ); 
    57   ediv( "postbox" ); 
    58 } 
     41    /** 
     42     * Outputs a postbox widget on the admin pages  
     43     * 
     44     * @param string $class additional CSS classes for the postbox 
     45     * @param string $id Unique CSS ID 
     46     * @param string $title Translatable title 
     47     * @param string $callback Callable function implementing the post box contents 
     48     */ 
     49    function oik_box( $class=null, $id=null, $title=null, $callback='oik_callback' ) { 
     50        $title = bw_translate( $title ); 
     51        if ( $id == null ) { 
     52            $id = $callback; 
     53        }   
     54        sdiv( "postbox $class", $id ); 
     55        oik_handlediv( $title ); 
     56        h3( $title, "hndle" ); 
     57        sdiv( "inside" ); 
     58        call_user_func( $callback ); 
     59        ediv( "inside" ); 
     60        ediv( "postbox" ); 
     61    } 
     62 
     63    /** 
     64     * Displays the toggle button for the postbox 
     65     *  
     66     * @param string $title - translated title 
     67     */ 
     68    function oik_handlediv( $title ) { 
     69        $title = sprintf( __( 'Toggle panel: %s' ), $title ); 
     70        e( '<button type="button" class="handlediv" aria-expanded="true">' ); 
     71        e( '<span class="screen-reader-text">' . $title . '</span>' ); 
     72        e( '<span class="toggle-indicator" aria-hidden="true">' ); 
     73        e( '</span>' ); 
     74        e( '</button>' ); 
     75    } 
    5976 
    6077/** 
    6178 * Start a column  
     79 *  
     80 * Starts a column in the admin page 
     81 * 
     82 * @param string $class additional CSS classes 
     83 * @param string $id Unique CSS ID 
    6284 */ 
    6385function scolumn( $class=NULL, $id=null ) { 
    64   sdiv( "metabox-holder" ); 
    65   sdiv( "postbox-container $class", $id  ); 
    66   sdiv( "meta-box-sortables ui-sortable" ); 
     86    sdiv( "metabox-holder" ); 
     87    sdiv( "postbox-container $class", $id  ); 
     88    sdiv( "meta-box-sortables ui-sortable" ); 
    6789} 
    68    
     90 
    6991/** 
    7092 * End a column 
    7193 */ 
    7294function ecolumn() { 
    73   _bw_c( "start ecolumn" ); 
    74   ediv( "meta-box-sortables" ); 
    75   ediv( "postbox-container" ); 
    76   ediv( "metabox-holder" ); 
    77   _bw_c( "end ecolumn" ); 
    78 }  
     95    _bw_c( "start ecolumn" ); 
     96    ediv( "meta-box-sortables" ); 
     97    ediv( "postbox-container" ); 
     98    ediv( "metabox-holder" ); 
     99    _bw_c( "end ecolumn" ); 
     100} 
    79101 
    80102/** 
    81103 * Create an oik menu header 
    82104 * 
    83  * Note: Removed the link to oik   
     105 * Note: Completely removed the link to oik   
    84106 * 
    85107 * @param string $title - title for the box 
     
    87109 */ 
    88110function oik_menu_header( $title="Overview", $class="w70pc" ) { 
    89   //oik_require( "bobbforms.inc" ); 
    90   //oik_enqueue_stylesheets(); 
    91   oik_enqueue_scripts(); 
    92   sdiv( "wrap" );  
    93   //oik_require( "shortcodes/oik-bob-bing-wide.php" ); 
    94     if ( function_exists( "bw_loik" ) ) { 
    95         $loik = bw_loik(); 
    96     } else { 
    97         $loik = null; 
    98     } 
    99   h2( "$loik " . bw_translate( $title ) );  
    100   scolumn( $class ); 
     111    oik_enqueue_scripts(); 
     112    e( wp_nonce_field( "closedpostboxes", "closedpostboxesnonce", false, false ) ); 
     113    sdiv( "wrap" );  
     114    h2( bw_translate( $title ) );  
     115    scolumn( $class ); 
    101116} 
    102117 
     
    105120 */ 
    106121function oik_menu_footer() { 
    107   ecolumn(); 
    108   sediv( "clear" ); 
    109   ediv( "wrap"); 
    110 }  
     122    ecolumn(); 
     123    sediv( "clear" ); 
     124    ediv( "wrap"); 
     125} 
    111126 
    112127/** 
     
    116131 * BUT it doesn't require the translator to have to worry about the position of the variable 
    117132 * AS this isn't in the text they translate. 
     133 *  
     134 * @param string $translatable_text - text to be translated 
     135 * @param string $non_translatable_text - text that's not translated 
    118136 */ 
    119137function _bwtnt( $translatable_text, $non_translatable_text ) { 
    120   $tnt = bw_translate( $translatable_text ); 
    121   $tnt .= $non_translatable_text; 
    122   return( $tnt ); 
     138    $tnt = bw_translate( $translatable_text ); 
     139    $tnt .= $non_translatable_text; 
     140    return( $tnt ); 
    123141} 
    124  
    125142 
    126143/** 
     
    130147 * You may think this is insecure. It probably is if there wasn't any other security. 
    131148 * It's certainly a lot easier. 
    132  *  
    133149 * 
    134150 * @param array $input stuff to validate 
     
    136152 */ 
    137153function oik_plugins_validate( $input ) { 
    138   return $input; 
     154    return $input; 
    139155} 
    140156 
     
    145161 * Where do we find out what all the others do? 
    146162 * Each of the default scripts that we enqueue gets added to the list of scripts loaded by wp-admin/load-scripts.php 
    147  * Except when 'SCRIPT_DEBUG' is true; then each script is loaded separately 
    148    
     163 * Except when 'SCRIPT_DEBUG' is true; then each script is loaded separately. 
     164 *  
    149165 * 'dashboard' enables postbox toggling 
    150  * It's not necessary to add most of these as they are pre-requisites  
     166 * Currently ( Jul 2017 ) we want the toggling but don't want the AJAX requests when a postbox is toggled. 
     167 *  
     168 * It's not necessary to add most of the others that are commented out below as they are pre-requisites  
    151169 * e.g. dashboard is dependent upon jquery, admin-comments and postbox 
    152170 * 
     
    154172 */ 
    155173function oik_enqueue_scripts() { 
    156  
    157   //wp_enqueue_style( 'wp-pointer' );  
    158   //wp_enqueue_script( 'jquery-ui' );  
    159   //wp_enqueue_script( 'jquery-ui-core' );  
    160   //wp_enqueue_script( 'jquery-ui-widget' );  
    161   //wp_enqueue_script( 'jquery-ui-mouse' );  
    162   //wp_enqueue_script( 'jquery-ui-sortable' ); 
    163   //wp_enqueue_script( 'postbox' ); 
    164   //wp_enqueue_script( 'wp-ajax-response' ); 
    165   //wp_enqueue_script( 'wp-lists' ); 
    166   //wp_enqueue_script( 'jquery-query' ); 
    167   wp_enqueue_script( 'dashboard' ); 
    168    
    169   //wp_enqueue_script( 'jquery-ui-draggable' ); 
    170   //wp_enqueue_script( 'jquery-ui-droppable' ); 
    171   //wp_enqueue_script( 'jquery-ui-tabs' ); 
    172   //wp_enqueue_script( 'jquery-ui-selectable' ); 
    173   //wp_enqueue_script( 'wp-pointer' );  
    174   //wp_enqueue_script( 'utils' ); 
    175  
    176  
     174    //wp_enqueue_style( 'wp-pointer' );  
     175    //wp_enqueue_script( 'jquery-ui' );  
     176    //wp_enqueue_script( 'jquery-ui-core' );  
     177    //wp_enqueue_script( 'jquery-ui-widget' );  
     178    //wp_enqueue_script( 'jquery-ui-mouse' );  
     179    //wp_enqueue_script( 'jquery-ui-sortable' ); 
     180    //wp_enqueue_script( 'postbox' ); 
     181    //wp_enqueue_script( 'wp-ajax-response' ); 
     182    //wp_enqueue_script( 'wp-lists' ); 
     183    //wp_enqueue_script( 'jquery-query' ); 
     184    wp_enqueue_script( 'dashboard' ); 
     185    //wp_enqueue_script( 'jquery-ui-draggable' ); 
     186    //wp_enqueue_script( 'jquery-ui-droppable' ); 
     187    //wp_enqueue_script( 'jquery-ui-tabs' ); 
     188    //wp_enqueue_script( 'jquery-ui-selectable' ); 
     189    //wp_enqueue_script( 'wp-pointer' );  
     190    //wp_enqueue_script( 'utils' ); 
     191} 
    177192 
    178193} /* end !defined() */ 
  • oik-bwtrace/trunk/libs/oik_boot.php

    r1313382 r1790744  
    1 <?php // (C) Copyright Bobbing Wide 2012-2015 
     1<?php // (C) Copyright Bobbing Wide 2012-2017 
    22if ( !defined( 'OIK_BOOT_INCLUDED' ) ) { 
    3 define( 'OIK_BOOT_INCLUDED', "3.0.1" ); 
     3define( 'OIK_BOOT_INCLUDED', "3.2.0" ); 
    44define( 'OIK_BOOT_FILE', __FILE__ ); 
    55/** 
     
    2222 * until you need them. 
    2323 * 
    24  * New version: 
    25  * use add_action( "oik_loaded", 'your_init_function' ); 
    26  * to know when oik has been loaded so you can use the APIs 
    27  *  
    28  * Note: oik_boot may be loaded before WordPress has done its stuff, so we may need to define some constants ourselves 
    29  * Here we assume the file is in ABSPATH/wp-content/plugins/oik/libs so we need 4 dirnames to get back to ABSPATH 
    30  * and then we need to convert backslashes to forward slashes and the drive letter to uppercase. 
    31  * Currently don't think it's necessary to check the first letter but we're doing it anyway. 
    32  *  
    33  */ 
    34 if (!function_exists( 'oik_path' )) { 
    35   if ( !defined('ABSPATH') ) { 
     24 * Use add_action( "oik_loaded", 'your_init_function' ); 
     25 * to know when oik has been loaded so you can use the APIs. 
     26 *  
     27 * Note: oik_boot may be loaded before WordPress has done its stuff, so we may need to define some constants ourselves. 
     28 * Here we assume the file is in ABSPATH/wp-content/plugins/oik/libs so we need 4 dirnames to get back to ABSPATH, 
     29 * and then we need to convert backslashes to forward slashes and the drive letter, if present, to uppercase. 
     30 *  
     31 * @param string $file - the relative file name within the plugin, without a leading slash 
     32 * @param string $plugin - the plugin slug 
     33 * @return string the fully qualified plugin file name 
     34 */ 
     35if ( !function_exists( 'oik_path' ) ) { 
     36    if ( !defined('ABSPATH') ) { 
    3637        $abspath = dirname( dirname( dirname ( dirname( dirname( __FILE__ ))))) . '/'; 
    37     $abspath = str_replace( "\\", "/", $abspath ); 
     38        $abspath = str_replace( "\\", "/", $abspath ); 
    3839        if ( ':' === substr( $abspath, 1, 1 ) ) { 
    3940            $abspath = ucfirst( $abspath ); 
    4041        } 
    41     define( 'ABSPATH', $abspath ); 
    42     } 
    43  
    44   if ( !defined('WP_CONTENT_DIR') ) 
    45     define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down 
    46            
    47   if ( !defined('WP_PLUGIN_DIR') ) 
    48     define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash 
    49  
    50   function oik_path( $file = NULL, $plugin='oik') { 
    51    
    52     return( WP_PLUGIN_DIR . '/'. $plugin. '/' . $file ); 
    53   } 
    54 } 
    55   
    56 /** 
    57  * invoke require_once on an oik include file or other file 
    58  * 
     42        define( 'ABSPATH', $abspath ); 
     43    } 
     44    if ( !defined('WP_CONTENT_DIR') ) { 
     45        define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down 
     46    }         
     47    if ( !defined('WP_PLUGIN_DIR') ) { 
     48        define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash 
     49    } 
     50    function oik_path( $file=NULL, $plugin='oik') { 
     51        return( WP_PLUGIN_DIR . '/'. $plugin. '/' . $file ); 
     52    } 
     53} 
     54 
     55/** 
     56 * Invoke require_once on an oik include file or other file 
     57 * 
     58 * @uses oik_path() 
     59 *  
    5960 * @param string $include_file - the include file (or any other file) that you want to load 
    6061 * @param string $plugin - the plugin in which the file is located (default="oik") 
    61  * @uses oik_path() 
    62  */ 
    63   
     62 */ 
    6463if (!function_exists( 'oik_require' )) { 
    65   function oik_require( $include_file = "bobbfunc.inc", $plugin="oik" ) { 
    66     $path = oik_path( $include_file, $plugin ); 
    67     if ( !file_exists( $path ) ) {  
    68       echo "<!-- File does not exist:$path! -->" ; 
    69       if ( !is_file( $path ) ) { 
    70         echo "<!-- File is not a real file:$path! -->" ; 
    71       } 
    72             echo "<!-- "; 
    73       print_r( debug_backtrace() ); 
    74             echo " -->"; 
    75       //gobang(); 
    76        
    77     }   
    78     require_once( $path );  
    79   }   
     64    function oik_require( $include_file = "bobbfunc.inc", $plugin="oik" ) { 
     65        $path = oik_path( $include_file, $plugin ); 
     66        if ( !file_exists( $path ) ) { 
     67            bw_log( $path, "path", true, "oik_yourehavingmeon" ); 
     68        }   
     69        require_once( $path );  
     70    }   
    8071}  
    8172 
     
    9283 * This code does REQUIRE the file to exist somewhere!  
    9384 */ 
    94 function oik_require2( $include_file="bobbfunc.inc", $to_plugin, $from_plugin="oik" ) { 
    95   $new_path = oik_path( $include_file, $to_plugin ); 
    96   if ( file_exists( $new_path ) ) { 
    97     require_once( $new_path ); 
    98   } else { 
    99     oik_require( $include_file, $from_plugin ); 
    100    
    101 } 
     85    function oik_require2( $include_file="bobbfunc.inc", $to_plugin, $from_plugin="oik" ) { 
     86        $new_path = oik_path( $include_file, $to_plugin ); 
     87        if ( file_exists( $new_path ) ) { 
     88            require_once( $new_path ); 
     89        } else { 
     90            oik_require( $include_file, $from_plugin ); 
     91         
     92    } 
    10293} 
    10394   
     
    109100 * OR, if add_action() is not yet available, call this function, if it's available. 
    110101 * In most cases all that is required initially is to load /libs/bwtrace.php 
    111 */  
     102 */  
    112103if ( !function_exists( "oik_init" ) ) { 
    113 function oik_init( ) { 
    114   oik_require_lib( 'bwtrace' ); 
    115 } 
     104    function oik_init( ) { 
     105        oik_require_lib( 'bwtrace' ); 
     106    } 
    116107}  
    117108  
     
    119110 * Return the array[index] or a default value if not set 
    120111 *  
     112 * Notes: This routine may produce a Warning message if the $index is not scalar. 
     113  
     114 * @TODO I can't change it yet since there are other bits of code that may go wrong if I attempt  
     115 * to deal with an invalid  $index parameter.  
     116 *  
    121117 * @param mixed $array - an array or object or scalar item from which to find $index 
    122118 * @param scalar $index - the array index or object property to obtain 
     
    124120 * @return mixed - the value found at the given index 
    125121 * 
    126  * Notes: This routine may produce a Warning message if the $index is not scalar 
    127  * I can't change it yet since there are other bits of code that may go wrong if I attempt  
    128  * to deal with an invalid  $index parameter.  
    129122 */ 
    130123if ( !function_exists( 'bw_array_get' ) ) { 
    131   function bw_array_get( $array = NULL, $index, $default=NULL ) {  
    132     //  sometimes we get passed an empty array as the index to the array - what should we do in this case **?** Herb 2013/10/24 
    133     if ( is_array( $index ) ) { 
    134       bw_backtrace( BW_TRACE_WARNING ); 
    135       //gobang(); 
    136     } 
    137     if ( isset( $array ) ) { 
    138       if ( is_array( $array ) ) { 
    139         if ( isset( $array[$index] ) || array_key_exists( $index, $array ) ) { 
    140           $value = $array[$index]; 
    141         } else { 
    142           $value = $default; 
    143          
    144       } elseif ( is_object( $array ) ) { 
    145         if ( property_exists( $array, $index ) ) { 
    146           $value = $array->$index; 
    147         } else { 
    148           $value = $default; 
    149         }  
    150       } else { 
    151         $value = $default; 
    152        
    153     } else { 
    154       $value = $default; 
    155      
    156     return( $value ); 
    157   } 
     124    function bw_array_get( $array = NULL, $index, $default=NULL ) {  
     125        //  sometimes we get passed an empty array as the index to the array - what should we do in this case **?** Herb 2013/10/24 
     126        if ( is_array( $index ) ) { 
     127            bw_backtrace( BW_TRACE_WARNING ); 
     128            //gobang(); 
     129        } 
     130        if ( isset( $array ) ) { 
     131            if ( is_array( $array ) ) { 
     132                if ( isset( $array[$index] ) || array_key_exists( $index, $array ) ) { 
     133                    $value = $array[$index]; 
     134                } else { 
     135                    $value = $default; 
     136                 
     137            } elseif ( is_object( $array ) ) { 
     138                if ( property_exists( $array, $index ) ) { 
     139                    $value = $array->$index; 
     140                } else { 
     141                    $value = $default; 
     142                }  
     143            } else { 
     144                $value = $default; 
     145             
     146        } else { 
     147            $value = $default; 
     148         
     149        return( $value ); 
     150    } 
    158151} 
    159152 
     
    185178            $library_file = oik_require_lib_fallback( $library ); 
    186179        } 
    187         // We are dependent upon the 'bwtrace' library for these functions 
    188         bw_trace2( $library_file, "library_file: $library", true, BW_TRACE_DEBUG ); 
    189         bw_backtrace( BW_TRACE_DEBUG ); 
     180        // We are dependent upon the 'bwtrace' library for these functions. Assume both are defined if bw_trace2() is. 
     181        if ( function_exists( "bw_trace2" ) ) { 
     182            bw_trace2( $library_file, "library_file: $library", true, BW_TRACE_VERBOSE ); 
     183            bw_backtrace( BW_TRACE_VERBOSE ); 
     184        } 
    190185        return( $library_file ); 
    191186    } 
     
    207202            $library .= ".php"; 
    208203        } 
    209         $oik_lib_fallback = oik_lib_fallback( __DIR__ ); 
     204        $oik_lib_fallback = oik_lib_fallback( dirname( __FILE__ ) ); 
    210205        foreach ( $oik_lib_fallback as $library_dir ) { 
    211206            $library_file = "$library_dir/$library"; 
     
    224219 
    225220/** 
    226  * Set a fallback directory for shared library processing 
     221 * Set a(nother) fallback directory for shared library processing 
    227222 * 
    228223 * @param string $lib_dir fully qualified directory for library files with NO trailing slash 
     
    230225 */ 
    231226function oik_lib_fallback( $lib_dir ) { 
    232     //echo "adding: $lib_dir " . PHP_EOL;  
    233227    global $oik_lib_fallback; 
    234     //echo count( $oik_lib_fallback ); 
    235228    if ( empty( $oik_lib_fallback ) ) { 
    236         //if ( __DIR__ == $lib_dir ) { 
    237     //  $oik_lib_fallback = array(); 
    238         //} else { 
    239             $oik_lib_fallback = array( __DIR__ ); 
    240         //} 
    241     } //else { 
    242         if ( __DIR__ != $lib_dir ) { 
    243             $oik_lib_fallback[] = $lib_dir; 
    244         } 
    245     //} 
     229        $oik_lib_fallback = array(); 
     230    } 
     231    $oik_lib_fallback[] = $lib_dir; 
    246232    return( $oik_lib_fallback ); 
    247233} 
     
    251237 *  
    252238 * Locates and loads a file from a given library in order to make additional functions available to the invoking routine 
    253  *  
    254  * @param string $file the relative file name ( relative to the library's "root" file ) e.g.  
     239 * Note: If successful the oik_lib object of the library is returned. It won't show the file name of the file loaded. 
     240 *  
     241 * @param string $file the relative file name ( relative to the library's "root" file ) e.g. class-oik-autoload.php  
    255242 * @param string $library the library name  
    256243 * @param array $args additional parameters 
    257  * @return bool|WP_Error  
     244 * @return bool|WP_Error|oik_lib  
    258245 */ 
    259246if ( !function_exists( "oik_require_file" ) ) {  
    260 function oik_require_file( $file, $library, $args=null ) { 
    261     //bw_trace2(); 
    262     if ( function_exists( "oik_libs" ) ) { 
    263         $oik_libs = oik_libs(); 
    264         $library_file = $oik_libs->require_file( $file, $library, $args ); 
    265     } else { 
    266         $library_file = oik_require_lib_fallback( $file ); 
    267     } 
    268     bw_trace2( $library_file, "library_file", true, BW_TRACE_VERBOSE ); 
    269     return( $library_file );     
    270 } 
    271 }  
     247    function oik_require_file( $file, $library, $args=null ) { 
     248        //bw_trace2(); 
     249        if ( function_exists( "oik_libs" ) ) { 
     250            $oik_libs = oik_libs(); 
     251            $library_file = $oik_libs->require_file( $file, $library, $args ); 
     252        } else { 
     253            $library_file = oik_require_lib_fallback( $file ); 
     254        } 
     255        bw_trace2( $library_file, "library_file", true, BW_TRACE_DEBUG ); 
     256        return( $library_file );     
     257    } 
     258} 
     259 
     260/** 
     261 * Dormant logging function 
     262 * 
     263 * Similar to oik-bwtrace's bw_trace2() but always enabled if the bw_lazy_log() function is defined, 
     264 * regardless of the $level. 
     265 * 
     266 * @param mixed $value - the data to be logged  
     267 * @param string $text - label for the data to be logged 
     268 * @param bool $show_args - true if the calling parameters should be logged 
     269 * @param string $level - either the logging level or a callable function which is passed $value  
     270 * @return mixed $value - in case it's invoked in a filter function's return 
     271 */ 
     272if ( !function_exists( "bw_log" ) ) { 
     273    function bw_log( $value=null, $text=null, $show_args=true, $level=BW_TRACE_ALWAYS ) {  
     274        if ( function_exists( "bw_lazy_log" ) ) { 
     275            bw_lazy_log( $value, $text, $show_args, $level ); 
     276        } 
     277        return( $value ); 
     278    } 
     279} 
     280 
    272281 
    273282} /* end if !defined */ 
  • oik-bwtrace/trunk/oik-bwtrace.php

    r1345825 r1790744  
    22/* 
    33Plugin Name: oik bwtrace  
    4 Plugin URI: http://www.oik-plugins.com/oik-plugins/oik-bwtrace 
     4Plugin URI: https://www.oik-plugins.com/oik-plugins/oik-bwtrace 
    55Description: Debug trace for WordPress, including action and filter tracing 
    6 Version: 2.0.11 
     6Version: 2.1.1 
    77Author: bobbingwide 
    8 Author URI: http://www.oik-plugins.com/author/bobbingwide 
     8Author URI: https://www.oik-plugins.com/author/bobbingwide 
    99Text Domain: oik-bwtrace 
    1010Domain Path: /languages/ 
     
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html 
    1313 
    14     Copyright 2011-2016 Bobbing Wide (email : herb@bobbingwide.com ) 
     14    Copyright 2011-2017 Bobbing Wide (email : herb@bobbingwide.com ) 
    1515 
    1616    This program is free software; you can redistribute it and/or modify 
     
    9191    if ( !empty( $_REQUEST['_bw_trace_reset'] ) ) { 
    9292        $bw_trace_reset = true; 
     93    } 
     94     
     95    if ( isset( $_REQUEST['wc-ajax'] ) ) { 
     96        $bw_trace_reset = false; 
    9397    }  
    9498    return( $bw_trace_reset ); 
     
    132136/** 
    133137 * Startup processing for oik-bwtrace 
     138 * 
     139 * @TODO Implementation doesn't match comments. What should happen when "ip" is set in the trace profile? 
    134140 *  
    135141 * Activate trace if the profile says so  
    136142 * AND if the chosen IP address is being used 
     143 * OR if there's no REMOTE_ADDR and the value for trace_ip matches the value for PHP CLI processing. 
    137144 *  
    138145 * Activate action hooks and filter counting or other action tracing if the profile says so 
     
    150157    if ( $bw_trace_ip ) { 
    151158        $server = bw_array_get( $_SERVER, "REMOTE_ADDR", null ); 
    152         $tracing = ( $server == $bw_trace_ip ); 
     159        if ( $server ) { 
     160            $tracing = ( $server == $bw_trace_ip ); 
     161        } else { 
     162            $tracing = ( $bw_trace_ip === php_sapi_name() ); 
     163        } 
    153164    } 
    154165    $bw_trace_reset = bw_trace_reset_status( $bw_trace_ip, $tracing ); 
     
    220231 */ 
    221232function oik_bwtrace_plugins_loaded() { 
    222     if ( oik_require_lib( "oik-admin" ) && oik_require_lib( "bobbforms" ) && oik_require_lib( "bobbfunc" )  ) { 
     233    if ( function_exists( "is_admin" ) ) { 
     234        $is_admin = is_admin(); 
     235    } else { 
     236        $is_admin = false; 
     237    } 
     238     
     239    /**  
     240     * Load the required library files before registering these hooks 
     241     */ 
     242    if ( oik_require_lib( "oik-admin" ) && oik_require_lib( "bobbforms" ) && oik_require_lib( "bobbfunc" ) && oik_require_lib( "class-bobbcomp") 
     243    && oik_require_lib( "class-BW-" ) && $is_admin ) { 
    223244        add_action( 'admin_menu', 'bw_trace_options_add_page'); 
    224245        add_action( 'admin_menu', 'bw_action_options_add_page'); 
     
    230251    add_action( 'admin_init', 'bw_trace_options_init' ); 
    231252    add_action( 'admin_init', 'bw_action_options_init' ); 
     253     
    232254    /* 
    233255     * Load admin logic if is_admin()  
    234256     */ 
    235     if ( function_exists( "is_admin" ) ) { 
    236         if ( is_admin() ) {    
    237             oik_require( "admin/oik-bwtrace.inc", "oik-bwtrace" ); 
    238         } 
    239     } 
    240      
     257    if ( $is_admin ) {    
     258        oik_require( "admin/oik-bwtrace.php", "oik-bwtrace" ); 
     259    } 
    241260     
    242261  add_action( "oik_admin_menu", "oik_bwtrace_admin_menu" ); 
     
    257276 */ 
    258277function oik_bwtrace_query_libs( $libraries ) { 
    259   // $libraries = oik_lib_query_libraries( $libraries, "oik-bwtrace" ); 
    260278    $lib_args = array(); 
    261279    $libs = array( "bobbfunc" => null, "bobbforms" => "bobbfunc", "oik-admin" => "bobbforms" ); 
    262     $versions = array( "bobbfunc" => "3.0.0" ); 
     280    $versions = array( "bobbfunc" => "3.2.0", "bobbforms" => "3.2.0", "oik-admin" => "3.2.0" ); 
    263281    foreach ( $libs as $library => $depends ) { 
    264282        $lib_args['library'] = $library; 
    265283        $lib_args['src'] = oik_path( "libs/$library.php", "oik-bwtrace" );  
    266         //if ( $depends ) { 
    267             $lib_args['deps'] = $depends; 
    268         //} 
    269          
     284        $lib_args['deps'] = $depends; 
    270285        // Here we should consider deferring the version setting until it's actually time to check compatibility 
    271286        $lib_args['version'] = bw_array_get( $versions, $library, null ); 
     
    273288        $libraries[] = $lib; 
    274289    } 
    275     bw_trace2( null, null, true, BW_TRACE_DEBUG ); 
     290    bw_trace2( null, null, true, BW_TRACE_VERBOSE ); 
    276291    //bw_backtrace(); 
    277292    return( $libraries ); 
     
    279294 
    280295/** 
    281  *  
    282  * Implement 'oik_admin_menu' action  
     296 * Implements 'oik_admin_menu' action  
    283297 *  
    284298 * Set the plugin server 
     
    320334    if ( !function_exists( 'oik_require' ) ) { 
    321335        // check that oik v2.6 (or higher) is available. 
    322         $oik_boot = __DIR__ . "/libs/oik_boot.php"; 
     336        $oik_boot = dirname( __FILE__ ). "/libs/oik_boot.php"; 
    323337        if ( file_exists( $oik_boot ) ) {  
    324338            require_once( $oik_boot ); 
     
    333347    */ 
    334348    if ( function_exists( "oik_require2" )) { 
    335         oik_lib_fallback( __DIR__ . '/libs' ); 
     349        oik_lib_fallback( dirname( __FILE__ ) . '/libs' ); 
    336350        oik_require( "libs/bwtrace.php", "oik-bwtrace" ); 
    337         oik_require( "libs/bwtrace_boot.php", "oik-bwtrace" );  
     351        oik_require( "libs/bwtrace_boot.php", "oik-bwtrace" ); 
     352        oik_require( "libs/bwtrace_log.php", "oik-bwtrace" );  
    338353        oik_require2( "includes/bwtrace.php", "oik-bwtrace" ); 
    339354    } 
     
    375390} 
    376391 
    377  
    378392global $bw_trace_options, $bw_trace_on, $bw_trace_level; 
    379393 
    380394oik_bwtrace_loaded(); 
    381  
    382  
  • oik-bwtrace/trunk/readme.txt

    r1345819 r1790744  
    11=== oik-bwtrace === 
    22Contributors: bobbingwide, vsgloik 
    3 Donate link: http://www.oik-plugins.com/oik/oik-donate/ 
    4 Tags: debug, trace, backtrace, actions, filters, ad hoc tracing, hook tracing, filter tracing 
    5 Requires at least: 4.2 
    6 Tested up to: 4.4.2 
    7 Stable tag: 2.0.11 
     3Donate link: https://www.oik-plugins.com/oik/oik-donate/ 
     4Tags: debug, trace, backtrace, actions, filters, ad hoc tracing, hook tracing, filter tracing, string watch 
     5Requires at least: 4.9 
     6Tested up to: 4.9.1 
     7Stable tag: 2.1.1 
    88License: GPLv2 or later 
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    1515* The primary purpose of action trace is to help you understand the sequence of events in the server. 
    1616* The primary purpose of ad hoc tracing is to let you see what's happening without changing any code. 
     17* The primary purpose of 'string watch' is to track the source of some output. 
    1718* This plugin provides the admin interface to trace functions and methods and action and filter tracing. 
    1819 
     
    5556* set the priority for the trace hook 
    5657* debug backtrace hook invocation 
     58* perform 'string watch' to watch for a particular string 
    5759  
    5860 
     
    7880* Information related to Errors, Warnings and Notices 
    7981 
     82New in v2.0.12 
     83 
     84* 'String watch' capability. Helps you track down the source of some output, whether it comes from code, content or elsewhere. 
     85 
    8086New in v2.0.8 
    8187 
     
    102108See also: 
    103109 
    104 * [bw_trace2()](http://www.oik-plugins.com/oik_api/bw_trace2) 
    105 * [bw_backtrace()](http://www.oik-plugins.com/oik_api/bw_backtrace) 
    106 * [bw_trace()](http://www.oik-plugins.com/oik_api/bw_trace) 
     110* [bw_trace2()](https://www.oik-plugins.com/oik_api/bw_trace2) 
     111* [bw_backtrace()](https://www.oik-plugins.com/oik_api/bw_backtrace) 
     112* [bw_trace()](https://www.oik-plugins.com/oik_api/bw_trace) 
    107113 
    108114 
     
    116122== Frequently Asked Questions == 
    117123= Where is the FAQ? = 
    118 [oik-bwtrace FAQ](http://www.oik-plugins.com/oik-plugins/oik-bwtrace-debug-trace-for-wordpress/?oik-tab=faq) 
     124[oik-bwtrace FAQ](https://www.oik-plugins.com/oik-plugins/oik-bwtrace-debug-trace-for-wordpress/?oik-tab=faq) 
    119125 
    120126= Can I get support? =  
     
    134140Put the following in your wp-config.php file 
    135141 
    136 `define( 'BW_TRACE_CONFIG_STARTUP', true ); 
     142` 
     143define( 'BW_TRACE_CONFIG_STARTUP', true ); 
    137144define( 'BW_TRACE_ON', true ); 
    138145define( 'BW_COUNT_ON', true ); 
    139146define( 'BW_TRACE_RESET', true ); 
    140147 
    141 if ( file_exists( ABSPATH . '/wp-content/plugins/oik-bwtrace/lib/bwtrace.php' ) ) {  
    142   require_once( ABSPATH . '/wp-content/plugins/oik-bwtrace/lib/bwtrace.php' ); 
     148if ( file_exists( ABSPATH . '/wp-content/plugins/oik-bwtrace/libs/bwtrace.php' ) ) {  
     149  require_once( ABSPATH . '/wp-content/plugins/oik-bwtrace/libs/bwtrace.php' ); 
    143150 
    144151` 
     
    155162  
    156163== Upgrade Notice == 
     164= 2.1.1 =  
     165Upgrade for PHP 7.2 support 
     166 
     167= 2.1.1-beta-20171023 =  
     168Upgrade to ensure shared library file compatibility with oik v3.2.0-RC1 
     169 
     170= 2.1.1-alpha.20170303 = 
     171Version used to attempt to detect changes to the PHP_SAPI constant. 
     172 
     173= 2.1.1-alpha.1124  
     174Started adding an Information section to help assist problem determination 
     175 
     176= 2.1.0 =  
     177Tested with WordPress 4.7-RC1 and WPMS. No longer requires PHP 5.3 or higher. 
     178 
     179= 2.0.12 =  
     180Now includes prototype 'string watch' capability. Tested with WordPress 4.5.2 and WordPress MultiSite 
     181 
    157182= 2.0.11 =  
    158183Upgrade for additional fields in the daily summary log. 
     
    241266 
    242267== Changelog == 
     268= 2.1.1 = 
     269* Added: Display information related to WPMS installations [github bobbingwide oik-bwtrace issues 51] 
     270* Changed: 100% translatable and localizable on wordpress.org [github bobbingwide oik-bwtrace issues 60] 
     271* Changed: Convert php.net URLs into links [github bobbingwide oik-bwtrace issues 51] 
     272* Changed: Display End of Life for PHP 7.2 [github bobbingwide oik-bwtrace issues 55] 
     273* Changed: First pass at tracing $_GET and $_POST as well as $_REQUEST [github bobbingwide oik-bwtrace issues 61] 
     274* Changed: Fix Warning: Count() messages for PHP 7.2 
     275* Changed: Logic to watch for a constant changing [github bobbingwide oik-bwtrace issues 57] 
     276* Changed: Test bw_invoke_shortcode exists even if oik-sc-help loaded [github bobbingwide oik-bwtrace issues 62] 
     277* Tested: With WordPress 4.9.1 and WordPress Multisite 
     278* Tested: With PHP 7.1 and 7.2  
     279 
     280= 2.1.1-beta-20171023 =  
     281* Changed: Synchronized shared libraries with oik v3.2.0-RC1,  
     282* Changed: Regenerate language files for en_GB and bb_BB 
     283* Added: bw_trace_all_attached_hooks() for when problem determination gets serious 
     284* Tested: With WordPress 4.8.2 and 4.9-beta3 
     285 
     286= 2.1.1-alpha.20170303 =  
     287* Added: Logic to limit tracing to CLI processing [github bobbingwide oik-bwtrace issues 58] 
     288* Changed: Logic to detect changes to a constant ( e.g. PHP_SAPI ) [github bobbingwide oik-bwtrace issue 57] 
     289* Changed: Further analysis in oik_yourehavingmeon() 
     290* Fixed: Catchable fatal error when tracing __PHP_Incomplete_Class [github bobbingwide oik-bwtrace issues 56] 
     291* Changed: Reduce messages produced by bw_trace_reset() [github bobbingwide oik-bwtrace issues 46] 
     292 
     293= 2.1.1-alpha.1124 = 
     294* Changed: Improve handling of temporary (random?) problems with file_exists()  
     295* Added: Add an Information section to improve problem determination [github bobbingwide oik-bwtrace issues 51] 
     296* Added: Include output_buffering and implicit_flush, EOL for PHP 7.1 [github bobbingwide oik-bwtrace issues 51] 
     297 
     298= 2.1.0 = 
     299* Changed: Add logging library functions under bw_log [github bobbingwide oik-bwtrace issues 50] 
     300* Changed: Cater for REST API v2 [github bobbingwide oik-bwtrace issues 42] 
     301* Changed: Do not enqueue jQuery when DOING_AJAX [github bobbingwide oik-bwtrace issues 47] 
     302* Changed: Improve bw_trace_error_handler output [github bobbingwide oik-bwtrace issues 44] 
     303* Changed: Make bw_trace_reset_status() more context sensitive [github bobbingwide oik-bwtrace issues 49] 
     304* Changed: Part 1 - include yyyy in the file name [github bobbingwide oik-bwtrace issues 45] 
     305* Changed: Reconcile shared libraries with oik v3.1.0 
     306* Changed: Reduce messages produced by trace reset [github bobbingwide oik-bwtrace issue 46] 
     307* Fixed: trace shutdown sometimes can't find all the functions it needs; Wrong type of slash [github bobbingwide oik-bwtrace issues 43] 
     308* Tested: With WordPress 4.7-RC1  
     309 
     310= 2.0.12 =  
     311* Added: 'String watch' capability [github bobbingwide oik-bwtrace issues 36] 
     312* Changed: Support tracing of nested Closures in bw_trace_obsafe_print_r() [github bobbingwide oik-bwtrace issues 28] 
     313* Changed: Improve output for saved queries [github bobbingwide oik-bwtrace issues 29] 
     314*   Changed: Improve formatting of included files [github bobbingwide oik-bwtrace issues 32] 
     315*   Changed: Improve formatting of hooks [github bobbingwide oik-bwtrace issues 33] 
     316*   Changed: Blessed task - reduce trace output produced [github bobbingwide oik-bwtrace issues 34] 
     317*   Changed: Add attached functions to hook shortcode [github bobbingwide oik-bwtrace issues 35] 
     318* Changed: Trace real memory usage [github bobbingwide oik-bwtrace issue 40] 
     319* Changed: Sync shared libraries with oik and oik-libs 
     320* Fixed: Don't call undefined c()  function from bw_trace_c3() [github bobbingwide oik-bwtrace issues 37] 
     321* Fixed: bw_trace_c3() should not produce comments after "load-async-upload.php" action [github bobbingwide oik-bwtrace issues 38] 
     322* Fixed: Avoid Notice when $GLOBALS['id'] is not just a post ID [github bobbingwide oik-bwtrace issues 39] 
     323* Tested: With WordPress 4.5.2 and WordPress MultiSite 
     324 
    243325= 2.0.11 =  
    244326* Added: github issue 21 - Show intentions to work on issue - though not yet implemented  
Note: See TracChangeset for help on using the changeset viewer.