本文整理汇总了PHP中JDispatcher类的典型用法代码示例。如果您正苦于以下问题:PHP JDispatcher类的具体用法?PHP JDispatcher怎么用?PHP JDispatcher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JDispatcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例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: getInstance
/**
* Returns the global Event Dispatcher object, only creating it
* if it doesn't already exist.
*
* @return JDispatcher The EventDispatcher object.
*
* @since 11.1
*/
public static function getInstance()
{
if (self::$instance === null) {
self::$instance = new JDispatcher();
}
return self::$instance;
}
示例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: _getArticleHTML
public static function _getArticleHTML($userid, $limit, $limitstart, $row, $app, $total, $cat, $params)
{
JPluginHelper::importPlugin('content');
$dispatcher = JDispatcher::getInstance();
$html = "";
if (!empty($row)) {
$html .= '<div class="joms-app--myarticle">';
$html .= '<ul class="joms-list">';
foreach ($row as $data) {
$text_limit = $params->get('limit', 50);
$result = $dispatcher->trigger('onPrepareContent', array(&$data, &$params, 0));
if (empty($cat[$data->catid])) {
$cat[$data->catid] = "";
}
$data->sectionid = empty($data->sectionid) ? 0 : $data->sectionid;
$link = plgCommunityMyArticles::buildLink($data->id, $data->alias, $data->catid, $cat[$data->catid], $data->sectionid);
$created = new JDate($data->created);
$date = CTimeHelper::timeLapse($created);
$html .= ' <li>';
$html .= ' <a href="' . $link . '">' . htmlspecialchars($data->title) . '</a>';
$html .= '<span class="joms-block joms-text--small joms-text--light">' . $date . '</span>';
$html .= ' </li>';
}
$html .= '</ul>';
$showall = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid . '&task=app&app=myarticles');
$html .= "<div class='joms-gap'></div><div class='list-articles--button'><small><a class='joms-button--link' href='" . $showall . "'>" . JText::_('PLG_MYARTICLES_SHOWALL') . "</a></small></div>";
$html .= '</div>';
} else {
$html .= "<p>" . JText::_("PLG_MYARTICLES_NO_ARTICLES") . "</p>";
}
return $html;
}
示例7: prepareArticleDB
/**
* Funkce pro načtení dat 1 článku z databáze
*/
private function prepareArticleDB($articleId, $text = 'all', $skipPlugins = false)
{
$db =& JFactory::getDBO();
$db->setQuery("SELECT * FROM #__content WHERE id='{$articleId}' LIMIT 1;");
$rows = $db->loadObjectList();
if (count($rows) == 1) {
$article = $rows[0]->introtext . $rows[0]->fulltext;
} else {
return false;
}
//připravíme text
if ($text == 'introtext') {
$rows[0]->text = $rows[0]->introtext;
} elseif ($text == 'fulltext') {
$rows[0]->text = $rows[0]->fulltext;
} else {
$rows[0]->text = $rows[0]->introtext . $rows[0]->fulltext;
}
if (!$skipPlugins) {
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin("content");
//naimportujeme všechny pluginy pro zpracování obsahu
$rows[0]->parameters = new JParameter($rows[0]->attribs);
//vytvoříme objekt s parametry článku
$results = $dispatcher->trigger('onPrepareContent', array(&$rows[0], &$rows[0]->parameters, 0));
//načtení pluginů
}
/*nahradíme event. špatný tvar komentářů*/
$rows[0]->text = str_replace('<!--gInclude{', '<!-- gInclude{', $rows[0]->text);
$rows[0]->text = str_replace('}-->', '} -->', $rows[0]->text);
/**/
return $rows[0];
}
示例8: 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;
}
示例9: getPlugins
/**
* get the list's active/selected plug-ins
* @return array
*/
public function getPlugins()
{
$item = $this->getItem();
// load up the active plug-ins
$dispatcher =& JDispatcher::getInstance();
$plugins = JArrayHelper::getValue($item->params, 'plugins', array());
$return = array();
//JModel::addIncludePath(JPATH_SITE.DS.'components'.DS.'com_fabrik'.DS.'models');
$pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel');
//@todo prob wont work for any other model that extends this class except for the form/list model
switch (get_class($this)) {
case 'FabrikModelList':
$class = 'list';
break;
default:
$class = 'form';
}
$feModel = JModel::getInstance($class, 'FabrikFEModel');
$feModel->setId($this->getState($class . '.id'));
foreach ($plugins as $x => $plugin) {
$o = $pluginManager->getPlugIn($plugin, $this->pluginType);
$o->getJForm()->model = $feModel;
$data = (array) $item->params;
$str = $o->onRenderAdminSettings($data, $x);
//$str = str_replace(array("\n", "\r"), "", $str);
$str = addslashes(str_replace(array("\n", "\r"), "", $str));
$location = $this->getPluginLocation($x);
$event = $this->getPluginEvent($x);
$return[] = array('plugin' => $plugin, 'html' => $str, 'location' => $location, 'event' => $event);
}
return $return;
}
示例10: 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);
}
示例11: 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]);
}
示例12: 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);
}
示例13: __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();
}
}
示例14: 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);
}
示例15: before
/**
* Prepare reply history display.
*
* @return void
*/
protected function before()
{
parent::before();
$id = $this->input->getInt('id');
$this->topic = KunenaForumTopicHelper::get($id);
$this->history = KunenaForumMessageHelper::getMessagesByTopic($this->topic, 0, (int) $this->config->historylimit, 'DESC');
$this->replycount = $this->topic->getReplies();
$this->historycount = count($this->history);
KunenaAttachmentHelper::getByMessage($this->history);
$userlist = array();
foreach ($this->history as $message) {
$userlist[(int) $message->userid] = (int) $message->userid;
}
KunenaUserHelper::loadUsers($userlist);
// Run events
$params = new JRegistry();
$params->set('ksource', 'kunena');
$params->set('kunena_view', 'topic');
$params->set('kunena_layout', 'history');
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('kunena');
$dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->history, &$params, 0));
// FIXME: need to improve BBCode class on this...
$this->attachments = KunenaAttachmentHelper::getByMessage($this->history);
$this->inline_attachments = array();
$this->headerText = JText::_('COM_KUNENA_POST_EDIT') . ' ' . $this->topic->subject;
}