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


PHP Themes::create方法代码示例

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


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

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

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

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

示例4: action_form_publish

 /**
  * Add the help to the publish form
  */
 public function action_form_publish($form, $post)
 {
     $selector = $form->append('wrapper', 'help_container');
     $selector->class = 'container';
     $theme = Themes::create();
     $theme->help = Options::get(strtolower(get_class($this)) . '__help');
     $content = $theme->fetch('help');
     $selector->append('static', 'help', $content);
     $form->move_after($selector, $form->silos);
     return $form;
 }
开发者ID:habari-extras,项目名称:helpify,代码行数:14,代码来源:helpify.plugin.php

示例5: filter_post_content_out

 function filter_post_content_out($content, $post)
 {
     if ($post->info->phpexec == 'true') {
         $content = str_replace('<!--php', '<?php', $content);
         $content = str_replace('?-->', '?>', $content);
         ob_start();
         $theme = Themes::create();
         eval('?>' . $content . '<?php ');
         $content = ob_get_clean();
     }
     return $content;
 }
开发者ID:ringmaster,项目名称:phpexec,代码行数:12,代码来源:phpexec.plugin.php

示例6: ajax_tags

 /**
  * Handles AJAX from /admin/tags
  * Used to delete and rename tags
  */
 public function ajax_tags($handler_vars)
 {
     Utils::check_request_method(array('POST'));
     $wsse = Utils::WSSE($handler_vars['nonce'], $handler_vars['timestamp']);
     if ($handler_vars['digest'] != $wsse['digest']) {
         Session::error(_t('WSSE authentication failed.'));
         echo Session::messages_get(true, array('Format', 'json_messages'));
         return;
     }
     $tag_names = array();
     $theme_dir = Plugins::filter('admin_theme_dir', Site::get_dir('admin_theme', true));
     $this->theme = Themes::create('admin', 'RawPHPEngine', $theme_dir);
     $action = $this->handler_vars['action'];
     switch ($action) {
         case 'delete':
             foreach ($_POST as $id => $delete) {
                 // skip POST elements which are not tag ids
                 if (preg_match('/^tag_\\d+/', $id) && $delete) {
                     $id = substr($id, 4);
                     $tag = Tags::get_by_id($id);
                     $tag_names[] = $tag->term_display;
                     Tags::vocabulary()->delete_term($tag);
                 }
             }
             $msg_status = _n(_t('Tag %s has been deleted.', array(implode('', $tag_names))), _t('%d tags have been deleted.', array(count($tag_names))), count($tag_names));
             Session::notice($msg_status);
             break;
         case 'rename':
             if (!isset($this->handler_vars['master'])) {
                 Session::error(_t('Error: New name not specified.'));
                 echo Session::messages_get(true, array('Format', 'json_messages'));
                 return;
             }
             $master = $this->handler_vars['master'];
             $tag_names = array();
             foreach ($_POST as $id => $rename) {
                 // skip POST elements which are not tag ids
                 if (preg_match('/^tag_\\d+/', $id) && $rename) {
                     $id = substr($id, 4);
                     $tag = Tags::get_by_id($id);
                     $tag_names[] = $tag->term_display;
                 }
             }
             Tags::vocabulary()->merge($master, $tag_names);
             $msg_status = sprintf(_n('Tag %1$s has been renamed to %2$s.', 'Tags %1$s have been renamed to %2$s.', count($tag_names)), implode($tag_names, ', '), $master);
             Session::notice($msg_status);
             break;
     }
     $this->theme->tags = Tags::vocabulary()->get_tree();
     $this->theme->max = Tags::vocabulary()->max_count();
     echo json_encode(array('msg' => Session::messages_get(true, 'array'), 'tags' => $this->theme->fetch('tag_collection')));
 }
开发者ID:ringmaster,项目名称:system,代码行数:56,代码来源:admintagshandler.php

示例7: __construct

	/**
	 * Constructor for theme
	 *
	 * If no parameter is supplied, then the constructor
	 * Loads the active theme from the database.
	 *
	 * If no theme option is set, a fatal error is thrown
	 *
	 * @param name            ( optional ) override the default theme lookup
	 * @param template_engine ( optional ) specify a template engine
	 * @param theme_dir       ( optional ) specify a theme directory
	 */
	public function __construct( $themedata )
	{
		$this->name = $themedata->name;
		$this->version = $themedata->version;
		$theme_dir = Utils::single_array($themedata->theme_dir);
		// Set up the corresponding engine to handle the templating
		$this->template_engine = new $themedata->template_engine();

		if(isset($themedata->parent)) {
			$parent = Themes::create($themedata->parent);
			$parent_theme_dir = Utils::single_array($parent->theme_dir);
			$theme_dir = array_merge($theme_dir, $parent_theme_dir);
		}
		$this->theme_dir = $theme_dir;
		$this->template_engine->set_template_dir( $theme_dir );
		$this->plugin_id = $this->plugin_id();
		$this->load();
	}
开发者ID:rynodivino,项目名称:system,代码行数:30,代码来源:theme.php

示例8: configure

 function configure()
 {
     $ui = new FormUI('jsmincdn');
     $scripts = $ui->append('checkboxes', 'scripts', 'jsmincdn__storage', 'Select the scripts that should be served as minimized.');
     $theme = Themes::create();
     Plugins::act('template_header', $theme);
     Plugins::act('template_footer', $theme);
     $options = Stack::get_named_stack('template_header_javascript');
     $options = array_merge($options, Stack::get_named_stack('template_footer_javascript'));
     $options_out = array();
     foreach ($options as $option => $value) {
         if (preg_match('#[a-f0-9]{32}#', $option)) {
             $value = htmlspecialchars(substr($value, 0, 80));
         } else {
             $value = $option;
         }
         $options_out[$option] = $value;
     }
     $scripts->options = $options_out;
     $ui->append('submit', 'submit', 'Submit');
     return $ui;
 }
开发者ID:habari-extras,项目名称:jsmincdn,代码行数:22,代码来源:jsmincdn.plugin.php

示例9: ajax_dashboard

 /**
  * Handles AJAX requests from the dashboard
  */
 public function ajax_dashboard($handler_vars)
 {
     Utils::check_request_method(array('POST'));
     $theme_dir = Plugins::filter('admin_theme_dir', Site::get_dir('admin_theme', true));
     $this->theme = Themes::create('admin', 'RawPHPEngine', $theme_dir);
     switch ($handler_vars['action']) {
         case 'updateModules':
             $modules = array();
             foreach ($_POST as $key => $module) {
                 // skip POST elements which are not module names
                 if (preg_match('/^module\\d+$/', $key)) {
                     list($module_id, $module_name) = explode(':', $module, 2);
                     // remove non-sortable modules from the list
                     if ($module_id != 'nosort') {
                         $modules[$module_id] = $module_name;
                     }
                 }
             }
             Modules::set_active($modules);
             $ar = new AjaxResponse(200, _t('Modules updated.'));
             break;
         case 'addModule':
             $id = Modules::add($handler_vars['module_name']);
             $this->fetch_dashboard_modules();
             $ar = new AjaxResponse(200, _t('Added module %s.', array($handler_vars['module_name'])));
             $ar->html('modules', $this->theme->fetch('dashboard_modules'));
             break;
         case 'removeModule':
             Modules::remove($handler_vars['moduleid']);
             $this->fetch_dashboard_modules();
             $ar = new AjaxResponse(200, _t('Removed module.'));
             $ar->html('modules', $this->theme->fetch('dashboard_modules'));
             break;
     }
     $ar->out();
 }
开发者ID:ringmaster,项目名称:system,代码行数:39,代码来源:admindashboardhandler.php

示例10: get_theme

	/**
	 * Retreive the Theme used to display the form component
	 *
	 * @param boolean $forvalidation If true, perform validation on control and add error messages to output
	 * @param FormControl $control The control to output using a template
	 * @return Theme The theme object to display the template for the control
	 */
	function get_theme( $forvalidation = false, $control = null )
	{
		if ( !isset( $this->theme_obj ) ) {
			$theme_dir = Plugins::filter( 'control_theme_dir', Plugins::filter( 'admin_theme_dir', Site::get_dir( 'admin_theme', true ) ) . 'formcontrols/', $control );
			$this->theme_obj = Themes::create( 'admin', 'RawPHPEngine', $theme_dir );
		}
		$this->theme_obj->start_buffer();
		if ( $control instanceof FormControl ) {
			// PHP doesn't allow __get() to return pointers, and passing this array to foreach directly generates an error.
			$properties = $control->properties;
			foreach ( $properties as $name => $value ) {
				$this->theme_obj->$name = $value;
			}
			$this->theme_obj->field = $control->field;
			$this->theme_obj->value = $control->value;
			$this->theme_obj->caption = $control->caption;
			$this->theme_obj->id = (string) $control->id;
			$class = (array) $control->class;

			$message = '';
			if ( $forvalidation ) {
				$validate = $control->validate();
				if ( count( $validate ) != 0 ) {
					$class[] = 'invalid';
					$message = implode( '<br>', (array) $validate );
				}
			}
			$this->theme_obj->class = implode( ' ', (array) $class );
			$this->theme_obj->message = $message;
		}
		return $this->theme_obj;
	}
开发者ID:nerdfiles,项目名称:habari_boilerplate,代码行数:39,代码来源:formui.php

示例11: setup_theme

 /**
  * Load the active theme and create a new Theme instance.
  * Also, assign the request variables.
  */
 public function setup_theme()
 {
     $this->theme = Themes::create();
     $this->theme->assign('matched_rule', URL::get_matched_rule());
     $request = Controller::get_request_obj();
     $this->theme->assign('request', $request);
 }
开发者ID:habari,项目名称:system,代码行数:11,代码来源:actionhandler.php

示例12: __construct

 /**
  * Constructor for the default theme handler.  Here, we
  * automatically load the active theme for the installation,
  * and create a new Theme instance.
  */
 public function __construct()
 {
     $this->theme = Themes::create();
 }
开发者ID:habari-extras,项目名称:pageless,代码行数:9,代码来源:pagelesshandler.php

示例13: display_calendar

 public function display_calendar()
 {
     $theme = Themes::create();
     $events = Posts::get(array("status" => Post::status('published'), "nolimit" => true, "content_type" => Post::type('event')));
     $upcoming = array();
     foreach ($events as $event) {
         if ($event->start->int > HabariDateTime::date_create()->modify('-1 week')->int) {
             $upcoming[] = $event;
         }
     }
     $theme->events = $upcoming;
     $theme->display('calendar');
 }
开发者ID:habari-extras,项目名称:partytime,代码行数:13,代码来源:partytime.plugin.php

示例14: add_comment

 /**
  * Add a comment to the site
  *
  * @param mixed $post A Post object instance or Post object id
  * @param string $name The commenter's name
  * @param string $email The commenter's email address
  * @param string $url The commenter's website URL
  * @param string $content The comment content
  * @param array $extra An associative array of extra values that should be considered
  */
 function add_comment($post, $name = null, $email = null, $url = null, $content = null, $extra = null)
 {
     if (is_numeric($post)) {
         $post = Post::get(array('id' => $post));
     }
     if (!$post instanceof Post) {
         // Not sure what you're trying to pull here, but that's no good
         header('HTTP/1.1 403 Forbidden', true, 403);
         die;
     }
     // let's do some basic sanity checking on the submission
     if (1 == Options::get('comments_require_id') && (empty($name) || empty($email))) {
         Session::error(_t('Both name and e-mail address must be provided.'));
     }
     if (empty($content)) {
         Session::error(_t('You did not provide any content for your comment!'));
     }
     if (Session::has_errors()) {
         // save whatever was provided in session data
         Session::add_to_set('comment', $name, 'name');
         Session::add_to_set('comment', $email, 'email');
         Session::add_to_set('comment', $url, 'url');
         Session::add_to_set('comment', $content, 'content');
         // now send them back to the form
         Utils::redirect($post->permalink . '#respond');
     }
     if ($post->info->comments_disabled) {
         // comments are disabled, so let's just send
         // them back to the post's permalink
         Session::error(_t('Comments on this post are disabled!'));
         Utils::redirect($post->permalink);
     }
     /* Sanitize data */
     foreach (array('name', 'url', 'email', 'content') as $k) {
         ${$k} = InputFilter::filter(${$k});
     }
     /* Sanitize the URL */
     if (!empty($url)) {
         $parsed = InputFilter::parse_url($url);
         if ($parsed['is_relative']) {
             // guess if they meant to use an absolute link
             $parsed = InputFilter::parse_url('http://' . $url);
             if (!$parsed['is_error']) {
                 $url = InputFilter::glue_url($parsed);
             } else {
                 // disallow relative URLs
                 $url = '';
             }
         }
         if ($parsed['is_pseudo'] || $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https') {
             // allow only http(s) URLs
             $url = '';
         } else {
             // reconstruct the URL from the error-tolerant parsing
             // http:moeffju.net/blog/ -> http://moeffju.net/blog/
             $url = InputFilter::glue_url($parsed);
         }
     }
     if (preg_match('/^\\p{Z}*$/u', $content)) {
         Session::error(_t('Comment contains only whitespace/empty comment'));
         Utils::redirect($post->permalink);
     }
     /* Create comment object*/
     $comment = new Comment(array('post_id' => $post->id, 'name' => $name, 'email' => $email, 'url' => $url, 'ip' => sprintf("%u", ip2long($_SERVER['REMOTE_ADDR'])), 'content' => $content, 'status' => Comment::STATUS_UNAPPROVED, 'date' => HabariDateTime::date_create(), 'type' => Comment::COMMENT));
     // Should this really be here or in a default filter?
     // In any case, we should let plugins modify the status after we set it here.
     $user = User::identify();
     if ($user->loggedin && $comment->email == $user->email) {
         $comment->status = Comment::STATUS_APPROVED;
     }
     // Users need to have permission to add comments
     if (!$user->can('comment')) {
         Session::error(_t('You do not have permission to create comments.'));
         Utils::redirect($post->permalink);
     }
     // Allow themes to work with comment hooks
     Themes::create();
     // Allow plugins to change comment data and add commentinfo based on plugin-added form fields
     Plugins::act('comment_accepted', $comment, $this->handler_vars, $extra);
     $spam_rating = 0;
     $spam_rating = Plugins::filter('spam_filter', $spam_rating, $comment, $this->handler_vars, $extra);
     $comment->insert();
     $anchor = '';
     // If the comment was saved
     if ($comment->id && $comment->status != Comment::STATUS_SPAM) {
         $anchor = '#comment-' . $comment->id;
         // store in the user's session that this comment is pending moderation
         if ($comment->status == Comment::STATUS_UNAPPROVED) {
             Session::notice(_t('Your comment is pending moderation.'), 'comment_' . $comment->id);
         }
//.........这里部分代码省略.........
开发者ID:psaintlaurent,项目名称:Habari,代码行数:101,代码来源:feedbackhandler.php

示例15: send_captcha

 /**
  * @todo use formui
  */
 private function send_captcha($comment = null)
 {
     Session::add_to_set('mollom', $comment, 'comment');
     $theme = Themes::create();
     $theme->comment = $comment;
     try {
         $theme->captcha = Mollom::getImageCaptcha($comment->info->mollom_session_id);
         $theme->audio_captcha = Mollom::getAudioCaptcha($comment->info->mollom_session_id);
     } catch (Exception $e) {
     }
     $theme->display('mollom_fallback_captcha');
 }
开发者ID:habari-extras,项目名称:mollom,代码行数:15,代码来源:mollom.plugin.php


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