function fetch()
 {
     $options = get_option("schunter");
     $this->limit = bw_array_get($options, "limit", $this->limit);
     $this->posts_per_page = bw_array_get($options, "posts_per_page", $this->posts_per_page);
     $this->last_date = bw_array_get($options, "last_date", $this->last_date);
     $this->max_id = bw_array_get($options, "max_id", $this->max_id);
 }
Beispiel #2
0
/**
 * Display information about each blog in the array of blogs
 *
 * @param	array $blogs
 * @param array $atts - shortcode attributes
 * @param string $content - content to be displayed for each blog
 */
function bw_display_blogs($blogs, $atts, $content)
{
    $class = bw_array_get($atts, "class", null);
    foreach ($blogs as $blog) {
        sdiv("bw_blog {$class}");
        bw_display_blog($blog, $atts, $content);
        ediv("bw_blog");
    }
}
 /**
  * Add a shortcode
  *
  */
 function add_code($code)
 {
     $code_obj = bw_array_get($this->codes, $code, null);
     if (!$code_obj) {
         $code_obj = new Schunter_code($code);
         $this->codes[$code] = $code_obj;
     }
     return $code_obj;
 }
/**
 * Return count of footer widgets required
 */
function gfw_footer_widgets()
{
    $supports = get_theme_support('genesis-footer-widgets');
    $supports = bw_array_get($supports, "0", $supports);
    if (is_array($supports)) {
        $supports = $supports[0];
    }
    bw_trace2($supports, "genesis-footer-widgets supported", false, BW_TRACE_DEBUG);
    return $supports;
}
 /** 
  * Return the array[index] or build the result by calling $callback, passing the $default as the arg.
  *
  *
  * Notes: dcb = deferred callback
  * Use this function when applying the default might take some time but would be unnecessary if the $array[$index] is already set.
  *
  * You can also use this function when the default value is a string that you want to be translated.
  *
  * 2012/10/23 - When the parameter was passed as a null value e.g. "" then it was being treated as NULL
  * hence the default processing took effect. 
  * In this new verision we replace the NULLs in the code body with $default
  * So bw_array_get() can return a given NULL value which will then override the default.
  * In this case, if the parameter that is passed turns out to be the default value then this will also be translated.
  * Note: It could could still match a default null value
  * Also: We don't expect a null value for the default callback function __()
  * 2012/12/04 - we have to allow for the value being set as 0 which differs from a default value of NULL
  * so the comparison needs to be identical ( === ) rather than equal ( == )
  * 
  * 2014/02/27 - In cases where value found may be the same as the default and the dcb function could mess this up
  * then it's advisable to NOT use this function.
  *   
  * @param array $array array from which to obtain the value
  * @param string $index - index of value to obtain]
  * @param mixed $default - parameter to the $callback function 
  * @param string $callback - function name to invoke - defaults to invoking __()
  */
 static function bw_array_get_dcb($array = array(), $index, $default = NULL, $callback = '__', $text_domain = "oik")
 {
     $value = bw_array_get($array, $index, $default);
     if ($value === $default) {
         if (is_callable($callback)) {
             $value = call_user_func($callback, $default, $text_domain);
         } else {
             bw_backtrace();
         }
     }
     return $value;
 }
Beispiel #6
0
/**
 * Display the sidebar for the given post type
 *
 * Normally we just append -widget-area but for some post types we override it 
 *
 * Post type  | Sidebar used
 * ---------- | -------------
 * oik_premiumversion | oik_pluginversion-widget-area
 * oik_sc_param | sidebar-alt
 * 
 * 
 */
function genesis_hm_get_sidebar()
{
    //* Output primary sidebar structure
    genesis_markup(array('html5' => '<aside %s>', 'xhtml' => '<div id="sidebar" class="sidebar widget-area">', 'context' => 'sidebar-primary'));
    do_action('genesis_before_sidebar_widget_area');
    $post_type = get_post_type();
    $cpts = array("oik_premiumversion" => "oik_pluginversion-widget-area", "oik_sc_param" => "sidebar-alt", "attachment" => "sidebar-alt");
    $dynamic_sidebar = bw_array_get($cpts, $post_type, "{$post_type}-widget-area");
    dynamic_sidebar($dynamic_sidebar);
    do_action('genesis_after_sidebar_widget_area');
    genesis_markup(array('html5' => '</aside>', 'xhtml' => '</div>'));
}
Beispiel #7
0
/**
 * 
 * Implement "admin_head-schunter-options_page_schunter" for oik-clone
 * 
 * When we're trying to display a List Table then hooking into 
 * nav-tabs is too late to load the classes since 
 * WordPress's get_column_headers() function invokes the hook to find the columns to be displayed.
 * and we need to have instantiated the class in order for this hook to have been registered.
 * Therefore, we need to hook into "admin_head" and determine what's actually happening.
 * Actually, we can hook into the specific action for the page.
 * 
 */
function schunter_admin_head()
{
    $tab = bw_array_get($_REQUEST, "tab", null);
    global $list_table;
    switch ($tab) {
        default:
            bw_trace2();
            oik_require_lib("admin/schunter-list.php", "schunter");
            oik_require("includes/oik-list-table.php");
            $list_table = bw_get_list_table("Schunter_List_Table", array("plugin" => "schunter", "tab" => $tab, "page" => "schunter"));
            add_action("schunter_nav_tab_codes", "schunter_nav_tab_codes");
    }
}
Beispiel #8
0
/**
 * Handle Copy options form
 */
function oik_ms_copy_site_settings()
{
    $copy = bw_array_get($_REQUEST, "_oik_ms_copy_options", null);
    if ($copy) {
        $alt_source = bw_array_get($_REQUEST, "oik_ms_alt_source", null);
        $alt_target = bw_array_get($_REQUEST, "oik_ms_alt_target", null);
        $site_id = bw_array_get($_REQUEST, "oik_ms_site", null);
        if ($site_id && $alt_source != null && $alt_target != null) {
            oik_ms_copy_settings_to_site($alt_source, $alt_target, $site_id);
        } else {
            p("Please choose source site and source and target options");
            p("site={$site_id}");
            p("alt source={$alt_source}");
            p("alt target={$alt_target}");
        }
    }
}
 /**
  * Locate the required class
  * 
  * self::$loads contains the raw information about classes we may want to load
  * self::$classes is the post processed version
  */
 function locate_class($class)
 {
     if (!isset($this->classes)) {
         $this->set_classes();
     }
     $class_file = bw_array_get($this->classes, $class, null);
     if ($class_file) {
         $class_file = (object) $class_file;
     }
     bw_trace2($class_file, "class_file", true, BW_TRACE_DEBUG);
     return $class_file;
 }
Beispiel #10
0
 /**
  * Return the localized version of some deferred translatable text (dtt)
  *
  * @param string $key - the key to the translatable text - which may be the actual text
  * @return string $l10n - the translated text - which may end up as the untranslated text or even the key.
  * 
  * **?** Does it matter what textdomain we use for subsequent translations?
  * 
  */
 function bw_tt($key)
 {
     global $bw_l10n;
     $l10n = bw_array_get($bw_l10n, $key, null);
     if ($l10n) {
         // It's already been translated, return this
     } else {
         $i18n = bw_get_dtt($key);
         $l10n = bw_translate($i18n);
         // $textdomain = bw_context( "textdomain" );
         $bw_l10n[$key] = $l10n;
     }
     //bw_trace2( $bw_l10n );
     return $l10n;
 }
 function add_ref($id, $class)
 {
     $property_name = "{$class}_refs";
     echo "Adding {$this->code} {$id} {$class} {$property_name}" . PHP_EOL;
     $referenced = bw_array_get($this->{$property_name}, $id, null);
     if (!$referenced) {
         $this->{$property_name}[$id] = $id;
         $this->total_references++;
     }
 }
Beispiel #12
0
 /**
  * Implement "oik_honeypot_message" filter for oik-honeypot
  *
  * Randomise the message that's displayed based on the value entered in the honeypot field
  * We look at the first character and lower case it.
  * Anything that doesn't match returns the default message.
  * 
  * @param string $message - Current message
  * @param string $value - the unexpected value of the honey pot field
  * @return string Potentially changed message 
  */
 function oik_honeypot_message($message, $value)
 {
     $value = trim($value);
     $char = substr($value, 0, 1);
     $char = strtolower($char);
     $messages = oik_honeypot_messages();
     $message = bw_array_get($messages, $char, $message);
     return $message;
 }
Beispiel #13
0
 /**
  * Determine if the library has been checked for dependencies
  * 
  * If the library is already loaded then we assume that its dependencies have been checked
  * If the library has already been checked then we don't need to do it again.
  * Each library that's checked is added to the array of checked libraries.
  *
  * @param object $lib 
  * @return object the checked library object or null
  */
 function checked($lib)
 {
     $checked = $this->is_loaded($lib->library, $lib->version);
     $checked = bw_array_get($this->checked_libraries, $lib->library, $checked);
     $this->checked_libraries[$lib->library] = $lib;
     bw_trace2($checked, "checked", true, BW_TRACE_VERBOSE);
     return $checked;
 }
 /**
  * Set the sort sequence - 'asc' or 'desc'
  *
  * @TODO Validate the order as 'asc' or 'desc'
  *
  */
 function order()
 {
     $this->order = bw_array_get($_GET, "order", "asc");
 }
 /**
  * Return the themes server if the requested theme is one of ours
  *
  * Note: $bw_registered_themes is an array of filenames
  * we create $bw_theme_slugs as an array of "slug" => array( 'basename' => "theme name", 'file'=> 'server'=>, 'apikey'=> )
  * $bw_themes (stored in WordPress options) also contains 'server' and 'apikey'
  * 
  * @param string $slug theme name
  * @return array 
  */
 static function oik_query_themes_server($slug)
 {
     global $bw_registered_themes, $bw_theme_slugs;
     if (!isset($bw_theme_slugs)) {
         $bw_theme_slugs = array();
         if (count($bw_registered_themes)) {
             foreach ($bw_registered_themes as $key => $value) {
                 $file = bw_array_get($value, "file", null);
                 // The next 2 lines are equivalent to $bw_slug = bw_last_path( $file );
                 $pathinfo = pathinfo($file, PATHINFO_DIRNAME);
                 $bw_slug = basename($pathinfo);
                 $value['basename'] = $bw_slug;
                 $bw_theme_slugs[$bw_slug] = $value;
             }
         }
         bw_trace2($bw_theme_slugs);
     }
     $theme_settings = bobbcomp::bw_get_option($slug, "bw_themes");
     bw_trace2($theme_settings);
     /* return the saved settings, with any registered defaults, otherwise just get the registered settings */
     if ($theme_settings) {
         $server = bw_array_get($theme_settings, "server", null);
         $apikey = bw_array_get($theme_settings, "apikey", null);
         if (!$server || !$apikey) {
             $value = bw_array_get($bw_theme_slugs, $slug, null);
         }
         if (!$server) {
             $server = bobbcomp::bw_array_get_dcb($value, "server", null, "oik_update::oik_get_themes_server");
             bw_trace2($server, $slug, false);
         }
         if (!$apikey) {
             $theme_settings['apikey'] = bw_array_get($value, "apikey", null);
         }
     } else {
         $theme_settings = bw_array_get($bw_theme_slugs, $slug, null);
         if ($theme_settings) {
             $server = bobbcomp::bw_array_get_dcb($theme_settings, "server", null, "oik_update::oik_get_themes_server");
         }
         // apikey doesn't default here
     }
     if ($theme_settings) {
         $theme_settings['server'] = $server;
         bw_trace2($server, "server", false, BW_TRACE_INFO);
     }
     return $theme_settings;
 }
 /**
  * Determine if this is one of "our" plugins
  *
  * @param mixed $args - object or array expected to contain "slug"
  * @return string $server - URL to connect with 
  *
  * Note: Can we trust slug? Could it be "plugin/plugin-file.php" or just "plugin"
  * It may depend upon the $action
  *
  */
 static function oikp_our_plugin($args)
 {
     $args_slug = bw_array_get($args, "slug", null);
     if ($args_slug) {
         $plugin_settings = oik_update::oik_query_plugins_server($args_slug);
         $server = bw_array_get($plugin_settings, 'server', null);
     } else {
         $server = null;
     }
     return $server;
 }
Beispiel #17
0
 /**
  * Check if we should be skipping shortcodes in content
  *
  * @TODO This is just a prototype using a known shortcode where we don't expect shortcodes since the content is CSS.
  * We could use the 'no_texturize_shortcodes' filter
  *
  * Other examples:
  * - code - is in $default_no_texturize_shortcodes
  * - bw_geshi
  * - bw_graphviz 
  * 
  * 
  * @param string $code - the code we're testing for
  */
 function check_code_skip($code)
 {
     static $no_texturize_shortcodes = null;
     if (!$no_texturize_shortcodes) {
         $no_texturize_shortcodes = apply_filters("no_texturize_shortcodes", array("codes"));
         $no_texturize_shortcodes = bw_assoc($no_texturize_shortcodes);
     }
     if (bw_array_get($no_texturize_shortcodes, $code, null)) {
         $this->skipping_to = "/{$code}";
     }
 }
 /**
  * Determine the server that supports this theme
  * @param string $theme - theme name
  * @param WP_theme $theme_object - the WP_theme object
  * @param array $theme_data - oik theme registration information
  * @return 
  */
 function bw_get_theme_server($theme = "oik", $theme_object, $theme_data)
 {
     $server = bw_array_get($theme_data, "server", null);
     if (!$server) {
         if ($theme_object->exists()) {
             $server = $theme_object->get('ThemeServer');
         }
     }
     if (!$server) {
         $server = "&nbsp;";
     }
     bw_trace2($server, "theme-server");
     return $server;
 }
Beispiel #19
0
/**
 * Implement "oik_query_libs" filter for oik-fum
 *
 * oik-fum provides the "oik_fum" library...
 * perhaps this should be called the bobbingwide/oik_fum library? 
 * which is dependent upon 'bw_list_table'
 */
function oik_fum_query_libs($libraries)
{
    $lib_args = array();
    //$libs = array( "oik_fum" => "bw_list_table", "bw_list_table" => null );
    $libs = array("oik_fum" => "bobbingwide/oik_depends");
    $versions = array("oik_fum" => "0.0.1", "bw_list_table" => "0.0.1");
    foreach ($libs as $library => $depends) {
        $lib_args['library'] = $library;
        $lib_args['plugin'] = "oik-fum";
        $lib_args['vendor-dir'] = "vendor";
        $lib_args['vendor'] = "bobbingwide";
        $lib_args['file'] = null;
        $lib_args['src'] = null;
        $lib_args['deps'] = $depends;
        // Here we should consider deferring the version setting until it's actually time to check compatibility
        $lib_args['version'] = bw_array_get($versions, $library, null);
        $lib = new OIK_lib($lib_args);
        $libraries[] = $lib;
    }
    // Add "oik_plugins" library
    //unset( $lib_args['vendor-dir'];
    //unset( $lib_args['vendor'];
    //unset( $lib_args['package'];
    //unset( $lib_args['file'];
    //unset( $lib_args['src' ];
    $lib_args2 = array('library' => "bobbingwide/oik_plugins", 'deps' => "oik-admin", "plugin" => "oik-fum");
    $libraries[] = new OIK_lib($lib_args2);
    $lib_args2 = array('library' => "bobbingwide/oik_depends", "deps" => null, "plugin" => "oik-fum", "file" => "oik-depends.php");
    $libraries[] = new OIK_lib($lib_args2);
    bw_trace2($libraries, "oik-fum libraries", false, BW_TRACE_VERBOSE);
    bw_backtrace(BW_TRACE_VERBOSE);
    return $libraries;
}
Beispiel #20
0
/**
 * Run a script in batch
 *
 * @TODO Check these comments
 * If the file name given is in the form of a plugin file name e.g. plugin/plugin.php
 * then we can invoke it using oik_path() 
 * If it's just a simple name then we assume it's in the ??? folder and we need to append .php 
 * and invoke it using oik_path()
 * If it's a fully specified file name that exists then we call it directly.
 *
 * The script can be run by simply loading the file
 * and/or it can implement an action hook for "run_$script"
 *
 * @param string $script the file to load and run
 *
 */
function oik_batch_run_script($script)
{
    if (file_exists($script)) {
        oik_require("oik-login.inc", "oik-batch");
        require_once $script;
        echo "Script required once: {$script}" . PHP_EOL;
        do_action("run_{$script}");
        echo "Did: run_{$script}" . PHP_EOL;
    } else {
        $script_parts = pathinfo($script);
        print_r($script_parts);
        $dirname = bw_array_get($script_parts, "dirname", null);
        if ($dirname == ".") {
            $dirname = "oik-wp";
            // @TODO - make it choose the current directory
            $dirname = "oik-batch";
            // @TODO - make it choose the current directory
        }
        $filename = bw_array_get($script_parts, "filename", null);
        $extension = bw_array_get($script_parts, "extension", ".php");
        $required_file = WP_PLUGIN_DIR . "/{$dirname}/{$filename}{$extension}";
        echo $required_file . PHP_EOL;
        if (file_exists($required_file)) {
            require_once $required_file;
        } else {
            echo "Cannot find script to run: {$required_file}" . PHP_EOL;
        }
        // Should this call do_action( "run_$??? " ). If so, what's $???
        // How does WP-cli work?
    }
}
 /**
  * Get the full plugin name given the slug
  * 
  * Note: This may return the wrong name if there are two plugins with the same plugin slug! 
  * Which can happen if someone manually renames a plugin folder in order to apply a new version.
  *
  * @return string $plugin_name
  */
 function bw_get_plugin_name($plugin = "oik")
 {
     $plugins = _bw_get_plugins();
     $plugin_name = bw_array_get($plugins, $plugin, null);
     return $plugin_name;
 }
 /**
  * Check that the plugins that this plugin is dependent upon are active
  *
  * @param string $plugin - name of the plugin being activated
  * @param string $dependencies - list of plugin dependencies - in whatever order you care
  * @param mixed $callback the callback to invoke when the dependency is not satisfied
  * Notes: 
  * The list of plugins could include oik - which should be loaded UNLESS this file is being
  * loaded by some other mechanism.
  */
 function oik_lazy_depends($plugin = null, $dependencies, $callback = "oik_plugin_inactive")
 {
     bw_backtrace(BW_TRACE_DEBUG);
     $names = bw_get_active_plugins();
     bw_trace2($names, "active plugin names", true, BW_TRACE_DEBUG);
     $depends = explode(",", $dependencies);
     foreach ($depends as $dependcolver) {
         list($depend, $version) = explode(":", $dependcolver . ":");
         //bw_trace2( $dependcolver, "dependcolver" );
         //bw_trace2( $depend, "depend" );
         //bw_trace2( $version, "version" );
         $problem = null;
         $active = bw_array_get($names, $depend, null);
         if ($active) {
             $active = oik_check_version($depend, $version);
             if (!$active) {
                 $problem = "version";
             }
         } else {
             $problem = "missing";
         }
         if (!$active) {
             bw_trace2($depend, "{$plugin} is dependent upon {$depend}, which is not active or is the wrong version", true, BW_TRACE_WARNING);
             if (!is_callable($callback)) {
                 $callback = "oik_plugin_inactive";
             }
             call_user_func($callback, $plugin, $dependcolver, $problem);
             //deactivate_plugins( array( $plugin ) );
         }
     }
 }
Beispiel #23
0
/** 
* Disable remaining filters for the current filter
*
* We're expanding a shortcode that's being used to compare the results of running
* different filters against the "current" installation.
* The current installation may be WordPress 4.0, 4.1, 4.2 or higher
* Any filters that are run after shortcode expansion could affect our output.
* So we need to disable all the filters that follow.
* We must not disable filters that precede this one
* First we have to find out what this one is
* We can look up the call stack and find a match for the filter function
* in the global filters array.
* 
* 
0. bw_lazy_backtrace C:\apache\htdocs\wordpress\wp-content\plugins\oik\bwtrace.inc:60 0
1. bw_backtrace C:\apache\htdocs\wordpress\wp-content\plugins\trac29608\trac29608.php:256 0
2. trac_29608_disable_remaining_filters C:\apache\htdocs\wordpress\wp-content\plugins\trac29608\trac29608.php:190 0
3. trac_29608(,,29608) C:\apache\htdocs\wordpress\wp-content\plugins\trac29608\trac29608.php:0 3
4. call_user_func(trac_29608,,,29608) C:\apache\htdocs\wordpress\wp-includes\shortcodes.php:286 4
5. do_shortcode_tag(array) C:\apache\htdocs\wordpress\wp-content\plugins\oik-css\includes\shortcodes-earlier.php:100 1
6. do_shortcode_tag_earlier(array) C:\apache\htdocs\wordpress\wp-content\plugins\oik-css\includes\shortcodes-earlier.php:0 1
7. preg_replace_callback(/\[(\[?)(embed|wp_caption|caption|gallery|playlist|audio|video|purchase_link|download_history|purchase_history|download_checkout|download_cart|edd_login|edd_register|download_discounts|purchase_collection|downloads|edd_price|edd_receipt|edd_profile_editor|dumptag|paragraph|noautop|29608|year|rss|ad|top|login_link|blog_title|xhtml|css|rss_url|rss_title|template_url|search|product|product_page|product_category|product_categories|add_to_cart|add_to_cart_url|products|recent_products|sale_products|best_selling_products|top_rated_products|featured_products|product_attribute|related_products|shop_messages|woocommerce_order_tracking|woocommerce_cart|woocommerce_checkout|woocommerce_my_account|woocommerce_messages|bw_otd|bw_field|bw_fields|bw_new|bw_related|oik_edd_apikey|oikp_download|bw_squeeze|bw_testimonials|oikth_download|bw_mshot|nivo|bugger|fbh|latestnews|getoik|lazy|loikp|TODO|apiref|themeref|smart|lssc|diy|bob|fob|bing|bong|wide|hide|wow|WoW|WOW|oik|loik|OIK|lbw|bw_page|bw_post|bw_plug|bp|lwp|lbp|wpms|lwpms|drupal|ldrupal|artisteer|lartisteer|wp|bw_csv|bw_search|bw_dash|bw_action|bw_rpt|bw_graphviz|bw_crumbs|bw_option|bw_text|bw_css|bw_geshi|bw_background|bw_autop|bw_blog|bw_blogs|bw_popup|bw_more|bw_rwd|bw_codes|bw_code|bw_user|bw_users|bw_wtf|bw_directions|bw|bw_address|bw_mailto|bw_email|bw_geo|bw_telephone|bw_fax|bw_mobile|bw_skype|bw_tel|bw_mob|bw_wpadmin|bw_domain|bw_show_googlemap|bw_contact|bw_company|bw_business|bw_formal|bw_slogan|bw_alt_slogan|bw_admin|bw_twitter|bw_facebook|bw_linkedin|bw_youtube|bw_flickr|bw_picasa|bw_googleplus|bw_google_plus|bw_google\-plus|bw_google|bw_instagram|bw_pinterest|bw_follow_me|clear|bw_logo|bw_qrcode|div|sdiv|ediv|sediv|bw_emergency|bw_abbr|bw_acronym|bw_blockquote|bw_cite|bw_copyright|stag|etag|bw_tree|bw_posts|bw_pages|bw_list|bw_bookmarks|bw_attachments|bw_pdf|bw_images|bw_portfolio|bw_thumbs|bw_button|bw_contact_button|bw_block|bw_eblock|paypal|ngslideshow|gpslides|bwtron|bwtroff|bwtrace|bw_power|bw_editcss|bw_table|bw_parent|bw_iframe|bw_jq|bw_accordion|bw_tabs|bw_login|bw_loginout|bw_register|bw_link|bw_contact_form|bw_countdown|bw_cycle|bw_count|bw_navi|bw_tides|bw_api|api|apis|hooks|codes|file|files|classes|hook|md)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)/s,do_shortcode_tag_earlier,[noautop][29608]

  
 global $wp_filter;
 $fields = array();
 $filters = bw_array_get( $wp_filter, "show_user_profile", null );
 foreach ( $filters as $priority => $hooks ) {
   foreach ( $hooks as $key => $hook ) {
     bw_trace2( $hook, "hook", false );
     $function = oiku_get_function_as_string( $hook['function'] ); 
     $fields["$priority $function"] = $hook['function'];
   }
 } 
* 
*/
function trac_29608_disable_remaining_filters()
{
    $cf = current_filter();
    e("Disabling remaining filters after {$cf}");
    //bw_backtrace();
    global $wp_filter;
    $filters = bw_array_get($wp_filter, $cf, null);
    bw_trace2($filters, "filters", null);
    // Make use of TRAC 17817 ! - didn't appear to work
    $current = current($wp_filter[$cf]);
    bw_trace2($current, "current", false);
    $key = key($wp_filter[$cf]);
    bw_trace2($key, "key", false);
    end($wp_filter[$cf]);
    next($wp_filter[$cf]);
    //do_action( $cf, "Disabling filters" );
}
Beispiel #24
0
/**
 * Display information about high and low tides obtained from the NOAA Tides and Currents website
 *
 * e.g.
 * `
 *   Threemile Cut entrance, Darien River GA
 *   May 18,2012
 *   02:10 AM 0.7 Low Tide
 *   07:50 AM 6.6 High Tide
 *   02:11 PM 0.2 Low Tide
 *   08:07 PM 7.8 High Tide
 * `
 *
 * @param array $atts- shortcode parameters
 * @return string Result of shortcode
 *
 * 
 * 
 */
function us_tides($atts = NULL)
{
    $station = bw_array_get($atts, "station", "8423745");
    $link = bw_array_get($atts, "link", "y");
    $link = bw_validate_torf($link);
    $date_format = bw_array_get($atts, "date_format", "M d,Y");
    $response = us_load_xml_file($station);
    if ($response) {
        $stationname = $response->stationname;
        $state = $response->state;
        $text = "Tide times and heights for:";
        $text .= "&nbsp;";
        $text .= $stationname;
        $text .= "&nbsp;";
        $text .= $state;
        if ($link) {
            alink("stationname", "http://tidesandcurrents.noaa.gov/noaatidepredictions/NOAATidesFacade.jsp?Stationid={$station}", $text);
        } else {
            p($text, "stationname");
        }
        p(bw_format_date(null, $date_format));
        $today = bw_format_date(null, "Y/m/d");
        foreach ($response->data->item as $item) {
            if ($item->date == $today) {
                us_format_item($item);
            }
        }
    }
    return bw_ret();
}
Beispiel #25
0
    $argc = $_SERVER['argc'];
    $argv = $_SERVER['argv'];
    //echo $argv[1];
}
if ($argc < 2) {
    echo "Syntax: oikwp oik-zip.php plugin version [lang]";
    echo PHP_EOL;
    echo "e.g. oik oik-zip.php oik v3.0.0-RC1";
    echo PHP_EOL;
} else {
    //$phpfile = $argv[0];
    //echo $phpfile;
    //echo PHP_EOL;
    $plugin = $argv[1];
    $version = $argv[2];
    $lang = bw_array_get($argv, 3, null);
    $filename = "{$plugin} {$version}.zip";
    echo "Creating {$filename}";
    echo PHP_EOL;
    cd2plugins();
    //dogitarchive( $plugin, $filename );
    //docontinue( "After creating git archive: $plugin $version" );
    doreadmetxt($plugin);
    dosetversion($plugin, $version);
    docontinue("{$plugin} {$version}");
    doassets($plugin);
    doreadmemd($plugin);
    // We need to find a good time to decide when to do this
    // First we need to ensure that there really is a string change
    // which means a better comparison of the .pot files
    //
Beispiel #26
0
 function bw_verify_nonce($action, $name)
 {
     $nonce_field = bw_array_get($_REQUEST, $name, null);
     $verified = wp_verify_nonce($nonce_field, $action);
     bw_trace2($verified, "wp_verify_nonce?");
     return $verified;
 }
Beispiel #27
0
 /**
  * Return dependencies to check as array of library => version
  * 
  * If not already done create the dependency array for the library
  * given a comma separated string, array of library:version or
  * array of library => version
  *
  * Note: We don't expect libraries to just have numeric names.
  * 
  * @return mixed dependency array or null
  */
 function deps()
 {
     if (null === $this->deps) {
         $deps = bw_array_get($this->args, 'deps', null);
         if (!is_array($deps)) {
             if ($deps) {
                 $deps = explode(",", $deps);
             } else {
                 $deps = array();
             }
         }
         bw_trace2($deps, "deps", false, BW_TRACE_DEBUG);
         $deps_array = array();
         if (count($deps)) {
             foreach ($deps as $key => $value) {
                 if (is_numeric($key)) {
                     list($key, $value) = explode(":", $value . ":*");
                 }
                 $deps_array[$key] = $value;
             }
         }
         $this->deps = $deps_array;
     }
     if (count($this->deps)) {
         return $this->deps;
     }
     return null;
 }