• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Spoon类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Spoon的典型用法代码示例。如果您正苦于以下问题:PHP Spoon类的具体用法?PHP Spoon怎么用?PHP Spoon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Spoon类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:32,代码来源:page.php


示例2: loadData

 /**
  * Load the data
  */
 private function loadData()
 {
     // get the current page id
     $pageId = Spoon::get('page')->getId();
     $navigation = FrontendNavigation::getNavigation();
     $pageInfo = FrontendNavigation::getPageInfo($pageId);
     $this->navigation = array();
     if (isset($navigation['page'][$pageInfo['parent_id']])) {
         $pages = $navigation['page'][$pageInfo['parent_id']];
         // store
         $pagesPrev = $pages;
         $pagesNext = $pages;
         // check for current id
         foreach ($pagesNext as $key => $value) {
             if ((int) $key != (int) $pageId) {
                 // go to next pointer in array
                 next($pagesNext);
                 next($pagesPrev);
             } else {
                 break;
             }
         }
         // get previous page
         $this->navigation['previous'] = prev($pagesPrev);
         // get next page
         $this->navigation['next'] = next($pagesNext);
         // get parent page
         $this->navigation['parent'] = FrontendNavigation::getPageInfo($pageInfo['parent_id']);
     }
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:33,代码来源:previous_next_navigation.php


示例3: defineForkConstants

 /**
  * This will disappear in time in favour of container-driven parameters.
  * @deprecated
  */
 public function defineForkConstants()
 {
     $container = $this->getContainer();
     Spoon::setDebug($container->getParameter('kernel.debug'));
     Spoon::setDebugEmail($container->getParameter('fork.debug_email'));
     Spoon::setDebugMessage($container->getParameter('fork.debug_message'));
     Spoon::setCharset($container->getParameter('kernel.charset'));
     /**
      * @deprecated SPOON_* constants are deprecated in favor of Spoon::set*().
      * Will be removed in the next major release.
      */
     defined('SPOON_DEBUG') || define('SPOON_DEBUG', $container->getParameter('kernel.debug'));
     defined('SPOON_DEBUG_EMAIL') || define('SPOON_DEBUG_EMAIL', $container->getParameter('fork.debug_email'));
     defined('SPOON_DEBUG_MESSAGE') || define('SPOON_DEBUG_MESSAGE', $container->getParameter('fork.debug_message'));
     defined('SPOON_CHARSET') || define('SPOON_CHARSET', $container->getParameter('kernel.charset'));
     defined('PATH_WWW') || define('PATH_WWW', $container->getParameter('site.path_www'));
     defined('PATH_LIBRARY') || define('PATH_LIBRARY', $container->getParameter('site.path_library'));
     defined('SITE_DEFAULT_LANGUAGE') || define('SITE_DEFAULT_LANGUAGE', $container->getParameter('site.default_language'));
     defined('SITE_DEFAULT_TITLE') || define('SITE_DEFAULT_TITLE', $container->getParameter('site.default_title'));
     defined('SITE_MULTILANGUAGE') || define('SITE_MULTILANGUAGE', $container->getParameter('site.multilanguage'));
     defined('SITE_DOMAIN') || define('SITE_DOMAIN', $container->getParameter('site.domain'));
     defined('SITE_PROTOCOL') || define('SITE_PROTOCOL', $container->getParameter('site.protocol'));
     defined('SITE_URL') || define('SITE_URL', SITE_PROTOCOL . '://' . SITE_DOMAIN);
     defined('FORK_VERSION') || define('FORK_VERSION', $container->getParameter('fork.version'));
     defined('ACTION_GROUP_TAG') || define('ACTION_GROUP_TAG', $container->getParameter('action.group_tag'));
     defined('ACTION_RIGHTS_LEVEL') || define('ACTION_RIGHTS_LEVEL', $container->getParameter('action.rights_level'));
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:31,代码来源:Kernel.php


示例4: loadData

 /**
  * Load the data
  */
 private function loadData()
 {
     // get the current page id
     $pageId = Spoon::get('page')->getId();
     // fetch the items
     $this->items = FrontendPagesModel::getSubpages($pageId);
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:10,代码来源:subpages.php


示例5: 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');
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:33,代码来源:helper.php


示例6: set

 /**
  * Stores a value in a cookie, by default the cookie will expire in one day.
  *
  * @param string $key	A name for the cookie.
  * @param mixed $value	The value to be stored. Keep in mind that they will be serialized.
  * @param int[optional] $time	The number of seconds that this cookie will be available, 30 days is the default.
  * @param string[optional] $path	The path on the server in which the cookie will be availabe. Use / for the entire domain, /foo if you just want it to be available in /foo.
  * @param string[optional] $domain	The domain that the cookie is available on. Use .example.com to make it available on all subdomains of example.com.
  * @param bool[optional] $secure	Should the cookie be transmitted over a HTTPS-connection? If true, make sure you use a secure connection, otherwise the cookie won't be set.
  * @param bool[optional] $httpOnly	Should the cookie only be available through HTTP-protocol? If true, the cookie can't be accessed by Javascript, ...
  * @return bool	If set with succes, returns true otherwise false.
  */
 public static function set($key, $value, $time = 2592000, $path = '/', $domain = null, $secure = null, $httpOnly = true)
 {
     // redefine
     $key = (string) $key;
     $value = serialize($value);
     $time = time() + (int) $time;
     $path = (string) $path;
     $httpOnly = (bool) $httpOnly;
     // when the domain isn't passed and the url-object is available we can set the cookies for all subdomains
     if ($domain === null && Spoon::exists('url')) {
         $domain = '.' . Spoon::get('url')->getDomain();
     }
     // when the secure-parameter isn't set
     if ($secure === null) {
         /*
         detect if we are using HTTPS, this wil only work in Apache, if you are using nginx you should add the
         code below into your config:
         	ssl on;
         				fastcgi_param HTTPS on;
         
         for lighttpd you should add:
         	setenv.add-environment = ("HTTPS" => "on")
         */
         $secure = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
     }
     // set cookie
     $cookie = setcookie($key, $value, $time, $path, $domain, $secure, $httpOnly);
     // problem occured
     return $cookie === false ? false : true;
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:42,代码来源:cookie.php


示例7: __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');
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:8,代码来源:header.php


示例8: __construct

 public function __construct()
 {
     // add to registry
     Spoon::set('url', $this);
     $this->setQueryString($_SERVER['REQUEST_URI']);
     $this->setHost($_SERVER['HTTP_HOST']);
     $this->processQueryString();
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:8,代码来源:url.php


示例9: 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'));
 }
开发者ID:jeroendesloovere,项目名称:library,代码行数:9,代码来源:SpoonTest.php


示例10: __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();
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:16,代码来源:url.php


示例11: __construct

 /**
  * You have to specify the action and module so we know what to do with this instance
  *
  * @param string $action The action to load.
  * @param string $module The module to load.
  */
 public function __construct($action, $module)
 {
     // grab stuff from the reference and store them in this object (for later/easy use)
     $this->tpl = Spoon::get('template');
     $this->setModule($module);
     $this->setAction($action);
     $this->loadConfig();
     // is the requested action possible? If not we throw an exception. We don't redirect because that could trigger a redirect loop
     if (!in_array($this->getAction(), $this->config->getPossibleActions())) {
         throw new BackendException('This is an invalid action (' . $this->getAction() . ').');
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:18,代码来源:action.php


示例12: __construct

 /**
  * Check if all required settings have been set
  *
  * @param string $module The module.
  */
 public function __construct($module)
 {
     parent::__construct($module);
     $this->loadEngineFiles();
     $url = Spoon::exists('url') ? Spoon::get('url') : null;
     // do the client ID check if we're not in the settings page
     if ($url != null && !in_array($url->getAction(), array('settings', 'import_groups', 'link_account', 'load_client_info'))) {
         $this->checkForAccount();
         $this->checkForClientID();
         $this->checkForGroups();
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:17,代码来源:config.php


示例13: __construct

 /**
  * @param string $name Name of the form.
  * @param string[optional] $action The action (URL) whereto the form will be submitted, if not provided it will be autogenerated.
  * @param string[optional] $method The method to use when submiting the form, default is POST.
  * @param string[optional] $hash The id of the anchor to append to the action-URL.
  * @param bool[optional] $useToken Should we automagically add a formtoken?
  */
 public function __construct($name, $action = null, $method = 'post', $hash = null, $useToken = true)
 {
     $this->URL = Spoon::get('url');
     $this->header = Spoon::get('header');
     $name = (string) $name;
     $hash = $hash !== null ? (string) $hash : null;
     $useToken = (bool) $useToken;
     // build the action if it wasn't provided
     $action = $action === null ? '/' . $this->URL->getQueryString() : (string) $action;
     // call the real form-class
     parent::__construct($name, $action, $method, $useToken);
     // add default classes
     $this->setParameter('id', $name);
     $this->setParameter('class', 'forkForms submitWithLink');
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:22,代码来源:form.php


示例14: __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);
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:22,代码来源:url.php


示例15: __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']);
     }
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:50,代码来源:breadcrumb.php


示例16: __construct

 /**
  * Check if all required settings have been set
  *
  * @return	void
  * @param	string $module	The module.
  */
 public function __construct($module)
 {
     // parent construct
     parent::__construct($module);
     // load additional engine files
     $this->loadEngineFiles();
     // get url object reference
     $url = Spoon::exists('url') ? Spoon::get('url') : null;
     // do the client ID check if we're not in the settings page
     if ($url != null && $url->getAction() != 'settings' && $url->getAction() != 'import_groups' && strpos($url->getQueryString(), 'link_account') === false && strpos($url->getQueryString(), 'load_client_info') === false) {
         // check for CM account
         $this->checkForAccount();
         // check for client ID
         $this->checkForClientID();
         // check for groups
         $this->checkForGroups();
     }
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:24,代码来源:config.php


示例17: __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);
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:24,代码来源:header.php


示例18: __construct

 /**
  * @param string[optional] $name Name of the form.
  * @param string[optional] $action The action (URL) whereto the form will be submitted, if not provided it will be autogenerated.
  * @param string[optional] $method The method to use when submiting the form, default is POST.
  * @param bool[optional] $useToken Should we automagically add a formtoken?
  * @param bool[optional] $useGlobalError Should we automagically show a global error?
  */
 public function __construct($name = null, $action = null, $method = 'post', $useToken = true, $useGlobalError = true)
 {
     if (Spoon::exists('url')) {
         $this->URL = Spoon::get('url');
     }
     if (Spoon::exists('header')) {
         $this->header = Spoon::get('header');
     }
     $this->useGlobalError = (bool) $useGlobalError;
     // build a name if there wasn't one provided
     $name = $name === null ? SpoonFilter::toCamelCase($this->URL->getModule() . '_' . $this->URL->getAction(), '_', true) : (string) $name;
     // build the action if it wasn't provided
     $action = $action === null ? '/' . $this->URL->getQueryString() : (string) $action;
     // call the real form-class
     parent::__construct($name, $action, $method, $useToken);
     // add default classes
     $this->setParameter('id', $name);
     $this->setParameter('class', 'forkForms submitWithLink');
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:26,代码来源:form.php


示例19: 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');
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:22,代码来源:frontend.php


示例20: __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);
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:20,代码来源:navigation.php



注:本文中的Spoon类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SpoonFile类代码示例发布时间:2022-05-23
下一篇:
PHP SplitWord类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap