本文整理汇总了PHP中Sh404sefFactory::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Sh404sefFactory::getConfig方法的具体用法?PHP Sh404sefFactory::getConfig怎么用?PHP Sh404sefFactory::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sh404sefFactory
的用法示例。
在下文中一共展示了Sh404sefFactory::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($tpl = null)
{
// get model and update context with current
$model =& $this->getModel();
$context = $model->setContext($this->_context . '.' . $this->getLayout());
// display type: simple for very large sites/slow slq servers
$sefConfig =& Sh404sefFactory::getConfig();
// if set for a slowServer, display simplified version of the url manager
$this->assign('slowServer', $sefConfig->slowServer);
// read data from model
$list =& $model->getList((object) array('layout' => $this->getLayout(), 'simpleUrlList' => $this->slowServer, 'slowServer' => $sefConfig->slowServer));
// and push it into the view for display
$this->assign('items', $list);
$this->assign('itemCount', count($this->items));
$this->assign('pagination', $model->getPagination((object) array('layout' => $this->getLayout(), 'simpleUrlList' => $this->slowServer, 'slowServer' => $sefConfig->slowServer)));
$options = $model->getDisplayOptions();
$this->assign('options', $options);
$this->assign('optionsSelect', $this->_makeOptionsSelect($options));
// add behaviors and styles as needed
$modalSelector = 'a.modalediturl';
$js = '\\function(){window.parent.shAlreadySqueezed = false;if(window.parent.shReloadModal) {parent.window.location=\'' . $this->defaultRedirectUrl . '\';window.parent.shReloadModal=true}}';
$params = array('overlayOpacity' => 0, 'classWindow' => 'sh404sef-popup', 'classOverlay' => 'sh404sef-popup', 'onClose' => $js);
Sh404sefHelperHtml::modal($modalSelector, $params);
// build the toolbar
$toolbarMethod = '_makeToolbar' . ucfirst($this->getLayout());
if (is_callable(array($this, $toolbarMethod))) {
$this->{$toolbarMethod}($params);
}
// add our own css
JHtml::styleSheet('urls.css', Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/');
// link to custom javascript
JHtml::script('list.js', Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/');
// now display normally
parent::display($tpl);
}
示例2: shGetNEWSPCategories
function shGetNEWSPCategories($catId, $option, $shLangName, &$cat, &$sec)
{
if (empty($catId)) {
return false;
}
static $catData = null;
$sefConfig =& Sh404sefFactory::getConfig();
if (!is_null($catData[$shLangName][$catId])) {
// get DB
$database =& JFactory::getDBO();
$query = "SELECT c.id, c.section, c.title, s.id as sectionid, s.title as stitle" . "\n FROM #__categories as c, #__sections as s" . "\n WHERE " . "\n s.id = c.section" . "\n AND c.id = '" . $catId . "'";
$database->setQuery($query);
if (shTranslateUrl($option, $shLangName)) {
$categories = $database->loadObjectList();
} else {
$categories = $database->loadObjectList(false);
}
if (!empty($categories)) {
$sec = ($sefConfig->shNewsPInsertSecId ? $sectionId . $sefConfig->replacement : '') . $categories[0]->stitle;
// section
$cat = ($sefConfig->shNewsPInsertCatId ? $sectionId . $sefConfig->replacement : '') . $categories[0]->title;
// category
$catData[$shLangName][$catId]['cat'] = $cat;
$catData[$shLangName][$catId]['sec'] = $sec;
}
} else {
$cat = $catData[$shLangName][$catId]['cat'];
$sec = $catData[$shLangName][$catId]['sec'];
}
return !empty($cat);
}
示例3: _doQuickControl
private function _doQuickControl($tpl)
{
// get configuration object
$sefConfig = Sh404sefFactory::getConfig($reset = true);
// push it into to the view
$this->sefConfig = $sefConfig;
$messages = JFactory::getApplication()->getMessageQueue();
$noMsg = JRequest::getInt('noMsg', 0);
$this->error = array();
// push any message
if (is_array($messages) && !empty($messages)) {
foreach ($messages as $msg) {
if (!empty($msg['message'])) {
$msg['type'] = isset($msg['type']) ? $msg['type'] : 'info';
if ($msg['type'] != 'error') {
if (empty($noMsg)) {
$this->message = $msg['message'];
}
} else {
$this->errors[] = $msg['message'];
}
}
}
}
parent::display($tpl);
}
示例4: array
/**
* Get a Extplugin object for the requested extension
* If no specific plugin is found, the default, generic
* public is used instead
*
* @param string $option the Joomla! component name. Should begin with "com_"
* @return object Sh404sefExtpluginBaseextplugin descendant
*/
public static function &getExtensionPlugin($option)
{
static $_plugins = array();
if (empty($option)) {
$option = 'default';
}
// plugin is cached, check if we already created
// the plugin for $option
if (empty($_plugins[$option])) {
// build the class name for this plugin
// autolaoder will find the appropriate file and load it
// if not loaded
if ($option !== 'default' && strpos($option, 'com_') !== 0) {
$option = 'com_' . $option;
}
$className = 'Sh404sefExtplugin' . ucfirst(strtolower($option));
// does this class exists?
$sefConfig =& Sh404sefFactory::getConfig();
if (class_exists($className, $autoload = true)) {
// instantiate plugin
$_plugins[$option] = new $className($option, $sefConfig);
} else {
// else use generic plugin
$_plugins[$option] = new Sh404sefExtpluginDefault($option, $sefConfig);
}
}
// return cached plugin
return $_plugins[$option];
}
示例5: display
public function display($tpl = null)
{
// version prefix
$this->joomlaVersionPrefix = Sh404sefHelperGeneral::getJoomlaVersionPrefix();
// get model and update context with current
$model = ShlMvcModel_Base::getInstance('urls', 'Sh404sefModel');
$context = $model->setContext($this->_context . '.' . $this->getLayout());
// display type: simple for very large sites/slow slq servers
$sefConfig = Sh404sefFactory::getConfig();
// store it
$model = $this->setModel($model, true);
// read data from model
$list = $model->getList((object) array('layout' => $this->getLayout(), 'getMetaData' => true, 'simpleUrlList' => true, 'slowServer' => $sefConfig->slowServer));
// and push it into the view for display
$this->assign('items', $list);
$this->assign('itemCount', count($this->items));
$this->assign('contentcs', Sh404sefHelperGeneral::getDataMD5($this->items, array('metatitle', 'metadesc')));
$this->assign('pagination', $model->getPagination((object) array('layout' => $this->getLayout(), 'simpleUrlList' => true, 'slowServer' => $sefConfig->slowServer)));
$options = $model->getDisplayOptions();
$this->assign('options', $options);
$this->assign('helpMessage', JText::_('COM_SH404SEF_META_HELP'));
if (version_compare(JVERSION, '3.0', 'ge')) {
$document = JFactory::getDocument();
// add our own css and js
JHtml::styleSheet(Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/' . $this->joomlaVersionPrefix . '_list.css');
JHtml::script(Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/shajax.js');
JHtml::script(Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/j3.js');
// add modal css and js
ShlHtmlBs_helper::addBootstrapCss(JFactory::getDocument());
ShlHtmlBs_helper::addBootstrapJs(JFactory::getDocument());
// variable for modal, not used in 3..x+
$params = array();
$this->_addFilters();
// render submenu sidebar
$this->sidebar = Sh404sefHelperHtml::renderSubmenu();
} else {
// add our own css
JHtml::styleSheet(Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/' . $this->joomlaVersionPrefix . '_urls.css');
// link to custom javascript
JHtml::script(Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/list.js');
JHtml::script(Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/metas.js');
// add behaviors and styles as needed
$modalSelector = 'a.modalediturl';
$js = '\\function(){window.parent.shAlreadySqueezed = false;if(window.parent.shReloadModal) {parent.window.location=\'' . $this->defaultRedirectUrl . '\';window.parent.shReloadModal=true}}';
$params = array('overlayOpacity' => 0, 'classWindow' => 'sh404sef-popup', 'classOverlay' => 'sh404sef-popup', 'onClose' => $js);
Sh404sefHelperHtml::modal($modalSelector, $params);
$this->assign('optionsSelect', $this->_makeOptionsSelect($options));
// add our own css
JHtml::styleSheet(Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/list.css');
}
// build the toolbar
$toolbarMethod = '_makeToolbar' . ucfirst($this->getLayout() . ucfirst($this->joomlaVersionPrefix));
if (is_callable(array($this, $toolbarMethod))) {
$this->{$toolbarMethod}($params);
}
// now display normally
parent::display($this->joomlaVersionPrefix);
}
示例6: _fetchAccountsList
protected function _fetchAccountsList()
{
$hClient =& Sh404sefHelperAnalytics::getHttpClient();
$hClient->resetParameters($clearAll = true);
// build the request
$sefConfig = Sh404sefFactory::getConfig();
$accountIdBits = explode('-', trim($sefConfig->analyticsId));
if (empty($accountIdBits) || count($accountIdBits) < 3) {
throw new Sh404sefExceptionDefault(JText::sprintf('COM_SH404SEF_ERROR_CHECKING_ANALYTICS', 'Invalid account Id'));
}
$accoundId = $accountIdBits[1];
// set target API url
$hClient->setUri($this->_endPoint . 'management/accounts/' . $accoundId . '/webproperties/' . trim($sefConfig->analyticsId) . '/profiles?key=' . $this->_getAppKey());
// make sure we use GET
$hClient->setMethod(Sh_Zend_Http_Client::GET);
// set headers required by Google Analytics
$headers = array('GData-Version' => 2, 'Authorization' => 'GoogleLogin auth=' . $this->_Auth);
$hClient->setHeaders($headers);
//perform request
// establish connection with available methods
$adapters = array('Sh_Zend_Http_Client_Adapter_Curl', 'Sh_Zend_Http_Client_Adapter_Socket');
$rawResponse = null;
// perform connect request
foreach ($adapters as $adapter) {
try {
$hClient->setAdapter($adapter);
$response = $hClient->request();
break;
} catch (Exception $e) {
// need that to be Exception, so as to catch Sh_Zend_Exceptions.. as well
// we failed, let's try another method
}
}
// return if error
if (empty($response)) {
$msg = 'unknown code';
throw new Sh404sefExceptionDefault(JText::sprintf('COM_SH404SEF_ERROR_CHECKING_ANALYTICS', $msg));
}
if (empty($response) || !is_object($response) || $response->isError()) {
$msg = method_exists($response, 'getStatus') ? $response->getStatus() : 'unknown code';
throw new Sh404sefExceptionDefault(JText::sprintf('COM_SH404SEF_ERROR_CHECKING_ANALYTICS', $msg));
}
// analyze response
// check if authentified
Sh404sefHelperAnalytics::verifyAuthResponse($response);
$xml = simplexml_load_string($response->getBody());
if (!empty($xml->entry)) {
foreach ($xml->entry as $entry) {
$account = new StdClass();
$bits = explode('/', (string) $entry->id);
$account->id = array_pop($bits);
$account->title = str_replace('Google Analytics Profile ', '', (string) $entry->title);
$this->_accounts[] = clone $account;
}
}
}
示例7: _makeViewDashboard
/**
* Prepare and display the control panel
* dashboard, which is a simplified view
* of main analytics results
*
* @param string $tpl layout name
*/
private function _makeViewDashboard($tpl)
{
// get configuration object
$sefConfig =& Sh404sefFactory::getConfig();
// push it into to the view
$this->assignRef('sefConfig', $sefConfig);
// get analytics data using helper, possibly from cache
$analyticsData = Sh404sefHelperAnalytics::getData($this->options);
// push analytics stats into view
$this->assign('analytics', $analyticsData);
}
示例8:
protected static function &_getInstance($type = 'file')
{
static $_instance = null;
if (empty($_instance)) {
// get global config
$config =& Sh404sefFactory::getConfig();
// instantiate object
$className = 'Sh404sefClass' . $type . 'cache';
$_instance = new $className($config);
}
return $_instance;
}
示例9: empty
protected static function &_getInstance($handler = '')
{
static $_instance = null;
if (empty($_instance)) {
// get global config
$config =& Sh404sefFactory::getConfig();
// instantiate object
$handler = empty($handler) ? $config->UrlCacheHandler : $handler;
$className = 'Sh404sefClass' . ucfirst($handler) . 'cache';
$_instance = new $className($config);
}
return $_instance;
}
示例10: _shDecodeSecLogLine
private static function _shDecodeSecLogLine($line)
{
$sefConfig =& Sh404sefFactory::getConfig();
// skip comments
if (substr($line, 0, 1) == '#') {
return;
}
if (preg_match('/[0-9]{2}\\-[0-9]{2}\\-[0-9]{2}/', $line)) {
// this is not header or comment line
self::$_counters['shSecTotalAttacks']++;
$bits = explode("\t", $line);
switch (substr($bits[2], 0, 15)) {
case 'Flooding':
self::$_counters['shSecTotalFlooding']++;
break;
case 'Caught by Honey':
self::$_counters['shSecTotalPHP']++;
break;
case 'Honey Pot but u':
self::$_counters['shSecTotalPHPUserClicked']++;
break;
case 'Var not numeric':
case 'Var not alpha-n':
case 'Var contains ou':
self::$_counters['shSecTotalStandardVars']++;
break;
case 'Image file name':
self::$_counters['shSecTotalImgTxtCmd']++;
break;
case '<script> tag in':
self::$_counters['shSecTotalScripts']++;
break;
case 'Base 64 encoded':
self::$_counters['shSecTotalBase64']++;
break;
case 'mosConfig_var i':
self::$_counters['shSecTotalConfigVars']++;
break;
case 'Blacklisted IP':
self::$_counters['shSecTotalIPDenied']++;
break;
case 'Blacklisted use':
self::$_counters['shSecTotalUserAgentDenied']++;
break;
default:
// if not one of those, then it's a 404, don't count it as an attack
self::$_counters['shSecTotalAttacks']--;
break;
}
}
}
示例11: _doQuickControl
private function _doQuickControl($tpl)
{
// get configuration object
$sefConfig =& Sh404sefFactory::getConfig();
// push it into to the view
$this->assignRef('sefConfig', $sefConfig);
// push any message
$error = $this->getError();
if (empty($error)) {
$noMsg = JRequest::getInt('noMsg', 0);
if (empty($noMsg)) {
$this->assign('message', JText::_('COM_SH404SEF_ELEMENT_SAVED'));
}
}
parent::display($tpl);
}
示例12: 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());
}
}
}
示例13: shSimpleLogger
function shSimpleLogger($siteName, $basePath, $fileName, $isActive)
{
$sefConfig = Sh404sefFactory::getConfig();
if (empty($isActive)) {
$this->isActive = 0;
return;
} else {
$this->isActive = 1;
}
$traceFileName = $basePath . $sefConfig->debugStartedAt . '.' . $fileName . '_' . str_replace('/', '_', str_replace('http://', '', $siteName)) . '.log';
// Create file
$fileIsThere = file_exists($traceFileName);
$sep = "\t";
if (!$fileIsThere) {
// create file
$fileHeader = 'sh404SEF trace file - created : ' . $this->logTime() . ' for ' . $siteName . "\n\n" . str_repeat('-', 25) . ' PHP Configuration ' . str_repeat('-', 25) . "\n\n";
$config = $this->parsePHPConfig();
$line = str_repeat('-', 69) . "\n\n";
// look for ob handlers, as we cannot use print_r from one (thanks Moovur !)
$handlers = ob_list_handlers();
$line .= "\nHandlers found : " . count($handlers);
if (!empty($handlers)) {
foreach ($handlers as $key => $handler) {
$line .= "\nHandler " . ($key + 1) . ' : ' . $handler;
}
}
$line .= "\n" . str_repeat('-', 69) . "\n\n";
} else {
$fileHeader = '';
}
$file = fopen($traceFileName, 'ab');
if ($file) {
if (!empty($fileHeader)) {
fWrite($file, $fileHeader);
fWrite($file, print_r($config, true));
fwrite($file, $line);
}
$this->logFile = $file;
} else {
$this->isActive = 0;
return;
}
}
示例14: shAppendListing
function shAppendListing($link_name, $link_id, $add_details = false, $shLangIso, $option, $shLangName)
{
global $sh_LANG;
$sefConfig =& Sh404sefFactory::getConfig();
$sef = array();
if ($sefConfig->shMTreeInsertListingId) {
if (!$sefConfig->shMTreePrependListingId) {
$sef[] = ($sefConfig->shMTreeInsertListingName ? $link_name . $sefConfig->replacement : '') . $link_id;
} else {
$sef[] = $link_id . ($sefConfig->shMTreeInsertListingName ? $sefConfig->replacement . $link_name : '');
}
} else {
if ($sefConfig->shMTreeInsertListingName) {
$sef[] = $link_name;
}
}
if ($add_details) {
$sef[] = $sh_LANG[$shLangIso]['_MT_SEF_DETAILS'];
}
if ($sefConfig->shMTreeInsertListingName || $sefConfig->shMTreeInsertListingId) {
shRemoveFromGETVarsList('link_id');
}
return $sef;
}
示例15: getSefURLFromCacheOrDB
public function getSefURLFromCacheOrDB($nonSefUrl, &$sefUrl)
{
$sefConfig = Sh404sefFactory::getConfig();
if (empty($nonSefUrl)) {
return sh404SEF_URLTYPE_NONE;
}
$sefUrl = '';
$urlType = sh404SEF_URLTYPE_NONE;
if ($sefConfig->shUseURLCache) {
$urlType = Sh404sefHelperCache::getSefUrlFromCache($nonSefUrl, $sefUrl);
}
// Check if the url is already saved in the database.
if ($urlType == sh404SEF_URLTYPE_NONE) {
$urlType = $this->getSefUrlFromDatabase($nonSefUrl, $sefUrl);
if ($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) {
return $urlType;
} else {
if ($sefConfig->shUseURLCache) {
Sh404sefHelperCache::addSefUrlToCache($nonSefUrl, $sefUrl, $urlType);
}
}
}
return $urlType;
}