本文整理汇总了PHP中Page::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::instance方法的具体用法?PHP Page::instance怎么用?PHP Page::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
public static function getInstance()
{
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
示例2: newInstance
public static function newInstance()
{
if (!self::$instance instanceof self) {
self::$instance = new self();
}
return self::$instance;
}
示例3: getInstance
public static function getInstance()
{
if (self::$instance === NULL) {
return self::$instance = new self();
} else {
return self::$instance;
}
}
示例4: load
public static function load()
{
if (self::$instance !== NULL) {
delete(self::$instance);
self::$instance = NULL;
}
$request_url = get_request_url();
$parts = parse_url($request_url);
$request_uri = strtolower($parts['path']);
/* Normalize Path */
$path = remove_ext($request_uri);
if (empty($path) || $path == "/" || $path == "/index" || $path == "/home") {
$path = "/start";
//later: do landing Page
} else {
//remove index from right
$rm = "/index";
$len = strlen($rm);
if (substr($path, $len * -1) == $rm) {
$path = substr($path, 0, strlen($path) - $len);
}
}
$request_cmd = $path;
//create the commando
$dir = 'pages' . $path;
$cmd = array();
//default to read index.html
$error = !(path2cmd($dir . '.php', $cmd) || path2cmd($dir . '.html', $cmd) || path2cmd($dir . '/index.php', $cmd) || path2cmd($dir . '/index.html', $cmd));
$data = array("request_url" => $request_url, "request_uri" => $request_uri, "request_cmd" => $request_cmd, "cmd" => $cmd);
$classname = "StaticPage";
$classfile = "php/static.php";
/*check if a *.php page is requested and exists*/
if (!$error) {
$path = $cmd["path"];
if (!$error && preg_match("/^(.*)\\.(php)\$/i", $path)) {
$classname = ucfirst($cmd["filename"]) . "Page";
$classfile = $path;
$data["modified"] = filemtime($classfile);
}
}
require_once $classfile;
$page = new $classname($data, $error);
self::$instance = $page;
return self::$instance;
}
示例5: sleep
<?php
/**
* @package CleverStyle CMS
* @subpackage System module
* @category modules
* @author Nazar Mokrynskyi <nazar@mokrynskyi.com>
* @copyright Copyright (c) 2011-2014, Nazar Mokrynskyi
* @license MIT License, see license.txt
*/
namespace cs;
$Config = Config::instance();
$L = Language::instance();
$Page = Page::instance();
$User = User::instance();
/**
* If AJAX request from local referer, user is registered - change password, otherwise - show error
*/
if (!$Config->server['referer']['local'] || !$Config->server['ajax'] || !isset($_POST['verify_hash'], $_POST['new_password']) || !$User->user()) {
sleep(1);
error_code(403);
return;
} elseif (!$_POST['new_password']) {
error_code(400);
$Page->error($L->please_type_new_password);
return;
} elseif (hash('sha224', $User->password_hash . $User->get_session()) != $_POST['verify_hash']) {
error_code(400);
$Page->error($L->wrong_current_password);
return;
示例6:
<?php
/**
* @package Versions
* @category modules
* @author Nazar Mokrynskyi <nazar@mokrynskyi.com>
* @copyright Copyright (c) 2014, Nazar Mokrynskyi
* @license MIT License, see license.txt
*/
namespace cs;
Page::instance()->json(5);
示例7:
<?php
/**
* @package Streams
* @category modules
* @author Nazar Mokrynskyi <nazar@mokrynskyi.com>
* @copyright Copyright (c) 2014, Nazar Mokrynskyi
* @license MIT License, see license.txt
*/
namespace cs;
Page::instance()->post_Body .= "<script src=\"//api-maps.yandex.ru/2.1-dev/?load=package.full&lang=uk-UA\"></script>\n" . "<script type=\"text/javascript\" src=\"//yandex.st/share/share.js\"></script>\n";
示例8: function
<?php
/**
* @package Metrics
* @category plugins
* @author Nazar Mokrynskyi <nazar@mokrynskyi.com>
* @copyright Copyright (c) 2011-2013, Nazar Mokrynskyi
* @license MIT License, see license.txt
*/
namespace cs;
Trigger::instance()->register('System/Page/pre_display', function () {
if (User::instance()->user() || !in_array('Metrics', Config::instance()->components['plugins'])) {
return;
}
//Yandex
Page::instance()->post_Body .= '<!-- Yandex.Metrika counter --><script type="text/javascript">(function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter24106597 = new Ya.Metrika({id:24106597, ut:"noindex"}); } catch(e) { } }); var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); } })(document, window, "yandex_metrika_callbacks");</script><noscript><div><img src="//mc.yandex.ru/watch/24106597?ut=noindex" style="position:absolute; left:-9999px;" alt="" /></div></noscript><!-- /Yandex.Metrika counter -->';
});
示例9: array
<?php
/*
Created by ANDRAS Zoltan Gyarfas azolee@gmail.com in 2015
*/
include_once './core/init.php';
global $header;
global $page;
$page = array("title" => "", "header" => "", "nav" => "", "content" => "");
$contentManager = Page::instance();
$urlPath = trim(filter_input(INPUT_GET, "path", FILTER_SANITIZE_STRING), "/");
global $url;
$url = $contentManager->getUrlDetails($urlPath);
$contentManager->generatePage($url);
$page['content'] = $contentManager->getPageContent();
$page['title'] = $contentManager->getPageTitle();
$m = $contentManager->loadNav();
if (!empty($m)) {
$page = array_merge($m, $page);
}
if (file_exists(TEMPLATES . DS . $contentManager->getPageTemplate())) {
echo tpl::display($page, TEMPLATES . DS . $contentManager->getPageTemplate());
}
示例10: error_code
<?php
/**
* @package CleverStyle CMS
* @subpackage System module
* @category modules
* @author Nazar Mokrynskyi <nazar@mokrynskyi.com>
* @copyright Copyright (c) 2011-2014, Nazar Mokrynskyi
* @license MIT License, see license.txt
*/
namespace cs;
$User = User::instance();
if ($User->guest()) {
error_code(403);
return;
}
Page::instance()->json($User->get_contacts());
示例11: _setcookie
<?php
/**
* @package CleverStyle CMS
* @subpackage System module
* @category modules
* @author Nazar Mokrynskyi <nazar@mokrynskyi.com>
* @copyright Copyright (c) 2011-2014, Nazar Mokrynskyi
* @license MIT License, see license.txt
*/
namespace cs;
$User = User::instance();
if ($User->guest()) {
Page::instance()->json(1);
return;
}
if (isset($_POST['sign_out'])) {
$User->del_session();
_setcookie('sign_out', 1, 0, true, true);
Page::instance()->json(1);
}
示例12: display
/**
* Displaying of errors
*/
function display()
{
if (User::instance()->admin() || DEBUG) {
if (!empty($this->errors_list_all)) {
foreach ($this->errors_list as $error) {
Page::instance()->warning($error);
}
}
}
}
示例13:
<?php
/**
* @package ClevereStyle CMS
* @subpackage CleverStyle theme
* @author Nazar Mokrynskyi <nazar@mokrynskyi.com>
* @copyright Copyright (c) 2013-2014, Nazar Mokrynskyi
* @license MIT License, see license.txt
*/
namespace cs;
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/msie|trident/i', $_SERVER['HTTP_USER_AGENT'])) {
Page::instance()->Head .= '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">';
}
示例14: function
<?php
/**
* @package Admin default theme
* @category plugins
* @author Nazar Mokrynskyi <nazar@mokrynskyi.com>
* @copyright Copyright (c) 2011-2014, Nazar Mokrynskyi
* @license MIT License, see license.txt
*/
namespace cs;
Trigger::instance()->register('System/Page/pre_display', function () {
if (ADMIN && in_array('Admin_default_theme', Config::instance()->components['plugins'])) {
Page::instance()->set_theme('CleverStyle')->set_color_scheme('Default');
}
});
示例15: show
/**
* 显示分页
* @param array $page_info
* @return void|Ambigous <string, mixed>
*/
public static function show(array $page_info)
{
if (self::$instance == null) {
self::$instance = new self();
}
self::$instance->init($page_info);
$page = self::$instance->page;
$last_page = self::$instance->last_page;
//总页数为1不显示分页
if ($last_page <= 1) {
return;
}
$average = self::$instance->average();
$show_page_start = $page - $average;
$show_page_end = $page + $average;
if ($show_page_start > 0 || $show_page_end <= self::$instance->last_page) {
if ($show_page_start < 0 && $show_page_end < self::$instance->last_page) {
$show_page_end = 1 - $show_page_start + $show_page_end;
$show_page_start = 1;
}
if ($show_page_end > self::$instance->last_page && $show_page_start > 0) {
$show_page_start = $show_page_start - ($show_page_end - self::$instance->last_page);
$show_page_end = self::$instance->last_page;
}
}
$show_page_start = $show_page_start < 1 ? 1 : $show_page_start;
$show_page_end = $show_page_end > self::$instance->last_page ? self::$instance->last_page : $show_page_end;
$result = self::$instance->getFirstPage();
$result .= self::$instance->getPrePage();
for ($i = $show_page_start; $i <= $show_page_end; $i++) {
$result .= self::produceLink($i, $i);
}
$result .= self::$instance->getNextPage();
$result .= self::$instance->getLastPage();
return $result;
}