本文整理汇总了PHP中Plugin::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::create方法的具体用法?PHP Plugin::create怎么用?PHP Plugin::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 25) as $index) {
Plugin::create(['name' => $faker->domainWord]);
}
}
示例2: _updatePluginStatus
/**
* プラグインのステータスを更新する
*
* @return boolean
* @access protected
*/
protected function _updatePluginStatus($dbConfig)
{
$db = $this->_getDataSource('baser', $dbConfig);
$db->truncate('plugins');
$version = getVersion();
$Plugin = new Plugin();
$corePlugins = Configure::read('BcApp.corePlugins');
$result = true;
$priority = intval($Plugin->getMax('priority')) + 1;
foreach ($corePlugins as $corePlugin) {
$data = array();
include BASER_PLUGINS . $corePlugin . DS . 'config.php';
$data['Plugin']['name'] = $corePlugin;
$data['Plugin']['title'] = $title;
$data['Plugin']['version'] = $version;
$data['Plugin']['status'] = true;
$data['Plugin']['db_inited'] = false;
$data['Plugin']['priority'] = $priority;
$Plugin->create($data);
if (!$Plugin->save()) {
$result = false;
}
$priority++;
}
return $result;
}
示例3: test_it_is_a_singleton
function test_it_is_a_singleton()
{
$instance1 = Plugin::create('foo.php');
$instance2 = Plugin::getInstance();
$this->assertSame($instance1, $instance2);
}
示例4: substr
# **********************************************************************
#
# For questions, help, comments, discussion, etc., please join the
# ScriptMind::Links Forum
#
# @link http://www.scriptmind.org/
# @copyright 2013 Bruce Clement. (http://www.clement.co.nz/)
# @license http://URL LGPLv3 or later
# @projectManager Bruce Clement
# @package ScriptMind::Plugins
# ######################################################################
*/
require_once 'init.php';
if (!empty($_REQUEST['Install'])) {
$pluginName = substr($_REQUEST['Install'], 8);
$plugin = Plugin::create($pluginName, $anchor);
$plugin->Active = false;
$plugin->save();
}
$deletedPlugins = array();
$keys = preg_grep('/^Delete_/', array_keys($_POST));
foreach ($keys as $key) {
$pluginName = (int) substr($key, 7);
$deletedPlugins[$pluginName] = true;
$plugins = Plugin::load($anchor, "ID={$pluginName}", false);
if (!empty($plugins)) {
$plugins[0]->delete();
}
}
$plugins = Plugin::allAvailablePlugins($anchor);
$allPlugins = $plugins[4];
示例5: handle
}
handle('0000' . $response);
break;
case 'list':
handle('0000' . Plugin::listData(getRequest('uid')));
break;
case 'new':
if (!checkAuthority(9)) {
handle(ERROR_PERMISSION . '00');
}
$currentPlugin = new Plugin();
$currentPlugin->init(getRequest('uid'), getRequest('folder'), getRequest('cover'), getRequest('name'), getRequest('author'), getRequest('git'), 0, 0);
if (!$currentPlugin->checkVariables()) {
handle(ERROR_INPUT . '01');
}
$response = $currentPlugin->create();
if ($response === false) {
handle(ERROR_SYSTEM . '00');
}
handle('0000{"pid":' . $response . '}');
break;
case 'renew':
if (!checkAuthority(9)) {
handle(ERROR_PERMISSION . '00');
}
$currentPlugin = new Plugin();
$currentPlugin->pid = getRequest('pid');
$response = json_decode($currentPlugin->getData(), true);
$gitStatus = (int) getRequest('gitStatus');
if (!($gitStatus >= 0 && $gitStatus <= 2)) {
$gitStatus = $response['gitStatus'];
示例6: build_backend_subactions
//.........这里部分代码省略.........
if ($properties[1]) {
$ste->vars["textprocessors"][] = $txtproc;
}
}
$ste->vars["sections"] = array();
foreach (Section::all() as $section) {
$ste->vars["sections"][] = $section->name;
}
$ste->vars["article_section"] = $default_section->name;
/* Check Form */
$fail_reasons = array();
if (isset($_POST["save_article"])) {
if (!Article::test_urlname($_POST["urlname"])) {
$fail_reasons[] = $translation["invalid_urlname"];
} else {
$inputs["urlname"] = $_POST["urlname"];
}
if (!Article::test_status(@$_POST["article_status"])) {
$fail_reasons[] = $translation["invalid_article_status"];
} else {
$inputs["article_status"] = (int) $_POST["article_status"];
}
if (!isset($textprocessors[@$_POST["content_txtproc"]])) {
$fail_reasons[] = $translation["unknown_txtproc"];
} else {
$inputs["content_txtproc"] = $_POST["content_txtproc"];
}
if (!isset($textprocessors[@$_POST["excerpt_txtproc"]])) {
$fail_reasons[] = $translation["unknown_txtproc"];
} else {
$inputs["excerpt_txtproc"] = $_POST["excerpt_txtproc"];
}
if (!empty($_POST["date"])) {
if (($time_tmp = @DateTime::createFromFormat("Y-m-d H:i:s", @$_POST["date"])) === False) {
$fail_reasons[] = $translation["invalid_date"];
} else {
$inputs["date"] = @$time_tmp->getTimestamp();
}
} else {
$inputs["date"] = time();
}
$inputs["allow_comments"] = !(empty($_POST["allow_comments"]) or $_POST["allow_comments"] != "yes");
try {
$inputs["article_section"] = Section::by_name($_POST["section"]);
} catch (DoesNotExistError $e) {
$fail_reasons[] = $translation["unknown_section"];
}
$inputs["title"] = $_POST["title"];
$inputs["content"] = $_POST["content"];
$inputs["excerpt"] = $_POST["excerpt"];
$inputs["tags"] = array_filter(array_map("trim", explode(",", $_POST["tags"])), function ($t) {
return !empty($t);
});
if (isset($_POST["saveaslang"])) {
$editlang = $_POST["saveaslang"];
}
} else {
/* Call articleeditor plugins */
$article = empty($article) ? NULL : Article::by_urlname($article);
foreach ($articleeditor_plugins as $plugin) {
call_user_func($plugin["fx"], $article, False);
}
}
function fill_article(&$article, $inputs, $editlang)
{
$article->urlname = $inputs["urlname"];