本文整理汇总了PHP中getCurrentPage函数的典型用法代码示例。如果您正苦于以下问题:PHP getCurrentPage函数的具体用法?PHP getCurrentPage怎么用?PHP getCurrentPage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCurrentPage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __appendAlert
/**
* Append notice that the site is currently in maintenance mode offering a link
* to switch to live mode if no other alert is set.
*
* @param array $context
* delegate context
*/
public function __appendAlert($context)
{
// Site in maintenance mode
if (Symphony::Configuration()->get('enabled', 'maintenance_mode') == 'yes') {
Administration::instance()->Page->pageAlert(__('This site is currently in maintenance mode.') . ' <a href="' . SYMPHONY_URL . '/system/preferences/?action=toggle-maintenance-mode&redirect=' . getCurrentPage() . '">' . __('Restore?') . '</a>', Alert::NOTICE);
}
}
示例2: printPageListWithNavAlt
function printPageListWithNavAlt($prevtext, $nexttext, $nextprev = true, $class = NULL, $id = "pagelist")
{
echo "<div" . ($id ? " id=\"{$id}\"" : "") . " class=\"{$class}\">";
$total = getTotalPages();
$current = getCurrentPage();
echo "\n<ul class=\"{$class}\"><li>[</li>";
for ($i = 1; $i <= $total; $i++) {
echo "\n <li" . ($i == $current ? " class=\"current\"" : "") . ">";
printLinkHTML(getPageURL($i), $i, "Page {$i}" . ($i == $current ? " (Current Page)" : ""));
echo "</li>";
}
echo "\n<li>]</li>";
if ($nextprev) {
echo "\n <li class=\"prev\">";
printPrevPageURL($prevtext, "Previous Page");
echo "</li>";
}
echo "\n<li></li>";
if ($nextprev) {
echo "\n <li class=\"next\">";
printNextPageURL($nexttext, "Next Page");
echo "</li>";
}
echo "\n</ul>";
echo "\n</div>\n";
}
示例3: showPagination
function showPagination($params)
{
if ($params['totalRows'] >= 1) {
$currentPage = getCurrentPage();
$recordsPerPage = isset($params['recordsPerPage']) ? trim($params['recordsPerPage']) : 10;
$range = isset($params['range']) ? $params['range'] : 5;
// count all lines in the database to calculate total pages
$totalPges = ceil($params['totalRows'] / $recordsPerPage);
// display links to 'range of pages' around 'current page'
$initialNum = $currentPage - $range;
$conditionLimitNum = $currentPage + $range + 1;
echo "<nav><ul class=\"pagination pagination-sm\">";
// button for first page
if ($currentPage > 1) {
echo "<li><a href=\"{$params['url']}\" title=\"Ir para primeira página.\"> << </a></li>";
}
for ($x = $initialNum; $x < $conditionLimitNum; $x++) {
// be sure '$x is greater than 0' AND 'less than or equal to the $totalPges'
if ($x > 0 && $x <= $totalPges) {
// current page
if ($x == $currentPage) {
echo "<li class=\"active\"><a href=\"#\">{$x} <span class=\"sr-only\">(current)</span></a></li>";
} else {
// not current page
echo "<li><a href=\"{$params['url']}?page={$x}\">{$x}</a></li>";
}
}
}
// button for last page
if ($currentPage < $totalPges) {
echo "<li><a href=\"" . $params['url'] . "?page={$totalPges}\" title=\"Last page is {$totalPges}.\"> >> </a></li>";
}
echo "</ul></nav>";
}
}
示例4: action
function action()
{
##Do not proceed if the config file is read only
if (!is_writable(CONFIG)) {
redirect($this->_Parent->getCurrentPageURL());
}
###
# Delegate: CustomActions
# Description: This is where Extensions can hook on to custom actions they may need to provide.
$this->_Parent->ExtensionManager->notifyMembers('CustomActions', getCurrentPage());
if (isset($_POST['action']['save'])) {
$settings = $_POST['settings'];
###
# Delegate: Save
# Description: Saving of system preferences.
$this->_Parent->ExtensionManager->notifyMembers('Save', getCurrentPage(), array('settings' => &$settings, 'errors' => &$this->_errors));
if (!is_array($this->_errors) || empty($this->_errors)) {
foreach ($settings as $set => $values) {
foreach ($values as $key => $val) {
$this->_Parent->Configuration->set($key, $val, $set);
}
}
$this->_Parent->saveConfig();
redirect($this->_Parent->getCurrentPageURL());
}
}
}
示例5: renderer_json
function renderer_json($mode)
{
if (strtolower($mode) == 'administration') {
throw new Lib\Exceptions\InvalidModeException('JSON Renderer launcher is only available on the frontend');
}
$renderer = Frontend::instance();
// Check if we should enable exception debug information
$exceptionDebugEnabled = Symphony::isLoggedIn();
// Use the JSON exception and error handlers instead of the Symphony one.
Lib\ExceptionHandler::initialise($exceptionDebugEnabled);
Lib\ErrorHandler::initialise($exceptionDebugEnabled);
// #1808
if (isset($_SERVER['HTTP_MOD_REWRITE'])) {
throw new Exception("mod_rewrite is required, however is not enabled.");
}
$output = $renderer->display(getCurrentPage());
cleanup_session_cookies();
if (in_array('JSON', Frontend::Page()->pageData()['type'])) {
// Load the output into a SimpleXML Container and convert to JSON
try {
$xml = new SimpleXMLElement($output, LIBXML_NOCDATA);
// Convert the XML to a plain array. This step is necessary as we cannot
// use JSON_PRETTY_PRINT directly on a SimpleXMLElement object
$outputArray = json_decode(json_encode($xml), true);
// Get the transforer object ready. Other extensions will
// add their transormations to this.
$transformer = new Lib\Transformer();
/**
* Allow other extensions to add their own transformers
*/
Symphony::ExtensionManager()->notifyMembers('APIFrameworkJSONRendererAppendTransformations', '/frontend/', ['transformer' => &$transformer]);
// Apply transformations
$outputArray = $transformer->run($outputArray);
// Now put the array through a json_encode
$output = json_encode($outputArray, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
} catch (\Exception $e) {
// This happened because the input was not valid XML. This could
// occur for a few reasons, but there are two scenarios
// we are interested in.
// 1) This is a devkit page (profile, debug etc). We want the data
// to be passed through and displayed rather than converted into
// JSON. There is no easy way in Symphony to tell if a devkit has
// control over the page, so instead lets inspect the output for
// any signs a devkit is rendering the page.
// 2) It is actually bad XML. In that case we need to let the error
// bubble through.
// Currently the easiest method is to check for the devkit.min.css
// in the output. This may fail in the furture if this file is
// renamed or moved.
if (!preg_match("@\\/symphony\\/assets\\/css\\/devkit.min.css@", $output)) {
throw $e;
}
}
}
echo $output;
return $renderer;
}
示例6: __appendAlert
public function __appendAlert($context)
{
if (!is_null($context['alert'])) {
return;
}
if ($this->_Parent->Configuration->get('enabled', 'maintenance_mode') == 'yes') {
Administration::instance()->Page->pageAlert(__('This site is currently in maintenance mode.') . ' <a href="' . URL . '/symphony/system/preferences/?action=toggle-maintenance-mode&redirect=' . getCurrentPage() . '">' . __('Restore?') . '</a>', Alert::NOTICE);
}
}
示例7: getNextLink
function getNextLink()
{
$paged = getCurrentPage();
if ($paged === getMaxPage()) {
echo '#';
} else {
echo getPageLink($paged + 1);
}
}
示例8: __appendAlert
public function __appendAlert($context){
if(Symphony::Configuration()->get('enabled', 'readonly_mode') == 'yes'){
$text = __('This site is currently in readonly mode.');
if($this->isDeveloper())
$text .= ' <a href="' . SYMPHONY_URL . '/system/preferences/?action=toggle-readonly-mode&redirect=' . getCurrentPage() . '">' . __('Restore?') . '</a>';
Administration::instance()->Page->pageAlert($text, Alert::NOTICE);
}
}
示例9: getConfigFile
/**
* Fonction permettant la récupération du fichier de configuration
* @return array associatif dont les clés, sont les sections
*/
function getConfigFile()
{
$page = getCurrentPage();
$isIndex = ($page == '' or $page == "index");
if ($isIndex) {
return parse_ini_file("config.ini.php", true);
} else {
return parse_ini_file("../config.ini.php", true);
}
}
示例10: printNavigation
static function printNavigation($prevtext, $nexttext, $oneImagePage = false, $navlen = 7, $firstlast = true)
{
$total = getTotalPages($oneImagePage);
$current = getCurrentPage();
if ($total < 2) {
$class .= ' disabled_nav';
}
if ($navlen == 0) {
$navlen = $total;
}
$extralinks = 2;
if ($firstlast) {
$extralinks += 2;
}
$len = floor(($navlen - $extralinks) / 2);
$j = max(round($extralinks / 2), min($current - $len - (2 - round($extralinks / 2)), $total - $navlen + $extralinks - 1));
$ilim = min($total, max($navlen - round($extralinks / 2), $current + floor($len)));
$k1 = round(($j - 2) / 2) + 1;
$k2 = $total - round(($total - $ilim) / 2);
if ($firstlast) {
echo '<div class="nav-cell ' . ($current == 1 ? 'current' : 'first') . '">';
echo "<span class='valign'>";
printLink(getPageURL(1, $total), 1, "Page 1");
echo "</span></div>\n";
if ($j > 2) {
echo '<div class="nav-cell">';
echo "<span class='valign'>";
printLink(getPageURL($k1, $total), $j - 1 > 2 ? '...' : $k1, "Page {$k1}");
echo "</span></div>\n";
}
}
for ($i = $j; $i <= $ilim; $i++) {
echo '<div class="nav-cell' . ($i == $current ? " current" : "") . '">';
echo "<span class='valign'>";
printLink(getPageURL($i, $total), $i, "Page {$i}" . ($i == $current ? ' ' . gettext("(Current Page)") : ""));
echo "</span></div>\n";
}
if ($i < $total) {
echo '<div class="nav-cell">';
echo "<span class='valign'>";
printLink(getPageURL($k2, $total), $total - $i > 1 ? '...' : $k2, "Page {$k2}");
echo "</span></div>\n";
}
if ($firstlast && $i <= $total) {
echo '<div class="nav-cell last">';
echo "<span class='valign'>";
printLink(getPageURL($total, $total), $total, "Page {$total}");
echo "</span></div>\n";
}
$prevNextLinks = array();
$prevNextLinks['prev'] = ThemeUtil::getLink(getPrevPageURL(), $prevtext) . "\n";
$prevNextLinks['next'] = ThemeUtil::getLink(getNextPageURL(), $nexttext) . "\n";
return $prevNextLinks;
}
示例11: __construct
public function __construct(View $view)
{
parent::__construct();
$this->document = new HTMLDocument();
$this->view = $view;
$this->data = (object) array();
$this->url = new URLWriter(URL . getCurrentPage(), $_GET);
// Remove symphony parameters:
unset($this->url->parameters()->{'symphony-page'});
unset($this->url->parameters()->{'symphony-renderer'});
}
示例12: GalleryController
function GalleryController()
{
global $_zp_gallery;
zp_load_page();
$this->requestedPage = getCurrentPage() >= 1 ? getCurrentPage() : 1;
if (!isset($_zp_gallery)) {
load_gallery();
}
list($album, $image) = rewrite_get_album_image('album', 'image');
$this->setAlbum($album);
$this->setImage($image);
}
示例13: renderView
/**
* Fields requests, routes them to appropriate View, returns output
*/
public function renderView()
{
// Set URL
$this->url = getCurrentPage();
// Create view
$this->View = $this->createView();
// Initialize View
$this->View->load($this->url);
// Initialize context
$this->initializeContext();
// Tell the view to build its output
$output = $this->View->buildOutput();
return $output;
}
示例14: smarty_function_reportPages
function smarty_function_reportPages($params, &$smarty)
{
/*
parameter total_results(integer,requrired): total number of results
parameter file_path(string,optional): set the file path that will be used in page urls
parameter pages_to_show(integer,optional): set number of pages we want to show the user on page select, default 12
*/
$url_params = convertRequestToUrl(array("page"));
$file_path = isset($params["file_path"]) ? $params["file_path"] : $_SERVER["PHP_SELF"];
$pages_to_show = isset($params["pages_to_show"]) ? (int) $params["pages_to_show"] : 12;
$total_pages = calcTotalPages($params["total_results"], getRPP());
$cur_page = min(getCurrentPage(), $total_pages);
$link = "{$file_path}?{$url_params}";
$pages = createReportPagesArray($link, $cur_page, $total_pages, $pages_to_show);
return createReportPagesTable($pages, $cur_page, $link, $total_pages);
}
示例15: promptAuth
/**
* Redirects user to login and if he logged he will be returned to where this was calles
* @param String $paramTo To what should he be redirected? (OPTIONAL)
*/
public static function promptAuth($paramTo = null)
{
if (getUser() != null) {
return;
}
if ($paramTo != null) {
header("Location: " . orongoURL('orongo-login.php?redirect=' . $paramTo));
exit;
}
if (!function_exists('getCurrentPage')) {
header("Location: " . orongoURL('orongo-login.php'));
exit;
}
$currentPage = str_replace("admin_", "orongo-admin/", getCurrentPage()) . '.php';
header("Location: " . orongoURL('orongo-login.php?redirect=' . $currentPage));
exit;
}