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


PHP Theme::current方法代码示例

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


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

示例1: route_submit

 /**
  * Function: submit
  * Submits a post to the blog owner.
  */
 public function route_submit()
 {
     if (!Visitor::current()->group->can("submit_article")) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to submit articles."));
     }
     if (!empty($_POST)) {
         if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
             show_403(__("Access Denied"), __("Invalid security key."));
         }
         if (empty($_POST['body'])) {
             Flash::notice(__("Post body can't be empty!"), redirect("/"));
         }
         if (!isset($_POST['draft'])) {
             $_POST['draft'] = "true";
         }
         $_POST['body'] = "{$_POST['body']}\n\n\n{$_POST['name']}\n{$_POST['email']}\n";
         $post = Feathers::$instances[$_POST['feather']]->submit();
         if (!in_array(false, $post)) {
             Flash::notice(__("Thank you for your submission. ", "submission"), "/");
         }
     }
     if (Theme::current()->file_exists("forms/post/submit")) {
         MainController::current()->display("forms/post/submit", array("feather" => $feather), __("Submit a Text Post"));
     } else {
         require "pages/submit.php";
     }
 }
开发者ID:betsyzhang,项目名称:chyrp,代码行数:31,代码来源:submission.php

示例2: __construct

 function __construct()
 {
     parent::__construct();
     $theme = Theme::current();
     $thname = $theme[0];
     // setTemplateDir can be set to an array, which Smarty will parse in order.
     // The order is thus very important here
     $template_dirs = array('theme' => "view/theme/{$thname}/tpl/");
     if (x(\App::$theme_info, "extends")) {
         $template_dirs = $template_dirs + array('extends' => "view/theme/" . \App::$theme_info["extends"] . "/tpl/");
     }
     $template_dirs = $template_dirs + array('base' => 'view/tpl/');
     $this->setTemplateDir($template_dirs);
     $basecompiledir = \App::$config['system']['smarty3_folder'];
     $this->setCompileDir($basecompiledir . '/compiled/');
     $this->setConfigDir($basecompiledir . '/config/');
     $this->setCacheDir($basecompiledir . '/cache/');
     $this->left_delimiter = \App::get_template_ldelim('smarty3');
     $this->right_delimiter = \App::get_template_rdelim('smarty3');
     // Don't report errors so verbosely
     $this->error_reporting = E_ALL & ~E_NOTICE;
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:22,代码来源:SmartyInterface.php

示例3: fix

<?php

$config = Config::current();
$trigger = Trigger::current();
$theme = Theme::current();
$title = !empty($_GET['title']) ? ": " . html_entity_decode($_GET['title']) : "";
echo "<" . '?xml version="1.0" encoding="utf-8"?' . ">\r";
?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title><?php 
echo $config->name . $title;
?>
</title>
<?php 
if (!empty($config->description)) {
    ?>
    <subtitle><?php 
    echo fix($config->description);
    ?>
</subtitle>
<?php 
}
?>
    <id><?php 
echo fix(self_url());
?>
</id>
    <updated><?php 
echo date("c", $latest_timestamp);
?>
</updated>
开发者ID:quanganhdo,项目名称:chyrp,代码行数:31,代码来源:feed.php

示例4: display

 /**
  * Function: display
  * Renders the page.
  *
  * Parameters:
  *     $action - The template file to display, in (theme dir)/pages.
  *     $context - Context for the template.
  *     $title - The title for the page. Defaults to a camlelization of the action, e.g. foo_bar -> Foo Bar.
  */
 public function display($action, $context = array(), $title = "")
 {
     $this->displayed = true;
     fallback($title, camelize($action, true));
     $this->context = array_merge($context, $this->context);
     $trigger = Trigger::current();
     $trigger->filter($this->context, array("admin_context", "admin_context_" . str_replace("/", "_", $action)));
     # Are there any extension-added pages?
     foreach (array("write" => array(), "manage" => array("import", "export"), "settings" => array(), "extend" => array("modules", "feathers", "themes")) as $main_nav => $val) {
         ${$main_nav} = $val;
         $trigger->filter(${$main_nav}, $main_nav . "_pages");
     }
     $visitor = Visitor::current();
     $route = Route::current();
     $this->context["theme"] = Theme::current();
     $this->context["flash"] = Flash::current();
     $this->context["trigger"] = $trigger;
     $this->context["title"] = $title;
     $this->context["site"] = Config::current();
     $this->context["visitor"] = $visitor;
     $this->context["logged_in"] = logged_in();
     $this->context["route"] = $route;
     $this->context["hide_admin"] = isset($_SESSION["hide_admin"]);
     $this->context["now"] = time();
     $this->context["version"] = CHYRP_VERSION;
     $this->context["debug"] = DEBUG;
     $this->context["feathers"] = Feathers::$instances;
     $this->context["modules"] = Modules::$instances;
     $this->context["admin_theme"] = $this->admin_theme;
     $this->context["theme_url"] = Config::current()->chyrp_url . "/admin/themes/" . $this->admin_theme;
     $this->context["POST"] = $_POST;
     $this->context["GET"] = $_GET;
     $this->context["navigation"] = array();
     $show = array("write" => array($visitor->group->can("add_draft", "add_post", "add_page")), "manage" => array($visitor->group->can("view_own_draft", "view_draft", "edit_own_draft", "edit_own_post", "edit_post", "delete_own_draft", "delete_own_post", "delete_post", "add_page", "edit_page", "delete_page", "add_user", "edit_user", "delete_user", "add_group", "edit_group", "delete_group")), "settings" => array($visitor->group->can("change_settings")), "extend" => array($visitor->group->can("toggle_extensions")));
     foreach ($show as $name => &$arr) {
         $trigger->filter($arr, $name . "_nav_show");
     }
     $this->context["navigation"]["write"] = array("title" => __("Write"), "show" => in_array(true, $show["write"]), "selected" => in_array($action, $write) or match("/^write_/", $action));
     $this->context["navigation"]["manage"] = array("title" => __("Manage"), "show" => in_array(true, $show["manage"]), "selected" => in_array($action, $manage) or match(array("/^manage_/", "/^edit_/", "/^delete_/", "/^new_/"), $action));
     $this->context["navigation"]["settings"] = array("title" => __("Settings"), "show" => in_array(true, $show["settings"]), "selected" => in_array($action, $settings) or match("/_settings\$/", $action));
     $this->context["navigation"]["extend"] = array("title" => __("Extend"), "show" => in_array(true, $show["extend"]), "selected" => in_array($action, $extend));
     $this->subnav_context($route->action);
     $trigger->filter($this->context["selected"], "nav_selected");
     $this->context["sql_debug"] = SQL::current()->debug;
     $file = MAIN_DIR . "/admin/themes/%s/pages/" . $action . ".twig";
     $template = file_exists(sprintf($file, $this->admin_theme)) ? sprintf($file, $this->admin_theme) : sprintf($file, "default");
     $config = Config::current();
     if (!file_exists($template)) {
         foreach (array(MODULES_DIR => $config->enabled_modules, FEATHERS_DIR => $config->enabled_feathers) as $path => $try) {
             foreach ($try as $extension) {
                 if (file_exists($path . "/" . $extension . "/pages/admin/" . $action . ".twig")) {
                     $template = $path . "/" . $extension . "/pages/admin/" . $action . ".twig";
                 }
             }
         }
         if (!file_exists($template)) {
             error(__("Template Missing"), _f("Couldn't load template: <code>%s</code>", array($template)));
         }
     }
     # Try the theme first
     try {
         $this->theme->getTemplate($template)->display($this->context);
     } catch (Exception $t) {
         # Fallback to the default
         try {
             $this->default->getTemplate($template)->display($this->context);
         } catch (Exception $e) {
             $prettify = preg_replace("/([^:]+): (.+)/", "\\1: <code>\\2</code>", $e->getMessage());
             $trace = debug_backtrace();
             $twig = array("file" => $e->filename, "line" => $e->lineno);
             array_unshift($trace, $twig);
             error(__("Error"), $prettify, $trace);
         }
     }
 }
开发者ID:eadz,项目名称:chyrp,代码行数:84,代码来源:Admin.php

示例5: theme_exists

 /**
  * Function: theme_exists
  * Checks if the current post's feather theme file exists.
  */
 public function theme_exists()
 {
     return !$this->no_results and Theme::current()->file_exists("feathers/" . $this->feather);
 }
开发者ID:relisher,项目名称:chyrp,代码行数:8,代码来源:Post.php

示例6: display

 /**
  * Function: display
  * Display the page.
  *
  * If "posts" is in the context and the visitor requested a feed, they will be served.
  *
  * Parameters:
  *     $file - The theme file to display.
  *     $context - The context for the file.
  *     $title - The title for the page.
  */
 public function display($file, $context = array(), $title = "")
 {
     if (is_array($file)) {
         for ($i = 0; $i < count($file); $i++) {
             $check = ($file[$i][0] == "/" or preg_match("/[a-zA-Z]:\\\\/", $file[$i])) ? $file[$i] : THEME_DIR . "/" . $file[$i];
             if (file_exists($check . ".twig") or $i + 1 == count($file)) {
                 return $this->display($file[$i], $context, $title);
             }
         }
     }
     $this->displayed = true;
     $route = Route::current();
     $trigger = Trigger::current();
     # Serve feeds.
     if ($this->feed) {
         if ($trigger->exists($route->action . "_feed")) {
             return $trigger->call($route->action . "_feed", $context);
         }
         if (isset($context["posts"])) {
             return $this->feed($context["posts"]);
         }
     }
     $this->context = array_merge($context, $this->context);
     $visitor = Visitor::current();
     $config = Config::current();
     $theme = Theme::current();
     $theme->title = $title;
     $this->context["theme"] = $theme;
     $this->context["flash"] = Flash::current();
     $this->context["trigger"] = $trigger;
     $this->context["modules"] = Modules::$instances;
     $this->context["feathers"] = Feathers::$instances;
     $this->context["title"] = $title;
     $this->context["site"] = $config;
     $this->context["visitor"] = $visitor;
     $this->context["route"] = Route::current();
     $this->context["hide_admin"] = isset($_COOKIE["hide_admin"]);
     $this->context["version"] = CHYRP_VERSION;
     $this->context["now"] = time();
     $this->context["debug"] = DEBUG;
     $this->context["POST"] = $_POST;
     $this->context["GET"] = $_GET;
     $this->context["sql_queries"] =& SQL::current()->queries;
     $this->context["visitor"]->logged_in = logged_in();
     $this->context["enabled_modules"] = array();
     foreach ($config->enabled_modules as $module) {
         $this->context["enabled_modules"][$module] = true;
     }
     $context["enabled_feathers"] = array();
     foreach ($config->enabled_feathers as $feather) {
         $this->context["enabled_feathers"][$feather] = true;
     }
     $this->context["sql_debug"] =& SQL::current()->debug;
     $trigger->filter($this->context, array("main_context", "main_context_" . str_replace("/", "_", $file)));
     $file = ($file[0] == "/" or preg_match("/[a-zA-Z]:\\\\/", $file)) ? $file : THEME_DIR . "/" . $file;
     if (!file_exists($file . ".twig")) {
         error(__("Template Missing"), _f("Couldn't load template: <code>%s</code>", array($file . ".twig")));
     }
     try {
         return $this->twig->getTemplate($file . ".twig")->display($this->context);
     } catch (Exception $e) {
         $prettify = preg_replace("/([^:]+): (.+)/", "\\1: <code>\\2</code>", $e->getMessage());
         $trace = debug_backtrace();
         $twig = array("file" => $e->filename, "line" => $e->lineno);
         array_unshift($trace, $twig);
         error(__("Error"), $prettify, $trace);
     }
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:79,代码来源:Main.php

示例7: show_404

/**
 * Function: show_404
 * Shows a 404 error message and immediately exits.
 *
 * Parameters:
 *     $scope - An array of values to extract into the scope.
 */
function show_404()
{
    header("HTTP/1.1 404 Not Found");
    if (!defined('CHYRP_VERSION')) {
        exit("404 Not Found");
    }
    $theme = Theme::current();
    $main = MainController::current();
    Trigger::current()->call("not_found");
    if ($theme->file_exists("pages/404")) {
        $main->display("pages/404", array(), "404");
    } else {
        error(__("404 Not Found"), __("The requested page could not be located."));
    }
    exit;
}
开发者ID:homebru,项目名称:bandb,代码行数:23,代码来源:helpers.php

示例8: ajax

    static function ajax()
    {
        header("Content-Type: application/x-javascript", true);
        $config = Config::current();
        $sql = SQL::current();
        $trigger = Trigger::current();
        $visitor = Visitor::current();
        $theme = Theme::current();
        $main = MainController::current();
        switch ($_POST['action']) {
            case "reload_comments":
                $post = new Post($_POST['post_id']);
                if ($post->no_results) {
                    break;
                }
                if ($post->latest_comment > $_POST['last_comment']) {
                    $new_comments = $sql->select("comments", "id, created_at", array("post_id" => $_POST['post_id'], "created_at >" => $_POST['last_comment'], "status not" => "spam", "status != 'denied' OR (\n                                                                (\n                                                                    user_id != 0 AND\n                                                                    user_id = :visitor_id\n                                                                ) OR (\n                                                                    id IN " . self::visitor_comments() . "\n                                                                )\n                                                            )"), "created_at ASC", array(":visitor_id" => $visitor->id));
                    $ids = array();
                    $last_comment = "";
                    while ($the_comment = $new_comments->fetchObject()) {
                        $ids[] = $the_comment->id;
                        if (strtotime($last_comment) < strtotime($the_comment->created_at)) {
                            $last_comment = $the_comment->created_at;
                        }
                    }
                    ?>
{ comment_ids: [ <?php 
                    echo implode(", ", $ids);
                    ?>
 ], last_comment: "<?php 
                    echo $last_comment;
                    ?>
" }
<?php 
                }
                break;
            case "show_comment":
                $comment = new Comment($_POST['comment_id']);
                $trigger->call("show_comment", $comment);
                $main->display("content/comment", array("comment" => $comment));
                break;
            case "delete_comment":
                $comment = new Comment($_POST['id']);
                if (!$comment->deletable()) {
                    break;
                }
                Comment::delete($_POST['id']);
                break;
            case "edit_comment":
                $comment = new Comment($_POST['comment_id'], array("filter" => false));
                if (!$comment->editable()) {
                    break;
                }
                if ($theme->file_exists("forms/comment/edit")) {
                    $main->display("forms/comment/edit", array("comment" => $comment));
                } else {
                    require "edit_form.php";
                }
                break;
        }
    }
开发者ID:relisher,项目名称:chyrp,代码行数:61,代码来源:comments.php

示例9: get_current_theme

function get_current_theme()
{
    return Theme::current();
}
开发者ID:BinaryGeometry,项目名称:aviate,代码行数:4,代码来源:theme.php


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