• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Plugins类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Plugins的典型用法代码示例。如果您正苦于以下问题:PHP Plugins类的具体用法?PHP Plugins怎么用?PHP Plugins使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Plugins类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: displayPluginContent

function displayPluginContent()
{
    $curPlugin = new Plugins($_GET['pluginID']);
    if (file_exists($curPlugin->get_filename())) {
        include_once $curPlugin->get_filename();
        $className = $curPlugin->get_class_name();
        $pluginClass = new $className();
        return $pluginClass->get_content();
    } else {
        return "The file does not exist.";
    }
    /*$phpFile = $curPlugin->get_filename();
    	$fh = fopen($phpFile, 'r');
    	$data = fread($fh, filesize($phpFile));
    	fclose($fh);
    	
    	if (!preg_match("/echo/i", $data) && !preg_match("/print/i", $data) )
    	{
    		if (class_exists($className))
    		{
    			$pluginClass = new $className();
    		}
    		else {return "Your class, \"".$className."\", taken from the database does not exist in your php file.";}
    		
    		if(method_exists($pluginClass, 'get_content')) {
    		
    			if($pluginClass->get_content() !='')
    			{
    				return $pluginClass->get_content();
    			}
    		}
    		else{return "No Content to retrieve";}
    	}
    	else {return "You cannot echo or print your content out, you must return a value";}*/
}
开发者ID:precurse,项目名称:netharbour,代码行数:35,代码来源:pluginTemplate.php


示例2: action_plugin_activation

 /**
  * action: plugin_activation
  *
  * @access public
  * @param string $file
  * @return void
  */
 public function action_plugin_activation($file)
 {
     if (Plugins::id_from_file($file) != Plugins::id_from_file(__FILE__)) {
         return;
     }
     Post::add_new_type('revision');
 }
开发者ID:habari-extras,项目名称:revision,代码行数:14,代码来源:revision.plugin.php


示例3: action_plugin_act_plaintext

    /**
     * Respond to the URL that was created
     * Determine the post that was supposed to be displayed, and show it in raw
     * @params array $handlervars An array of values passed in from the URL requested
     */
    function action_plugin_act_plaintext($handlervars)
    {
        $activetheme = Themes::create();
        $user_filters = array('fetch_fn' => 'get_row', 'limit' => 1);
        $page_key = array_search('page', $activetheme->valid_filters);
        unset($activetheme->valid_filters[$page_key]);
        $user_filters = Plugins::filter('template_user_filters', $user_filters);
        $user_filters = array_intersect_key($user_filters, array_flip($activetheme->valid_filters));
        $where_filters = Controller::get_handler()->handler_vars->filter_keys($activetheme->valid_filters);
        $where_filters = $where_filters->merge($user_filters);
        $where_filters = Plugins::filter('template_where_filters', $where_filters);
        $post = Posts::get($where_filters);
        $current_url = URL::get();
        $created_at = $post->pubdate->get();
        header('Content-type: text/plain; charset=utf-8');
        echo <<<HERE
# {$post->title}

  By {$post->author->displayname}
  <{$current_url}>
  {$created_at}
\t
{$post->content}
HERE;
        exit;
    }
开发者ID:habari-extras,项目名称:plaintext,代码行数:31,代码来源:plaintext.plugin.php


示例4: action_template_footer

	/**
	 * Ouputs the default menu in the template footer, and runs the 'habmin_bar' plugin filter.
	 * You can add menu items via the filter. See the 'filter_habminbar' method for
	 * an example.
	 */
	public function action_template_footer()
	{
		if ( User::identify()->loggedin ) {
			$bar = '<div id="habminbar"><div>';
			$bar.= '<div id="habminbar-name"><a href="' . Options::get('base_url') . '">' . Options::get('title') . '</a></div>';
			$bar.= '<ul>';

			$menu = array();
			$menu['dashboard']= array( 'Dashboard', URL::get( 'admin', 'page=dashboard' ), "view the admin dashboard" );
			$menu['write']= array( 'Write', URL::get( 'admin', 'page=publish' ), "create a new entry" );
			$menu['option']= array( 'Options', URL::get( 'admin', 'page=options' ), "configure site options" );
			$menu['comment']= array( 'Moderate', URL::get( 'admin', 'page=comments' ),"moderate comments" );
			$menu['user']= array( 'Users', URL::get( 'admin', 'page=users' ), "administer users" );
			$menu['plugin']= array( 'Plugins', URL::get( 'admin', 'page=plugins' ), "activate and configure plugins" );
			$menu['theme']= array( 'Themes', URL::get( 'admin', 'page=themes' ), "select a theme" );

			$menu = Plugins::filter( 'habminbar', $menu );

			$menu['logout']= array( 'Logout', URL::get( 'user', 'page=logout' ), "logout" );

			foreach ( $menu as $name => $item ) {
				list( $label, $url, $tooltip )= array_pad( $item, 3, "" );
				$bar.= "\n\t<li><a href=\"$url\" class=\"$name\"" .
				( ( $tooltip ) ? " title=\"$tooltip\"" : "" ) .">$label</a></li>";
			}
			$bar.= '</ul><br style="clear:both;" /></div></div>';

			echo $bar;
		}
	}
开发者ID:nerdfiles,项目名称:habari_boilerplate,代码行数:35,代码来源:habminbar.plugin.php


示例5: mdh_emailmagick_bump_me

/**
 * Makes this plugin the first to be loaded.
 * - Bumps this plugin at the top of the active_plugins stack.
 */
function mdh_emailmagick_bump_me()
{
    if (OC_ADMIN) {
        // @legacy : ALWAYS remove this if active.
        if (osc_plugin_is_enabled("madhouse_utils/index.php")) {
            Plugins::deactivate("madhouse_utils/index.php");
        }
        // Sanitize & get the {PLUGIN_NAME}/index.php.
        $path = str_replace(osc_plugins_path(), '', osc_plugin_path(__FILE__));
        if (osc_plugin_is_installed($path)) {
            // Get the active plugins.
            $plugins_list = unserialize(osc_active_plugins());
            if (!is_array($plugins_list)) {
                return false;
            }
            // Remove $path from the active plugins list
            foreach ($plugins_list as $k => $v) {
                if ($v == $path) {
                    unset($plugins_list[$k]);
                }
            }
            // Re-add the $path at the beginning of the active plugins.
            array_unshift($plugins_list, $path);
            // Serialize the new active_plugins list.
            osc_set_preference('active_plugins', serialize($plugins_list));
            if (Params::getParam("page") === "plugins" && Params::getParam("action") === "enable" && Params::getParam("plugin") === $path) {
                //osc_redirect_to(osc_admin_base_url(true) . "?page=plugins");
            } else {
                osc_redirect_to(osc_admin_base_url(true) . "?" . http_build_query(Params::getParamsAsArray("get")));
            }
        }
    }
}
开发者ID:bomvendador,项目名称:soroka_r,代码行数:37,代码来源:index.php


示例6: __get

 public function __get($name)
 {
     // if there is a _ in the name, there is a filter at the end
     if (strpos($name, '_') !== false) {
         // pick off the last _'d piece
         preg_match('/^(.*)_([^_]+)$/', $name, $matches);
         list($junk, $name, $filter) = $matches;
         // so that we don't break every info value that has a _ in it, only _out is an acceptable filter name
         if ($filter != 'out') {
             // put it back together
             $name = $name . '_' . $filter;
             // turn off the filter
             $filter = false;
         }
     } else {
         $filter = false;
     }
     // get the value by calling our parent function directly
     $value = parent::__get($name);
     // apply the main filter so values can be altered regardless of any _filter
     $value = Plugins::filter("post_info_{$name}", $value);
     // if there is a filter, apply that specific one too
     if ($filter) {
         $value = Plugins::filter("post_info_{$name}_{$filter}", $value);
     }
     return $value;
 }
开发者ID:habari,项目名称:system,代码行数:27,代码来源:postinfo.php


示例7: __get

 public function __get($name)
 {
     switch ($name) {
         case 'resource':
             return Plugins::filter('get_stackitem_resource', $this->resource, $this);
     }
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:7,代码来源:stackitem.php


示例8: install_schema

 /**
  * Получение схемы БД из SQL файлов модулей и активированных плагинов
  * 
  * @return string
  */
 public static function install_schema()
 {
     $schema = '';
     // Create a new directory iterator
     $path = new DirectoryIterator(CMS_MODPATH);
     foreach ($path as $dir) {
         if ($dir->isDot()) {
             continue;
         }
         $file_name = CMS_MODPATH . $dir->getBasename() . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . 'schema.sql';
         if (file_exists($file_name)) {
             $schema .= file_get_contents($file_name);
             $schema .= "\n\n";
         }
     }
     if (class_exists('Plugins')) {
         foreach (Plugins::activated() as $id) {
             $file_name = PLUGPATH . $id . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . 'schema.sql';
             if (file_exists($file_name)) {
                 $schema .= file_get_contents($file_name);
                 $schema .= "\n\n";
             }
         }
     }
     return str_replace('__TABLE_PREFIX__', TABLE_PREFIX, $schema);
 }
开发者ID:kodicms,项目名称:core,代码行数:31,代码来源:Helper.php


示例9: test_delete

	public function test_delete()
	{
		$group = UserGroup::get( "new test group" );

		Plugins::register( array( $this, 'filter_usergroup_delete_allow' ), 'filter','usergroup_delete_allow' );
		$this->assert_true(
			$group instanceof UserGroup,
			'Could not retrieve group named "new test group".'
		);

		$this->allow_filter = false;
		$group->delete();
		$this->assert_false(
			DB::get_value('SELECT count(*) FROM {groups} WHERE name = ?', array('new test group')) == 0,
			'Was able to delete a group despite not being allowed to do so.'
		);

		$this->allow_filter = true;
		$group->delete();
		$this->assert_true(
			DB::get_value('SELECT count(*) FROM {groups} WHERE name = ?', array('new test group')) == 0,
			'Was not able to delete a created group.'
		);

		$group = UserGroup::get( "new test group" );
		$this->assert_false(
			$group instanceof UserGroup,
			'Was able to retrieve (deleted) group named "new test group".'
		);
	}
开发者ID:rynodivino,项目名称:tests,代码行数:30,代码来源:test_usergroup.php


示例10: filter_rssblocks_update

 public function filter_rssblocks_update($success, $force = false)
 {
     EventLog::log('Running rrsblocks update');
     $blocks = DB::get_results('SELECT b.* FROM {blocks} b WHERE b.type = ?', array('rssblock'), 'Block');
     Plugins::act('get_blocks', $blocks);
     $success = true;
     foreach ($blocks as $block) {
         $cachename = array('rssblock', md5($block->feed_url));
         if ($force || Cache::expired($cachename)) {
             $r = new RemoteRequest($block->feed_url);
             $r->set_timeout(10);
             $r->execute();
             $feed = $r->get_response_body();
             try {
                 if (is_string($feed)) {
                     new SimpleXMLElement($feed);
                     // This throws an exception if the feed isn't valid
                     Cache::set($cachename, $feed, 3600, true);
                 }
             } catch (Exception $e) {
                 $success = false;
             }
         }
     }
     Session::notice('ran rssblocks update');
     return $success;
 }
开发者ID:habari-extras,项目名称:rssblocks,代码行数:27,代码来源:rssblocks.plugin.php


示例11: action_plugin_activation

 /**
  * Don't bother loading if the gd library isn't active
  */
 public function action_plugin_activation($file)
 {
     if (!function_exists('imagecreatefromjpeg')) {
         Session::error(_t("Habari Silo activation failed. PHP has not loaded the gd imaging library."));
         Plugins::deactivate_plugin(__FILE__);
     }
 }
开发者ID:anupom,项目名称:my-blog,代码行数:10,代码来源:habarisilo.plugin.php


示例12: __construct

 /**
  * Constructor.
  *
  * @access protected
  */
 protected function __construct()
 {
     // Init Config
     Config::init();
     // Turn on output buffering
     ob_start();
     // Display Errors
     Config::get('system.errors.display') and error_reporting(-1);
     // Set internal encoding
     function_exists('mb_language') and mb_language('uni');
     function_exists('mb_regex_encoding') and mb_regex_encoding(Config::get('system.charset'));
     function_exists('mb_internal_encoding') and mb_internal_encoding(Config::get('system.charset'));
     // Set default timezone
     date_default_timezone_set(Config::get('system.timezone'));
     // Start the session
     Session::start();
     // Init Cache
     Cache::init();
     // Init Plugins
     Plugins::init();
     // Init Blocks
     Blocks::init();
     // Init Pages
     Pages::init();
     // Flush (send) the output buffer and turn off output buffering
     ob_end_flush();
 }
开发者ID:zorca,项目名称:morfy,代码行数:32,代码来源:Morfy.php


示例13: action_ajax_block

 public function action_ajax_block(AjaxHandler $handler)
 {
     if (!isset($_SESSION['ajax_blocks'][$_GET['_b']])) {
         die;
     }
     $block = $_SESSION['ajax_blocks'][$_GET['_b']];
     $context = null;
     $handler->setup_theme();
     $theme = $handler->theme;
     $blocks = $theme->get_blocks($block->_area, $block->_scope_id, $theme);
     $blocks = array_filter($blocks, function ($b) use($block) {
         return $b->id == $block->id;
     });
     $rebuildblock = reset($blocks);
     $rebuildblock->_area = $block->_area;
     $rebuildblock->_instance_id = $block->_instance_id;
     $rebuildblock->_area_index = $block->_area_index;
     $hook = 'block_content_' . $rebuildblock->type;
     Plugins::act($hook, $rebuildblock, $theme);
     Plugins::act('block_content', $rebuildblock, $theme);
     $rebuildblock->_content = $theme->content($rebuildblock, $context);
     $rebuildblock->_first = $block->_first;
     $rebuildblock->_last = $block->_last;
     // Set up the theme for the wrapper
     $theme->block = $rebuildblock;
     $theme->content = $rebuildblock->_content;
     // This is the block wrapper fallback template list
     $fallback = array($block->area . '.blockwrapper', 'blockwrapper', 'content');
     if (!is_null($context)) {
         array_unshift($fallback, $context . '.blockwrapper');
         array_unshift($fallback, $context . '.' . $block->area . '.blockwrapper');
     }
     $output = $theme->display_fallback($fallback, 'fetch');
     echo $output;
 }
开发者ID:ringmaster,项目名称:ajaxify_block,代码行数:35,代码来源:ajaxify_block.plugin.php


示例14: action_plugin_activation

 /**
  * When Plugin is activated insert default options
  */
 public function action_plugin_activation($file)
 {
     if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
         Options::set('syntax__default_lang', 'php');
         Options::set('syntax__line_numbers', '');
     }
 }
开发者ID:habari-extras,项目名称:syntaxhighlighter,代码行数:10,代码来源:syntax.plugin.php


示例15: action_admin_header

 public function action_admin_header($theme)
 {
     if ($theme->page == 'configure_block' && $_GET['inline'] == 1) {
         Plugins::act('add_jwysiwyg_admin');
         Stack::add('admin_stylesheet', array('#block_admin { display: none; } textarea { height: 250px; width: 540px; }', 'screen'));
     }
 }
开发者ID:habari-extras,项目名称:inlineblock,代码行数:7,代码来源:inlineblock.plugin.php


示例16: test_format_priority

 public function test_format_priority()
 {
     Format::apply(function ($v) {
         return $v . '7';
     }, 'test_filter_7');
     Format::apply(function ($v) {
         return $v . '8';
     }, 'test_filter');
     $result = Plugins::filter('test_filter', 'test');
     $this->assert_equal('test78', $result);
     Format::apply(function ($v, $c) {
         return $v . '7' . $c;
     }, 'test_filter2_7', 'a');
     Format::apply(function ($v, $c) {
         return $v . '8' . $c;
     }, 'test_filter2', 'b');
     $result = Plugins::filter('test_filter2', 'test');
     $this->assert_equal('test7a8b', $result);
     Format::apply_with_hook_params(function ($v, $h, $c) {
         return $v . '7' . $h . $c;
     }, 'test_filter3_7', 'a');
     Format::apply_with_hook_params(function ($v, $h, $c) {
         return $v . '8' . $h . $c;
     }, 'test_filter3', 'b');
     $result = Plugins::filter('test_filter3', 'test', 'h');
     $this->assert_equal('test7ha8hb', $result);
 }
开发者ID:habari,项目名称:tests,代码行数:27,代码来源:test_format.php


示例17: init

	static function init() {
		$base_hooks_dir = ROOT . "/hooks" ;
		if (is_dir($base_hooks_dir)) {
			$handle = opendir($base_hooks_dir);
			while ($file = readdir($handle)) {
				if (is_file("$base_hooks_dir/$file") && substr($file, -4) == '.php') {
					include_once "$base_hooks_dir/$file";
				}
			}
			closedir($handle);
		}
		
		foreach ( Plugins::instance()->getActive() as $plugin ){
			/* @var $plugin Plugin  */
			$plugin_hooks_dir = $plugin->getHooksPath();
			if (is_dir($plugin_hooks_dir)) {
				$handle = opendir($plugin_hooks_dir);
				while ($file = readdir($handle)) {
					if (is_file("$plugin_hooks_dir/$file") && substr($file, -4) == '.php') {
						include_once "$plugin_hooks_dir/$file";
					}
				}
				$plugin->getSystemName() ;
				closedir($handle);
			}
		}
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:27,代码来源:Hook.class.php


示例18: act

 /**
  * All handlers must implement act() to conform to handler API.
  * This is the default implementation of act(), which attempts
  * to call a class member method of $this->act_$action().  Any
  * subclass is welcome to override this default implementation.
  *
  * @param string $action the action that was in the URL rule
  */
 public function act($action)
 {
     if (null === $this->handler_vars) {
         $this->handler_vars = new SuperGlobal(array());
     }
     $this->action = $action;
     $this->theme->assign('matched_rule', URL::get_matched_rule());
     $request = new StdClass();
     foreach (URL::get_active_rules() as $rule) {
         $request->{$rule->name} = false;
     }
     $request->{$this->theme->matched_rule->name} = true;
     $this->theme->assign('request', $request);
     $action_hook = 'plugin_act_' . $action;
     $before_action_hook = 'before_' . $action_hook;
     $theme_hook = 'route_' . $action;
     $after_action_hook = 'after_' . $action_hook;
     Plugins::act($before_action_hook, $this);
     Plugins::act($action_hook, $this);
     if (Plugins::implemented($theme_hook, 'theme')) {
         $theme = Themes::create();
         $rule = URL::get_matched_rule();
         Plugins::theme($theme_hook, $theme, $rule->named_arg_values, $this);
     }
     Plugins::act($after_action_hook);
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:34,代码来源:pluginhandler.php


示例19: act

 /**
  * All handlers must implement act() to conform to handler API.
  * This is the default implementation of act(), which attempts
  * to call a class member method of $this->act_$action().  Any
  * subclass is welcome to override this default implementation.
  *
  * @param string $action the action that was in the URL rule
  */
 public function act($action)
 {
     if (null === $this->handler_vars) {
         $this->handler_vars = new SuperGlobal(array());
     }
     $this->action = $action;
     $action_method = 'act_' . $action;
     $before_action_method = 'before_' . $action_method;
     $after_action_method = 'after_' . $action_method;
     if (method_exists($this, $action_method)) {
         if (method_exists($this, $before_action_method)) {
             $this->{$before_action_method}();
         }
         /**
          * Plugin action to allow plugins to execute before a certain
          * action is triggered
          *
          * @see ActionHandler::$action
          * @action before_act_{$action}
          */
         Plugins::act($before_action_method, $this);
         $this->{$action_method}();
         /**
          * Plugin action to allow plugins to execute after a certain
          * action is triggered
          *
          * @see ActionHandler::$action
          * @action before_act_{$action}
          */
         Plugins::act($after_action_method);
         if (method_exists($this, $after_action_method)) {
             $this->{$after_action_method}();
         }
     }
 }
开发者ID:anupom,项目名称:my-blog,代码行数:43,代码来源:actionhandler.php


示例20: action_plugin_activation

 /**
  * action: plugin_activation
  *
  * @access public
  * @param string $file
  * @return void
  */
 public function action_plugin_activation($file)
 {
     if (Plugins::id_from_file($file) != Plugins::id_from_file(__FILE__)) {
         return;
     }
     Options::set('calendar__week_start', 0);
 }
开发者ID:habari-extras,项目名称:calendar,代码行数:14,代码来源:calendar.plugin.php



注:本文中的Plugins类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP PoTable类代码示例发布时间:2022-05-23
下一篇:
PHP Plugin_Upgrader类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap