本文整理汇总了PHP中Sh404sefHelperGeneral类的典型用法代码示例。如果您正苦于以下问题:PHP Sh404sefHelperGeneral类的具体用法?PHP Sh404sefHelperGeneral怎么用?PHP Sh404sefHelperGeneral使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sh404sefHelperGeneral类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _makeToolbarDefault
/**
* Create toolbar for default layout view
*
* @param midxed $params
*/
private function _makeToolbarDefault($params = null)
{
global $mainframe;
// Get the JComponent instance of JToolBar
$bar =& JToolBar::getInstance('toolbar');
// add title
$title = Sh404sefHelperGeneral::makeToolbarTitle(JText16::_('COM_SH404SEF_PAGEIDS_MANAGER'), $icon = 'sh404sef', $class = 'sh404sef-toolbar-title');
$mainframe->set('JComponentTitle', $title);
// get toolbar object
$bar =& JToolBar::getInstance('toolbar');
$bar->addButtonPath(JPATH_COMPONENT . DS . 'classes');
// add import button
$params['class'] = 'modaltoolbar';
$params['size'] = array('x' => 500, 'y' => 400);
unset($params['onClose']);
$url = 'index.php?option=com_sh404sef&c=wizard&task=start&tmpl=component&optype=import&opsubject=pageids';
$bar->appendButton('Shpopuptoolbarbutton', 'import', $url, JText::_('Import'), $msg = '', $task = 'import', $list = false, $hidemenu = true, $params);
// add import button
$params['class'] = 'modaltoolbar';
$params['size'] = array('x' => 500, 'y' => 300);
unset($params['onClose']);
$url = 'index.php?option=com_sh404sef&c=wizard&task=start&tmpl=component&optype=export&opsubject=pageids';
$bar->appendButton('Shpopuptoolbarbutton', 'export', $url, JText::_('Export'), $msg = '', $task = 'export', $list = false, $hidemenu = true, $params);
// separator
JToolBarHelper::divider();
// add delete button as an ajax call
$params['class'] = 'modaltoolbar';
$params['size'] = array('x' => 500, 'y' => 300);
unset($params['onClose']);
$url = 'index.php?option=com_sh404sef&c=pageids&task=confirmdelete&tmpl=component';
$bar->appendButton('Shpopuptoolbarbutton', 'delete', $url, JText::_('Delete'), $msg = JText::_('VALIDDELETEITEMS', true), $task = 'purgeselected', $list = true, $hidemenu = true, $params);
// separator
JToolBarHelper::divider();
}
示例2: _makeViewInfo
/**
* Attach css, js and create toolbar for Info view
*
* @param midxed $params
*/
private function _makeViewInfo($params = null)
{
global $mainframe;
// add our own css
JHtml::styleSheet('list.css', Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/');
// add title
$title = Sh404sefHelperGeneral::makeToolbarTitle(JText16::_('COM_SH404SEF_TITLE_SUPPORT'), $icon = 'sh404sef', $class = 'sh404sef-toolbar-title');
$mainframe->set('JComponentTitle', $title);
}
示例3: _doDefault
private function _doDefault($tpl)
{
// declare docoument mime type
$document =& JFactory::getDocument();
$document->setMimeEncoding('text/xml');
// call helper to prepare response xml file content
$response = Sh404sefHelperGeneral::prepareAjaxResponse($this);
// echo it
echo $response;
}
示例4: display
public function display($tpl = null)
{
// declare docoument mime type
$document = JFactory::getDocument();
$document->setMimeEncoding('text/xml');
// call helper to prepare response xml file content
$response = Sh404sefHelperGeneral::prepareAjaxResponse($this);
// echo it
echo $response;
}
示例5: display
public function display($tpl = null)
{
// version prefix
$this->joomlaVersionPrefix = Sh404sefHelperGeneral::getJoomlaVersionPrefix();
// get action
$this->task = empty($this->task) ? 'delete' : $this->task;
if (version_compare(JVERSION, '3.0', 'ge')) {
$document = JFactory::getDocument();
// add modal css and js
ShlHtmlBs_helper::addBootstrapCss(JFactory::getDocument());
ShlHtmlBs_helper::addBootstrapModalFixCss(JFactory::getDocument());
ShlHtmlBs_helper::addBootstrapJs(JFactory::getDocument());
JHtml::styleSheet(Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/j3_list.css');
if (!empty($this->redirectTo) && !empty($this->message)) {
// redirecting to parent page, but there's a message
// let's enqueue it, so it's displayed after the redirect
JFactory::getApplication()->enqueueMessage($this->message);
}
} else {
// J2
// if redirecting to another page, we need to simply send some javascript
// to : a / close the popup, b / redirect the parent page to where we
// want to go
if (!empty($this->redirectTo)) {
$js = 'window.addEvent( \'domready\', function () {
setTimeout( \'shRedirectTo()\', 2000);
});
function shRedirectTo() {
parent.window.location="' . $this->redirectTo . '";
window.parent.SqueezeBox.close();
}
';
$document = JFactory::getDocument();
$document->addScriptDeclaration($js);
} else {
// build the toolbar
$toolBar = $this->_makeToolbar();
$this->assignRef('toolbar', $toolBar);
// add confirmation phrase to toolbar
$this->assign('toolbarTitle', '<div class="headerconfirm" >' . JText::_('COM_SH404SEF_CONFIRM_TITLE') . '</div>');
// link to custom javascript
JHtml::script(Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/edit.js');
}
// add our own css
JHtml::styleSheet(Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/confirm.css');
}
// now display normally
parent::display($this->joomlaVersionPrefix);
}
示例6: save
/**
* Save a list of meta data as edited by
* user in backend
*/
public function save()
{
// first check if anything was modified
$originalMd5 = JRequest::getString('contentcs');
$dataSet = array();
$ids = JRequest::getVar('metaid', array(0), 'post', 'array');
$titles = JRequest::getVar('metatitle', array(), 'post', 'array');
$descs = JRequest::getVar('metadesc', array(), 'post', 'array');
$newurls = JRequest::getVar('newurls', array(), 'post', 'array');
// calculate md5 of incoming data and compare to stored value
foreach ($ids as $id => $value) {
$t = array();
$t['meta_id'] = $value;
$t['metatitle'] = $titles[$id];
$t['metadesc'] = $descs[$id];
$t['newurl'] = $newurls[$id];
$dataSet[] = $t;
}
$newMd5 = Sh404sefHelperGeneral::getDataMD5($dataSet, array('metatitle', 'metadesc'), $asObject = false);
$dataModified = $originalMd5 != $newMd5;
// if nothing changed, display message and return to meta data list
if ($dataModified) {
// we did change something, ask model to save it
$model = $this->getModel('metas', 'Sh404sefModel');
$model->saveSet($dataSet);
// check errors and display if not ajax call
$error = $model->getError();
if (!empty($error)) {
$this->setError($error);
}
} else {
// did not change data, display that
$this->setError(JText::_('COM_SH404SEF_DATA_NOT_MODIFIED'));
}
// check if ajax call, we'll return differently
$isAjax = JRequest::getInt('shajax') == 1;
// finally return
if ($isAjax) {
// ajax : send xml response
$this->display();
} else {
// not ajax, enqueue message and go back to list
$this->enqueuemessages(array($error), 'error');
$this->setRedirect($this->_getDefaultRedirect());
}
}
示例7: _doDefault
/**
* Ajax response handler for any configuration dialog
* except quick control panel
*
* @param string $tpl
*/
private function _doDefault($tpl)
{
// use Joomla wml object
jimport('joomla.utilities.simplexml');
// prepare elements of respn
$this->assign('taskexecuted', $this->getLayout());
$errors = $this->getError();
$task = JRequest::getCmd('task');
switch ($task) {
case 'apply':
// applying : dialog box not going to be closed
if (($this->taskexecuted == 'default' || $this->taskexecuted == 'ext') && empty($errors)) {
// no errors, insert success messages
$this->assign('message', '<li>' . JText16::_('COM_SH404SEF_ELEMENT_SAVED') . '.</li><br /><li>' . JText16::_('COM_SH404SEF_MAY_NEED_PURGE_DIALOGBOX') . '</li>');
} else {
if (empty($errors)) {
$this->assign('message', JText16::_('COM_SH404SEF_ELEMENT_SAVED'));
}
}
break;
case 'save':
// box is going to be close, we want to redirect so that message is displayed
if (($this->taskexecuted == 'default' || $this->taskexecuted == 'ext') && empty($errors)) {
// no errors, tell user they must purge urls
$messagecode = 'COM_SH404SEF_MAY_NEED_PURGE';
} else {
if (empty($errors)) {
// no errors, but no need to purge : seo settings, security settings, etc
$messagecode = 'COM_SH404SEF_ELEMENT_SAVED';
}
}
$this->assign('redirectTo', $this->defaultRedirectUrl);
$this->assign('messagecode', $messagecode);
break;
}
// use helper to prepare response
$response = Sh404sefHelperGeneral::prepareAjaxResponse($this);
// declare docoument mime type
$document =& JFactory::getDocument();
$document->setMimeEncoding('text/xml');
// output resulting text, no need for a layout file I think
echo $response;
}
示例8: updateShurls
public static function updateShurls()
{
$pageInfo =& Sh404sefFactory::getPageInfo();
$sefConfig =& Sh404sefFactory::getConfig();
$pageInfo->shURL = empty($pageInfo->shURL) ? '' : $pageInfo->shURL;
if ($sefConfig->enablePageId && !$sefConfig->stopCreatingShurls) {
try {
jimport('joomla.utilities.string');
$nonSefUrl = JString::ltrim($pageInfo->currentNonSefUrl, '/');
$nonSefUrl = shSortURL($nonSefUrl);
// make sure we have a language
$nonSefUrl = shSetURLVar($nonSefUrl, 'lang', $pageInfo->currentLanguageShortTag);
// remove tracking vars (Google Analytics)
$nonSefUrl = Sh404sefHelperGeneral::stripTrackingVarsFromNonSef($nonSefUrl);
// try to get the current shURL, if any
$shURL = ShlDbHelper::selectResult('#__sh404sef_pageids', array('pageid'), array('newurl' => $nonSefUrl));
// if none, we may have to create one
if (empty($shURL)) {
$shURL = self::_createShurl($nonSefUrl);
}
// insert in head and header, if not empty
if (!empty($shURL)) {
$fullShURL = JString::ltrim($pageInfo->getDefaultFrontLiveSite(), '/') . '/' . $shURL;
$document = JFactory::getDocument();
if ($sefConfig->insertShortlinkTag) {
$document->addHeadLink($fullShURL, 'shortlink');
// also add header, especially for HEAD requests
JResponse::setHeader('Link', '<' . $fullShURL . '>; rel=shortlink', true);
}
if ($sefConfig->insertRevCanTag) {
$document->addHeadLink($fullShURL, 'canonical', 'rev', array('type' => 'text/html'));
}
if ($sefConfig->insertAltShorterTag) {
$document->addHeadLink($fullShURL, 'alternate shorter');
}
// store for reuse
$pageInfo->shURL = $shURL;
}
} catch (Exception $e) {
ShlSystem_Log::error('sh404sef', '%s::%s::%d: %s', __CLASS__, __METHOD__, __LINE__, $e->getMessage());
}
}
}
示例9: _addCss
private function _addCss()
{
// add link to css
JHtml::styleSheet('icon.css', 'administrator/templates/khepri/css/');
JHtml::styleSheet('rounded.css', 'administrator/templates/khepri/css/');
JHtml::styleSheet('system.css', 'administrator/templates/system/css/');
$customCss = '
<!--[if IE 7]>
<link href="templates/khepri/css/ie7.css" rel="stylesheet" type="text/css" />
<![endif]-->
<!--[if lte IE 6]>
<link href="templates/khepri/css/ie6.css" rel="stylesheet" type="text/css" />
<![endif]-->';
// insert using addCustomtag, so that J! does not add any markup
$document =& JFactory::getDocument();
$document->addCustomTag($customCss);
// add our own css
JHtml::styleSheet('list.css', Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/');
}
示例10: updateShurls
public static function updateShurls()
{
$sefConfig =& shRouter::shGetConfig();
// set the short link tag
$shPageInfo =& shRouter::shPageInfo();
$shPageInfo->shURL = '';
if ($sefConfig->enablePageId && !$sefConfig->stopCreatingShurls) {
try {
jimport('joomla.utilities.string');
$nonSefUrl = JString::ltrim($shPageInfo->shCurrentPageNonSef, '/');
$nonSefUrl = shSortURL($nonSefUrl);
// remove tracking vars (Google Analytics)
$nonSefUrl = Sh404sefHelperGeneral::stripTrackingVarsFromNonSef($nonSefUrl);
// try to get the current shURL, if any
$shURL = Sh404sefHelperDb::selectResult('#__sh404sef_pageids', array('pageid'), array('newurl' => $nonSefUrl));
// if none, we may have to create one
if (empty($shURL)) {
$shURL = self::_createShurl($nonSefUrl);
}
// insert in head and header, if not empty
if (!empty($shURL)) {
$fullShURL = JString::ltrim($GLOBALS['shConfigLiveSite'], '/') . '/' . $shURL;
$document =& JFactory::getDocument();
if ($sefConfig->insertShortlinkTag) {
$document->addHeadLink($fullShURL, 'shortlink');
// also add header, especially for HEAD requests
JResponse::setHeader('Link', '<' . $fullShURL . '>; rel=shortlink', true);
}
if ($sefConfig->insertRevCanTag) {
$document->addHeadLink($fullShURL, 'canonical', 'rev', array('type' => 'text/html'));
}
if ($sefConfig->insertAltShorterTag) {
$document->addHeadLink($fullShURL, 'alternate shorter');
}
// store for reuse
$shPageInfo->shURL = $shURL;
}
} catch (Sh404sefExceptionDefault $e) {
}
}
}
示例11: saveqcontrol
/**
* Saves data from the quickStart pane on main dashboard
*/
public function saveqcontrol()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
try {
// get current settings for sh404SEF
$params = Sh404sefHelperGeneral::getComponentParams($forceRead = true);
// set params from the form
$params->set('Enabled', JRequest::getInt('Enabled', 0));
$params->set('canReadRemoteConfig', JRequest::getInt('canReadRemoteConfig', 0));
$params->set('shRewriteMode', JRequest::getInt('shRewriteMode', 1));
$params->set('shSecEnableSecurity', JRequest::getInt('shSecEnableSecurity', 1));
// convert to json and store into db
$textParams = $params->toString();
ShlDbHelper::update('#__extensions', array('params' => $textParams), array('element' => 'com_sh404sef', 'type' => 'component'));
JFactory::getApplication()->enqueueMessage(JText::_('COM_SH404SEF_ELEMENT_SAVED'));
} catch (Exception $e) {
JFactory::getApplication()->enqueueMessage(JText::_('COM_SH404SEF_ELEMENT_NOT_SAVED'), 'error');
}
parent::display();
}
示例12: display
public function display($tpl = null)
{
// prepare the view, based on request
// do we force reading updates from server ?
$options = Sh404sefHelperAnalytics::getRequestOptions();
$method = '_makeView' . ucfirst($options['report']);
if (is_callable(array($this, $method))) {
$this->{$method}($tpl);
}
// push display options into template
$this->assign('options', $options);
// add our javascript
JHTML::script('cp.js', Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/');
// add Joomla calendar behavior, needed to input start and end dates
if ($options['showFilters'] == 'yes') {
JHTML::_('behavior.calendar');
}
// add our own css
JHtml::styleSheet('cp.css', Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/');
// add tooltips handler
JHTML::_('behavior.tooltip');
// add title
$app =& JFactory::getApplication();
$title = Sh404sefHelperGeneral::makeToolbarTitle(JText16::_('COM_SH404SEF_ANALYTICS_MANAGER'), $icon = 'sh404sef', $class = 'sh404sef-toolbar-title');
$app->set('JComponentTitle', $title);
// add a div to display our ajax-call-in-progress indicator
// Get the JComponent instance of JToolBar
$bar =& JToolBar::getInstance('toolbar');
$bar->addButtonPath(JPATH_COMPONENT . DS . 'classes');
$html = '<div id="sh-progress-cpprogress"></div>';
$bar->appendButton('custom', $html, 'sh-progress-button-cpprogress');
// add quick control panel loader
$js = 'window.addEvent(\'domready\', function(){ shSetupAnalytics({report:" ' . $options['report'] . '"});});';
$document =& JFactory::getDocument();
$document->addScriptDeclaration($js);
// flag to know if we should display placeholder for ajax fillin
$this->assign('isAjaxTemplate', true);
parent::display($tpl = null);
}
示例13: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*/
protected function getInput()
{
$text = JText::_('COM_SH404SEF_CONFIGURE_SHLIB_PLUGIN');
$link = '<span class = "btn sh404sef-textinput"><a href="' . Sh404sefHelperGeneral::getShLibPluginLink() . '" target="_blank">' . $text . '</a></span>';
return $link;
$html = '';
$class = $this->element['class'] ? (string) $this->element['class'] : '';
// Build the class for the label.
$class = !empty($this->description) ? 'hasTip' : '';
$class = $this->required == true ? $class . ' required' : $class;
// Add the opening label tag and main attributes attributes.
$field = '<fieldset id="' . $this->id . ' class="' . $class . '"';
// If a description is specified, use it to build a tooltip.
$label = '<label for=""';
if (!empty($this->description)) {
$label .= ' title="' . htmlspecialchars(trim($text, ':') . '::' . ($this->translateDescription ? JText::_($this->description) : $this->description), ENT_COMPAT, 'UTF-8') . '"';
}
// Add the label text and closing tag.
$label .= "></label>";
$field .= '><span class = "sh404sef-additionaltext">' . $link . '</span></fieldset>';
$html[] = $field;
return implode('', $html);
}
示例14: _getDefaultRedirect
/**
* 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);
}
示例15: empty
<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>