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


PHP Plugins::filter方法代码示例

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


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

示例1: __get

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

示例2: 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

示例3: locale_js

    /**
     * Serves the locale Javascript to translate javascript strings.
     */
    public function locale_js()
    {
        header('Expires: ' . gmdate('D, d M Y H:i:s ', time() + 432000) . 'GMT');
        header('content-type: text/javascript');
        $domain = HabariLocale::get_messages();
        $domain_json = json_encode($domain);
        $js = <<<TEEHEE
function _t() {
    var domain = {$domain_json};
    var s = arguments[0];

    if(domain[s] != undefined) {
        s = domain[s][1][0];
    }

    for(var i = 1; i <= arguments.length; i++) {
        r = new RegExp('%' + (i) + '\\\\\$s', 'g');
        if(!s.match(r)) {
            r = new RegExp('%s');
        }
        s = s.replace(r, arguments[i]);
    }
    return s;
}
TEEHEE;
        echo Plugins::filter('locale_js', $js);
    }
开发者ID:wwxgitcat,项目名称:habari,代码行数:30,代码来源:ajaxhandler.php

示例4: 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

示例5: 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

示例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: action_block_content

 /**
  * When adding dashboard modules, the titles should remain as they're written in their providing plugin
  * This function adds a value for the title of the block that is the same as the name of the type of block.
  * The value is in _title because overwriting the main title value causes the block data to reload.
  * @param Block $block The block that has data stored for the title
  * @param Theme $theme The theme displaying this block
  */
 public function action_block_content($block, $theme)
 {
     static $available_modules;
     if (!isset($available_modules)) {
         $available_modules = Plugins::filter('dashboard_block_list', array());
     }
     $block->_title = $available_modules[$block->type];
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:15,代码来源:theme.php

示例8: get_groups

 /**
  * Handles GET requests for the groups page.
  */
 public function get_groups()
 {
     // prepare the WSSE tokens
     $this->theme->wsse = Utils::WSSE();
     $groups = UserGroups::get_all();
     $this->theme->groups = Plugins::filter('admin_groups_visible', $groups);
     $this->display('groups');
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:11,代码来源:admingroupshandler.php

示例9: get_import

	/**
	 * Handles GET requests for the import page.
	 */
	public function get_import()
	{
		// First check for troublesome plugins
		$bad_features = array(
		    'ping',
		    'pingback',
		    'spamcheck',
		);
		$troublemakers = array();
		$plugins = Plugins::list_active();
		foreach( $plugins as $plugin ) {
			$info = Plugins::load_info( $plugin );
			$provides = array();
			if( isset($info->provides ) ) {
				foreach( $info->provides->feature as $feature ) {
					$provides[] = $feature;
				}
			}
			$has_bad = array_intersect( $bad_features, $provides );
			if( count( $has_bad ) ) {
				$troublemakers[] = $info->name;
			}
		}
		if( count( $troublemakers ) ) {
			$troublemakers = implode( ', ', $troublemakers );
			$msg = _t( 'Plugins that conflict with importing are active. To prevent undesirable consequences, please de-activate the following plugins until the import is finished: ' ) . '<br>';
			$msg .= $troublemakers;
			$this->theme->conflicting_plugins = $msg;
			Session::error( $msg );
		}

		// Now get on with creating the page
		$importer = isset( $_POST['importer'] ) ? $_POST['importer'] : '';
		$stage = isset( $_POST['stage'] ) ? $_POST['stage'] : '1';
		$step = isset( $_POST['step'] ) ? $_POST['step'] : '1';

		$this->theme->enctype = Plugins::filter( 'import_form_enctype', 'application/x-www-form-urlencoded', $importer, $stage, $step );
		
		// filter to get registered importers
		$importers = Plugins::filter( 'import_names', array() );
		
		// fitler to get the output of the current importer, if one is running
		if ( $importer != '' ) {
			$output = Plugins::filter( 'import_stage', '', $importer, $stage, $step );
		}
		else {
			$output = '';
		}

		$this->theme->importer = $importer;
		$this->theme->stage = $stage;
		$this->theme->step = $step;
		$this->theme->importers = $importers;
		$this->theme->output = $output;
		
		$this->display( 'import' );

	}
开发者ID:rynodivino,项目名称:system,代码行数:61,代码来源:adminimporthandler.php

示例10: ajax_dashboard

 /**
  * Handles AJAX requests from the dashboard
  */
 public function ajax_dashboard($handler_vars)
 {
     Utils::check_request_method(array('POST'));
     $this->create_theme();
     $this->get_additem_form();
     $available_modules = Plugins::filter('dashboard_block_list', array());
     $user_id = User::identify()->id;
     $dashboard_area = 'dashboard_' . $user_id;
     switch ($handler_vars['action']) {
         case 'updateModules':
             $modules = $_POST['moduleOrder'];
             $order = 0;
             foreach ($modules as $module) {
                 $order++;
                 DB::query('UPDATE {blocks_areas} SET display_order = :display_order WHERE block_id = :id AND area = :dashboardarea', array('display_order' => $order, 'id' => $module, 'dashboardarea' => $dashboard_area));
             }
             $ar = new AjaxResponse(200, _t('Modules updated.'));
             break;
         case 'addModule':
             $type = $handler_vars['module_name'];
             $title = $available_modules[$type];
             $block = new Block(array('title' => $title, 'type' => $type));
             $block->insert();
             $max_display_order = DB::get_value('SELECT max(display_order) FROM {blocks_areas} WHERE area = :dashboardarea and scope_id = 0;', array('dashboardarea' => $dashboard_area));
             $max_display_order++;
             DB::query('INSERT INTO {blocks_areas} (block_id, area, scope_id, display_order) VALUES (:block_id, :dashboardarea, 0, :display_order)', array('block_id' => $block->id, 'display_order' => $max_display_order, 'dashboardarea' => $dashboard_area));
             $ar = new AjaxResponse(200, _t('Added module %s.', array($title)));
             $ar->html('modules', $this->theme->fetch('dashboard_modules'));
             break;
         case 'removeModule':
             $block_id = $handler_vars['moduleid'];
             DB::delete('{blocks}', array('id' => $block_id));
             DB::delete('{blocks_areas}', array('block_id' => $block_id));
             $ar = new AjaxResponse(200, _t('Removed module.'));
             $ar->html('modules', $this->theme->fetch('dashboard_modules'));
             break;
         case 'configModule':
             $block_id = $handler_vars['moduleid'];
             $block = DB::get_row('SELECT * FROM {blocks} b WHERE b.id = :id', array('id' => $block_id), 'Block');
             /** Block $block */
             $form = $block->get_form();
             $form->_ajax = true;
             $form->set_option('success_message', _t('Module Configuration Saved.') . '<script type="text/javascript">window.setTimeout(function(){$(".form_message").fadeOut();}, 2000);</script>');
             $control_id = new FormControlHidden('moduleid', 'null:null');
             $control_id->value = $block->id;
             $control_id->id = 'moduleid';
             $form->append($control_id);
             $control_action = new FormControlHidden('action', 'null:null');
             $control_action->value = 'configModule';
             $control_action->id = 'action';
             $form->append($control_action);
             $form->out();
             $form_id = $form->name;
             exit;
             break;
     }
     $ar->out();
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:61,代码来源:admindashboardhandler.php

示例11: __get

 public function __get($name)
 {
     switch ($name) {
         case 'resource':
             return Plugins::filter('get_stackitem_resource', $this->resource, $this);
     }
     trigger_error(_t('Requested property @name does not exist.', array('@name' => $name)), E_NOTICE);
     return null;
 }
开发者ID:habari,项目名称:system,代码行数:9,代码来源:stackitem.php

示例12: test_register_assets

 /**
  * Test that plugins can register assets
  */
 public function test_register_assets()
 {
     Plugins::register(array($this, 'filter_register_simple_assets'), 'filter', 'pluggable_assets');
     $result = Plugins::filter('pluggable_assets', array());
     $expected = $this->simple_assets;
     $key = 'simple_assets';
     $this->assert_true(array_key_exists($key, $result), "Expected <em>{$key}</em> key to exist in <em>" . var_export($result, true) . "</em>");
     $this->assert_equal($expected[$key], $result[$key], "Expected <em>" . var_export($result[$key], true) . "</em> to equal <em>" . var_export($expected[$key], true) . "</em>");
 }
开发者ID:habari,项目名称:tests,代码行数:12,代码来源:test_pluggable.php

示例13: __static

 public static function __static()
 {
     self::$whitelist_elements = Plugins::filter('inputfilter_whitelist_elements', self::$whitelist_elements);
     self::$whitelist_attributes = Plugins::filter('inputfilter_whitelist_attributes', self::$whitelist_attributes);
     self::$elements_empty = Plugins::filter('inputfilter_elements_empty', self::$elements_empty);
     self::$whitelist_protocols = Plugins::filter('inputfilter_whitelist_protocols', self::$whitelist_protocols);
     self::$character_entities = Plugins::filter('inputfilter_character_entities', self::$character_entities);
     self::$character_entities_re = Plugins::filter('inputfilter_character_entities_re', self::$character_entities_re);
 }
开发者ID:habari,项目名称:system,代码行数:9,代码来源:inputfilter.php

示例14: action_init

 public function action_init()
 {
     // gotta be an easier way of doing this
     $theme_dir = Plugins::filter('admin_theme_dir', Site::get_dir('admin_theme', TRUE));
     $theme = Themes::create('admin', 'RawPHPEngine', $theme_dir);
     if (!$theme->template_exists('admincontrol_select')) {
         $this->add_template('admincontrol_select', dirname(__FILE__) . '/admincontrol_select.php');
     }
 }
开发者ID:habari-extras,项目名称:projectr,代码行数:9,代码来源:projectr.plugin.php

示例15: get_theme_dir

 /**
  * Returns the name of the active or previewed theme
  * 
  * @params boolean $nopreview If true, return the real active theme, not the preview
  * @return string the current theme or previewed theme's directory name
  */
 public static function get_theme_dir($nopreview = false)
 {
     if (!$nopreview && isset($_SESSION['user_theme_dir'])) {
         $theme_dir = $_SESSION['user_theme_dir'];
     } else {
         $theme_dir = Options::get('theme_dir');
     }
     $theme_dir = Plugins::filter('get_theme_dir', $theme_dir);
     return $theme_dir;
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:16,代码来源:themes.php


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