本文整理汇总了PHP中Plugins::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugins::add方法的具体用法?PHP Plugins::add怎么用?PHP Plugins::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins
的用法示例。
在下文中一共展示了Plugins::add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_plugin
private static function load_plugin(ContextManager $context, DirectoryIterator $plugin_path)
{
$plugin_load_file = $plugin_path->getPathname() . DIRECTORY_SEPARATOR . 'init.php';
if ($plugin_path->isDir() && is_file($plugin_load_file) && (require $plugin_load_file)) {
$class = Plugins::plugin_class_name($plugin_path);
try {
$klass = new ReflectionClass($class);
Plugins::add($klass->newInstance($context));
$context->logger()->debugf('%s --> %s', str_replace(MEDICK_PATH, '${' . $context->config()->application_name() . '}', $plugin_load_file), $class);
} catch (ReflectionException $rfEx) {
$context->logger()->warn('failed to load plugin `' . $plugin_path->getFilename() . '`: ' . $rfEx->getMessage());
}
}
}
示例2: skel
public function skel()
{
Cli::enableHelp();
$dir = opendir(getcwd());
while (false !== ($file = readdir($dir))) {
if ($file != '.' && $file != '..' && $file != 'data') {
Cli::question("The current folder is not empty, do you want to continue?");
break;
}
}
closedir($dir);
Cli::pinfo("Create new CF project");
System::copyTree($this->getDir() . DIRECTORY_SEPARATOR . "project", getcwd());
$this->updateFiles();
chmod(getcwd() . DIRECTORY_SEPARATOR . "setup", 0755);
System::ensureDir(DATA_DIR);
$conf = Config::getInstance();
$conf->load(CONFIG_DIR . DIRECTORY_SEPARATOR . "config.json");
foreach ($conf->get("plugins", array()) as $plugin) {
Plugins::add($plugin);
}
Cli::install();
Options::updateConf(array("DEBUG" => true));
}
示例3: __construct
/**
* Create a new Plugin!
*
* @param string $name The name of the plugin.
* @param string $author The creator of the plugin.
* @param string $description A description of the plugin. Can be any length, but should be long enough to describe the plugin.
* @param string $version
* @param string $link Optional. The path to the homepage of the plugin.
*/
public function __construct($name, $author, $description, $version, $link = '')
{
$backtrace = debug_backtrace();
$caller = dirname($backtrace[0]['file']);
$caller = str_replace('\\', '/', $caller);
$caller = explode('/', rtrim($caller, '/\\'));
$folderName = end($caller) . '/';
$this->dir = $folderName;
$this->version = $version;
$this->name = $name;
$this->author = $author;
$this->description = $description;
if (Validate::link($link)) {
$this->link = $link;
}
Plugins::add($this);
}
示例4: define
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
if (!defined("ROOT_DIR")) {
define("ROOT_DIR", getcwd());
}
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "cf.php";
if (file_exists(ROOT_DIR . "/phpunit.phar")) {
include_once ROOT_DIR . "/phpunit.phar";
}
if (!IS_CLI) {
die("Not running from CLI");
}
$logger = Logger::getInstance();
$logger->setLevel(Logger::WARNING);
Plugins::add("Skel");
CorePlugin::loadConfig();
$cli = new Cli($_SERVER['argv']);
Plugins::dispatchAll("cli", $cli);
$cli->handle($cli->getCommand(), $cli->getArguments());
Output::finish();
示例5:
<?php
Plugins::add(["plugin1", "syslog"]);