本文整理汇总了PHP中PerchUtil::get方法的典型用法代码示例。如果您正苦于以下问题:PHP PerchUtil::get方法的具体用法?PHP PerchUtil::get怎么用?PHP PerchUtil::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PerchUtil
的用法示例。
在下文中一共展示了PerchUtil::get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_qs_param
public function set_qs_param($qs_param)
{
if ($qs_param) {
$this->qs_param = $qs_param;
}
$Perch = Perch::fetch();
$this->page_pattern = '\\b' . $this->qs_param . '=[0-9]+\\b';
$this->page_replacement = $this->qs_param . '=%d';
if (!$Perch->admin && PERCH_RUNWAY) {
$paging_conf = PerchConfig::get('paging');
if ($paging_conf && isset($paging_conf['pattern']) && isset($paging_conf['replacement'])) {
$this->page_pattern = $paging_conf['pattern'];
$this->page_replacement = $paging_conf['replacement'];
$this->use_qs = false;
}
}
if (PerchUtil::get($this->qs_param)) {
$this->current_page = (int) PerchUtil::get($this->qs_param);
}
}
示例2:
">
<input type="hidden" name="reset" value="1" />
</p>
</form>
<?php
}
}
// request link
if ($mode == 'enter_token') {
?>
<form action="<?php
echo PerchUtil::html(PERCH_LOGINPATH);
?>
/core/reset/?token=<?php
echo PerchUtil::html(PerchUtil::get('token'), true);
?>
" method="post" class="reset recover">
<p class="instructions"><?php
echo PerchLang::get('Please confirm your username and then choose a new password.');
?>
</p>
<?php
if ($error && $error == 'non_matching_username') {
?>
<p class="instructions error"><?php
echo PerchLang::get('Sorry, that username is not correct.');
?>
</p>
<?php
示例3:
if (!$CurrentUser->has_priv('perch_blog.post.create')) {
PerchUtil::redirect($API->app_path());
}
if (isset($_GET['id']) && $_GET['id'] != '') {
$postID = (int) $_GET['id'];
$Post = $Posts->find($postID, true);
$details = $Post->to_array();
$template = $Post->postMetaTemplate();
}
$Blog = false;
if (PERCH_RUNWAY) {
if ($Post) {
$Blog = $Post->get_blog();
} else {
if (PerchUtil::get('blog')) {
$Blog = $Blogs->find((int) PerchUtil::get('blog'));
}
}
}
if (!$Blog) {
$Blog = $Blogs->find(1);
}
$Sections = new PerchBlog_Sections();
$sections = $Sections->get_by('blogID', $Blog->id());
if (!$template) {
$template = $Blog->postMetaTemplate();
}
$Template = $API->get('Template');
$Template->set('blog/' . $template, 'blog');
$tags = $Template->find_all_tags_and_repeaters();
$Form = $API->get('Form');
示例4:
}
}
// Template
$Template = $API->get('Template');
$Template->set('mailchimp/lists/list.html', 'mailchimp');
$tags = $Template->find_all_tags_and_repeaters();
$Form = $API->get('Form');
$Form->handle_empty_block_generation($Template);
$Form->set_required_fields_from_template($Template, $details);
if ($Form->submitted()) {
$data = $Form->get_posted_content($Template, $Lists, $List);
if ($List) {
$List->update($data);
} else {
$List = $Lists->create($data);
if ($List) {
PerchUtil::redirect($Perch->get_page() . '?id=' . $List->id() . '&created=1');
}
}
if (is_object($List)) {
$message = $HTML->success_message('Your list has been successfully edited. Return to %slisting%s', '<a href="' . $API->app_path('perch_mailchimp') . '/">', '</a>');
} else {
$message = $HTML->failure_message('Sorry, that update was not successful.');
}
}
if (PerchUtil::get('created') && !$message) {
$message = $HTML->success_message('Your list has been successfully created. Return to %s listing%s', '<a href="' . $API->app_path('perch_mailchimp') . '/">', '</a>');
}
if (is_object($List)) {
$details = $List->to_array();
}
示例5: PerchPaging
<?php
$Paging = new PerchPaging();
$Paging->set_per_page(24);
$API = new PerchAPI(1.0, 'perch_twitter');
$HTML = $API->get('HTML');
$ScheduledTweets = new PerchTwitter_ScheduledTweets();
$state = PerchUtil::get('filter', 'unsent');
switch ($state) {
case 'sent':
$tweets = $ScheduledTweets->all_sent($Paging);
break;
case 'unsent':
$tweets = $ScheduledTweets->all_unsent($Paging);
break;
}
示例6: PerchAdminSearch
echo '<img src="' . PERCH_LOGINPATH . '/core/assets/img/logo.png" width="110" class="logo" alt="Perch" />';
}
}
echo '</a>';
if (PERCH_RUNWAY) {
$results = false;
$PerchAdminSearch = new PerchAdminSearch();
$class = '';
if (PerchUtil::get('q')) {
$results = $PerchAdminSearch->search(PerchUtil::get('q'), array());
$class = ' focus';
}
echo '<div class="searchbox' . $class . '">
<form method="get">
<div class="icon search">
<input type="text" name="q" class="text" placeholder="' . PerchLang::get('Search') . '" value="' . PerchUtil::html(PerchUtil::get('q', ''), true) . '" />';
foreach ($_GET as $fkey => $fvalue) {
if ($fkey != 'q') {
echo '<input type="hidden" name="' . PerchUtil::html($fkey, true) . '" value="' . PerchUtil::html($fvalue, true) . '" />';
}
}
echo ' </div>
</form>';
echo $results;
echo '</div>';
}
// Search
?>
<div class="helptext">
<h2 class="icon help">
<?php
示例7:
<?php
$Item = false;
$details = false;
if (PerchUtil::get('id')) {
if (!$CurrentUser->has_priv($delete_priv)) {
PerchUtil::redirect($API->app_path());
}
$Item = $Factory->find(PerchUtil::get('id'));
} else {
PerchUtil::redirect($API->app_path('perch_mailchimp') . $return_path);
}
$Form = $API->get('Form');
$Form->set_name('delete');
if ($Form->submitted()) {
if ($Item) {
$Item->delete();
}
if ($Form->submitted_via_ajax) {
echo $API->app_path('perch_mailchimp') . $return_path;
exit;
} else {
PerchUtil::redirect($API->app_path('perch_mailchimp') . $return_path);
}
}
if (!$Item) {
PerchUtil::redirect($API->app_path('perch_mailchimp') . $return_path);
}
示例8: display_blocks
public static function display_blocks($tags, $id, $item, $Page, $Form, $Template, $blocks_link_builder)
{
$block_tags = $Template->find_all_tags('block');
$blocks_index = array();
if (PerchUtil::count($block_tags)) {
foreach ($block_tags as $Tag) {
if ($Tag->is_set('type')) {
$blocks_index[$Tag->type] = $Tag;
}
}
}
$blocks_data = array();
if (isset($item['_blocks'])) {
$blocks_data = $item['_blocks'];
}
$stamp = time();
echo '<div class="blocks">';
if (PerchUtil::count($blocks_data)) {
$flat_data = array();
if ($id === null) {
$flat_data = PerchContent_Util::flatten_details($blocks_data, '_blocks', false, true);
}
foreach ($blocks_data as $count => $block_data) {
if (isset($flat_data[$count])) {
$block_data = array_merge($block_data, $flat_data[$count]);
}
self::display_block($id, $blocks_index, $block_data, $count, $Page, $Template, $Form, $stamp);
}
}
echo '<div class="master block-add-bar ' . (PerchUtil::count($blocks_data) ? 'hidden' : '') . '" tabindex="0">';
$qs = array();
$qs['id'] = PerchUtil::get('id');
$qs['itm'] = $id;
foreach ($blocks_index as $BlockTag) {
$qs['add-block'] = $BlockTag->type();
$url = call_user_func($blocks_link_builder, $qs);
echo '<a href="' . PerchUtil::html($url, true) . '" class="icon add" tabindex="0">' . $BlockTag->label() . '</a> ';
}
echo '</div>';
echo '</div>';
// .blocks
}
示例9: PerchAlert
<?php
include __DIR__ . '/../../inc/pre_config.php';
include __DIR__ . '/../../../config/config.php';
include PERCH_CORE . '/inc/loader.php';
if (!PERCH_RUNWAY) {
PerchUtil::redirect(PERCH_LOGINPATH . '/core/settings/');
}
$Perch = PerchAdmin::fetch();
include PERCH_CORE . '/inc/auth.php';
if (!$CurrentUser->has_priv('perch.settings')) {
PerchUtil::redirect(PERCH_LOGINPATH);
}
$Perch->page_title = PerchLang::get('Backup');
$Alert = new PerchAlert();
$app_path = __DIR__ . '/..';
include PERCH_CORE . '/runway/settings/inc/backup.php';
$mode = 'backup.plans.list';
if (PerchUtil::get('id')) {
$mode = 'backup.runs.list';
}
include PERCH_CORE . '/runway/settings/modes/' . $mode . '.pre.php';
include PERCH_CORE . '/inc/top.php';
include PERCH_CORE . '/runway/settings/modes/' . $mode . '.post.php';
include PERCH_CORE . '/inc/btm.php';
示例10:
*/
if (PerchUtil::get('id')) {
// Edit mode
$catID = (int) PerchUtil::get('id');
$Category = $Categories->find($catID);
$Set = $Sets->find($Category->setID());
$details = $Category->to_array();
} else {
// New category mode
if (PerchUtil::get('sid')) {
// New in set
$Set = $Sets->find((int) PerchUtil::get('sid'));
}
if (PerchUtil::get('pid')) {
// New based on parent category
$ParentCat = $Categories->find((int) PerchUtil::get('pid'));
$Set = $Sets->find($ParentCat->setID());
}
}
/*
Check permissions and that we have enough data to proceed.
If not, redirect back to the listing.
This state wouldn't normally be hit - this is a safety valve.
*/
if (!$Set || !$CurrentUser->has_priv('categories.manage')) {
PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/categories/');
}
/*
TEMPLATE
Load up the master template that is used for editing.
Set a namespace.
示例11: PerchAPI
<?php
$default_fields = '<perch:categories id="setTitle" type="smarttext" label="Title" required="true" />
<perch:categories id="setSlug" type="slug" for="setTitle" />';
$API = new PerchAPI(1.0, 'categories');
$HTML = $API->get('HTML');
$Sets = new PerchCategories_Sets();
$setID = false;
$Set = false;
$message = false;
$details = array();
$template = 'set.html';
if (PerchUtil::get('id')) {
$setID = (int) PerchUtil::get('id');
$Set = $Sets->find($setID);
$template = $Set->setTemplate();
$details = $Set->to_array();
}
if (!$CurrentUser->has_priv('categories.manage')) {
PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/categories/');
}
$Template = $API->get('Template');
$Template->set('categories/' . $template, 'categories', $default_fields);
$Template->disable_feature('categories');
$Form = $API->get('Form');
$Form->handle_empty_block_generation($Template);
$Form->set_required_fields_from_template($Template, $details);
if ($Form->submitted()) {
$fixed_fields = $Form->receive(array('setTemplate', 'setCatTemplate'));
$data = $Form->get_posted_content($Template, $Sets, $Set);
$data = array_merge($data, $fixed_fields);
示例12: PerchBlog_Posts
if ($Settings->get('perch_blog_update')->val() != '5.0.1') {
PerchUtil::redirect($API->app_path() . '/update/');
}
$Posts = new PerchBlog_Posts($API);
$Blogs = new PerchBlog_Blogs($API);
$blogs = $Blogs->all();
if (!PerchUtil::count($blogs)) {
$Posts->attempt_install();
$blogs = $Blogs->all();
}
$Paging = $API->get('Paging');
$Paging->set_per_page(15);
$Blog = false;
if (PERCH_RUNWAY) {
if (PerchUtil::get('blog')) {
$Blog = $Blogs->get_one_by('blogSlug', PerchUtil::get('blog'));
}
}
if (!$Blog) {
$Blog = $Blogs->find(1);
}
$Categories = new PerchCategories_Categories();
$categories = $Categories->get_for_set($Blog->setSlug());
$Sections = new PerchBlog_Sections($API);
$sections = $Sections->get_by('blogID', (int) $Blog->id());
$Lang = $API->get('Lang');
$posts = array();
$filter = 'all';
if (isset($_GET['category']) && $_GET['category'] != '') {
$filter = 'category';
$category = $_GET['category'];