示例#1
0
 /**
  * Load 'plugin' file if the options checkbox is set on
  *
  * The file extension of the plugin is ".php"
  * This function implements a simple "load module" until such a time as 
  * either a) modules are implemented, b) the logic is replaced with library logic
  */
 function bw_load_plugin($set = "bw_buttons", $option = "oik-button-shortcodes", $plugin = NULL)
 {
     $checkbox = bw_get_option($option, $set);
     bw_trace2($checkbox, "checkbox", true, BW_TRACE_DEBUG);
     if ($checkbox == "on") {
         if ($plugin == NULL) {
             $plugin = $option . ".php";
         }
         bw_trace2($plugin, "plugin", false, BW_TRACE_DEBUG);
         oik_require($plugin);
     }
 }
示例#2
0
/**
 * Activate the MU version of this plugin
 *
 * When the plugin is deactivated then the MU plugin may also be deactivated.
 * In order to achieve this, before the plugin is deactivated, enable-mu should be set to false.
 * Note: If oik is not active then bw_get_option() won't be available so the MU logic can only be
 * controlled by the constant. 
 * 
 *
 * @TODO Should this use oik_require_lib()? 
 */
function oik_lib_maybe_activate_mu()
{
    if (function_exists("oik_require")) {
        oik_require("libs/oik-lib-mu.php", "oik-lib");
        if (defined("OIK_ALLOW_MU")) {
            $activate = OIK_ALLOW_MU;
        } else {
            if (function_exists("bw_get_option")) {
                $activate = bw_get_option("enable-mu", "bw_lib");
            } else {
                $activate = false;
            }
        }
        oik_lib_activate_mu($activate);
    }
}
示例#3
0
 /**
  * Get the document root suffix
  * 
  * This routine finds the subdirectory under which this local version of the website is installed.
  * Sometimes we need to remove this from index lookups but add it to links! 
  *
  * @TODO Shouldn't this function be deprecated?
  */
 function bw_get_docroot_suffix()
 {
     bw_backtrace(BW_TRACE_DEBUG);
     $docroot_suffix = "/";
     if ($_SERVER['SERVER_NAME'] == bw_get_option("betterbyfar")) {
         $exdr = explode('/', $_SERVER["DOCUMENT_ROOT"]);
         $exsf = explode('/', $_SERVER['SCRIPT_FILENAME']);
         $docroot_suffix = '/' . $exsf[count($exdr)] . '/';
         // bw_debug( "_SERVER[DOCUMENT_ROOT]: " . $_SERVER["DOCUMENT_ROOT"] );
         // bw_debug( "_SERVER[REQUEST_URI]: " .  $_SERVER['REQUEST_URI'] );
         // bw_debug( "_SERVER[SCRIPT_FILENAME]: " . $_SERVER['SCRIPT_FILENAME'] );
         // bw_debug( "docroot_suffix: " . $docroot_suffix );
     }
     return $docroot_suffix;
 }
示例#4
0
/**
 * Display a blog option or shortcode
 * 
 */
function bw_display_blog_field($shortcode, $tag = "div", $use_shortcode = true)
{
    stag($tag);
    if ($use_shortcode) {
        e(do_shortcode("[{$shortcode}]"));
    } else {
        bw_get_option($shortcode);
        e($shortcode);
    }
    etag("e{$tag}");
}