本文整理汇总了PHP中Fox::getPreference方法的典型用法代码示例。如果您正苦于以下问题:PHP Fox::getPreference方法的具体用法?PHP Fox::getPreference怎么用?PHP Fox::getPreference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fox
的用法示例。
在下文中一共展示了Fox::getPreference方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reply
/**
* Send reply to contact request
*
* @param string $replyMessage
*/
public function reply($replyMessage)
{
$this->setStatus(Fox_Contact_Model_Contact::STATUS_REPLIED);
$this->save();
$modelTemplate = Fox::getModel('core/email/template');
$modelTemplate->sendTemplateMail(Fox::getPreference('contact/reply/email_template'), $this->getEmail(), array('sender_email' => Fox::getPreference('contact/reply/email'), 'sender_name' => Fox::getPreference('contact/reply/name')), array('name' => $this->getName(), 'subject' => $this->getSubject(), 'message' => $this->getMessage(), 'reply' => $replyMessage));
}
示例2: getMenu
/**
* Get menu html
*
* @param string $key Menu group key
* @return string
*/
public function getMenu($key)
{
$menuHTML = '';
$cacheSettings = Uni_Core_CacheManager::loadCacheSettings();
$isCacheEnabled = isset($cacheSettings[Fox_Core_Model_Cache::CACHE_CODE_LAYOUT]) ? $cacheSettings[Fox_Core_Model_Cache::CACHE_CODE_LAYOUT] : FALSE;
$package = Fox::getPreference(Uni_Controller_Action::MODE_ADMIN . '/package');
$theme = Fox::getPreference(Uni_Controller_Action::MODE_ADMIN . '/theme');
$cacheMenuBasePath = CACHE_DIR . DIRECTORY_SEPARATOR . Fox_Core_Model_Cache::CACHE_CODE_LAYOUT . DIRECTORY_SEPARATOR . Uni_Controller_Action::MODE_WEB . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . self::CACHE_MENU_FOLDER;
file_exists($cacheMenuBasePath) && is_dir($cacheMenuBasePath) || mkdir($cacheMenuBasePath, 0777, TRUE);
$cacheMenuPath = $cacheMenuBasePath . DIRECTORY_SEPARATOR . $key . '.menu';
if ($isCacheEnabled && file_exists($cacheMenuPath)) {
$cacheMenuDoc = new DOMDocument();
$cacheMenuDoc->loadHTMLFile($cacheMenuPath);
$menuHTML = $cacheMenuDoc->saveXML();
unset($cacheMenuDoc);
} else {
$menuGroupModel = Fox::getModel('navigation/menugroup');
$menuGroupModel->load($key, 'key');
if ($menuGroupModel->getId() && $menuGroupModel->getStatus() == Fox_Navigation_Model_Menugroup::STATUS_ENABLED) {
$menuModel = Fox::getModel('navigation/menu');
$menuList = $menuModel->getMenuItemsByGroup($key);
$mnuDoc = new DOMDocument();
$mnuDoc->formatOutput = true;
$mnuRoot = NULL;
if (count($menuList)) {
$mnuRoot = Uni_Data_XDOMDocument::createNode(self::ROOT_TAG, array('class' => 'menu_container'), $mnuDoc);
$mnuDoc->appendChild($mnuRoot);
foreach ($menuList as $menu) {
$node = Uni_Data_XDOMDocument::createNode(self::LEAF_TAG, array('class' => 'menu_nav' . ($menu['style_class'] ? ' ' . $menu['style_class'] : '')), $mnuDoc);
if (strpos($menu['link'], 'http://', 0) === 0 || strpos($menu['link'], 'https://', 0) === 0) {
$link = $menu['link'];
} else {
$link = Fox::getUrl($menu['link']);
}
$link = Uni_Data_XDOMDocument::createNode('a', array('href' => $link, 'target' => $menu['open_window'], 'class' => $menu['style_class']), $mnuDoc);
$link->appendChild($mnuDoc->createTextNode($menu['title']));
$node->appendChild($link);
$mnuRoot->appendChild($node);
}
}
if (isset($mnuDoc)) {
$menuHTML = $mnuDoc->saveXML($mnuRoot);
if ($isCacheEnabled) {
$mnuDoc->saveHTMLFile($cacheMenuPath);
@chmod($cacheMenuPath, 0777);
}
}
unset($mnuDoc);
}
}
return $menuHTML;
}
示例3: isReliableStability
/**
* Check stability is reliable
*
* @return boolean
*/
private function isReliableStability()
{
$packageInfo = $this->getViewOptions('package');
if (isset($packageInfo['stability']) && $packageInfo['stability']) {
if ($packageInfo['stability'] >= Fox::getPreference('extensionmanager/downloader/preferred_state')) {
return true;
} else {
$this->messages[] = "This extension is under " . Fox::getModel('extensionmanager/package/state')->getOptionText($packageInfo['stability']) . " state";
}
} else {
$this->messages[] = "Unknown stability";
}
return false;
}
示例4: loadLayout
/**
* Loads layout for current module, controller, action.
*
* @param string $layoutUpdate
* @param string $updateKey
*
* @return Uni_Core_LayoutManager
*/
public function loadLayout($layoutUpdate = NULL, $updateKey = NULL)
{
if (NULL == $this->layout) {
$request = $this->getRequest();
$package = 'core';
$theme = 'default';
if ($this->appMode != self::MODE_INSTALL) {
$package = Fox::getPreference($this->appMode . '/design/package');
$theme = Fox::getPreference($this->appMode . '/design/theme');
}
$this->layout = new Uni_Core_LayoutManager($this->getFrontController()->getBaseUrl(), $request->getModuleName(), $request->getControllerName(), $request->getActionName(), $this->appMode, $package, $theme);
$this->layout->load($layoutUpdate, $updateKey);
}
return $this->layout;
}
示例5: subscribeAction
/**
* Subscribe action
*/
function subscribeAction()
{
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
$subscriberModel = Fox::getModel('newsletter/subscriber');
try {
$subscriberModel->subscribe($data);
if (Fox::getPreference('newsletter/subscription/need_to_confirm')) {
Fox::getHelper('core/message')->setInfo('Confirmation request has been sent to your email.');
} else {
Fox::getHelper('core/message')->setInfo('Thank you for your subscription.');
}
} catch (Exception $e) {
Fox::getHelper('core/message')->setError('There was a problem with the subscription.');
}
}
$this->redirectReferer();
}
示例6: indexAction
/**
* Index action
*/
public function indexAction()
{
if ($this->getRequest()->isPost()) {
try {
$data = $this->getRequest()->getPost();
$model = Fox::getModel('contact/contact');
$data['status'] = Fox_Contact_Model_Contact::STATUS_UNREAD;
$data['contact_date'] = Fox_Core_Model_Date::getCurrentDate('Y-m-d H:i:s');
$model->setData($data);
$model->save();
try {
Fox::getHelper('core/message')->setInfo("Your request was successfully sent.");
$modelTemplate = Fox::getModel('core/email/template');
$modelTemplate->sendTemplateMail(Fox::getPreference('contact/receiver/email_template'), Fox::getPreference('contact/receiver/email'), array('sender_name' => $data['name'], 'sender_email' => $data['email']), $data);
} catch (Exception $e) {
}
} catch (Exception $e) {
Fox::getHelper('core/message')->setError($e->getMessage());
}
}
$this->loadLayout();
$this->renderLayout();
}
示例7: isExceptionPrintingEnabled
/**
* Retrieve exception printing status
*
* @return int Returns 1 if exception printing is enabled
*/
function isExceptionPrintingEnabled()
{
return Fox::getPreference('core/debug/exception_printing');
}
示例8: getMemberSessionInterval
/**
* Retrieve member session timeout interval in seconds
*
* @return int
*/
public static function getMemberSessionInterval()
{
$sessionInterval = Fox::getPreference('member/login/online_minutes_interval');
return $sessionInterval > 0 ? $sessionInterval * 60 : self::$defaultMemberSessionInterval;
}
示例9: sendTemplateMail
/**
* Send template email
*
* @param int $templateId Template id
* @param string $to Recipient email
* @param mixed $sender array|string
* @param array $vars Template variables
* @param array $bcc Bcc email ids
* @throws Exception if template not found
*/
public function sendTemplateMail($templateId, $to, $sender, $vars = array(), $bcc = array())
{
$this->load($templateId);
if (!$this->getId()) {
throw new Exception('Email template was not found.');
}
if (!is_array($sender)) {
$senderName = Fox::getPreference('website_email_addresses/' . $sender . '/sender_name');
$senderEmail = Fox::getPreference('website_email_addresses/' . $sender . '/sender_email');
} else {
$senderName = isset($sender['sender_name']) ? $sender['sender_name'] : '';
$senderEmail = isset($sender['sender_email']) ? $sender['sender_email'] : '';
}
$subject = $this->getParsedContent($this->getSubject(), $vars);
$body = $this->getParsedContent($this->getContent(), $vars);
$mail = new Zend_Mail();
$mail->addHeader('MIME-Version', '1.0');
$mail->addHeader('Content-Transfer-Encoding', '8bit');
$mail->addHeader('X-Mailer:', 'PHP/' . phpversion());
$mail->addHeader("From ", $senderEmail);
$mail->setSubject($subject);
$mail->setBodyHtml($body);
$mail->setFrom($senderEmail, $senderName);
$mail->addTo($to);
if (!empty($bcc)) {
foreach ($bcc as $email) {
$mail->addBcc($email);
}
}
$mail->send();
}
示例10: sendPasswordChangedMail
/**
* Send password changed email
*
* @param array $vars Email template parameters
*/
public function sendPasswordChangedMail($password)
{
try {
$sender = Fox::getPreference('member/password/email_sender');
$template = Fox::getPreference('member/password/change_password_email');
$modelTemplate = Fox::getModel('core/email/template');
$vars = array('name' => $this->getFirstName(), 'email' => $this->getEmailId(), 'password' => $password);
$modelTemplate->sendTemplateMail($template, $this->getEmailId(), $sender, $vars);
} catch (Exception $e) {
}
}
示例11: getWebsiteAddress
/**
* Get website address
*
* @return string
*/
public static function getWebsiteAddress()
{
return Fox::getPreference('general/website/address');
}
示例12: forgetPasswordAction
/**
* Forget password action
*
* Sends an email with link to user which redirects to change password interface
*/
public function forgetPasswordAction()
{
if (Fox::getModel('admin/session')->getLoginData()) {
$this->sendRedirect('*/dashboard/');
}
if ($this->getRequest()->isPost()) {
try {
$data = $this->getRequest()->getPost();
$model = Fox::getModel('admin/user');
$model->load($data['username'], 'username');
if ($model->getId()) {
$code = strtolower(substr(md5(time() * mt_rand()), 0, 20));
$modelSetCode = Fox::getModel('admin/forgetPassword');
$modelSetCode->load($model->getId(), 'user_id');
$modelSetCode->setUserId($model->getId());
$modelSetCode->setCode($code);
$modelSetCode->setCreatedOn(Fox_Core_Model_Date::getCurrentDate('Y-m-d H:i:s'));
$modelSetCode->save();
Fox::getHelper('core/message')->setInfo('Change Password link has been sent to your email id.');
try {
$modelTemplate = Fox::getModel('core/email/template');
$sender = Fox::getPreference('admin/password/forgot_email_sender');
$template = Fox::getPreference('admin/password/forgot_email_template');
$modelTemplate->sendTemplateMail($template, $model->getEmail(), $sender, array('name' => $model->getFirstname(), 'link' => Fox::getUrl('*/*/change-password', array('user_id' => $model->getId(), 'code' => $code))));
} catch (Exception $e) {
}
$this->sendRedirect('*/*/');
} else {
throw new Exception('Invalid username was given.');
}
} catch (Exception $e) {
Fox::getHelper('core/message')->setError($e->getMessage());
}
}
$this->loadLayout();
$this->renderLayout();
}
示例13: isChartEnabled
/**
* Retrieves whether the chart is enabled
*
* @return boolean
*/
public function isChartEnabled()
{
return Fox::getPreference('admin/analytics/enable_charts');
}
示例14: setTemplate
/**
* Sets template for rendering of view
*
* @param string $template
* @return void
*/
public function setTemplate($template)
{
$package = Fox::getPreference(Fox::getMode() . '/design/package');
$theme = Fox::getPreference(Fox::getMode() . '/design/theme');
$sPath = $this->viewBase . $package . DS . $theme . DS . 'template';
if (!file_exists($sPath . DS . $template . self::VIEW_SUFFIX)) {
$sPath = $this->defaultScriptPath;
}
parent::setScriptPath($sPath);
$this->template = $template;
}
示例15: getFavicon
/**
* Get favicon image path
*
* @return string
*/
public function getFavicon()
{
$imgName = Fox::getPreference('web/head/favicon_image');
if ($imgName && file_exists(Fox::getUploadDirectoryPath() . DIRECTORY_SEPARATOR . Fox_Core_Model_Preference::CORE_UPLOAD_FOLDER . DIRECTORY_SEPARATOR . $imgName)) {
return Fox::getUploadDirectoryUrl() . '/' . Fox_Core_Model_Preference::CORE_UPLOAD_FOLDER . '/' . $imgName;
} else {
return $this->themeUrl('images/default_favicon.ico');
}
}