示例#1
0
function pageNavButtons()
{
    global $apiBase, $requesturl, $suburl;
    //build new array from api
    $response = jsonDecoder($apiBase . '/' . $suburl, true);
    //set the data variable to be parsed
    $data = isset($response['categories']['entries']) ? $response['categories']['entries'] : '';
    //define a container for page links
    $pageLinks = [];
    //lets set the array count for later comparisons
    $total_pages = count($data);
    if ($data) {
        foreach ($data as $urlkey => $val) {
            if ($val['url'] === $requesturl) {
                $next = $urlkey === $total_pages - 1 ? ['url' => $suburl, 'title' => 'Back to Category'] : ['url' => $data[$urlkey + 1]['url'], 'title' => $data[$urlkey + 1]['title']];
                $prev = $urlkey === 0 ? ['url' => $suburl, 'title' => 'Back to Category'] : ['url' => $data[$urlkey - 1]['url'], 'title' => $data[$urlkey - 1]['title']];
                $pageLinks = ['next' => $next, 'prev' => $prev];
            }
        }
        return $pageLinks;
    }
}
示例#2
0
function pageNavButtons()
{
    // This function builds previous and next buttons for articles pages only.
    global $apiBase, $requesturl, $suburl;
    //build new array from api
    $response = jsonDecoder($apiBase . '/' . $suburl, true);
    //set the data variable to be parsed
    $data = isset($response['articles']['list']) ? $response['articles']['list'] : '';
    //define a container for page links
    $pageLinks = [];
    //lets set store the length of our data to use within pagination
    $total_pages = count($data);
    if ($data) {
        foreach ($data as $urlkey => $val) {
            if ($val['url'] === $requesturl) {
                $next = $urlkey === $total_pages - 1 ? ['url' => $suburl, 'title' => 'Back to Category'] : ['url' => $data[$urlkey + 1]['url'], 'title' => $data[$urlkey + 1]['title']];
                $prev = $urlkey === 0 ? ['url' => $suburl, 'title' => 'Back to Category'] : ['url' => $data[$urlkey - 1]['url'], 'title' => $data[$urlkey - 1]['title']];
                $pageLinks = ['next' => $next, 'prev' => $prev];
            }
        }
        return $pageLinks;
    }
}
示例#3
0
<?php

/*
|--------------------------------------------------------------------------
| SITE SETTINGS
|--------------------------------------------------------------------------
|
| Global definitions used throughout the app.
|
*/
$root_url = '/Users/derry.spann/Dev/wordpress/sites/gullahcelebration/content/';
define("ABSPATH", $_SERVER['DOCUMENT_ROOT']);
// Site settings are stored inside json the _config.json file
$settings = jsonDecoder(ABSPATH . '/_config.json');
define('USERSDIR', ABSPATH . '/users/');
// define('CONTENTDIR', $root_url);
define('CONTENTDIR', ABSPATH . '/content/');
// define('PAGESDIR', $root_url.'pages/');
define('PAGESDIR', ABSPATH . '/content/pages/');
// define('ARTICLESDIR', $root_url.'posts/');
define('ARTICLESDIR', ABSPATH . '/content/posts/');
define('SITETHEME', $settings['theme']);
define('LIBDIR', ABSPATH . '/_app/lib/');
define('CURRDATETIME', date("Y-m-d h:i:sa"));
define('CONFIG_EXT', '.json');
define('PAGE_EXT', '.md');
define('TEMPLATEPATH', ABSPATH . '/_themes/' . SITETHEME . '/');
// Password hashing arguments.
$hash_options = array('cost' => '08');
/*
|--------------------------------------------------------------------------