本文整理汇总了PHP中Spoon::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Spoon::set方法的具体用法?PHP Spoon::set怎么用?PHP Spoon::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spoon
的用法示例。
在下文中一共展示了Spoon::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
// set tracking cookie
FrontendModel::getVisitorId();
// add reference
Spoon::set('page', $this);
// get pageId for requested URL
$this->pageId = FrontendNavigation::getPageId(implode('/', $this->URL->getPages()));
// set headers if this is a 404 page
if ($this->pageId == 404) {
$this->statusCode = 404;
}
// create breadcrumb instance
$this->breadcrumb = new FrontendBreadcrumb();
// create header instance
$this->header = new FrontendHeader();
// new footer instance
$this->footer = new FrontendFooter();
// get pagecontent
$this->getPageContent();
// process page
$this->processPage();
// execute all extras linked to the page
$this->processExtras();
// store statistics
$this->storeStatistics();
// display
$this->display();
// trigger event
FrontendModel::triggerEvent('core', 'after_page_processed', array('id' => $this->getId(), 'record' => $this->getRecord(), 'statusCode' => $this->getStatusCode(), 'sessionId' => SpoonSession::getSessionId(), 'visitorId' => FrontendModel::getVisitorId(), 'SESSION' => $_SESSION, 'COOKIE' => $_COOKIE, 'GET' => $_GET, 'POST' => $_POST, 'SERVER' => $_SERVER));
}
示例2: getCM
/**
* Returns the CampaignMonitor object
*
* @param int[optional] $listId The default list id to use.
* @return CampaignMonitor
*/
public static function getCM($listId = null)
{
// campaignmonitor reference exists
if (!Spoon::exists('campaignmonitor')) {
// check if the CampaignMonitor class exists
if (!SpoonFile::exists(PATH_LIBRARY . '/external/campaignmonitor.php')) {
// the class doesn't exist, so throw an exception
throw new SpoonFileException('The CampaignMonitor wrapper class is not found. Please locate and place it in /library/external');
}
// require CampaignMonitor class
require_once 'external/campaignmonitor.php';
// set login data
$url = FrontendModel::getModuleSetting('mailmotor', 'cm_url');
$username = FrontendModel::getModuleSetting('mailmotor', 'cm_username');
$password = FrontendModel::getModuleSetting('mailmotor', 'cm_password');
// init CampaignMonitor object
$cm = new CampaignMonitor($url, $username, $password, 5, self::getClientId());
// set CampaignMonitor object reference
Spoon::set('campaignmonitor', $cm);
// get the default list ID
$listId = !empty($listId) ? $listId : self::getDefaultListID();
// set the default list ID
$cm->setListId($listId);
}
// return the CampaignMonitor object
return Spoon::get('campaignmonitor');
}
示例3: __construct
public function __construct()
{
// add to registry
Spoon::set('url', $this);
$this->setQueryString($_SERVER['REQUEST_URI']);
$this->setHost($_SERVER['HTTP_HOST']);
$this->processQueryString();
}
示例4: __construct
public function __construct()
{
// store in reference so we can access it from everywhere
Spoon::set('header', $this);
// grab from the reference
$this->URL = Spoon::get('url');
$this->tpl = Spoon::get('template');
}
示例5: testSet
public function testSet()
{
// set value
$value = array('Davy Hellemans', 'Tijs Verkoyen', 'Dave Lens', 'Matthias Mullie');
$this->assertEquals(Spoon::set('salad_fingers', $value), $value);
// get rid of value
Spoon::set('salad_fingers');
$this->assertFalse(Spoon::exists('salad_fingers'));
}
示例6: __construct
/**
* The constructor will store the instance in the reference, preset some settings and map the custom modifiers.
*
* @param bool[optional] $addToReference Should the instance be added into the reference.
*/
public function __construct($addToReference = true)
{
parent::__construct();
if ($addToReference) {
Spoon::set('template', $this);
}
$this->setCacheDirectory(FRONTEND_CACHE_PATH . '/cached_templates');
$this->setCompileDirectory(FRONTEND_CACHE_PATH . '/compiled_templates');
$this->setForceCompile(SPOON_DEBUG);
$this->mapCustomModifiers();
}
示例7: __construct
/**
* Default constructor
*
* @return void
*/
public function __construct()
{
// add ourself to the reference so other classes can retrieve us
Spoon::set('url', $this);
// set query-string for later use
$this->setQueryString($_SERVER['REQUEST_URI']);
// set host for later use
$this->setHost($_SERVER['HTTP_HOST']);
// process URL
$this->processQueryString();
}
示例8: __construct
/**
* Default constructor
*
* @return void
*/
public function __construct()
{
// add ourself to the reference so other classes can retrieve us
Spoon::set('url', $this);
// if there is a trailing slash we permanent redirect to the page without slash
if (mb_strlen($_SERVER['REQUEST_URI']) != 1 && mb_substr($_SERVER['REQUEST_URI'], -1) == '/') {
SpoonHTTP::redirect(mb_substr($_SERVER['REQUEST_URI'], 0, -1), 301);
}
// set query-string for later use
$this->setQueryString($_SERVER['REQUEST_URI']);
// set host for later use
$this->setHost($_SERVER['HTTP_HOST']);
// process URL
$this->processQueryString();
// set constant
define('SELF', SITE_URL . '/' . $this->queryString);
}
示例9: __construct
/**
* Class constructor
* The constructor will store the instance in the reference, preset some settings and map the custom modifiers.
*
* @return void
* @param bool[optional] $addToReference Should the instance be added into the reference.
*/
public function __construct($addToReference = true)
{
// parent constructor
parent::__construct();
// store in reference so we can access it from everywhere
if ($addToReference) {
Spoon::set('template', $this);
}
// set cache directory
$this->setCacheDirectory(FRONTEND_CACHE_PATH . '/cached_templates');
// set compile directory
$this->setCompileDirectory(FRONTEND_CACHE_PATH . '/compiled_templates');
// when debugging the template should be recompiled every time
$this->setForceCompile(SPOON_DEBUG);
// map custom modifiers
$this->mapCustomModifiers();
}
示例10: __construct
/**
* Default constructor
*
* @return void
*/
public function __construct()
{
// call parent
parent::__construct();
// add into the reference
Spoon::set('breadcrumb', $this);
// get more information for the homepage
$homeInfo = FrontendNavigation::getPageInfo(1);
// add homepage as first item (with correct element)
$this->addElement($homeInfo['navigation_title'], FrontendNavigation::getURL(1));
// get other pages
$pages = $this->URL->getPages();
// init vars
$items = array();
$errorURL = FrontendNavigation::getUrl(404);
// loop pages
while (!empty($pages)) {
// init vars
$URL = implode('/', $pages);
$menuId = FrontendNavigation::getPageId($URL);
$pageInfo = FrontendNavigation::getPageInfo($menuId);
// do we know something about the page
if ($pageInfo !== false && isset($pageInfo['navigation_title'])) {
// only add pages that aren't direct actions
if ($pageInfo['tree_type'] != 'direct_action') {
// get URL
$pageURL = FrontendNavigation::getUrl($menuId);
// if this is the error-page, so we won't show an URL.
if ($pageURL == $errorURL) {
$pageURL = null;
}
// add to the items
$items[] = array('title' => $pageInfo['navigation_title'], 'url' => $pageURL);
}
}
// remove element
array_pop($pages);
}
// reverse so everything is in place
krsort($items);
// loop and add elements
foreach ($items as $row) {
$this->addElement($row['title'], $row['url']);
}
}
示例11: __construct
/**
* Default constructor
*
* @return void
*/
public function __construct()
{
// call the parent
parent::__construct();
// store in reference
Spoon::set('header', $this);
// add some default CSS files
$this->addCSS('/frontend/core/layout/css/jquery_ui/jquery_ui.css');
$this->addCSS('/frontend/core/layout/css/screen.css');
// debug stylesheet
if (SPOON_DEBUG) {
$this->addCSS('/frontend/core/layout/css/debug.css');
}
// add default javascript-files
$this->addJS('/frontend/core/js/jquery/jquery.js', false);
$this->addJS('/frontend/core/js/jquery/jquery.ui.js', false);
$this->addJS('/frontend/core/js/utils.js', true);
$this->addJS('/frontend/core/js/frontend.js', false, true);
}
示例12: initializeFacebook
/**
* Initialize Facebook
*/
private function initializeFacebook()
{
// get settings
$facebookApplicationId = FrontendModel::getModuleSetting('core', 'facebook_app_id');
$facebookApplicationSecret = FrontendModel::getModuleSetting('core', 'facebook_app_secret');
// needed data available?
if ($facebookApplicationId != '' && $facebookApplicationSecret != '') {
// require
require_once 'external/facebook.php';
// create instance
$facebook = new Facebook($facebookApplicationSecret, $facebookApplicationId);
// get the cookie, this will set the access token.
$facebook->getCookie();
// store in reference
Spoon::set('facebook', $facebook);
// trigger event
FrontendModel::triggerEvent('core', 'after_facebook_initialization');
}
}
示例13: __construct
public function __construct()
{
// store in reference so we can access it from everywhere
Spoon::set('navigation', $this);
// grab from the reference
$this->URL = Spoon::get('url');
// check if navigation cache file exists
if (!SpoonFile::exists(BACKEND_CACHE_PATH . '/navigation/navigation.php')) {
$this->buildCache();
}
$navigation = array();
// require navigation-file
require_once BACKEND_CACHE_PATH . '/navigation/navigation.php';
// load it
$this->navigation = (array) $navigation;
// cleanup navigation (not needed for god user)
if (!BackendAuthentication::getUser()->isGod()) {
$this->navigation = $this->cleanup($this->navigation);
}
}
示例14: __construct
/**
* The constructor will store the instance in the reference, preset some settings and map the custom modifiers.
*
* @param bool[optional] $addToReference Should the instance be added into the reference.
*/
public function __construct($addToReference = true)
{
parent::__construct();
// get URL instance
if (Spoon::exists('url')) {
$this->URL = Spoon::get('url');
}
// store in reference so we can access it from everywhere
if ($addToReference) {
Spoon::set('template', $this);
}
// set cache directory
$this->setCacheDirectory(BACKEND_CACHE_PATH . '/cached_templates');
// set compile directory
$this->setCompileDirectory(BACKEND_CACHE_PATH . '/compiled_templates');
// when debugging, the template should be recompiled every time
$this->setForceCompile(SPOON_DEBUG);
// map custom modifiers
$this->mapCustomModifiers();
// parse authentication levels
$this->parseAuthentication();
}
示例15: getMC
/**
* Returns the mailchimp object.
*
* @return mailchimp
*/
public static function getMC()
{
// mailchimp reference exists
if (!\Spoon::exists('mailchimp')) {
// check if the mailchimp class exists
if (!\SpoonFile::exists(PATH_LIBRARY . '/external/mcapi.php')) {
// the class doesn't exist, so throw an exception
throw new \SpoonFileException(sprintf(FL::err('ClassDoesNotExist'), 'mailchimp'));
}
// require mailchimp class
require_once PATH_LIBRARY . '/external/mcapi.php';
// set login data
$key = FrontendModel::getModuleSetting('MailMotor', 'api_key');
if (empty($key)) {
throw new \Exception('Mailmotor api_key is required.');
}
// init mailchimp object
$mc = new \MCAPI($key);
// set mailchimp object reference
\Spoon::set('mailchimp', $mc);
}
// return the CampaignMonitor object
return \Spoon::get('mailchimp');
}