/** * Builds a (non routed) Joomla url according to default values * of controller, task, view and layout * * @param array $userVars optional set of variables to override default vars, or add more to url * @return string the target url, not routed */ protected function _getDefaultRedirect($userVars = array()) { // get default values of the controller $defaultVars = array('c' => $this->_returnController, 'layout' => $this->_returnLayout, 'view' => $this->_returnView, 'task' => $this->_returnTask); // override default vars with user defined vars $vars = array_merge($defaultVars, $userVars); // strip empty vars foreach ($vars as $key => $value) { if ($value == '') { unset($vars[$key]); } } return Sh404sefHelperGeneral::buildUrl($vars); }
/** * Builds up an html link using the various parts supplied * * @param $view a JView object, to be able to escape output text * @param $linkData an array of key/value pairs to build up the target links * @param $elementData an array holding element data : title, class, rel * @param $modal boolean, if true, required stuff to make the link open in modal box is added * @param $hasTip boolean, if true, required stuff to turn elementData['title'] into a tooltip is added * @param $extra an array holding key/value pairs, will be added as raw attributes to the link */ public static function makeLink($view, $linkData, $elementData, $modal = false, $modalOptions = array(), $hasTip = false, $extra = array()) { // calculate target link if ($modal) { $linkData['tmpl'] = 'component'; } $url = Sh404sefHelperGeneral::buildUrl($linkData); $url = JRoute::_($url); // calculate title $title = empty($elementData['title']) ? '' : $elementData['title']; $title = is_null($view) ? $title : $view->escape($title); $attribs = array(); // calculate class $class = empty($elementData['class']) ? '' : $elementData['class']; if ($hasTip) { $class .= ' ' . $hasTip; } // store title in attributes array if (!empty($title)) { $attribs['title'] = $title; } // store in attributes array if (!empty($class)) { $attribs['class'] = $class; } // calculate modal information $rel = empty($elementData['rel']) || is_null($view) ? '' : $view->escape($elementData['rel']); if ($modal) { $modalOptionsString = Sh404sefHelperHtml::makeSqueezeboxOptions($modalOptions); $rel .= ' {handler: \'iframe\'' . (empty($modalOptionsString) ? '' : ', ' . $modalOptionsString) . '}'; } // store in attributes array if (!empty($rel)) { $attribs['rel'] = $rel; } // any custom attibutes ? if (!empty($extra)) { foreach ($extra as $key => $value) { $attribs[$key] = $value; } } // finish link $anchor = empty($elementData['anchor']) ? $title : $elementData['anchor']; return JHTML::link($url, $anchor, $attribs); }
<td class="shl-list-shurl"> <?php echo empty($url->pageid) ? '' : ShlHtmlBs_Helper::badge($this->escape($url->pageid), 'info'); ?> </td> <td class="shl-list-sef"> <?php echo '<input type="hidden" name="metaid[' . $url->id . ']" value="' . (empty($url->metaid) ? 0 : $url->metaid) . '" />'; echo '<input type="hidden" name="newurls[' . $url->id . ']" value="' . (empty($url->nonsefurl) ? '' : $this->escape($url->nonsefurl)) . '" />'; // link to full meta edit $anchor = empty($url->oldurl) ? '(-)' : $this->escape($url->oldurl); $anchor .= '<br/><i>(' . $this->escape($url->nonsefurl) . ')</i>'; $params = array(); $linkData = array('c' => 'editurl', 'task' => 'edit', 'view' => 'editurl', 'startOffset' => '1', 'cid[]' => $url->id, 'tmpl' => 'component'); $targetUrl = Sh404sefHelperGeneral::buildUrl($linkData); $displayedUrl = empty($url->oldurl) ? $url->nonsefurl : $url->oldurl; $params['linkTitle'] = JText::_('COM_SH404SEF_MODIFY_META_TITLE') . ' ' . $this->escape($displayedUrl); $modalTitle = ''; $params['linkClass'] = 'shl-list-sef'; $params['linkType'] = 'a'; $name = '-editurl-' . $url->id; echo ShlHtmlModal_helper::modalLink($name, $anchor, $targetUrl, Sh404sefFactory::getPConfig()->windowSizes['editurl']['x'], Sh404sefFactory::getPConfig()->windowSizes['editurl']['y'], $top = 0, $left = 0, $onClose = '', $modalTitle, $params); // small preview icon $sefConfig =& Sh404sefFactory::getConfig(); $link = JURI::root() . ltrim($sefConfig->shRewriteStrings[$sefConfig->shRewriteMode], '/') . (empty($url->oldurl) ? $url->nonsefurl : $url->oldurl); echo ' <a href="' . $this->escape($link) . '" target="_blank" title="' . JText::_('COM_SH404SEF_PREVIEW') . ' ' . $this->escape($url->oldurl) . '">'; echo '<img src=\'components/com_sh404sef/assets/images/external-black.png\' border=\'0\' alt=\'' . JText::_('COM_SH404SEF_PREVIEW') . '\' />'; echo '</a>'; ?> </td>
protected function _useAdapterResult($result) { // use results : the adapter may have change the suject // of this operation, after analyzing incoming data in an import // for instance if (!empty($result['opSubject'])) { $this->_opSubject = $result['opSubject']; } // redirections results $redirectOptions = empty($result['redirectOptions']) ? array() : $result['redirectOptions']; if (!empty($result['redirectTo'])) { $this->_redirectTo = $this->_getDefaultRedirect($redirectOptions); } // display results if (!empty($result['mainText'])) { $this->_mainText = $result['mainText']; } if (!empty($result['hiddenText'])) { $this->_hiddenText = $result['hiddenText']; } if (!empty($result['setFormEncType'])) { $this->_setFormEncType = $result['setFormEncType']; } if (!empty($result['continue'])) { // calculate redirect url to next step $vars = array('option' => 'com_sh404sef', 'c' => $this->_defaultController, 'tmpl' => 'component', 'optype' => $this->_opType, 'opsubject' => $this->_opSubject); $vars = array_merge($vars, $result['continue']); $this->_continue = Sh404sefHelperGeneral::buildUrl($vars); } if (!empty($result['nextStart'])) { $this->_nextStart = $result['nextStart']; } }