当前位置: 首页>>代码示例>>PHP>>正文


PHP Plugins类代码示例

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


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


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