本文整理汇总了PHP中JFactory类的典型用法代码示例。如果您正苦于以下问题:PHP JFactory类的具体用法?PHP JFactory怎么用?PHP JFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: save
function save()
{
$mainframe =& JFactory::getApplication();
$row =& JTable::getInstance('K2UserGroup', 'Table');
if (!$row->bind(JRequest::get('post'))) {
$mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error');
}
if (!$row->check()) {
$mainframe->redirect('index.php?option=com_k2&view=userGroup&cid=' . $row->id, $row->getError(), 'error');
}
if (!$row->store()) {
$mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error');
}
$cache =& JFactory::getCache('com_k2');
$cache->clean();
switch (JRequest::getCmd('task')) {
case 'apply':
$msg = JText::_('Changes to User Group saved');
$link = 'index.php?option=com_k2&view=userGroup&cid=' . $row->id;
break;
case 'save':
default:
$msg = JText::_('User Group Saved');
$link = 'index.php?option=com_k2&view=userGroups';
break;
}
$mainframe->redirect($link, $msg);
}
开发者ID:navinpai,项目名称:GEC-Tandav,代码行数:28,代码来源:usergroup.php
示例2: addToolbar
/**
* Add the page title and toolbar.
*/
protected function addToolbar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
if (isset($this->item->checked_out)) {
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
} else {
$checkedOut = false;
}
$canDo = SomosmaestrosHelper::getActions();
JToolBarHelper::title(JText::_('COM_SOMOSMAESTROS_TITLE_FORMACION'), 'formacion.png');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
JToolBarHelper::apply('formacion.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('formacion.save', 'JTOOLBAR_SAVE');
}
if (!$checkedOut && $canDo->get('core.create')) {
JToolBarHelper::custom('formacion.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::custom('formacion.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('formacion.cancel', 'JTOOLBAR_CANCEL');
} else {
JToolBarHelper::cancel('formacion.cancel', 'JTOOLBAR_CLOSE');
}
}
开发者ID:emeraldstudio,项目名称:somosmaestros,代码行数:33,代码来源:view.html.php
示例3: getInput
protected function getInput()
{
if (!NNFrameworkFunctions::extensionInstalled('virtuemart')) {
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
}
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$group = $this->get('group', 'categories');
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'virtuemart_' . $group, $tables)) {
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
}
$parameters = NNParameters::getInstance();
$params = $parameters->getPluginParams('nnframework');
$this->max_list_count = $params->max_list_count;
if (!is_array($this->value)) {
$this->value = explode(',', $this->value);
}
$options = $this->{'get' . $group}();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
if ($group == 'categories') {
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
}
$attr = '';
$attr .= ' size="' . (int) $size . '"';
$attr .= $multiple ? ' multiple="multiple"' : '';
return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
}
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:30,代码来源:virtuemart.php
示例4: _canonicalizeSlug
/**
* Make sure the slug is unique
*
* This function checks if the slug already exists and if so appends a number to the slug to make it unique. The
* slug will get the form of slug-x.
*
* If the slug is empty it returns the current date in the format Y-m-d-H-i-s
*
* @return void
*/
protected function _canonicalizeSlug()
{
if (trim(str_replace($this->_separator, '', $this->slug)) == '') {
$this->slug = JFactory::getDate()->format('Y-m-d-H-i-s');
}
parent::_canonicalizeSlug();
}
开发者ID:daodaoliang,项目名称:nooku-framework,代码行数:17,代码来源:sluggable.php
示例5: delete
public function delete()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// Get items to remove from the request.
$cid = JFactory::getApplication()->input->get('cid', array(), 'array');
if (!is_array($cid) || count($cid) < 1) {
JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror');
} else {
// Get the model.
$model = $this->getModel();
// Make sure the item ids are integers
jimport('joomla.utilities.arrayhelper');
JArrayHelper::toInteger($cid);
// Remove the items.
if ($model->delete($cid)) {
$this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
} else {
$this->setMessage($model->getError());
}
}
$version = new JVersion();
if ($version->isCompatible('3.0')) {
// Invoke the postDelete method to allow for the child class to access the model.
$this->postDeleteHook($model, $cid);
}
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
}
开发者ID:AndreKoepke,项目名称:Einsatzkomponente,代码行数:28,代码来源:alarmierungsarten.php
示例6: akeebaACLCheck
/**
* Do our custom ACL checks for the back-end views
*
* @return boolean
*/
private function akeebaACLCheck()
{
// Get the view
$view = $this->input->getCmd('view', '');
// Fetch the privilege to check, or use the default (akeeba.configure)
// privilege.
if (array_key_exists($view, self::$viewACLMap)) {
$privilege = self::$viewACLMap[$view];
} else {
$privilege = 'akeeba.configure';
}
// If an empty privileve is defined do not do any ACL check
if (empty($privilege)) {
return true;
}
// Throw an error if we are not allowed access to the view
if (!JFactory::getUser()->authorise($privilege, 'com_akeeba')) {
$this->setRedirect('index.php?option=com_akeeba&view=cpanel');
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
$this->redirect();
return false;
} else {
return true;
}
}
开发者ID:jvhost,项目名称:A-Website,代码行数:30,代码来源:default.php
示例7: addToolbar
/**
* Add the page title and toolbar.
*/
protected function addToolbar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = SibdietHelper::getActions();
JToolBarHelper::title(JText::_('COM_SIBDIET_MANAGER_ERRAND'), 'database errands');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
JToolBarHelper::apply('errand.apply');
JToolBarHelper::save('errand.save');
}
if (!$checkedOut && $canDo->get('core.create')) {
JToolbarHelper::save2new('errand.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolbarHelper::save2copy('errand.save2copy');
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('errand.cancel');
} else {
JToolBarHelper::cancel('errand.cancel', 'JTOOLBAR_CLOSE');
}
}
开发者ID:smhnaji,项目名称:sdnet,代码行数:29,代码来源:view.html.php
示例8: display
function display($tpl = null)
{
JToolBarHelper::title(JText::_('COM_REDSOCIALSTREAM_CONFIGURE'), 'configure.png');
JToolBarHelper::apply();
JToolBarHelper::cancel('cancel', 'COM_REDSOCIALSTREAM_CLOSE');
//DEVNOTE: set document title
$document = JFactory::getDocument();
$document->setTitle(JText::_('COM_REDSOCIALSTREAM_REDSOCIALSTREAMS'));
$mainframe = JFactory::getApplication();
$context = "config";
$model = $this->getModel('configure');
$db = JFactory::getDbo();
$q = "SELECT * FROM #__redsocialstream_settings";
$db->setQuery($q);
$this->settingsrows = $db->loadObjectList();
$typelist = $this->get('type_list_sorted');
$pagination = $this->get('Pagination');
//DEVNOTE:give me ordering from request
$filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'ordering');
$filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
$this->assignRef('lists', $lists);
$this->assignRef("typelist", $typelist);
$this->assignRef('pagination', $pagination);
parent::display($tpl);
}
开发者ID:prox91,项目名称:joomla-dev,代码行数:25,代码来源:view.html.php
示例9: getInput
/**
* Method to get the field input markup for a generic list.
* Use the multiple attribute to enable multiselect.
*
* @return string The field input markup.
*
* @since 11.1
*/
protected function getInput()
{
$document = JFactory::getDocument();
$jsPath = JURI::root(true) . '/modules/mod_currentdatetime/js';
$joomlaVersion = new JVersion();
if ($joomlaVersion->isCompatible('3')) {
JHtml::_('jquery.ui', array('core', 'sortable'));
} else {
$document->addStyleSheet($jsPath . '/25/css/chosen.min.css');
$document->addScript($jsPath . '/25/jquery.min.js');
$document->addScript($jsPath . '/25/jquery-noconflict.js');
$document->addScript($jsPath . '/25/chosen.jquery.min.js');
$document->addScript($jsPath . '/25/jquery.ui.core.min.js');
$document->addScript($jsPath . '/25/jquery.ui.widget.min.js');
$document->addScript($jsPath . '/25/jquery.ui.mouse.min.js');
$document->addScript($jsPath . '/25/jquery.ui.sortable.min.js');
}
$document->addScript($jsPath . '/jquery-chosen-sortable.min.js');
$script = 'jQuery(function(){jQuery(".chzn-sortable").chosen().chosenSortable();});';
$document->addScriptDeclaration($script);
if (!is_array($this->value)) {
$this->value = explode(',', $this->value);
}
$html = parent::getInput();
return $html;
}
开发者ID:abdullah929,项目名称:bulletin,代码行数:34,代码来源:items.php
示例10: saveOrder
public function saveOrder($pks = array(), $lft = array())
{
JPluginHelper::importPlugin('cck_storage_location');
if (!count($pks)) {
return false;
}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('a.id, a.pk, a.storage_location, b.id AS type_id')->from('#__cck_core AS a')->join('LEFT', '#__cck_core_types AS b ON b.name = a.cck')->where('a.id IN (' . implode(',', $pks) . ')');
$db->setQuery($query);
$results = $db->loadAssocList('id');
if (!empty($results)) {
$ids = array();
$location = null;
$user = JCck::getUser();
$user_id = $user->get('id');
foreach ($pks as $i => $pk) {
$canEdit = $user->authorise('core.edit', 'com_cck.form.' . $results[$pk]['type_id']);
$canEditOwn = $user->authorise('core.edit.own', 'com_cck.form.' . $results[$pk]['type_id']);
// Check Permissions
if (!($canEdit && $canEditOwn || $canEdit && !$canEditOwn && $results[$pk]['author_id'] != $user_id || $canEditOwn && $results[$pk]['author_id'] == $user_id)) {
unset($lft[$i]);
continue;
}
$ids[] = $results[$pk]['pk'];
if (null === $location) {
$location = $results[$pk]['storage_location'];
}
}
if ($location && count($ids)) {
return JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'onCCK_Storage_LocationSaveOrder', array($ids, $lft));
}
}
return false;
}
开发者ID:hamby,项目名称:SEBLOD,代码行数:35,代码来源:list.php
示例11: getObjectOwner
function getObjectOwner($id)
{
$db =& JFactory::getDBO();
$db->setQuery('SELECT created_by, id FROM #__jcp_polls WHERE id = ' . $id);
$userid = $db->loadResult();
return $userid;
}
开发者ID:omarmm,项目名称:MangLuoiBDS,代码行数:7,代码来源:com_communitypolls.plugin.php
示例12: delete
public function delete()
{
// Get items to remove from the request and reverse the order to delete child albums first
$cid = JFactory::getApplication()->input->get('cid', array(), 'array');
JFactory::getApplication()->input->set('cid', array_reverse($cid));
parent::delete();
}
开发者ID:chaudhary4k4,项目名称:modernstore,代码行数:7,代码来源:categories.php
示例13: __construct
/**
* Constructor.
*
* @param Registry $options JOAuth2Client options object
* @param JHttp $http The HTTP client object
* @param JInput $input The input object
* @param JApplicationWeb $application The application object
*
* @since 12.3
*/
public function __construct(Registry $options = null, JHttp $http = null, JInput $input = null, JApplicationWeb $application = null)
{
$this->options = isset($options) ? $options : new Registry();
$this->http = isset($http) ? $http : new JHttp($this->options);
$this->input = isset($input) ? $input : JFactory::getApplication()->input;
$this->application = isset($application) ? $application : new JApplicationWeb();
}
开发者ID:deenison,项目名称:joomla-cms,代码行数:17,代码来源:client.php
示例14: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = NewsfeedsHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
JToolBarHelper::title(JText::_('COM_NEWSFEEDS_MANAGER_NEWSFEED'), 'newsfeeds.png');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)) {
JToolBarHelper::apply('newsfeed.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('newsfeed.save', 'JTOOLBAR_SAVE');
}
if (!$checkedOut && count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) {
JToolBarHelper::custom('newsfeed.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::custom('newsfeed.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('newsfeed.cancel', 'JTOOLBAR_CANCEL');
} else {
JToolBarHelper::cancel('newsfeed.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS_EDIT');
}
开发者ID:akksi,项目名称:jcg,代码行数:33,代码来源:view.html.php
示例15: allowEdit
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 1.6
*/
protected function allowEdit($data = array(), $key = 'id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$user = JFactory::getUser();
$userId = $user->get('id');
// If we get a deny at the component level, we cannot override here.
if (!parent::allowEdit($data, $key)) {
return false;
}
// Check general edit permission first.
if ($user->authorise('core.edit', 'com_content.article.' . $recordId)) {
return true;
}
// Fallback on edit.own.
// First test if the permission is available.
if ($user->authorise('core.edit.own', 'com_content.article.' . $recordId)) {
// Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId) && $recordId) {
// Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId);
if (empty($record)) {
return false;
}
$ownerId = $record->created_by;
}
// If the owner matches 'me' then permission is granted.
if ($ownerId == $userId) {
return true;
}
}
return false;
}
开发者ID:adjaika,项目名称:J3Base,代码行数:43,代码来源:article.php
示例16: display
function display($map, $values, $type = 'discount')
{
$id = $type . '_' . $map;
$js = 'window.hikashop.ready( function(){ updateSubscription(\'' . $id . '\'); });';
if (!HIKASHOP_PHP5) {
$doc =& JFactory::getDocument();
} else {
$doc = JFactory::getDocument();
}
$doc->addScriptDeclaration($js);
if (empty($values)) {
$values = 'none';
}
$choiceValue = $values == 'none' ? $values : 'special';
$return = JHTML::_('hikaselect.radiolist', $this->choice, "choice_" . $id, 'onchange="updateSubscription(\'' . $id . '\');"', 'value', 'text', $choiceValue);
$return .= '<input type="hidden" name="data[' . $type . '][' . $map . ']" id="hidden_' . $id . '" value="' . $values . '"/>';
$valuesArray = explode(',', $values);
$listAccess = '<div style="display:none" id="div_' . $id . '"><table>';
foreach ($this->groups as $oneGroup) {
$listAccess .= '<tr><td>';
if (version_compare(JVERSION, '1.6.0', '>=') || !in_array($oneGroup->value, array(29, 30))) {
$listAccess .= '<input type="radio" onchange="updateSubscription(\'' . $id . '\');" value="' . $oneGroup->value . '" ' . (in_array($oneGroup->value, $valuesArray) ? 'checked' : '') . ' name="special_' . $id . '" id="special_' . $id . '_' . $oneGroup->value . '"/>';
}
$listAccess .= '</td><td><label for="special_' . $id . '_' . $oneGroup->value . '">' . $oneGroup->text . '</label></td></tr>';
}
$listAccess .= '</table></div>';
$return .= $listAccess;
return $return;
}
开发者ID:q0821,项目名称:esportshop,代码行数:29,代码来源:subscription.php
示例17: update
/**
* Update method to register message sending events.
*
* @access public
* @param $args['news_id'] Newsletter identifier refferring to the event.
* * @param $args['msg_id'] Message identifier refferring to the event.
* @return false if something wrong.
* @since 0.6
*/
function update(&$args)
{
jincimport('utility.servicelocator');
$servicelocator = ServiceLocator::getInstance();
$logger = $servicelocator->getLogger();
if (!isset($args['news_id']) || !isset($args['msg_id'])) {
return false;
}
$news_id = (int) $args['news_id'];
$msg_id = (int) $args['msg_id'];
$dbo =& JFactory::getDBO();
$query = 'UPDATE #__jinc_newsletter SET lastsent = now() ' . 'WHERE id = ' . (int) $news_id;
$dbo->setQuery($query);
$logger->debug('SentMsgEvent: executing query: ' . $query);
if (!$dbo->query()) {
$logger->error('SentMsgEvent: error updating last newsletter dispatch date');
return false;
}
$query = 'UPDATE #__jinc_message SET datasent = now() ' . 'WHERE id = ' . (int) $msg_id;
$dbo->setQuery($query);
$logger->debug('SentMsgEvent: executing query: ' . $query);
if (!$dbo->query()) {
$logger->error('SentMsgEvent: error updating last message dispatch date');
return false;
}
return true;
}
开发者ID:madseller,项目名称:coperio,代码行数:36,代码来源:sentmsgevent.php
示例18: _checkPermissions
/**
* Check that the user has sufficient permissions, or die in error
*
*/
private function _checkPermissions()
{
// Is frontend backup enabled?
$febEnabled = Platform::getInstance()->get_platform_configuration_option('failure_frontend_enable', 0) != 0;
// Is the Secret Key strong enough?
$validKey = Platform::getInstance()->get_platform_configuration_option('frontend_secret_word', '');
if (!\Akeeba\Engine\Util\Complexify::isStrongEnough($validKey, false)) {
$febEnabled = false;
}
if (!$febEnabled) {
@ob_end_clean();
echo '403 ' . JText::_('ERROR_NOT_ENABLED');
flush();
JFactory::getApplication()->close();
}
// Is the key good?
$key = $this->input->get('key', '', 'none', 2);
$validKeyTrim = trim($validKey);
if ($key != $validKey || empty($validKeyTrim)) {
@ob_end_clean();
echo '403 ' . JText::_('ERROR_INVALID_KEY');
flush();
JFactory::getApplication()->close();
}
}
开发者ID:densem-2013,项目名称:exikom,代码行数:29,代码来源:check.php
示例19: getInput
protected function getInput()
{
JHTML::_('behavior.framework');
$document =& JFactory::getDocument();
if (!version_compare(JVERSION, '3.0', 'ge')) {
$checkJqueryLoaded = false;
$header = $document->getHeadData();
foreach ($header['scripts'] as $scriptName => $scriptData) {
if (substr_count($scriptName, '/jquery')) {
$checkJqueryLoaded = true;
}
}
//Add js
if (!$checkJqueryLoaded) {
$document->addScript(JURI::root() . $this->element['path'] . 'js/jquery.min.js');
}
$document->addScript(JURI::root() . $this->element['path'] . 'js/chosen.jquery.min.js');
$document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/chosen.css');
}
$document->addScript(JURI::root() . $this->element['path'] . 'js/colorpicker/colorpicker.js');
$document->addScript(JURI::root() . $this->element['path'] . 'js/jquery.lightbox-0.5.min.js');
$document->addScript(JURI::root() . $this->element['path'] . 'js/btbase64.min.js');
$document->addScript(JURI::root() . $this->element['path'] . 'js/bt.js');
$document->addScript(JURI::root() . $this->element['path'] . 'js/script.js');
//Add css
$document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/bt.css');
$document->addStyleSheet(JURI::root() . $this->element['path'] . 'js/colorpicker/colorpicker.css');
$document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/jquery.lightbox-0.5.css');
return null;
}
开发者ID:Tommar,项目名称:vino2,代码行数:30,代码来源:asset.php
示例20: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
// Get the application object.
$params = JFactory::getApplication()->getParams('com_users');
// Load the parameters.
$this->setState('params', $params);
}
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:14,代码来源:login.php
注:本文中的JFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论