本文整理汇总了PHP中F0FPlatform类的典型用法代码示例。如果您正苦于以下问题:PHP F0FPlatform类的具体用法?PHP F0FPlatform怎么用?PHP F0FPlatform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了F0FPlatform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptions
/**
* Create objects for the options
*
* @return array The array of option objects
*/
protected function getOptions()
{
$options = array();
// Initialize some field attributes.
$key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
$value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
$translate = $this->element['translate'] ? (string) $this->element['translate'] : false;
$query = (string) $this->element['query'];
// Get the database object.
$db = F0FPlatform::getInstance()->getDbo();
// Set the query and get the result list.
$db->setQuery($query);
$items = $db->loadObjectlist();
// Build the field options.
if (!empty($items)) {
foreach ($items as $item) {
if ($translate == true) {
$options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value}));
} else {
$options[] = JHtml::_('select.option', $item->{$key}, $item->{$value});
}
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例2: isEnabled
/**
* Is this feature enabled?
*
* @return bool
*/
public function isEnabled()
{
if (!F0FPlatform::getInstance()->isFrontend()) {
return false;
}
return $this->cparams->getValue('urlredirection', 1) == 1;
}
示例3: isAdminAccessAttempt
/**
* Checks if a non logged in user is trying to access the administrator application
*
* @param bool $onlySubmit bool Return true only if the login form is submitted
*
* @return bool
*/
protected function isAdminAccessAttempt($onlySubmit = false)
{
// Not back-end at all. Bail out.
if (!F0FPlatform::getInstance()->isBackend()) {
return false;
}
// If the user is already logged in we don't have a login attempt
$user = JFactory::getUser();
if (!$user->guest) {
return false;
}
// If we have option=com_login&task=login then the user is submitting the login form. Otherwise Joomla! is
// just displaying the login form.
$input = JFactory::getApplication()->input;
$option = $input->getCmd('option', null);
$task = $input->getCmd('task', null);
$isPostingLoginForm = $option == 'com_login' && $task == 'login';
// If the user is submitting the login form we return depending on whether we are asked for posting access
// or not.
if ($isPostingLoginForm) {
return $onlySubmit;
}
// This is a regular admin access attempt
if ($onlySubmit) {
// Since we were asked to only return true for login form posting and this is not the case we have to
// return false (the login form is not being posted)
return false;
}
// In any other case we return true.
return true;
}
示例4: isEnabled
/**
* Is this feature enabled?
*
* @return bool
*/
public function isEnabled()
{
// We only use this feature in the front-end
if (F0FPlatform::getInstance()->isBackend())
{
return false;
}
// The feature must be enabled
if ($this->cparams->getValue('httpsizer', 0) != 1)
{
return false;
}
// Make sure we're accessed over SSL (HTTPS)
$uri = JURI::getInstance();
$protocol = $uri->toString(array('scheme'));
if ($protocol != 'https://')
{
return false;
}
return true;
}
示例5: isEnabled
/**
* Is this feature enabled?
*
* @return bool
*/
public function isEnabled()
{
if (!F0FPlatform::getInstance()->isFrontend()) {
return false;
}
return $this->cparams->getValue('httpblenable', 0) == 1;
}
示例6: onCreate
public function onCreate($tpl = null)
{
$document = F0FPlatform::getInstance()->getDocument();
if ($document instanceof JDocument) {
if ($this->useHypermedia) {
$document->setMimeEncoding('application/hal+json');
} else {
$document->setMimeEncoding('application/json');
}
}
$key = $this->input->getCmd('key', '');
$pwd = $this->input->getCmd('pwd', '');
$json = $this->getModel()->createCoupon($key, $pwd);
$json = json_encode($json);
// JSONP support
$callback = $this->input->get('callback', null);
if (!empty($callback)) {
echo $callback . '(' . $json . ')';
} else {
$defaultName = $this->input->getCmd('view', 'joomla');
$filename = $this->input->getCmd('basename', $defaultName);
$document->setName($filename);
echo $json;
}
return false;
}
示例7: isEnabled
/**
* Is this feature enabled?
*
* @return bool
*/
public function isEnabled()
{
if (!F0FPlatform::getInstance()->isFrontend()) {
return false;
}
return $this->cparams->getValue('custgenerator', 0) != 0;
}
示例8: isEnabled
/**
* Is this feature enabled?
*
* @return bool
*/
public function isEnabled()
{
if (!F0FPlatform::getInstance()->isBackend()) {
return false;
}
return $this->cparams->getValue('nonewadmins', 0) == 1;
}
示例9: cron
public function cron($cachable = false)
{
// Makes sure SiteGround's SuperCache doesn't cache the CRON view
JResponse::setHeader('X-Cache-Control', 'False', true);
require_once F0FTemplateUtils::parsePath('admin://components/com_akeebasubs/helpers/cparams.php', true);
$configuredSecret = AkeebasubsHelperCparams::getParam('secret', '');
if (empty($configuredSecret)) {
header('HTTP/1.1 503 Service unavailable due to configuration');
JFactory::getApplication()->close();
}
$secret = $this->input->get('secret', null, 'raw');
if ($secret != $configuredSecret) {
header('HTTP/1.1 403 Forbidden');
JFactory::getApplication()->close();
}
$command = $this->input->get('command', null, 'raw');
$command = trim(strtolower($command));
if (empty($command)) {
header('HTTP/1.1 501 Not implemented');
JFactory::getApplication()->close();
}
F0FPlatform::getInstance()->importPlugin('system');
F0FPlatform::getInstance()->runPlugins('onAkeebasubsCronTask', array($command, array('time_limit' => 10)));
echo "{$command} OK";
JFactory::getApplication()->close();
}
示例10: isEnabled
/**
* Is this feature enabled?
*
* @return bool
*/
public function isEnabled()
{
// We only use this feature in the front-end
if (F0FPlatform::getInstance()->isBackend())
{
return false;
}
// The feature must be enabled
if ($this->cparams->getValue('linkmigration', 0) != 1)
{
return false;
}
// Populate the old domains array
$this->populateOldDomains();
// If there are no old domains to migrate from, what exactly am I doing here?
if (empty($this->oldDomains))
{
return false;
}
return true;
}
示例11: isEnabled
/**
* Is this feature enabled?
*
* @return bool
*/
public function isEnabled()
{
if (!F0FPlatform::getInstance()->isBackend()) {
return false;
}
$password = $this->cparams->getValue('adminpw', '');
return !empty($password);
}
示例12: getForm
/**
* A method for getting the form from the model.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @param boolean $source The name of the form. If not set we'll try the form_name state variable or fall back to default.
*
* @return mixed A F0FForm object on success, false on failure
*/
public function getForm($data = array(), $loadData = true, $source = null)
{
$f0fPlatform = F0FPlatform::getInstance();
$isFrontend = $f0fPlatform->isFrontend();
$this->input->set('option', 'com_content');
$this->input->set('view', $isFrontend ? 'form' : 'article');
return parent::getForm($data, $loadData, $source);
}
示例13: getOptions
/**
* Method to get a list of tags
*
* @return array The field option objects.
*
* @since 3.1
*/
protected function getOptions()
{
$options = array();
$published = $this->element['published'] ? $this->element['published'] : array(0, 1);
$db = F0FPlatform::getInstance()->getDbo();
$query = $db->getQuery(true)->select('a.id AS value, a.path, a.title AS text, a.level, a.published')->from('#__tags AS a')->join('LEFT', $db->quoteName('#__tags') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
if ($this->item instanceof F0FTable) {
$item = $this->item;
} else {
$item = $this->form->getModel()->getItem();
}
if ($item instanceof F0FTable) {
// Fake value for selected tags
$keyfield = $item->getKeyName();
$content_id = $item->{$keyfield};
$type = $item->getContentType();
$selected_query = $db->getQuery(true);
$selected_query->select('tag_id')->from('#__contentitem_tag_map')->where('content_item_id = ' . (int) $content_id)->where('type_alias = ' . $db->quote($type));
$db->setQuery($selected_query);
$this->value = $db->loadColumn();
}
// Ajax tag only loads assigned values
if (!$this->isNested()) {
// Only item assigned values
$values = (array) $this->value;
F0FUtilsArray::toInteger($values);
$query->where('a.id IN (' . implode(',', $values) . ')');
}
// Filter language
if (!empty($this->element['language'])) {
$query->where('a.language = ' . $db->quote($this->element['language']));
}
$query->where($db->quoteName('a.alias') . ' <> ' . $db->quote('root'));
// Filter to only load active items
// Filter on the published state
if (is_numeric($published)) {
$query->where('a.published = ' . (int) $published);
} elseif (is_array($published)) {
F0FUtilsArray::toInteger($published);
$query->where('a.published IN (' . implode(',', $published) . ')');
}
$query->group('a.id, a.title, a.level, a.lft, a.rgt, a.parent_id, a.published, a.path')->order('a.lft ASC');
// Get the options.
$db->setQuery($query);
try {
$options = $db->loadObjectList();
} catch (RuntimeException $e) {
return false;
}
// Prepare nested data
if ($this->isNested()) {
$this->prepareOptionsNested($options);
} else {
$options = JHelperTags::convertPathsToNames($options);
}
return $options;
}
示例14: isEnabled
/**
* Is this feature enabled?
*
* @return bool
*/
public function isEnabled()
{
if (!F0FPlatform::getInstance()->isBackend()) {
return false;
}
if (!$this->cparams->getValue('awayschedule_from') || !$this->cparams->getValue('awayschedule_to')) {
return false;
}
return true;
}
示例15: isEnabled
/**
* Is this feature enabled?
*
* @return bool
*/
public function isEnabled()
{
if (!F0FPlatform::getInstance()->isFrontend()) {
return false;
}
if ($this->skipFiltering) {
return false;
}
return $this->cparams->getValue('xssshield', 0) == 1;
}