本文整理汇总了PHP中FrontendModel::getModuleSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontendModel::getModuleSetting方法的具体用法?PHP FrontendModel::getModuleSetting怎么用?PHP FrontendModel::getModuleSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrontendModel
的用法示例。
在下文中一共展示了FrontendModel::getModuleSetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateForm
/**
* Validate the form
*/
private function validateForm()
{
if ($this->frm->isSubmitted()) {
$this->frm->cleanupFields();
// validate required fields
$this->frm->getField('name')->isFilled(FL::err('NameIsRequired'));
$this->frm->getField('email')->isEmail(FL::err('EmailIsInvalid'));
$this->frm->getField('message')->isFilled(FL::err('QuestionIsRequired'));
if ($this->frm->isCorrect()) {
$spamFilterEnabled = FrontendModel::getModuleSetting('faq', 'spamfilter');
$variables['sentOn'] = time();
$variables['name'] = $this->frm->getField('name')->getValue();
$variables['email'] = $this->frm->getField('email')->getValue();
$variables['message'] = $this->frm->getField('message')->getValue();
if ($spamFilterEnabled) {
// if the comment is spam alter the comment status so it will appear in the spam queue
if (FrontendModel::isSpam($variables['message'], SITE_URL . FrontendNavigation::getURLForBlock('faq'), $variables['name'], $variables['email'])) {
$this->status = 'errorSpam';
return;
}
}
$this->status = 'success';
FrontendMailer::addEmail(sprintf(FL::getMessage('FaqOwnQuestionSubject'), $variables['name']), FRONTEND_MODULES_PATH . '/faq/layout/templates/mails/own_question.tpl', $variables, $variables['email'], $variables['name']);
}
}
}
示例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: getTheme
/**
* Gets the active theme name
*
* @return string
*/
public static function getTheme()
{
// theme nama has not yet been saved, fetch and save it
if (!self::$theme) {
self::$theme = FrontendModel::getModuleSetting('core', 'theme', null);
}
// return theme name
return self::$theme;
}
示例4: parse
/**
* Parse the footer into the template
*/
public function parse()
{
// get footer links
$footerLinks = (array) FrontendNavigation::getFooterLinks();
// assign footer links
$this->tpl->assign('footerLinks', $footerLinks);
// initial value for footer HTML
$siteHTMLFooter = (string) FrontendModel::getModuleSetting('core', 'site_html_footer', null);
// facebook admins given?
if (FrontendModel::getModuleSetting('core', 'facebook_admin_ids', null) !== null || FrontendModel::getModuleSetting('core', 'facebook_app_id', null) !== null) {
// build correct locale
switch (FRONTEND_LANGUAGE) {
case 'en':
$locale = 'en_US';
break;
case 'zh':
$locale = 'zh_CN';
break;
case 'cs':
$locale = 'cs_CZ';
break;
case 'el':
$locale = 'el_GR';
break;
case 'ja':
$locale = 'ja_JP';
break;
case 'sv':
$locale = 'sv_SE';
break;
case 'uk':
$locale = 'uk_UA';
break;
default:
$locale = strtolower(FRONTEND_LANGUAGE) . '_' . strtoupper(FRONTEND_LANGUAGE);
}
// add Facebook container
$siteHTMLFooter .= "\n" . '<div id="fb-root"></div>' . "\n";
// add facebook JS
$siteHTMLFooter .= '<script>' . "\n";
if (FrontendModel::getModuleSetting('core', 'facebook_app_id', null) !== null) {
$siteHTMLFooter .= ' window.fbAsyncInit = function() {' . "\n";
$siteHTMLFooter .= ' FB.init({ appId: \'' . FrontendModel::getModuleSetting('core', 'facebook_app_id', null) . '\', status: true, cookie: true, xfbml: true, oauth: true });' . "\n";
$siteHTMLFooter .= ' jsFrontend.facebook.afterInit();' . "\n";
$siteHTMLFooter .= ' };' . "\n";
}
$siteHTMLFooter .= ' (function() {' . "\n";
$siteHTMLFooter .= ' var e = document.createElement(\'script\'); e.async = true; e.src = document.location.protocol + "//connect.facebook.net/' . $locale . '/all.js#xfbml=1";' . "\n";
$siteHTMLFooter .= ' document.getElementById(\'fb-root\').appendChild(e);' . "\n";
$siteHTMLFooter .= ' }());' . "\n";
$siteHTMLFooter .= '</script>';
}
// assign site wide html
$this->tpl->assign('siteHTMLFooter', $siteHTMLFooter);
}
示例5: parse
/**
* Parse the data into the template
*
* @return void
*/
private function parse()
{
// get vars
$title = isset($this->settings['rss_title_' . FRONTEND_LANGUAGE]) ? $this->settings['rss_title_' . FRONTEND_LANGUAGE] : FrontendModel::getModuleSetting('blog', 'rss_title_' . FRONTEND_LANGUAGE, SITE_DEFAULT_TITLE);
$link = SITE_URL . FrontendNavigation::getURLForBlock('blog');
$description = isset($this->settings['rss_description_' . FRONTEND_LANGUAGE]) ? $this->settings['rss_description_' . FRONTEND_LANGUAGE] : null;
// create new rss instance
$rss = new FrontendRSS($title, $link, $description);
// loop articles
foreach ($this->items as $item) {
// init vars
$title = $item['title'];
$link = $item['full_url'];
$description = $item['introduction'] != '' ? $item['introduction'] : $item['text'];
// meta is wanted
if (FrontendModel::getModuleSetting('blog', 'rss_meta_' . FRONTEND_LANGUAGE, true)) {
// append meta
$description .= '<div class="meta">' . "\n";
$description .= ' <p><a href="' . $link . '" title="' . $title . '">' . $title . '</a> ' . sprintf(FL::msg('WrittenBy'), FrontendUser::getBackendUser($item['user_id'])->getSetting('nickname'));
$description .= ' ' . FL::lbl('In') . ' <a href="' . $item['category_full_url'] . '" title="' . $item['category_title'] . '">' . $item['category_title'] . '</a>.</p>' . "\n";
// any tags
if (isset($item['tags'])) {
// append tags-paragraph
$description .= ' <p>' . ucfirst(FL::lbl('Tags')) . ': ';
$first = true;
// loop tags
foreach ($item['tags'] as $tag) {
// prepend separator
if (!$first) {
$description .= ', ';
}
// add
$description .= '<a href="' . $tag['full_url'] . '" rel="tag" title="' . $tag['name'] . '">' . $tag['name'] . '</a>';
// reset
$first = false;
}
// end
$description .= '.</p>' . "\n";
}
// end HTML
$description .= '</div>' . "\n";
}
// create new instance
$rssItem = new FrontendRSSItem($title, $link, $description);
// set item properties
$rssItem->setPublicationDate($item['publish_on']);
$rssItem->addCategory($item['category_title']);
$rssItem->setAuthor(FrontendUser::getBackendUser($item['user_id'])->getSetting('nickname'));
// add item
$rss->addItem($rssItem);
}
// output
$rss->parse();
}
示例6: parse
/**
* Parse
*
* @return void
*/
private function parse()
{
// get RSS-link
$rssLink = FrontendModel::getModuleSetting('blog', 'feedburner_url_' . FRONTEND_LANGUAGE);
if ($rssLink == '') {
$rssLink = FrontendNavigation::getURLForBlock('blog', 'rss');
}
// add RSS-feed into the metaCustom
$this->header->addLink(array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => FrontendModel::getModuleSetting('blog', 'rss_title_' . FRONTEND_LANGUAGE), 'href' => $rssLink), true);
// assign comments
$this->tpl->assign('widgetBlogRecentArticlesList', FrontendBlogModel::getAll(FrontendModel::getModuleSetting('blog', 'recent_articles_list_num_items', 5)));
}
示例7: getData
/**
* Load the data, don't forget to validate the incoming data
*/
private function getData()
{
$categories = FrontendFaqModel::getCategories();
$limit = FrontendModel::getModuleSetting('faq', 'overview_num_items_per_category', 10);
foreach ($categories as $item) {
$item['questions'] = FrontendFaqModel::getAllForCategory($item['id'], $limit);
// no questions? next!
if (empty($item['questions'])) {
continue;
}
// add the category item including the questions
$this->items[] = $item;
}
}
示例8: parse
/**
* Parse the data into the template
*
* @return void
*/
private function parse()
{
// get RSS-link
$rssLink = FrontendModel::getModuleSetting('blog', 'feedburner_url_' . FRONTEND_LANGUAGE);
if ($rssLink == '') {
$rssLink = FrontendNavigation::getURLForBlock('blog', 'rss');
}
// add RSS-feed
$this->header->addLink(array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => FrontendModel::getModuleSetting('blog', 'rss_title_' . FRONTEND_LANGUAGE), 'href' => $rssLink), true);
// assign articles
$this->tpl->assign('items', $this->items);
// parse the pagination
$this->parsePagination();
}
示例9: display
/**
* Display
*/
private function display()
{
// set variables
$this->requestedPage = $this->URL->getParameter('page', 'int', 1);
$this->limit = FrontendModel::getModuleSetting('search', 'overview_num_items', 20);
$this->offset = $this->requestedPage * $this->limit - $this->limit;
$this->cacheFile = FRONTEND_CACHE_PATH . '/' . $this->getModule() . '/' . FRONTEND_LANGUAGE . '_' . md5($this->term) . '_' . $this->offset . '_' . $this->limit . '.php';
// load the cached data
if (!$this->getCachedData()) {
// ... or load the real data
$this->getRealData();
}
// parse
$this->parse();
}
示例10: display
/**
* Display
*/
private function display()
{
// set variables
$this->requestedPage = 1;
$this->limit = (int) FrontendModel::getModuleSetting('search', 'overview_num_items', 20);
$this->offset = $this->requestedPage * $this->limit - $this->limit;
$this->cacheFile = FRONTEND_CACHE_PATH . '/' . $this->getModule() . '/' . FRONTEND_LANGUAGE . '_' . md5($this->term) . '_' . $this->offset . '_' . $this->limit . '.php';
// load the cached data
if (!$this->getCachedData()) {
// ... or load the real data
$this->getRealData();
}
// parse
$this->parse();
// output
$this->output(self::OK, $this->tpl->getContent(FRONTEND_PATH . '/modules/search/layout/templates/results.tpl', false, true));
}
示例11: 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');
}
}
示例12: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// get parameters
$term = SpoonFilter::getGetValue('term', null, '');
$limit = (int) FrontendModel::getModuleSetting('search', 'autocomplete_num_items', 10);
// validate
if ($term == '') {
$this->output(self::BAD_REQUEST, null, 'term-parameter is missing.');
}
// get matches
$matches = FrontendSearchModel::getStartsWith($term, FRONTEND_LANGUAGE, $limit);
// get search url
$url = FrontendNavigation::getURLForBlock('search');
// loop items and set search url
foreach ($matches as &$match) {
$match['url'] = $url . '?form=search&q=' . $match['term'];
}
// output
$this->output(self::OK, $matches);
}
示例13: __construct
/**
* The default constructor
*
* @return void
* @param string $title The title off the feed.
* @param string $link The link of the feed.
* @param string $description The description of the feed.
* @param array[optional] $items An array with SpoonRSSItems.
*/
public function __construct($title, $link, $description, array $items = array())
{
// decode
$title = SpoonFilter::htmlspecialcharsDecode($title);
$description = SpoonFilter::htmlspecialcharsDecode($description);
// call the parent
parent::__construct($title, FrontendModel::addURLParameters($link, array('utm_source' => 'feed', 'utm_medium' => 'rss', 'utm_campaign' => SpoonFilter::urlise($title))), $description, $items);
// set feed properties
$this->setLanguage(FRONTEND_LANGUAGE);
$this->setCopyright(SpoonDate::getDate('Y') . ' ' . SpoonFilter::htmlspecialcharsDecode(FrontendModel::getModuleSetting('core', 'site_title_' . FRONTEND_LANGUAGE)));
$this->setGenerator(SITE_RSS_GENERATOR);
$this->setImage(SITE_URL . FRONTEND_CORE_URL . '/layout/images/rss_image.png', $title, $link);
// theme was set
if (FrontendModel::getModuleSetting('core', 'theme', null) != null) {
// theme name
$theme = FrontendModel::getModuleSetting('core', 'theme', null);
// theme rss image exists
if (SpoonFile::exists(PATH_WWW . '/frontend/themes/' . $theme . '/core/images/rss_image.png')) {
// set rss image
$this->setImage(SITE_URL . '/frontend/themes/' . $theme . '/core/images/rss_image.png', $title, $link);
}
}
}
示例14: parse
public function parse()
{
// more matches to be found than?
if ($this->pagination['num_items'] > count($this->items)) {
// remove last result (to add this reference)
array_pop($this->items);
// add reference to full search results page
$this->items[] = array('title' => FL::lbl('More'), 'text' => FL::msg('MoreResults'), 'full_url' => FrontendNavigation::getURLForBlock('search') . '?form=search&q=' . $this->term);
}
// format data
foreach ($this->items as &$item) {
// full url is set?
if (!isset($item['full_url'])) {
continue;
}
// build utm array
$utm['utm_source'] = SpoonFilter::urlise(FrontendModel::getModuleSetting('core', 'site_title_' . FRONTEND_LANGUAGE, SITE_DEFAULT_TITLE));
$utm['utm_medium'] = 'fork-search';
$utm['utm_term'] = $this->term;
// get parameters in url already
if (strpos($item['full_url'], '?') !== false) {
$glue = '&';
} else {
$glue = '?';
}
// add utm to url
$item['full_url'] .= $glue . http_build_query($utm, '', '&');
// format description
$item['text'] = !empty($item['text']) ? mb_strlen($item['text']) > $this->length ? mb_substr(strip_tags($item['text']), 0, $this->length, SPOON_CHARSET) . '…' : $item['text'] : '';
}
// output
$this->output(self::OK, $this->items);
}
示例15: getClientID
/**
* Returns the client ID from the settings
*
* @return string
*/
public static function getClientID()
{
return (string) FrontendModel::getModuleSetting('mailmotor', 'cm_client_id');
}