本文整理汇总了PHP中JDispatcher::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JDispatcher::getInstance方法的具体用法?PHP JDispatcher::getInstance怎么用?PHP JDispatcher::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDispatcher
的用法示例。
在下文中一共展示了JDispatcher::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
function remove()
{
$cid = JRequest::getVar("cid");
$db = JFactory::getDBO();
$text = '';
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeRemoveTax', array(&$cid));
foreach ($cid as $key => $value) {
$tax = JSFactory::getTable('tax', 'jshop');
$tax->load($value);
$query2 = "SELECT pr.product_id\n FROM `#__jshopping_products` AS pr\n WHERE pr.product_tax_id = '" . $db->escape($value) . "'";
$db->setQuery($query2);
$res = $db->query();
if ($db->getNumRows($res)) {
$text .= sprintf(_JSHOP_TAX_NO_DELETED, $tax->tax_name) . "<br>";
continue;
}
$query = "DELETE FROM `#__jshopping_taxes` WHERE `tax_id` = '" . $db->escape($value) . "'";
$db->setQuery($query);
if ($db->query()) {
$text .= sprintf(_JSHOP_TAX_DELETED, $tax->tax_name) . "<br>";
}
$query = "DELETE FROM `#__jshopping_taxes_ext` WHERE `tax_id` = '" . $db->escape($value) . "'";
$db->setQuery($query);
$db->query();
}
$dispatcher->trigger('onAfterRemoveTax', array(&$cid));
$this->setRedirect("index.php?option=com_jshopping&controller=taxes", $text);
}
示例2: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
* @since 1.6
*/
protected function getOptions()
{
$options = array();
$params = JComponentHelper::getParams('com_joomdle');
$app = $params->get('activities');
$option = array('value' => 'no', 'text' => JText::_('COM_JOOMDLE_NONE'));
$options[] = $option;
$option = array('value' => 'jomsocial', 'text' => 'Jomsocial');
$options[] = $option;
// Add sources added via plugins
JPluginHelper::importPlugin('joomdleactivities');
$dispatcher = JDispatcher::getInstance();
$more_sources = $dispatcher->trigger('onGetActivitiesSource', array());
if (is_array($more_sources)) {
foreach ($more_sources as $source) {
$keys = array_keys($source);
$key = $keys[0];
$source_name = array_shift($source);
$option['value'] = $key;
$option['text'] = $source_name;
$options[] = $option;
}
}
return $options;
}
示例3: tag
function tag()
{
$doc = JFactory::getDocument();
$doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css?v=' . filemtime(ACYMAILING_MEDIA . 'css' . DS . 'frontendedition.css'));
JPluginHelper::importPlugin('acymailing');
$dispatcher = JDispatcher::getInstance();
$tagsfamilies = $dispatcher->trigger('acymailing_getPluginType');
$defaultFamily = reset($tagsfamilies);
$app = JFactory::getApplication();
$fctplug = $app->getUserStateFromRequest(ACYMAILING_COMPONENT . ".tag", 'fctplug', $defaultFamily->function, 'cmd');
ob_start();
$defaultContents = $dispatcher->trigger($fctplug);
$defaultContent = ob_get_clean();
$js = 'function insertTag(){if(window.parent.insertTag(window.document.getElementById(\'tagstring\').value)) {acymailing_js.closeBox(true);}}';
$js .= 'function setTag(tagvalue){window.document.getElementById(\'tagstring\').value = tagvalue;}';
$js .= 'function showTagButton(){window.document.getElementById(\'insertButton\').style.display = \'inline\'; window.document.getElementById(\'tagstring\').style.display=\'inline\';}';
$js .= 'function hideTagButton(){}';
$js .= 'try{window.parent.previousSelection = window.parent.getPreviousSelection(); }catch(err){window.parent.previousSelection=false; }';
$doc->addScriptDeclaration($js);
$this->assignRef('fctplug', $fctplug);
$type = JRequest::getString('type', 'news');
$this->assignRef('type', $type);
$this->assignRef('defaultContent', $defaultContent);
$this->assignRef('tagsfamilies', $tagsfamilies);
$app = JFactory::getApplication();
$this->assignRef('app', $app);
$ctrl = JRequest::getString('ctrl');
$this->assignRef('ctrl', $ctrl);
}
示例4: display
public function display()
{
// Get model data.
$state = $this->get('State');
$item = $this->get('Item');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
$doc = JFactory::getDocument();
$doc->setMetaData('Content-Type', 'text/directory', true);
// Initialise variables.
$app = JFactory::getApplication();
$params = $app->getParams();
$user = JFactory::getUser();
$dispatcher =& JDispatcher::getInstance();
// Compute lastname, firstname and middlename
$item->name = trim($item->name);
// "Lastname, Firstname Midlename" format support
// e.g. "de Gaulle, Charles"
$namearray = explode(',', $item->name);
if (count($namearray) > 1) {
$lastname = $namearray[0];
$card_name = $lastname;
$name_and_midname = trim($namearray[1]);
$firstname = '';
if (!empty($name_and_midname)) {
$namearray = explode(' ', $name_and_midname);
$firstname = $namearray[0];
$middlename = count($namearray) > 1 ? $namearray[1] : '';
$card_name = $firstname . ' ' . ($middlename ? $middlename . ' ' : '') . $card_name;
}
} else {
$namearray = explode(' ', $item->name);
$middlename = count($namearray) > 2 ? $namearray[1] : '';
$firstname = array_shift($namearray);
$lastname = count($namearray) ? end($namearray) : '';
$card_name = $firstname . ($middlename ? ' ' . $middlename : '') . ($lastname ? ' ' . $lastname : '');
}
$rev = date('c', strtotime($item->modified));
JResponse::setHeader('Content-disposition', 'attachment; filename="' . $card_name . '.vcf"', true);
$vcard = array();
$vcard[] .= 'BEGIN:VCARD';
$vcard[] .= 'VERSION:3.0';
$vcard[] = 'N:' . $lastname . ';' . $firstname . ';' . $middlename;
$vcard[] = 'FN:' . $item->name;
$vcard[] = 'TITLE:' . $item->con_position;
$vcard[] = 'TEL;TYPE=WORK,VOICE:' . $item->telephone;
$vcard[] = 'TEL;TYPE=WORK,FAX:' . $item->fax;
$vcard[] = 'TEL;TYPE=WORK,MOBILE:' . $item->mobile;
$vcard[] = 'ADR;TYPE=WORK:;;' . $item->address . ';' . $item->suburb . ';' . $item->state . ';' . $item->postcode . ';' . $item->country;
$vcard[] = 'LABEL;TYPE=WORK:' . $item->address . "\n" . $item->suburb . "\n" . $item->state . "\n" . $item->postcode . "\n" . $item->country;
$vcard[] = 'EMAIL;TYPE=PREF,INTERNET:' . $item->email_to;
$vcard[] = 'URL:' . $item->webpage;
$vcard[] = 'REV:' . $rev . 'Z';
$vcard[] = 'END:VCARD';
echo implode("\n", $vcard);
return true;
}
示例5: listing
function listing()
{
JRequest::setVar('tmpl', 'component');
$statsClass = acymailing_get('class.stats');
$statsClass->saveStats();
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header("Expires: Wed, 17 Sep 1975 21:32:10 GMT");
ob_end_clean();
JPluginHelper::importPlugin('acymailing');
$this->dispatcher = JDispatcher::getInstance();
$results = $this->dispatcher->trigger('acymailing_getstatpicture');
$picture = reset($results);
if (empty($picture)) {
$picture = 'media/com_acymailing/images/statpicture.png';
}
$picture = ltrim(str_replace(array('\\', '/'), DS, $picture), DS);
$imagename = ACYMAILING_ROOT . $picture;
$handle = fopen($imagename, 'r');
if (!$handle) {
exit;
}
header("Content-type: image/png");
$contents = fread($handle, filesize($imagename));
fclose($handle);
echo $contents;
exit;
}
示例6: verify
public static function verify() {
if (! self::enabled ())
return true;
$app = JFactory::getApplication ();
$dispatcher = JDispatcher::getInstance ();
$results = $dispatcher->trigger ( 'onCaptchaRequired', array ('kunena.post' ) );
if (! JPluginHelper::isEnabled ( 'system', 'captcha' ) || ! $results [0]) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_CAPTCHA_CANNOT_CHECK_CODE' ), 'error' );
return false;
}
if ($results [0]) {
$captchaparams = array (
JRequest::getVar ( 'captchacode', '', 'post' ),
JRequest::getVar ( 'captchasuffix', '', 'post' ),
JRequest::getVar ( 'captchasessionid', '', 'post' ) );
$results = $dispatcher->trigger ( 'onCaptchaVerify', $captchaparams );
if (! $results [0]) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_CAPTCHACODE_DO_NOT_MATCH' ), 'error' );
return false;
}
}
return true;
}
示例7: display
function display($cachable = false, $urlparams = false)
{
$jshopConfig = JSFactory::getConfig();
$position = JRequest::getInt('position');
$filter = JRequest::getVar('filter');
$path_length = strlen($jshopConfig->image_product_path) + 1;
$html = "<div class='images_list_search'><input type='text' id='filter_product_image_name' value='" . $filter . "'> <input type='button' value='" . _JSHOP_SEARCH . "' onclick='product_images_request(" . $position . ", \"index.php?option=com_jshopping&controller=product_images&task=display\", jQuery(\"#filter_product_image_name\").val())'></div>";
$html .= '<div class="images_list">';
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($jshopConfig->image_product_path), RecursiveIteratorIterator::SELF_FIRST) as $v) {
$filename = substr($v, $path_length);
if ($filter != '' && !substr_count($filename, $filter)) {
continue;
}
if (file_exists($jshopConfig->image_product_path . '/' . 'thumb_' . $filename)) {
$html .= '<div class="one_image">';
$html .= '<table>';
$html .= '<tr><td align="center" valign="middle"><div>';
$html .= $this->_getLinkForImage('<img alt="" title="' . $filename . '" src="' . $jshopConfig->image_product_live_path . '/thumb_' . $filename . '"/>', $filename);
$html .= '</div></td></tr>';
$html .= '<tr><td valign="bottom" align="center"><div>';
$html .= $this->_getLinkForImage($filename, $filename);
$html .= '</div></td></tr>';
$html .= '</table>';
$html .= '</div>';
}
}
$html .= '<div style="clear: both"></div>';
$html .= '</div>';
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeDisplayProductsImagesHTML', array(&$html));
echo $html;
die;
}
示例8: addTitleHead
function addTitleHead()
{
$jshopConfig = JSFactory::getConfig();
$vendorinfo = $this->_vendorinfo;
$this->Image($jshopConfig->path . 'images/' . $this->img_header, 1, 1, $jshopConfig->pdf_header_width, $jshopConfig->pdf_header_height);
$this->Image($jshopConfig->path . 'images/' . $this->img_footer, 1, 265, $jshopConfig->pdf_footer_width, $jshopConfig->pdf_footer_height);
$this->SetFont('freesans', '', 8);
$this->SetXY(115, 12);
$this->SetTextColor($this->pdfcolors[2][0], $this->pdfcolors[2][1], $this->pdfcolors[2][2]);
$_vendor_info = array();
$_vendor_info[] = $vendorinfo->adress;
$_vendor_info[] = $vendorinfo->zip . " " . $vendorinfo->city;
if ($vendorinfo->phone) {
$_vendor_info[] = _JSHOP_CONTACT_PHONE . ": " . $vendorinfo->phone;
}
if ($vendorinfo->fax) {
$_vendor_info[] = _JSHOP_CONTACT_FAX . ": " . $vendorinfo->fax;
}
if ($vendorinfo->email) {
$_vendor_info[] = _JSHOP_EMAIL . ": " . $vendorinfo->email;
}
JDispatcher::getInstance()->trigger('onBeforeAddTitleHead', array(&$vendorinfo, &$pdf, &$_vendor_info, &$this));
$str_vendor_info = implode("\n", $_vendor_info);
$this->MultiCell(80, 3, $str_vendor_info, 0, 'R');
$this->SetTextColor($this->pdfcolors[0][0], $this->pdfcolors[0][1], $this->pdfcolors[0][2]);
}
示例9: save
function save(&$element)
{
$old = $this->get($element->tax_namekey);
JPluginHelper::importPlugin('hikashop');
$dispatcher = JDispatcher::getInstance();
$do = true;
if (!empty($old)) {
$element->old =& $old;
$dispatcher->trigger('onBeforeTaxUpdate', array(&$element, &$do));
} else {
$dispatcher->trigger('onBeforeTaxCreate', array(&$element, &$do));
}
if (!$do) {
return false;
}
if (!empty($old)) {
$result = parent::save($element);
} else {
$this->database->setQuery($this->_getInsert($this->getTable(), $element));
$result = $this->database->query();
}
if (!empty($old)) {
$dispatcher->trigger('onAfterTaxUpdate', array(&$element));
} else {
$dispatcher->trigger('onAfterTaxCreate', array(&$element));
}
return $result;
}
示例10: display
/**
* Display the view
*/
public function display($tpl = null)
{
$jinput = JFactory::getApplication()->input;
$layout = $jinput->get("layout", 'default');
$user = JFactory::getUser();
$params = JComponentHelper::getParams('com_tjcpg');
// print"<pre>" ; print_r($params);
if ($layout == "default") {
//START :: getting payment gateway data
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('payment');
if (!is_array($params->get('gateways'))) {
$gateway_param[] = $params->get('gateways');
} else {
$gateway_param = $params->get('gateways');
}
if (!empty($gateway_param)) {
$gateways = $dispatcher->trigger('onTP_GetInfo', array($gateway_param));
}
$this->gateways = $gateways;
//START :: getting payment gateway data
} else {
// getting order id
$order_id = $jinput->get("order_id", '');
if (!empty($order_id)) {
$model = $this->getModel('payment');
// GETTING ORDER INFO
$orderinfo = $model->getOrderInfo($order_id);
$this->processor = $orderinfo->processor;
// GETTING USER PAYMENT HTML
$this->payhtml = $model->getHTML($orderinfo->processor, $order_id);
}
}
parent::display($tpl);
}
示例11: searchareas
/**
* Search areas checklist helper.
*
* @param Array $config An optional configuration object
*/
public function searchareas($config = array())
{
$config = new KConfig($config);
$areas = array();
//Import the search plugins
JPluginHelper::importPlugin('search');
$results = JDispatcher::getInstance()->trigger('onSearchAreas');
foreach($results as $result) {
$areas = array_merge($areas, $result);
}
// Get and format the search areas
foreach($areas as $value => $title)
{
$search_area = new stdClass();
$search_area->value = $value;
$search_area->title = $title;
$search_areas[] = $search_area;
}
$config->append(array(
'list' => $search_areas,
'name' => 'areas',
'key' => 'value'
))->append(array(
'selected' => $config->{$config->name})
);
return parent::checklist($config);
}
示例12: __construct
public function __construct($default = array())
{
parent::__construct($default);
// init vars
$this->joomla = JFactory::getApplication();
$this->user = JFactory::getUser();
$this->session = JFactory::getSession();
$this->document = JFactory::getDocument();
$this->dispatcher = JDispatcher::getInstance();
$this->option = YRequest::getCmd('option');
$this->link_base = 'index.php?option=' . $this->option;
$this->controller = $this->getName();
// add super administrator var to user
$this->user->superadmin = UserHelper::isJoomlaSuperAdmin($this->user);
// init additional admin vars
if ($this->joomla->isAdmin()) {
$this->baseurl = 'index.php?option=' . $this->option . '&controller=' . $this->getName();
}
// init additional site vars
if ($this->joomla->isSite()) {
$this->itemid = (int) $GLOBALS['Itemid'];
$this->params = $this->joomla->getParams();
$this->pathway = $this->joomla->getPathway();
}
}
示例13: display
function display($tpl = null)
{
$app = JFactory::getApplication();
$params = $app->getParams();
$dispatcher = JDispatcher::getInstance();
/*$model = $this->getModel('addeditsocial');
$controller = JControllerLegacy::getInstance('SWG_Events');*/
// Get some data from the models
$state = $this->get('State');
$this->form = $this->get('Form');
$this->social = $this->get('Social');
// Check the current user can edit this walk (or add a new one)
/*if (
($model->editing() && !$controller->canEdit($this->social)) ||
(!$model->editing() && !$controller->canAdd())
)
{
return JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
}*/
// Add CSS
$document =& JFactory::getDocument();
$document->addStyleSheet('components/com_swg_events/css/addedit.css');
// Add form validation
JHTML::_('behavior.formvalidation');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
$this->showForm = true;
// Display the view
parent::display($tpl);
}
示例14: getDiscounts
public static function getDiscounts($discounts, $params)
{
if (empty($discounts)) {
return array();
}
$arr_params = $params->toArray();
$types = isset($arr_params['types']) && is_array($arr_params['types']) && count($arr_params['types']) ? $arr_params['types'] : array('all');
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('d.id, d.title, d.content, d.from_date, d.to_date, d.info_methods');
$query->from('#__ksenmart_discounts as d');
$query->where("d.id IN (" . implode(',', $discounts) . ")");
if (!in_array('all', $types)) {
foreach ($types as &$type) {
$type = $db->quote($type);
}
$query->where('d.type in (' . implode(',', $types) . ')');
}
$query = KSMedia::setItemMainImageToQuery($query, 'discount', 'd.');
$results = $db->setQuery($query)->loadObjectList('id');
foreach ($results as $key => $res) {
$content = JDispatcher::getInstance()->trigger('onGetDiscountContent', array($res->id));
if (isset($content[0]) && !empty($content[0])) {
$results[$key]->content = $content[0];
}
$info_methods = json_decode($res->info_methods, true);
$results[$key]->image = !empty($results[$key]->filename) ? KSMedia::resizeImage($results[$key]->filename, $results[$key]->folder, $params->get('img_width', 200), $params->get('img_height', 100), json_decode($results[$key]->params, true)) : '';
if (!in_array('module', $info_methods)) {
unset($results[$key]);
}
}
unset($res);
return $results;
}
示例15: load
function load($type = '')
{
$this->allValues = array();
$this->allValues["text"] = JText::_('K2STORE_TEXT');
$this->allValues["email"] = JText::_('K2STORE_EMAIL');
// $this->allValues["link"] = JText::_('K2STORE_LINK');
$this->allValues["textarea"] = JText::_('K2STORE_TEXTAREA');
$this->allValues["wysiwyg"] = JText::_('K2STORE_WYSIWYG');
$this->allValues["radio"] = JText::_('K2STORE_RADIO');
$this->allValues["checkbox"] = JText::_('K2STORE_CHECKBOX');
$this->allValues["singledropdown"] = JText::_('K2STORE_SINGLEDROPDOWN');
// $this->allValues["multipledropdown"] = JText::_('K2STORE_MULTIPLEDROPDOWN');
$this->allValues["zone"] = JText::_('K2STORE_ZONE');
$this->allValues["date"] = JText::_('K2STORE_DATE');
$this->allValues["time"] = JText::_('K2STORE_TIME');
$this->allValues["datetime"] = JText::_('K2STORE_DATETIME');
$this->allValues["customtext"] = JText::_('K2STORE_CUSTOM_TEXT');
if ($this->externalValues == null) {
$this->externalValues = array();
JPluginHelper::importPlugin('k2store');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onK2StoreFieldsLoad', array(&$this->externalValues));
if (!empty($this->externalValues)) {
foreach ($this->externalValues as $value) {
if (substr($value->name, 0, 4) != 'plg.') {
$value->name = 'plg.' . $value->name;
}
$this->allValues[$value->name] = $value->text;
}
}
}
}