Esempio n. 1
0
 /** 
  * Return the plugin version of the oik base plugin
  *
  * @TODO Consider moving this function to the oik_plugins library.
  *
  * In the mean time, if 'oik_plugins' can't be loaded
  * we'll assume the version is the same as this library version.
  * 
  * @return string $version e.g. 3.0.0-alpha, 3.0.0-beta.mmdd, 3.0.0-RCn, 3.0.0, 3.0.1
  */
 function bw_oik_version()
 {
     $oik_plugins = oik_require_lib("oik_plugins");
     if ($oik_plugins && !is_wp_error($oik_plugins)) {
         $version = bw_get_plugin_version();
     } else {
         $version = BOBBFUNC_INCLUDED;
     }
     return $version;
 }
Esempio n. 2
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");
    }
}
Esempio n. 3
0
/**
 * Add admin when 'oik' OR 'oik-lib' is active
 *
 * What if it's been done already?
 * oik-fum is dependent upon its own library ( oik_fum ) and the
 * shared libraries that the oik base plugin used.
 * If oik-lib is active then we can simply request "oik_fum"
 * If not, we have to request them one by one. 
 *
 * @TODO We can tell oik-lib is active by ???
 *
 */
function oikf_admin_setup()
{
    oik_lib_fallback(__DIR__ . "/vendor/bobbingwide/oik_fum");
    $bobbfunc = oik_require_lib("bobbfunc");
    //c( $bobbfunc );
    $bobbforms = oik_require_lib("bobbforms");
    //c( $bobbforms );
    $oik_admin = oik_require_lib("oik-admin");
    //c( $oik_admin );
    $oik_fum = oik_require_lib("oik_fum");
    //c( $oik_fum );
    bw_trace2($oik_fum, "oik_fum library?", false, BW_TRACE_DEBUG);
    if ($oik_fum && !is_wp_error($oik_fum)) {
        $oik_fum_admin = oik_require_file('admin/oik-fum.php', "oik_fum");
        bw_trace2($oik_fum_admin, "oik_fum_admin?", false, BW_TRACE_DEBUG);
        //c( $oik_fum_admin );
        //echo $oik_fum_admin;
        if ($oik_fum_admin) {
            oik_fum_add_page();
        }
    }
}
 static function oik_themes_api($false, $action, $args)
 {
     oik_require_lib("class-oik-remote");
     return oik_remote::oik_lazy_themes_api($false, $action, $args);
 }
Esempio n. 5
0
 /**
  * Require a library function
  *
  * @param string $library 
  * @param string/callable function $func
  * @param string $version
  * @param array $args
  * @return 
  */
 function require_func($library, $func, $version = null, $args = null)
 {
     $required_func = null;
     if (is_callable($func)) {
         $required_func = $func;
     } else {
         // @TODO Should this be $this->require_lib() ?
         $lib_loaded = oik_require_lib($library, $version);
         if (is_callable($func)) {
             $required_func = $func;
         }
     }
     return $required_func;
 }
Esempio n. 6
0
 /**
  * Returns the plugin names
  * 
  * Returns a cached array of $plugins. 
  * We expect there to be at least one.
  * 
  * @return array $plugins 
  */
 function _bw_get_plugins()
 {
     static $plugins = null;
     if (!$plugins) {
         $plugin_slugs = bw_get_plugin_slugs();
         //oik_require( "admin/oik-depends.inc" );
         oik_require_lib("oik-depends");
         $plugins = bw_get_all_plugin_names($plugin_slugs);
     }
     return $plugins;
 }
 /**
  * Require a library
  * 
  * @param string $lib library name
  * @param string $version the required minimum version
  * @return bool true if the required version has been loaded
  */
 function require_lib($lib, $version = '*')
 {
     $lib_loaded = oik_require_lib($lib);
     if ($lib_loaded && !is_wp_error($lib_loaded)) {
         $lib_loaded = $this->version_check($lib, $version);
     } else {
         bw_trace2($lib_loaded, "require_lib error", true);
         bw_backtrace();
         $this->show_update_nag("Failed to load library: {$lib}. version: {$version} ");
         $lib_loaded = null;
     }
     return $lib_loaded;
 }
Esempio n. 8
0
 /**
  * Check for an updated theme
  *
  */
 function oik_themes_check()
 {
     $check_theme = bw_array_get($_REQUEST, "check_theme", null);
     $check_version = bw_array_get($_REQUEST, "check_version", null);
     if ($check_theme && $check_version) {
         // Check the theme from the remote server ? What does this mean? Validate the apikey perhaps?
         //$response = oik_themes
         oik_require_lib("class-oik-remote");
         $response = oik_remote::oik_check_for_theme_update($check_theme, $check_version, true);
         bw_trace2($response, "response-octfu");
         if (is_wp_error($response)) {
             p("Error checking the theme: {$check_theme}");
             $error_message = $response->get_error_message();
             p($error_message);
         } else {
             $new_version = bw_array_get($response, "new_version", null);
             if ($new_version) {
                 p("A new version of the theme is available");
                 p("theme: {$check_theme}");
                 p("Current version: {$check_version} ");
                 p("New version: {$new_version} ");
                 oik_theme_record_new_version($check_theme, $check_version, $response);
                 oik_theme_new_version($response);
             } else {
                 p("Theme is up to date.");
                 p("Theme: {$check_theme}");
                 p("Current version: {$check_version} ");
             }
         }
     }
 }
Esempio n. 9
0
/**
 * Implement "wp_loaded" action for oik-lib
 *
 * @TODO Decide whether or not oik-lib will actually provide the oik-admin, bobbforms and bobbfunc shared libraries
 *
 * Note: Prior to v3.0.0 bobbfunc did not provide bw_as_array().
 * This function is currently needed by oik-lib admin.
 * The oik-admin library, which is dependent upon bobbforms, which is dependent upon bobbfunc, is not aware of this problem.
 * It doesn't currently have any version dependency.
 *
 * So we need to check for this first. 
 * Note: We have to wrap each call to oik_require_lib() with !is_wp_error() 
 *  
 */
function oik_lib_wp_loaded()
{
    $bobbfunc = oik_require_lib("bobbfunc", "3.0.0");
    bw_trace2($bobbfunc, "bobbfunc?", false, BW_TRACE_DEBUG);
    if (!is_wp_error($bobbfunc)) {
        if (!is_wp_error(oik_require_lib("oik-admin")) && !is_wp_error(oik_require_lib("bobbforms"))) {
            add_action('admin_menu', 'oik_lib_options_add_page');
        }
    }
}
Esempio n. 10
0
 function oik_init()
 {
     oik_require_lib('bwtrace');
 }