Exemplo n.º 1
0
/**
* Display the registered libraries
*
* Nothing fancy here as we cannot alter the settings
* So we just convert each OIK_lib in the OIK_libs class to an array of fields
* 
* We can display $oik_libs->libraries, $oik_libs->loaded_libraries and $oik_libs->checked_libraries
*
* If deps is an assoc array then we only get the '*' - so we copy the value of args['deps']
* which we know is set

*
	                   [library] => oik_boot
                   [src] => C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\libs\oik_boot.php
                   [deps] => 
                   [version] => 2.6
                   [init_function] => 
                   [args] => Array
*
*/
function oik_lib_display_libraries()
{
    p("Registered libraries, showing the versions and dependencies.");
    $oik_libs = oik_libs();
    //bw_trace2( $oik_libs, "oik_libs" );
    //$oik_libs->display_libs();
    $libraries = $oik_libs->libraries;
    stag("table", "wide-fat");
    $labels = bw_as_array(__("Library,Source,Dependencies,Version,Args", 'oik-lib'));
    bw_tablerow($labels, "tr", "th");
    foreach ($libraries as $lib => $data) {
        //print_r( $lib );
        //bw_trace2( $data, "data" );
        //$data->deps();
        $data->deps = $data->args['deps'];
        unset($data->error);
        bw_tablerow($data);
    }
    etag("table");
}
Exemplo n.º 2
0
 /**
  * Return a select list with the current selection
  *
  * The current value may either be a numeric index OR the actual string 
  * It's slightly more efficient when it's the index
  *
  * @param string $name - the name for the field
  * @param string/mixed $value - the key value for the current selection or an array for #multiple selection
  * @param array $args - containing "#options" which must point to a non empty array
  * @return $iselect HTML for the select list
  */
 function iselect($name, $value, $args)
 {
     //bw_trace2();
     $multiple = bw_array_get($args, "#multiple", false);
     if ($multiple) {
         $iselect = "<select name=\"{$name}[]\" multiple size=\"{$multiple}\">";
     } else {
         $iselect = "<select name=\"{$name}\">";
     }
     $options = bw_as_array($args['#options']);
     $optional = bw_array_get($args, "#optional", false);
     if ($optional) {
         $options = array(__("None")) + $options;
     }
     //bw_trace2( $options, "options" );
     $bw_shorten = bw_query_shorten($args);
     foreach ($options as $option_key => $option_value) {
         $selected = is_selected($option_key, $option_value, $value);
         if ($bw_shorten) {
             $option_value = bw_shorten($option_value, $bw_shorten);
         }
         $option = "<option value=\"{$option_key}\" {$selected}>{$option_value}</option>";
         $iselect .= $option;
     }
     $iselect .= "</select>";
     return $iselect;
 }
Exemplo n.º 3
0
/** 
 * Implement [bw_blogs] shortcode to list the blogs on the multisite
 * 
 * @param array $atts - expected to either contain "blogs" or uses the index 0 values
 * @param string $content - content to expand for each blog
 * @param string $tag - the shortcode used
 * @return string - nothing is generated directly by this shortcode
 */
function bw_blogs($atts = null, $content = null, $tag = null)
{
    if (is_multisite()) {
        $blogs = bw_array_get_from($atts, "blogs,0", null);
        if ($blogs) {
            $blogs = bw_as_array($blogs);
        } else {
            $blogs = bw_get_blog_list();
        }
        bw_display_blogs($blogs, $atts, $content);
    } else {
        bw_trace2("bw_blogs shortcode not effective in a non-multisite implementation");
    }
    return bw_ret();
}
Exemplo n.º 4
0
//$dates = array( "0501", "0502", "0503", "0504", "0505" ); // , "0426", "0427", "0428", "0429", "0430" );
//$hosts = array( "bobbingwide.org.uk" );
$dates = array();
$startdate = oik_batch_query_value_from_argv(1, null);
//echo "Start: $startdate" . PHP_EOL;
$startdate = strtotime($startdate);
$enddate = oik_batch_query_value_from_argv(2, null);
if ($enddate) {
    $enddate = strtotime($enddate);
} else {
    $enddate = time();
}
//echo "End: $enddate" . PHP_EOL;
$host = oik_batch_query_value_from_argv("host", null);
if ($host) {
    $hosts = bw_as_array($host);
}
//$enddate = time();
//$enddate = strtotime( "2016-07-27" );
//$startdate = strtotime( "2015-06-01" );
//$enddate = strtotime( "2015-07-0" );
//echo "start: $startdate" ;
//echo "end: $enddate";
for ($thisdate = $startdate; $thisdate <= $enddate; $thisdate += 86400) {
    $dates[] = date("md", $thisdate);
}
echo " Start:" . reset($dates) . PHP_EOL;
echo "End: " . end($dates) . PHP_EOL;
/** 
 * Fetch and save the bwtrace.vt.mmdd file for each of the selected hosts
 */