本文整理汇总了PHP中Typeframe::CurrentPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Typeframe::CurrentPage方法的具体用法?PHP Typeframe::CurrentPage怎么用?PHP Typeframe::CurrentPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Typeframe
的用法示例。
在下文中一共展示了Typeframe::CurrentPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
public function output(Pagemill_Data $data, Pagemill_Stream $stream)
{
$data = $data->fork();
$apps = array();
foreach (Typeframe::Registry()->pages() as $page) {
if ($page->siteid() == Typeframe::CurrentPage()->siteid()) {
if (strpos($page->uri(), '/admin/') !== false) {
if ($page->allow()) {
$apps[] = array('title' => $page->title(), 'icon' => $page->icon(), 'uri' => $page->uri());
}
}
}
}
$data['applications'] = $apps;
if (class_exists('Model_Site')) {
$sites = new Model_Site();
if (Typeframe::User()->get('usergroupid') != TYPEF_ADMIN_USERGROUPID) {
$sites->innerJoin('perm', 'Model_User_Site', 'id = perm.siteid');
$sites->where('perm.userid = ?', Typeframe::User()->get('userid'));
$primary = new Model_User_Site();
$primary->where('userid = ?', Typeframe::User()->get('userid'));
$primary->where('siteid = ?', 0);
$data['admin_primary'] = $primary->count() > 0;
} else {
$data['admin_primary'] = 1;
}
$data['sites'] = $sites;
}
$data->sortNodes(array('applications', 'title'));
if (defined('TYPEF_HOST')) {
$data['primary_host'] = TYPEF_HOST;
}
parent::output($data, $stream);
}
示例2: _AtResponse
private static function _AtResponse(Typeframe_Response $response)
{
$settings = $response->page()->settings();
if (!empty($settings['skin'])) {
return $settings['skin'];
}
$uri = $response->applicationUri();
$admin_root = TYPEF_WEB_DIR . '/admin';
if (Typeframe::CurrentPage()->siteid() != 0) {
$site = Model_Site::Get(Typeframe::CurrentPage()->siteid());
if ($site['directory']) {
$admin_root = TYPEF_WEB_DIR . '/' . $site['directory'] . '/admin';
}
}
if ($uri == $admin_root || substr($uri, 0, strlen($admin_root . '/')) == $admin_root . '/') {
if (TYPEF_USE_MOBILE_SKINS && self::_IsMobile()) {
return TYPEF_MOBILE_ADMIN_SKIN;
}
if (TYPEF_ADMIN_SKIN) {
return TYPEF_ADMIN_SKIN;
}
}
if (TYPEF_USE_MOBILE_SKINS && self::_IsMobile()) {
return TYPEF_MOBILE_SITE_SKIN;
}
return TYPEF_SITE_SKIN ? TYPEF_SITE_SKIN : 'default';
}
示例3: output
public function output(\Pagemill_Data $data, \Pagemill_Stream $stream)
{
$this->pluginTemplate = "/downloads/downloads.plug.html";
$data = $data->fork();
$downloads = new Model_Download_File();
$downloads->where('siteid = ?', Typeframe::CurrentPage()->siteid());
$data['downloads'] = $downloads;
parent::output($data, $stream);
}
示例4: admin
public function admin(Pagemill_Data $data, Pagemill_Stream $stream)
{
$this->adminTemplate = '/admin/mailform/settings.plug.html';
$data = $data->fork();
$data->setArray($this->attributes());
$mailforms = new Model_Mailform();
$mailforms->where('siteid = ?', Typeframe::CurrentPage()->siteid());
$data->set('mailforms', $mailforms);
parent::admin($data, $stream);
}
示例5: Cache
/**
* Get the cached page content.
* @return array
*/
public static function Cache()
{
static $cached_content = null;
if (is_null($cached_content)) {
if (Typeframe::CurrentPage()->page()->pageid()) {
$page = Model_Content_Page::Get(Typeframe::CurrentPage()->page()->pageid());
$cached_content = $page['content'];
}
}
return $cached_content;
}
示例6: output
public function output(Pagemill_Data $data, Pagemill_Stream $stream)
{
$data = $data->fork();
if (!empty($this->attributes['menuplugid'])) {
$menuplugid = $this->attributes['menuplugid'];
$db = Typeframe::Database();
$base = substr(Typeframe::CurrentPage()->uri(), STRLEN(TYPEF_WEB_DIR));
if ($base == '') {
$base = '/';
}
$search = new Model_Nav();
$search->where('plugid = ?', $menuplugid);
$search->where('url = ? OR url = ? OR url = ? OR url = ? OR url = ? OR url = ? OR pageid = ?', "~{$base}", "~{$base}/", "/{$base}", "/{$base}/", TYPEF_WEB_DIR . $base, TYPEF_WEB_DIR . $base . '/', Typeframe::CurrentPage()->pageid());
foreach ($search->select() as $current) {
$current['url'] = $this->_convertUrl($current['url']);
$data->set('current', $current);
$parentid = $current['parent'];
$siblings = new Model_Nav();
$siblings->where('plugid = ?', $menuplugid);
$siblings->where('parent = ?', $parentid);
$siblings->order('sortnum');
$data['siblings'] = $siblings;
/*$sibArray = array();
foreach ($siblings->select() as $sib) {
$sib['url'] = $this->_convertUrl($sib['url']);
$sibArray[] = $sib;
}
$data['siblings'] = $sibArray;*/
if (!empty($this->attributes['showparent'])) {
$parent = $db->execute('SELECT * FROM #__nav WHERE itemid = ' . $parentid);
foreach ($parent as $par) {
$par['url'] = $this->_convertUrl($par['url']);
$data->set('parent', $par);
}
}
if (!empty($this->attributes['showchildren'])) {
$childArray = array();
$children = $db->execute('SELECT * FROM #__nav WHERE plugid = ' . $menuplugid . ' AND parent = ' . $current['itemid'] . ' ORDER BY sortnum');
foreach ($children as $chi) {
$chi['url'] = $this->_convertUrl($chi['url']);
$childArray[] = $chi;
}
$data['children'] = $childArray;
}
}
}
$this->pluginTemplate = "navigation/submenu.plug.html";
parent::output($data, $stream);
}
示例7: output
public function output(\Pagemill_Data $data, \Pagemill_Stream $stream)
{
$data = $data->fork();
$url = Typeframe::CurrentPage()->uri();
if (substr($url, -1) == '/') {
$url = substr($url, 0, -1);
}
$dirs = explode('/', substr($url, strlen(TYPEF_WEB_DIR)));
$this->pluginTemplate = '/breadcrumbs/breadcrumbs.plug.html';
$data['breadcrumbs'] = array();
$currentUrl = TYPEF_WEB_DIR;
$start = $data->parseVariables(Typeframe_Attribute_Url::ConvertShortUrlToExpression($this->getAttribute('start')));
while (count($dirs) > 0) {
$currentUrl .= '/' . array_shift($dirs);
$currentUrl = preg_replace('/\\/+/', '/', $currentUrl);
if ($start && strpos($currentUrl, $start) === false) {
continue;
}
if (isset($_SESSION['breadcrumbs'][$currentUrl])) {
$bc = $_SESSION['breadcrumbs'][$currentUrl];
$bc['url'] = $currentUrl . ($bc['query'] ? '?' . $bc['query'] : '');
$data['breadcrumbs'][] = $bc;
} else {
$response = Typeframe::Registry()->responseAt($currentUrl);
if ($currentUrl == $response->page()->uri()) {
if ($response->application()->name() != '403' && $response->application()->name() != '404') {
$settings = $response->page()->settings();
if (!empty($settings['nickname'])) {
$title = $settings['nickname'];
} else {
$title = $response->page()->title();
}
$bc = array('title' => $title, 'query' => '');
$_SESSION['breadcrumbs'][$currentUrl] = $bc;
$bc['url'] = $currentUrl;
$data['breadcrumbs'][] = $bc;
}
}
}
}
parent::output($data, $stream);
return;
}
示例8: GetCategoryId
public static function GetCategoryId($from_settings = false)
{
// get categoryid from request, if any
$categoryid = $from_settings ? '' : trim(@$_REQUEST['categoryid']);
if (0 == strlen($categoryid)) {
// none give; try loading from settings
$settings = Typeframe::CurrentPage()->settings();
$categoryid = @$settings['categoryid'];
// if none set, display all by default
if (is_null($categoryid)) {
return array(0);
}
// if it's an array
if (is_array($categoryid)) {
// and contains all case, return all
if (in_array(0, $categoryid)) {
return array(0);
}
// if has more than one value, convert all to ints
if (count($categoryid) > 0) {
$result = array();
foreach ($categoryid as $value) {
if (ctype_digit($value)) {
$result[] = intval($value);
}
}
return $result;
}
// otherwise, convert single value to int
return intval($categoryid[0]);
}
// otherwise, convert single value to int
return intval($categoryid);
}
// integer category id given
if (ctype_digit($categoryid)) {
return intval($categoryid);
}
// none of the above
return null;
}
示例9:
<?php
$site = Model_Site::Get($_REQUEST['id']);
if ($site->exists()) {
require_once 'options.inc.php';
$pm->setVariable('site', $site);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
include 'update.inc.php';
Typeframe::Redirect('Site updated.', Plugin_Breadcrumbs::SavedState(Typeframe::CurrentPage()->applicationUri()));
}
} else {
Typeframe::Redirect('Invalid site specified.', Plugin_Breadcrumbs::SavedState(Typeframe::CurrentPage()->applicationUri()));
}
示例10: array
<?php
$mailform['mailformname'] = $_POST['mailformname'];
$mailform['message'] = $_POST['message'];
$mailform['response'] = $_POST['response'];
$mailform['subject'] = $_POST['subject'];
$mailform['replyto'] = $_POST['replyto'];
$mailform['redirect'] = $_POST['redirect'];
$mailform['template'] = $_POST['template'];
$recipients = array();
for ($i = 0; $i < count($_POST['recipients']['email']); $i++) {
if (!empty($_POST['recipients']['email'][$i])) {
$recipients[] = array('email' => $_POST['recipients']['email'][$i], 'name' => $_POST['recipients']['name'][$i], 'when' => $_POST['recipients']['when'][$i], 'fieldname' => $_POST['recipients']['fieldname'][$i], 'fieldvalue' => $_POST['recipients']['fieldvalue'][$i]);
}
}
$mailform['recipients'] = $recipients;
$formfields = array();
for ($i = 0; $i < count($_POST['fields']['name']); $i++) {
if (!empty($_POST['fields']['name'][$i])) {
$formfields[] = array('name' => $_POST['fields']['name'][$i], 'class' => $_POST['fields']['class'][$i], 'type' => $_POST['fields']['type'][$i], 'values' => $_POST['fields']['values'][$i], 'required' => $_POST['fields']['required'][$i]);
}
}
$mailform['captcha'] = !empty($_POST['captcha']) ? 1 : 0;
$mailform['formfields'] = $formfields;
$mailform->save();
Typeframe::Redirect('Mailform saved.', Typeframe::CurrentPage()->applicationUri());
示例11: Log
/**
* Log a user action to the database.
* @param string $action.
* @param string $fulldesc The full description of the event [optional].
*/
public static function Log($action, $fulldesc = false)
{
if (!$fulldesc) {
$fulldesc = $action;
}
// Also addin the source URL, as that may change and reveal important information.
if (isset($_SERVER['HTTP_HOST'])) {
$fulldesc .= "\n" . 'Source URL: ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if (isset($_SERVER['HTTP_REFERER'])) {
$fulldesc .= "\n" . 'Referrer URL: ' . $_SERVER['HTTP_REFERER'];
}
} else {
$fulldesc .= "\nN/a";
}
$log = Model_Log::Create();
$log['userid'] = Typeframe::User()->get('userid');
$log['ipaddress'] = @$_SERVER['REMOTED_ADDR'];
$log['package'] = Typeframe::CurrentPage() ? Typeframe::CurrentPage()->application()->package() : '';
$log['application'] = Typeframe::CurrentPage() ? Typeframe::CurrentPage()->application()->name() : '';
$log['action'] = $action;
$log['logdate'] = Typeframe::Now();
$log['fulldesc'] = $fulldesc;
$log->save();
}
示例12: ProcessRules
public static function ProcessRules($string)
{
$show = false;
$rules = explode(';', $string);
$countrules = count($rules);
// Now I can do the check to see if there are no rules.
if ($countrules <= 0) {
$show = true;
}
foreach ($rules as $r) {
list($type, $code) = explode(':', $r);
$not = false;
if (substr($type, 0, 1) == '!') {
$type = substr($type, 1);
$not = true;
}
switch ($type) {
case 'pid':
if (Typeframe::CurrentPage()->page()->pageid() == $code) {
if ($not) {
$show = false;
return false;
} else {
$show = true;
}
}
break;
case 'url':
if ($code == '*') {
if ($not) {
$show = false;
return false;
} else {
$show = true;
continue;
}
}
if (substr($code, 0, 2) == '//') {
$code = TYPEF_WEB_DIR . substr($code, 1);
}
if (($pos = strpos($code, '*')) !== false) {
if (substr(Typeframe::CurrentPage()->uri(), 0, $pos) == substr($code, 0, $pos)) {
if ($not) {
$show = false;
return false;
} else {
$show = true;
}
}
}
if (Typeframe::CurrentPage()->uri() == $code) {
if ($not) {
$show = false;
return false;
} else {
$show = true;
}
}
break;
}
// switch($type)
}
// foreach ($rules as $r)
return $show;
}
示例13: isset
<?php
$file = isset($_REQUEST['file']) ? $_REQUEST['file'] : '';
if ($file && file_exists(TYPEF_DIR . $file) && is_file(TYPEF_DIR . $file)) {
header('Content-type: text/css');
$dir = dirname($file);
$md5 = md5($file) . '.css';
$dst = TYPEF_DIR . '/files/cache/lessphp/' . $md5;
lessc::ccompile(TYPEF_DIR . $file, $dst);
$css = SimpleCss::LoadFile($dst, TYPEF_WEB_DIR . $dir);
$code = $css->toString();
preg_match_all('/url\\(\\"([\\w\\W\\s\\S]*?)"\\)/', $code, $matches);
if (isset($matches[1])) {
foreach ($matches[1] as $url) {
$url = Typeframe_Attribute_Url::ConvertShortUrlToExpression($url);
$url = Typeframe::Pagemill()->data()->parseVariables($url);
$code = str_replace($matches[1], $url, $code);
}
}
echo $code;
exit;
} else {
http_response_code(404);
Typeframe::SetPageTemplate('/404.html');
Typeframe::CurrentPage()->stop();
}
示例14:
<?php
/*
29 december 2010: cleanup while trying to add
status field to typef_news table;
rewrote to use news tag class
3 january 2011: DAOFactory, not DAO_Factory;
setCategoryId now static
28 march 2011: merged in code from HL
29 march 2011: added page title, header
*/
// define some handy shortcuts to save typing
$settings = Typeframe::CurrentPage()->settings();
// create news tag object
$tags = News_Tag::DAOFactory();
// inner join on the news article table
$tags->select()->innerJoin('#__news', '#__news.newsid = #__news_tag.newsid');
// add the count of news articles to the result
$tags->select()->field('COUNT(#__news_tag.newsid) AS articles');
// limit to a particular category id
News::SetCategoryId($tags, @$settings['categoryid']);
// group and sort by tag name
$tags->select()->group('tag');
$tags->select()->order('tag');
// add tags to template
$pm->setVariable('tags', $tags);
// add page title and header to template
$title = News::GetTitle();
$pm->setVariable('page_title', $title);
$pm->setVariable('page_header', $title);
示例15: _executeApplicationCode
private function _executeApplicationCode()
{
static $executed = false;
if (!$executed) {
$executed = true;
// Execute triggers
$currentPath = $this->path();
$this->_executeTriggers('before');
if (Typeframe::CurrentPage()->stopped()) {
return;
}
Typeframe_Page::_IncludeController(Typeframe::CurrentPage()->controller());
if (Typeframe::CurrentPage()->stopped()) {
return;
}
$this->_executeTriggers('after');
} else {
trigger_error('Applications can only be executed once');
}
}