本文整理汇总了PHP中plugin函数的典型用法代码示例。如果您正苦于以下问题:PHP plugin函数的具体用法?PHP plugin怎么用?PHP plugin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plugin函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:google2013,项目名称:pppon,代码行数:26,代码来源:PluginAction.class.php
示例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);
}
开发者ID:alecgorge,项目名称:TopHat,代码行数:33,代码来源:add-group.php
示例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');
}
开发者ID:quickapps-plugins,项目名称:system,代码行数:36,代码来源:ConfigurationController.php
示例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 . ')';
}
开发者ID:philum,项目名称:cms,代码行数:29,代码来源:bazx.php
示例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));
}
开发者ID:philum,项目名称:cms,代码行数:7,代码来源:exsys.php
示例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).
}
开发者ID:poweronio,项目名称:mbsite,代码行数:14,代码来源:version-specific-upgrade.php
示例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);
}
开发者ID:quickapps-plugins,项目名称:captcha,代码行数:38,代码来源:CaptchaManager.php
示例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);
}
开发者ID:philum,项目名称:cms,代码行数:25,代码来源:microform.php
示例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;
}
开发者ID:quickapps-plugins,项目名称:user,代码行数:11,代码来源:ActivatedMessage.php
示例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'));
}
开发者ID:GarryVeles,项目名称:Artibaltika,代码行数:13,代码来源:utils-feed.php
示例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;
}
}
开发者ID:alecgorge,项目名称:TopHat,代码行数:13,代码来源:cc-includes.php
示例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();
}
}
开发者ID:buditanrim,项目名称:kirby-comments,代码行数:16,代码来源:walker.php
示例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');
}
开发者ID:byjinx,项目名称:super-redirect,代码行数:9,代码来源:admin.php
示例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.')]);
}
开发者ID:quickapps-plugins,项目名称:block,代码行数:15,代码来源:BlockRegionsTable.php
示例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');
}
开发者ID:quickapps-plugins,项目名称:system,代码行数:31,代码来源:HelpController.php
示例16: ifrgz
function ifrgz($dr)
{
$r = explore($dr);
$f = 'users/public/ifr' . date('ymd') . '.tar';
if (!is_file($f)) {
$ret = plugin('tar', $f, $dr);
}
rmdir_r($dr);
return $ret;
}
开发者ID:philum,项目名称:cms,代码行数:10,代码来源:ifrm.php
示例17: commentsNav
/**
*
* Adds a shortcut button to Comment's management submenu.
*
* @param \Go\Aop\Intercept\MethodInvocation $invocation Invocation
* @Before("execution(public Menu\View\Helper\MenuHelper->render(*))")
*/
public function commentsNav(MethodInvocation $invocation)
{
$helper = $invocation->getThis();
$settings = plugin('Disqus')->settings;
list($items, $options) = $invocation->getArguments();
if (!empty($settings['disqus_shortname']) && count($items) == 5 && $items[0]['title'] == __d('comment', 'All')) {
$items[] = ['title' => __d('disqus', 'Go to Disqus Moderation'), 'url' => 'https://' . $settings['disqus_shortname'] . '.disqus.com/admin/moderate/', 'target' => '_blank'];
$this->setProperty($invocation, 'arguments', [$items, $options]);
}
}
开发者ID:quickapps-plugins,项目名称:disqus,代码行数:17,代码来源:CommentAspect.php
示例18: __construct
/**
* Class constructor.
*
* @since 141111 First documented version.
*/
public function __construct()
{
$this->plugin = plugin();
$class = get_called_class();
if (empty(static::$___static[$class])) {
static::$___static[$class] = [];
}
$this->static =& static::$___static[$class];
$this->___overload = new \stdClass();
}
开发者ID:websharks,项目名称:comment-mail,代码行数:15,代码来源:AbsBase.php
示例19: groupUpdate
/**
* 会员组升级
*/
protected function groupUpdate()
{
if (empty($this->memberinfo)) {
return false;
}
if (empty($this->membergroup)) {
return false;
}
$group = array();
$update = 0;
$credit = $this->memberinfo['credits'];
$groupid = $this->memberinfo['groupid'];
if (plugin('vip')) {
//会员组付费插件
$vip = $this->plugin_model('vip', 'vip');
$row = $vip->find($this->memberinfo['id']);
//查询数据
if ($row) {
//存在付费组中,判断是否到期
if ($row['endtime'] - time() > 0) {
return false;
//未到期直接跳过
} else {
$vip->delete('userid=' . $this->memberinfo['id']);
//删除该会员数据
$update = 1;
//更新标识
}
}
}
//属于非自动升级会员组直接跳过
if ($update == 0 && $this->membergroup[$groupid]['auto']) {
return false;
}
foreach ($this->membergroup as $t) {
$group[$t['id']] = $t['credits'];
}
asort($group);
foreach ($group as $gid => $g) {
if ($credit >= $g) {
$groupid = $gid;
}
}
if ($groupid != $this->memberinfo['groupid']) {
//升级
$this->member->update(array('groupid' => $groupid), 'id=' . $this->memberinfo['id']);
if (!isset($this->memberconfig['email']) || $this->memberconfig['email'] == 0) {
return false;
}
mail::set($this->site);
$content = $this->memberconfig['group_tpl'] ? $this->memberconfig['group_tpl'] : lang('m-com-2');
$content = str_replace(array('{username}', '{groupname}', '{credit}'), array($this->memberinfo['username'], $this->membergroup[$groupid]['name'], $this->memberinfo['credits']), $content);
mail::sendmail($this->memberinfo['email'], lang('m-com-3', array('1' => $this->memberinfo['username'])), htmlspecialchars_decode($content));
}
}
开发者ID:rainbow88,项目名称:hummel,代码行数:58,代码来源:Common.php
示例20: __construct
public function __construct()
{
$this->plugin = plugin();
if (empty($_REQUEST[__NAMESPACE__])) {
return;
}
foreach ((array) $_REQUEST[__NAMESPACE__] as $action => $args) {
if (method_exists($this, $action)) {
$this->{$action}($args);
}
}
}
开发者ID:bigkey,项目名称:php-getting-started,代码行数:12,代码来源:actions.php
注:本文中的plugin函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论