/**
 * Init the autoload
 *
 * @param string $dir (The path of the lib/ directory)
 *
 * @return FALSE | Requisite\SPLAutoLoader
 */
function init_requisite($dir)
{
    if (!class_exists('\\Requisite\\SPLAutoLoader')) {
        $requisite = $dir . '/Requisite/Requisite.php';
        if (!is_readable($requisite)) {
            return FALSE;
        }
        require_once $requisite;
    }
    Requisite\Requisite::init();
    return new Requisite\SPLAutoLoader();
}
Esempio n. 2
0
 /**
  * Initialize the plugin autoload files
  *
  * @since 3.1.1
  *
  * @return void
  */
 public function init()
 {
     search_replace_textdomain();
     if ($this->user_can_access() === TRUE) {
         /**
          * Load the Requisite library. Alternatively you can use composer's
          */
         require_once __DIR__ . '/requisite/src/Requisite/Requisite.php';
         Requisite::init();
         $autoloader = new SPLAutoLoader();
         $autoloader->addRule(new Psr4(__DIR__, 'Inpsyde\\SearchReplace'));
         $plugin = new Plugin();
         $plugin->run();
     }
 }
/**
 * Load and init in WP Environment.
 */
function init()
{
    if (!is_admin()) {
        return;
    }
    // This sets the capability needed to run the plugin.
    if (!current_user_can('manage_options')) {
        return;
    }
    load_textdomain();
    /**
     * Load the Requisite library. Alternatively you can use composer's
     */
    require_once __DIR__ . '/inc/requisite/src/Requisite/Requisite.php';
    Requisite::init();
    $autoloader = new SPLAutoLoader();
    $autoloader->addRule(new Psr4(__DIR__ . '/inc', 'Inpsyde\\SearchReplace'));
    // Start the plugin.
    $plugin = new Plugin();
    $plugin->run(__FILE__);
}