本文整理汇总了PHP中CsviHelper::arrayExtend方法的典型用法代码示例。如果您正苦于以下问题:PHP CsviHelper::arrayExtend方法的具体用法?PHP CsviHelper::arrayExtend怎么用?PHP CsviHelper::arrayExtend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CsviHelper
的用法示例。
在下文中一共展示了CsviHelper::arrayExtend方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runCron
/**
* Initialise some settings
*/
public function runCron()
{
// Buffer all output to prevent conflicts with external software
ob_start();
// Start the clock
$starttime = time();
$db = JFactory::getDbo();
// First check if we deal with a valid user
if ($this->Login()) {
// Set some global values
$jinput = JFactory::getApplication()->input;
$jfilter = new JFilterInput();
// Get the parameters
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/settings.php';
$settings = new CsviSettings();
// Check if we are running cron mode and set some necessary variables
$_SERVER['SERVER_ADDR'] = $_SERVER['HTTP_HOST'] = $settings->get('site.hostname');
$_SERVER['SCRIPT_NAME'] = '/index.php';
$_SERVER['REQUEST_URI'] = '/';
$_SERVER['PHP_SELF'] = '/index.php';
// Get the task to do
if (isset($this->_variables['task'])) {
$task = $jfilter->clean($this->_variables['task']);
} else {
$task = '';
}
// Perform the requested task
switch ($task) {
case 'maintenance':
$jinput->set('task', 'maintenance.' . $this->_variables['operation']);
// Fire CSVI VirtueMart
$this->ExecuteJob();
break;
default:
// Second check if any template is set to process
if (array_key_exists('template_id', $this->_variables)) {
$template_id = $jfilter->clean($this->_variables['template_id'], 'int');
} else {
$template_id = false;
}
if (array_key_exists('template_name', $this->_variables)) {
$template_name = $jfilter->clean($this->_variables['template_name']);
} else {
$template_name = false;
}
if ($template_id || $template_name) {
// There is a template_id or template name, get some details to streamline processing
$where = empty($template_id) ? 'name=' . $db->Quote($template_name) : 'id=' . $template_id;
// There is a template name, get some details to streamline processing
$q = "SELECT id AS template_id, name AS template_name, settings\r\n\t\t\t\t\t\t\tFROM #__csvi_template_settings\r\n\t\t\t\t\t\t\tWHERE " . $where;
$db->setQuery($q);
$row = $db->loadObject();
if (is_object($row)) {
echo JText::sprintf('COM_CSVI_PROCESSING_STARTED', date('jS F Y, g:i a')) . "\n";
echo JText::sprintf('COM_CSVI_TEMPLATE', $row->template_name) . "\n";
// Set the template ID
$jinput->set('select_template', $row->template_id);
$jinput->set('template_name', $row->template_name);
// Set the settings
if (array_key_exists('jform', $this->_variables)) {
$settings = CsviHelper::arrayExtend(json_decode($row->settings, true), $this->_variables['jform']);
} else {
$settings = json_decode($row->settings, true);
}
// Set some export settings
if ($settings['options']['action'] == 'export') {
// Export settings
$jinput->set('task', 'exportfile.process');
// Set export to
if ($settings['general']['exportto'] == 'todownload') {
$settings['general']['exportto'] = 'tofile';
}
} else {
if ($settings['options']['action'] == 'import') {
// Import settings
$jinput->set('task', 'importfile.doimport');
// Turn off preview
$settings['general']['show_preview'] = 0;
}
}
// Post the settings
$jinput->set('jform', $settings, 'post');
// Fire CSVI
$this->ExecuteJob();
} else {
if ($template_name) {
echo JText::sprintf('COM_CSVI_NO_TEMPLATE_FOUND', $template_name) . "\n";
} else {
if ($template_id) {
echo JText::sprintf('COM_CSVI_NO_TEMPLATE_FOUND', $template_id) . "\n";
}
}
}
} else {
echo JText::_('COM_CSVI_NO_TEMPLATE_SPECIFIED') . "\n";
}
break;
//.........这里部分代码省略.........