本文整理汇总了PHP中plugin函数的典型用法代码示例。如果您正苦于以下问题:PHP plugin函数的具体用法?PHP plugin怎么用?PHP plugin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plugin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
//为方便调试, 插件功能模块编译不缓存
C('TMPL_CACHE_ON', false);
$name = $this->_get('name', false);
if (empty($name)) {
$this->error('参数错误!');
}
$method = $this->_get('method', false);
$method = empty($method) ? 'index' : $method;
$path = './Public/Plugin/' . $name . '/admin.php';
if (file_exists($path)) {
$model = M('plugin');
$map['title'] = $name;
$list = $model->where($map)->find();
if (!$list) {
$this->error('当前插件没有注册!');
}
if ($list['status'] == 1) {
$this->error('当前插件没有启用!');
}
} else {
$this->error('当前插件无管理功能!');
}
echo plugin($name, $method);
}
示例2: display
public static function display()
{
$messages = "";
if ($_POST['cc_form'] === 'add-group') {
$group = $_POST['group'];
$rows = Database::select('users', 'name', array('name = ? AND type = ?', $group, 'group'), null, 1)->fetch(PDO::FETCH_ASSOC);
if (!empty($rows)) {
$messages .= Message::error(__('admin', 'group-in-use'));
} else {
$row = DB::select('users', array('data'), array('users_id = ?', $_GET['parent']))->fetch(PDO::FETCH_ASSOC);
$inheritance = unserialize($row['data']);
$inheritance = $inheritance['permissions'];
$result = Database::insert('users', array('name' => filter('admin_add_group_name', $group), 'type' => 'group', 'group' => '-1', 'data' => serialize(filter('admin_add_group_data', array('permissions' => $inheritance)))));
if ($result === 1) {
$messages .= Message::success(__('admin', 'group-added'));
}
}
}
$form = new Form('self', 'post', 'add-group');
$form->startFieldset(__("admin", 'group-information'));
$form->addInput(__('admin', 'group-name'), 'text', 'group', self::get('group'));
$groups = Users::allGroups();
foreach ($groups as $key => $value) {
$groups[$value->getId()] = $value->getName();
}
$form->addSelectList(__('admin', 'inherit-permissions'), 'parent', $groups);
plugin('admin_add_group_custom_fields', array(&$form));
$form->addSubmit('', 'add-group', __('admin', 'add-group'));
$form->endFieldset();
plugin('admin_add_group_custom_fieldset', array(&$form));
$form = $form->endAndGetHTML();
return array(__('admin', 'add-group'), $messages . $form);
}
示例3: index
/**
* Main action.
*
* @return void
*/
public function index()
{
$this->loadModel('System.Options');
$languages = LocaleToolbox::languagesList();
$arrayContext = ['schema' => ['site_title' => 'string', 'site_slogan' => 'string', 'site_description' => 'string', 'site_email' => 'string', 'site_contents_home' => 'integer', 'site_maintenance' => 'boolean', 'site_maintenance_ip' => 'string', 'site_maintenance_message' => 'string', 'default_language' => 'string', 'url_locale_prefix' => 'string'], 'defaults' => [], 'errors' => []];
$variables = $this->Options->find()->where(['name IN' => array_keys($arrayContext['schema'])])->all();
foreach ($variables as $var) {
$arrayContext['defaults'][$var->name] = $var->value;
}
if ($this->request->data()) {
$validator = $this->_mockValidator();
$errors = $validator->errors($this->request->data());
if (empty($errors)) {
foreach ($this->request->data() as $k => $v) {
$this->Options->update($k, $v, null, false);
}
snapshot();
$this->Flash->success(__d('system', 'Configuration successfully saved!'));
$this->redirect($this->referer());
} else {
$arrayContext['errors'] = $errors;
$this->Flash->danger(__d('system', 'Configuration could not be saved, please check your information.'));
}
}
$pluginSettings = plugin()->filter(function ($plugin) {
return !$plugin->isTheme && $plugin->hasSettings;
});
$this->title(__d('system', 'Site’ Configuration'));
$this->set(compact('arrayContext', 'languages', 'variables', 'pluginSettings'));
$this->Breadcrumb->push('/admin/system/configuration');
}
示例4: baz_u
function baz_u($d)
{
list($ob, $op) = split_right(':', $d);
list($od, $oq) = split_one('/', $op);
//echo $ob.'-'.$od.'-'.$oq.br();
if ($oq) {
switch ($od) {
case 'bal':
return bal($oq, $ob);
break;
case 'plug':
return plugin($oq, $ob);
break;
}
} else {
switch ($op) {
case 'br':
return br();
break;
case 'b':
return bal($op, $ob);
break;
case 'u':
return bal($op, $ob);
break;
}
}
return '(' . $d . ')';
}
示例5: plug_exsys
function plug_exsys($p, $o = '')
{
$rid = 'plg' . $p;
$ret .= autoclic('param', $p, 10, 244, '', 1) . ' ';
$ret .= lj('', $rid . '_plug___exsys_sys___param', picto('reload'));
return $ret . divd($rid, plugin($plg, $p, $o));
}
示例6: __construct
/**
* Class constructor.
*
* Reorganizing class members.
*
* @param string $prev_version Version they are upgrading from.
*/
public function __construct($prev_version)
{
$this->plugin = plugin();
$this->prev_version = (string) $prev_version;
$this->run_handlers();
// Run upgrade(s).
}
示例7: adapter
/**
* Gets an instance of the given adapter name (or default adapter if not given).
*
* @param string|null $name Name of the adapter, or null to use default adapter
* selected in Captcha plugin's setting page. The latest registered adapter
* will be used if no default adapter has been selected yet
* @param array $config Options to be passed to Adapter's `config()` method, if
* not given it will try to get such parameters from Captcha plugin's settings
* @return \Captcha\Adapter\BaseAdapter
* @throws \Captcha\Error\AdapterNotFoundException When no adapter was found
*/
public static function adapter($name = null, array $config = [])
{
$class = null;
if ($name === null) {
$default = (string) plugin('Captcha')->settings('default_adapter');
if (!empty($default)) {
return static::adapter($default, $config);
}
$class = end(static::$_adapters);
} elseif (isset(static::$_adapters[$name])) {
$class = static::$_adapters[$name];
}
if (empty($config)) {
$config = (array) plugin('Captcha')->settings($name);
}
if (is_string($class) && class_exists($class)) {
$class = new $class($config);
$created = true;
}
if ($class instanceof BaseAdapter) {
if (!isset($created)) {
$class->config($config);
}
return $class;
}
throw new AdapterNotFoundException(__d('captcha', 'The captcha adapter "{0}" was not found.'), $name);
}
示例8: plug_microform
function plug_microform($p, $id)
{
$rid = 'mfr' . randid();
//echo $p.'-'.$id;
$nod = ses('mform', ses('qb') . '_microform_' . $id);
req('pop');
ses('mformj', $rid . '_plug___microform_plug*microform_' . ajx($p) . '_' . $id);
reqp('msql');
$msq = new msql('', $nod);
//table
list($p, $tp) = explode('§', $p);
$rb = mform_mr($p);
//p($rb);
$msq->create($rb);
$ret .= make_form($p, 'mfr' . $id, '_plug___microform_mform*j_' . ajx($p, '') . '_' . $id . '_') . br();
if (auth(4)) {
$ret .= msqlink('users', ses('mform')) . ' ' . btn('txtsmall2', $nod) . ' ';
}
if ($tp == 1) {
$ret .= mform_read($id);
} elseif ($tp) {
$ret .= plugin('msqtemplate', $nod, $tp);
}
return divd($rid, $ret . $bt);
}
示例9: send
/**
* {@inheritDoc}
*/
public function send()
{
$this->subject(plugin('User')->settings['message_activation_subject'])->body(plugin('User')->settings['message_activation_body']);
if (plugin('User')->settings['message_activation']) {
return parent::send();
}
return true;
}
示例10: __construct
/**
* Class constructor.
*
* @since 150218 Refactoring cache clear/purge routines.
*/
public function __construct()
{
$this->plugin = plugin();
$this->home_url = home_url('/');
$this->default_feed = get_default_feed();
$this->seo_friendly_permalinks = (bool) get_option('permalink_structure');
$this->feed_types = array_unique(array($this->default_feed, 'rdf', 'rss', 'rss2', 'atom'));
}
示例11: cc_theme_include
/**
* Includes the theme file for the given theme. (it is pretty important).
*
* @param string $theme The name of the theme!
*/
function cc_theme_include($theme)
{
plugin('core_theme_include', array($theme));
$file = filter('core_theme_include', TH_ROOT . TH_THEMES . $theme . '/index.tpl.php');
if (file_exists($file)) {
require_once $file;
}
}
示例12: onCommentStart
/**
* Callback function triggered at the beginning of the rendering process of
* an individual comment.
*
* @param string $output Generated output.
* @param Comment $comment Comment to render.
* @param integer $level Current level in the hierarchy.
*/
protected function onCommentStart(&$output, $comment, $level = 0)
{
if ($template = plugin('comments')->finder()->locate('comment')) {
ob_start();
require $template;
$output .= ob_get_clean();
}
}
示例13: enqueue_scripts
public function enqueue_scripts()
{
wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
wp_enqueue_script('fancybox', '//cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.js', array('jquery'));
wp_enqueue_style('fancybox', '//cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.css');
wp_enqueue_script('super-redirect-polyfill', plugins_url('', plugin()->file) . '/client-s/custom-element-polyfill.min.js');
wp_enqueue_script('super-redirect-admin', plugins_url('', plugin()->file) . '/client-s/admin.js', array('jquery', 'jquery-ui-sortable', 'jquery-effects-core', 'jquery-effects-pulsate'));
wp_enqueue_style('super-redirect-admin', plugins_url('', plugin()->file) . '/client-s/admin.css');
}
示例14: validationDefault
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator The validator object
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
return $validator->add('theme', 'validTheme', ['rule' => function ($value, $context) {
$exists = plugin()->filter(function ($plugin) use($value) {
return $plugin->isTheme && $plugin->name === $value;
})->first();
return !empty($exists);
}, 'message' => __d('block', 'Invalid theme for region.')]);
}
示例15: index
/**
* Main action.
*
* Here is where we render all available documents. Plugins are able to define
* their own `help document` just by creating an view-element named `help.ctp`.
*
* Example:
*
* Album plugin may create its own `help document` by creating this file:
*
* /plugins/Album/src/Template/Element/Help/help.ctp
*
* Optionally, plugins are able to define translated versions of help documents.
* To do this, you must simply define a view element as `help_[code].ctp`, where
* `[code]` is a two-character language code. For example:
*
* help_en_US.ctp
* help_es.ctp
* help_fr.ctp
*
* @return void
*/
public function index()
{
$plugins = plugin()->filter(function ($plugin) {
return $plugin->status && $plugin->hasHelp;
});
$this->title(__d('system', 'Help'));
$this->set('plugins', $plugins);
$this->Breadcrumb->push('/admin/system/help');
}