本文整理汇总了PHP中VmConfig::loadConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP VmConfig::loadConfig方法的具体用法?PHP VmConfig::loadConfig怎么用?PHP VmConfig::loadConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VmConfig
的用法示例。
在下文中一共展示了VmConfig::loadConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Handle the save task
*/
function save($data = 0){
vRequest::vmCheckToken();
$model = VmModel::getModel('config');
$data = vRequest::getPost();
if(strpos($data['offline_message'],'|')!==false){
$data['offline_message'] = str_replace('|','',$data['offline_message']);
}
$msg = '';
if ($model->store($data)) {
$msg = vmText::_('COM_VIRTUEMART_CONFIG_SAVED');
// Load the newly saved values into the session.
VmConfig::loadConfig();
}
$redir = 'index.php?option=com_virtuemart';
if(vRequest::getCmd('task') == 'apply'){
$redir = $this->redirectPath;
}
$this->setRedirect($redir, $msg);
}
示例2: fetchElement
function fetchElement()
{
$db = JFactory::getDBO();
$query = '';
require JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php';
VmConfig::loadConfig();
$query = 'SELECT a.virtuemart_category_id AS id, b.category_parent_id AS parent_id, b.category_parent_id AS parent, c. category_name AS title ' . 'FROM #__virtuemart_categories AS a ' . 'LEFT JOIN #__virtuemart_category_categories AS b ON a.virtuemart_category_id = b.category_child_id ' . 'LEFT JOIN #__virtuemart_categories_' . VMLANG . ' AS c ON a.virtuemart_category_id = c.virtuemart_category_id ' . 'WHERE a.published = 1 ' . 'ORDER BY a.ordering';
$db->setQuery($query);
$menuItems = $db->loadObjectList();
$children = array();
if ($menuItems) {
foreach ($menuItems as $v) {
$pt = $v->parent_id;
$list = isset($children[$pt]) ? $children[$pt] : array();
array_push($list, $v);
$children[$pt] = $list;
}
}
jimport('joomla.html.html.menu');
$options = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
$this->_xml->addChild('option', 'Root')->addAttribute('value', 0);
if (count($options)) {
foreach ($options as $option) {
$this->_xml->addChild('option', htmlspecialchars(' - ' . $option->treename))->addAttribute('value', $option->id);
}
}
$this->_value = $this->_form->get($this->_name, $this->_default);
return parent::fetchElement();
}
示例3: getInstance
public static function getInstance(&$query = null, $nolimit = false)
{
if (!class_exists('VmConfig')) {
require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
VmConfig::loadConfig();
}
$instanceKey = VMLANG;
if (isset($query['langswitch'])) {
if ($query['langswitch'] != VMLANG) {
$instanceKey = $query['langswitch'];
}
unset($query['langswitch']);
}
if (!array_key_exists($instanceKey, self::$_instances)) {
self::$_instances[$instanceKey] = new vmrouterHelperSEFforOPC($instanceKey, $query);
if (empty($nolimit)) {
if (self::$limit === null) {
$mainframe = Jfactory::getApplication();
$view = 'virtuemart';
if (isset($query['view'])) {
$view = $query['view'];
}
self::$limit = $mainframe->getUserStateFromRequest('com_virtuemart.' . $view . '.limit', VmConfig::get('list_limit', 20), 'int');
// self::$limit= $mainframe->getUserStateFromRequest('global.list.limit', 'limit', VmConfig::get('list_limit', 20), 'int');
}
}
}
return self::$_instances[$instanceKey];
}
示例4: display
function display($tpl = null)
{
// Load the helper(s)
if (!class_exists('VmConfig')) {
require JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'config.php';
}
VmConfig::loadConfig();
VmConfig::loadJLang('com_virtuemart_countries');
if (!class_exists('VmHTML')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
}
$model = VmModel::getModel('country');
$zoneModel = VmModel::getModel('worldzones');
$this->SetViewTitle();
$layoutName = JRequest::getWord('layout', 'default');
if ($layoutName == 'edit') {
$country = $model->getData();
$this->assignRef('country', $country);
$wzsList = $zoneModel->getWorldZonesSelectList();
$this->assignRef('worldZones', $wzsList);
$this->addStandardEditViewCommands();
} else {
$this->addStandardDefaultViewCommands(true, false);
//First the view lists, it sets the state of the model
$this->addStandardDefaultViewLists($model, 0, 'ASC');
$filter_country = JRequest::getWord('filter_country', false);
$countries = $model->getCountries(false, false, $filter_country);
$this->assignRef('countries', $countries);
$pagination = $model->getPagination();
$this->assignRef('pagination', $pagination);
}
parent::display($tpl);
}
示例5: vm_require
protected function vm_require()
{
if (!class_exists('VmConfig')) {
if (file_exists(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php')) {
require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php';
} else {
$this->error = 'Could not find VmConfig helper';
return false;
}
}
VmConfig::loadConfig();
VmConfig::loadJLang('com_virtuemart', true);
if (!class_exists('VmModel')) {
if (defined('JPATH_VM_ADMINISTRATOR') && file_exists(JPATH_VM_ADMINISTRATOR . '/helpers/vmmodel.php')) {
require JPATH_VM_ADMINISTRATOR . '/helpers/vmmodel.php';
} else {
$this->error = 'Could not find VmModel helper';
return false;
}
}
if (defined('JPATH_VM_ADMINISTRATOR')) {
JTable::addIncludePath(JPATH_VM_ADMINISTRATOR . '/tables');
}
if (!class_exists('VirtueMartModelCustom')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'custom.php';
}
if (!class_exists('VirtueMartModelCustomfields')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'customfields.php';
}
return true;
}
示例6: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
function getInput()
{
$key = $this->element['key_field'] ? $this->element['key_field'] : 'value';
$val = $this->element['value_field'] ? $this->element['value_field'] : $this->name;
VmConfig::loadConfig();
return JHtml::_('select.genericlist', $this->_getProducts(), $this->name, 'class="inputbox" ', 'value', 'text', $this->value, $this->id);
}
示例7: save
/**
* Save the file to the specified path
* @return boolean TRUE on success
*/
function save($path, $filename)
{
$input = fopen("php://input", "r");
$temp = tmpfile();
$realSize = stream_copy_to_stream($input, $temp);
fclose($input);
if ($realSize != $this->getSize()) {
return false;
}
$target = fopen($path, "w");
fseek($temp, 0, SEEK_SET);
stream_copy_to_stream($temp, $target);
fclose($target);
//insert data into attachment table
if (!class_exists('VmConfig')) {
require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
}
$thumb_width = VmConfig::loadConfig()->get('img_width');
$user_s =& JFactory::getUser();
$user_id = $user_s->id;
$product_vm_id = JRequest::getInt('virtuemart_product_id');
$database =& JFactory::getDBO();
$gallery = new stdClass();
$gallery->id = 0;
$gallery->virtuemart_user_id = $user_id;
$gallery->virtuemart_product_id = $product_vm_id;
$gallery->file_name = $filename;
$gallery->created_on = date('Y-m-d,H:m:s');
if (!$database->insertObject('#__virtuemart_product_attachments', $gallery, 'id')) {
echo $database->stderr();
return false;
}
// end of insert data
return true;
}
示例8: getOptions
protected function getOptions()
{
//check com_vituemart existed
$path = JPATH_ADMINISTRATOR . '/components/com_virtuemart';
if (!is_dir($path) || !file_exists(JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php')) {
$this->options[] = JHtml::_('select.option', '', JText::_('COM_VIRTUEMART_NOT_EXIST'));
} else {
// Initialize variables
require_once JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php';
require_once JPATH_ADMINISTRATOR . '/components/com_virtuemart/models/category.php';
VmConfig::loadConfig();
$categoryModel = new VirtueMartModelCategory();
$categoryModel->_noLimit = true;
$categories = $categoryModel->getCategories();
if (count($categories)) {
// iterating
$temp_options = array();
foreach ($categories as $item) {
array_push($temp_options, array($item->virtuemart_category_id, $item->category_name, $item->category_parent_id));
}
foreach ($temp_options as $option) {
if ($option[2] == 0) {
$this->options[] = JHtml::_('select.option', $option[0], $option[1]);
$this->recursive_options($temp_options, 1, $option[0]);
}
}
}
}
return $this->options;
}
示例9: onBeforeRender
function onBeforeRender()
{
if ($this->app->isAdmin()) {
return;
}
$app = JFactory::getApplication();
$option = $app->input->get('option');
$view = $app->input->get('view');
$tmpl = $app->input->get('tmpl');
$document = JFactory::getDocument();
if ($app->isSite() && $tmpl != 'component') {
if (!defined('SMART_JQUERY') && (int) $this->params->get('include_jquery', '1')) {
$document->addScript(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/js/jquery-1.8.2.min.js');
$document->addScript(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/js/jquery-noconflict.js');
define('SMART_JQUERY', 1);
}
if (!class_exists('VmConfig')) {
require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
}
VmConfig::loadConfig();
if (class_exists('vmJsApi')) {
vmJsApi::jPrice();
}
$document->addScript(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/js/jquery.fancybox.js');
$document->addStyleSheet(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/css/jquery.fancybox.css');
$document->addStyleSheet(JURI::root(true) . '/plugins/system/plg_sj_vm_quickview/assets/css/quickview.css');
}
return true;
}
示例10: onAfterRoute
function onAfterRoute()
{
if (JFactory::getApplication()->isAdmin()) {
return;
}
$input = JFactory::getApplication()->input;
$document = JFactory::getDocument();
$app = JFactory::getApplication();
$template = $app->getTemplate(true);
if (!class_exists('VmConfig')) {
require JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php';
}
VmConfig::loadConfig();
$uri = JFactory::getURI();
$input = JFactory::getApplication()->input;
$post = $input->post->getArray();
$_option = $input->getString('option');
$_view = $input->getString('view');
$_format = $input->getString('format');
$_task = $input->getString('task');
$_tmpl = $input->getString('tmpl');
if ($_option == 'com_virtuemart' && $_view == 'cart' && $_format != 'json') {
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cart' . DIRECTORY_SEPARATOR . 'view.html.php';
} else {
if ($_option == 'com_virtuemart' && $_view == 'vmplg' && $_task == "pluginUserPaymentCancel") {
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cart' . DIRECTORY_SEPARATOR . 'view.html.php';
} else {
if ($_option == 'com_virtuemart' && $_view == 'pluginresponse' && $_task == "pluginUserPaymentCancel") {
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cart' . DIRECTORY_SEPARATOR . 'view.html.php';
}
}
}
}
示例11: save
/**
* Handle the save task
*
* @author RickG
*/
function save($data = 0){
JRequest::checkToken() or jexit( 'Invalid Token' );
$model = VmModel::getModel('config');
$data = JRequest::get('post');
$data['offline_message'] = JRequest::getVar('offline_message','','post','STRING',JREQUEST_ALLOWHTML);
if(strpos($data['offline_message'],'|')!==false){
$data['offline_message'] = str_replace('|','',$data['offline_message']);
}
if ($model->store($data)) {
$msg = JText::_('COM_VIRTUEMART_CONFIG_SAVED');
// Load the newly saved values into the session.
VmConfig::loadConfig();
}
else {
$msg = $model->getError();
}
$redir = 'index.php?option=com_virtuemart';
if(JRequest::getCmd('task') == 'apply'){
$redir = $this->redirectPath;
}
$this->setRedirect($redir, $msg);
}
示例12: getOptions
protected function getOptions()
{
// if VM is not installed
if (!JFolder::exists(JPATH_ROOT . '/administrator/components/com_virtuemart') or !class_exists('ShopFunctions')) {
// add the root item
$option = new stdClass();
$option->text = JText::_('MOD_ACCORDEONCK_VIRTUEMART_NOTFOUND');
$option->value = '0';
$options[] = $option;
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
VmConfig::loadConfig();
$categorylist = ShopFunctions::categoryListTree();
// $categorylist = 'testced';
$categorylist = trim($categorylist, '</option>');
$categorylist = explode("</option><option", $categorylist);
// add the root item
$option = new stdClass();
$option->text = JText::_('MOD_ACCORDEONCK_VIRTUEMART_ROOTNODE');
$option->value = '0';
$options[] = $option;
foreach ($categorylist as $cat) {
$option = new stdClass();
$text = explode(">", $cat);
$option->text = trim($text[1]);
$option->value = strval(trim(trim(trim($text[0]), '"'), 'value="'));
$options[] = $option;
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例13: display
public function display($tpl = null)
{
if (!class_exists('VmConfig')) {
require JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'config.php';
}
VmConfig::loadConfig();
// Load the CSS
$config = LiveUpdateConfig::getInstance();
$this->assign('config', $config);
if (JVM_VERSION === 2) {
JHtml::_('bootstrap.loadCss');
}
if (!$config->addMedia()) {
// No custom CSS overrides were set; include our own
// $document = JFactory::getDocument();
// $url = JURI::base().'/components/'.JRequest::getCmd('option','').'/liveupdate/assets/liveupdate.css';
// $document->addStyleSheet($url, 'text/css');
}
$requeryURL = 'index.php?option=' . JRequest::getCmd('option', '') . '&view=' . JRequest::getCmd('view', 'liveupdate') . '&force=1';
$this->assign('requeryURL', $requeryURL);
$extInfo = (object) $config->getExtensionInformation();
JToolBarHelper::title($extInfo->title . ' – ' . JText::_('LIVEUPDATE_TASK_OVERVIEW'), 'liveupdate');
if (version_compare(JVERSION, '1.6.0', 'ge')) {
$msg = 'JTOOLBAR_BACK';
} else {
$msg = 'Back';
}
JToolBarHelper::back($msg, 'index.php?option=' . JRequest::getCmd('option', ''));
switch (JRequest::getCmd('task', 'default')) {
case 'startupdate':
$this->setLayout('startupdate');
$this->assign('url', 'index.php?option=' . JRequest::getCmd('option', '') . '&view=' . JRequest::getCmd('view', 'liveupdate') . '&task=download');
break;
case 'install':
$this->setLayout('install');
// Get data from the model
$state =& $this->get('State');
// Are there messages to display ?
$showMessage = false;
if (is_object($state)) {
$message1 = $state->get('message');
$message2 = $state->get('extension.message');
$showMessage = $message1 || $message2;
}
$this->assign('showMessage', $showMessage);
$this->assignRef('state', $state);
break;
case 'overview':
default:
$this->setLayout('overview');
$force = JRequest::getInt('force', 0);
$this->assign('updateInfo', LiveUpdate::getUpdateInformation($force));
$this->assign('runUpdateURL', 'index.php?option=' . JRequest::getCmd('option', '') . '&view=' . JRequest::getCmd('view', 'liveupdate') . '&task=startupdate');
$needsAuth = !$config->getAuthorization() && $config->requiresAuthorization();
$this->assign('needsAuth', $needsAuth);
break;
}
parent::display($tpl);
}
示例14: getInput
function getInput()
{
VmConfig::loadConfig();
VmConfig::loadJLang('com_virtuemart');
$model = VmModel::getModel('Manufacturer');
$manufacturers = $model->getManufacturers(true, true, false);
return JHtml::_('select.genericlist', $manufacturers, $this->name, 'class="inputbox" ', 'value', 'text', $this->value, $this->id);
}
示例15: getCategories
protected function getCategories()
{
if (is_null($this->categories)) {
$this->categories = array();
// set user language
// $lang = JFactory::getLanguage();
// JRequest::setVar( 'vmlang', $lang->getTag() );
VmConfig::loadJLang('com_virtuemart', true);
VmConfig::loadConfig();
$categoryModel = VmModel::getModel('category');
$categoryModel->_noLimit = true;
$categories = $categoryModel->getCategories(0);
if (!count($categories)) {
return $this->categories;
}
// render tree
//usort($categories, create_function('$a, $b', 'return $a->ordering > $b->ordering;'));
$_categories = array();
$_children = array();
foreach ($categories as $i => $category) {
$_categories[$category->virtuemart_category_id] =& $categories[$i];
}
foreach ($categories as $i => $category) {
$cid = $category->virtuemart_category_id;
$pid = $category->category_parent_id;
if (isset($_categories[$pid])) {
if (!isset($_children[$pid])) {
$_children[$pid] = array();
}
$_children[$pid][$cid] = $cid;
}
}
if (!count($_categories)) {
return $this->categories;
}
$__categories = array();
$__levels = array();
foreach ($_categories as $cid => $category) {
$pid = $category->category_parent_id;
if (!isset($_categories[$pid])) {
$queue = array($cid);
$_categories[$cid]->level = 1;
while (count($queue) > 0) {
$qid = array_shift($queue);
$__categories[$qid] =& $_categories[$qid];
if (isset($_children[$qid])) {
foreach ($_children[$qid] as $child) {
$_categories[$child]->level = $_categories[$qid]->level + 1;
array_push($queue, $child);
}
}
}
}
}
$this->categories = $__categories;
}
return $this->categories;
}