aliroSEF Class Reference

Inheritance diagram for aliroSEF:

cachedSingleton aliroFriendlyBase

List of all members.

Public Member Functions

 clearCache ()
 getContentMenuInfo ()
 nameForURL ($string)
 translateContentTask ($task)
 untranslateContentTask ($tr_task)
 sefRetrieval ()
 getHead ()
 makeMeta ($name, $value)
 metaData ()
 sefRelToAbs ($string, $specialamp=true)
 nameForURL ($string)
 translateContentTask ($task)
 untranslateContentTask ($tr_task)
 sefRetrieval ()
 sefRelToAbs ($string, $specialamp=true)
 __construct ()
 sefRetrieval ($register_globals)
 default_revert ($specialname)
 sefRelToAbs ($string)
 componentDetails (&$params, $task)

Static Public Member Functions

static getInstance ()
static getInstance ()
static getInstance ()

Public Attributes

 $content_data = null
 $content_items = array()
 $content_sections = array()
 $content_categories = array()

Protected Member Functions

 __construct ()

Static Protected Attributes

static $instance = __CLASS__

Private Member Functions

 __construct ()
 analyseStandardURI ($uri)
 retrieveURI ($sef)
 invoke_plugin ($i, $method, $parm1, $parm2=0)
 default_revert ($specialname)
 parse ($string, &$parms)
 outSubstitution ($inuri, $outuri)
 componentDetails (&$params, $task)
 basicJoomlaRetrieve ($uri)
 saveCache ()
 invoke_plugin ($i, $method, $parm1, $parm2=0)
 default_revert ($specialname)
 parse ($string, &$parms)
 componentDetails (&$params, $task)

Private Attributes

 $live_site = ''
 $home_page = false
 $mainmenu = array()
 $config = null
 $sef_name_string = ''
 $sef_translate_string = ''
 $content_tasks = array()
 $content_menus = array()
 $metadata = null
 $SEF_SPACE
 $cachedSEF = array()
 $cachedTime = array()
 $cacheWritten = array()
 $cacheObject = null
 $database = null
 $prefix = ''
 $translate_underscore = 0
 $sef_active = false
 $custom_code = array()
 $custom_name = array()
 $custom_PHP = array()
 $custom_short = array()
 $sef_content_task = array()
 $sef_name_chars = array()
 $sef_translate_chars = array()


Detailed Description

Definition at line 156 of file aliroSEF.php.


Constructor & Destructor Documentation

aliroSEF::__construct (  )  [private]

Definition at line 211 of file aliroSEF.php.

References aliroFriendlyBase::getCfg(), aliroMenuHandler::getInstance(), and aliroDatabase::getInstance().

00211                                     {
00212         $this->database = aliroDatabase::getInstance();
00213         $this->live_site = $this->getCfg('live_site');
00214 
00215         /*******************************************************************************
00216         **  The following are parameters for the ReMOSef Search Engine
00217         **  Optimisation component.  $this->SEF_SPACE should be set to the
00218         **  character that is to replace blanks in names that form the URL.
00219         **  You can privatey this, although the only sensible choices seem to be
00220         **  underscore or hyphen (_ or -).
00221         **
00222         **  The arrays $this->config->custom_code and $this->config->custom_name must be kept exactly
00223         **  in step with each other.  $this->custom_code is a list of the components
00224         **  that are to be handled by ReMOSef.
00225         **
00226         **  The array $this->config->custom_name is the alternative name that will be used
00227         **  in the optimised URL to identify the component and can be whatever
00228         **  you please so long as it is unique and legal for a URL.  Apart from
00229         **  using the custom name for the component, ReMOSef will do no further
00230         **  translation of the URL than is done by the standard Mambo SEF - UNLESS
00231         **  there is a sef_ext.php file installed for that component.  The
00232         **  exception to this is ReMOSitory - the optimisation code for Remository
00233         **  is integrated in ReMOSef.  For other components, if a sef_ext.php is
00234         **  present, it will be invoked by ReMOSef.
00235         **
00236         **  The array $remosef_content_task is capable of translating the tasks
00237         **  understood by the Mambo content component.  Please DO NOT CHANGE what
00238         **  is to the left of the equals sign.  When putting different values on
00239         **  the right hand side, remember that they must all be different, and must
00240         **  also be different from any of the custom names used for components.
00241         **  Without that, Remosef cannot figure out what a SEF URL means and will
00242         **  give unpredictable results.
00243         **
00244         **  Note that the names in custom_name must not be allowed to clash with
00245         **  the names used as tasks by the content component, in their
00246         **  translated form - see below.
00247         *******************************************************************************/
00248         // Use of underscore is NOT recommended, as search engines then do not see the words
00249         global $_SEF_SPACE;                                 // divide words with hyphens
00250         $this->SEF_SPACE = $_SEF_SPACE = "-";               // divide words with hyphens
00251         /*******************************************************************************
00252         **  The following are the parameters for the optional content specific
00253         **  URL optimisation.  They are not used within the standard SEF processing
00254         **  unless you add in a sef_ext.php that is integrated with the Mambo SEF.
00255         **
00256         **  The following two lines define the translations that SEF will perform on
00257         **  names of sections and categories when translating them for inclusion in a URL.
00258         **  Each item in $this->config->sef_name_chars is translated into the corresponding
00259         **  element of $this->config->sef_translate_chars.
00260         **
00261         **  NOTE it is important that space be the last translate character, since the
00262         **  characters are processed in the order in which they appear.  Since earlier
00263         **  translates may create new spaces, it is vital that the space translation is
00264         **  done last.
00265         **
00266         **  You can extend these arrays as you wish, although it is obviously important
00267         **  to make sure that the items of one match the items of the other exactly.
00268         *******************************************************************************/
00269         $this->sef_name_string = '"\'';
00270         $this->sef_translate_string = '--';
00271         $this->content_tasks = array ('findkey',
00272         'view',
00273         'section',
00274         'category',
00275         'blogsection',
00276         'blogcategorymulti',
00277         'blogcategory',
00278         'archivesection',
00279         'archivecategory',
00280         'save',
00281         'cancel',
00282         'emailform',
00283         'emailsend',
00284         'vote',
00285         'showblogsection'
00286         );
00287 
00288         $this->cache =new aliroCache('aliroSEF');
00289         $this->config = $this->cache->get('sefConfig');
00290         if (!$this->config) {
00291             $this->config = new stdClass();
00292             $this->config->underscore = 0;
00293             $this->config->enabled = 1;
00294             $this->config->strip_chars = '';
00295             $this->config->lower_case = '0';
00296             $this->config->unique_id = '0';
00297             $this->config->cache_time = '600';
00298             $this->config->buffer_size = '500';
00299             $this->config->home_title = 'Home';
00300             $this->config->title_separator = '|';
00301             $this->config->default_robots = 'index, follow';
00302             $this->config->custom_code = array();
00303             $this->config->custom_name = array();
00304             $this->config->custom_PHP = array();
00305             $this->config->custom_short = array();
00306             $this->config->sef_content_task = array();
00307             $this->config->sef_name_chars = array();
00308             $this->config->sef_translate_chars = array();
00309             $this->config->component_details = array();
00310             $this->config->sef_substitutions_exact = array();
00311             $this->config->sef_substitutions_in = array();
00312             $this->config->sef_substitutions_out = array();
00313             $this->config->legal_content_tasks = array();
00314             $this->config->sef_name_chars = array('!', '?', '&', '/', ' ');
00315             $this->config->sef_translate_chars = array('', '', 'and', ' or ', $this->SEF_SPACE);
00316 
00317             $configdata = $this->database->doSQLget ("SELECT * FROM #__remosef_config");
00318             foreach ($configdata as $item) {
00319                 if ('options' == $item->type) {
00320                     $name = $item->name;
00321                     $this->config->$name = $item->modified;
00322                 }
00323                 elseif ('components' == $item->type) {
00324                     $this->config->custom_code[] = $item->name;
00325                     $this->config->custom_name[] = $item->modified;
00326                 }
00327                 elseif ('characters' == $item->type) {
00328                     $this->config->sef_name_chars[] = $item->name;
00329                     $this->config->sef_translate_chars[] = $item->modified;
00330                 }
00331                 elseif ('substitutions' == $item->type) {
00332                     $this->config->sef_substitutions_exact[$item->name] = $item->modified;
00333                 }
00334                 elseif ('substitutions_in' == $item->type) {
00335                     $this->config->sef_substitutions_in["#$item->name#i"] = $item->modified;
00336                 }
00337                 elseif ('substitutions_out' == $item->type) {
00338                     $this->config->sef_substitutions_out["#$item->name#i"] = $item->modified;
00339                 }
00340                 elseif ('content' == $item->type) $this->config->sef_content_task[$item->name] = $item->modified;
00341                 else $this->config->component_details[$item->type][$item->name] = $item->modified;
00342             }
00343             unset($configdata);
00344             foreach ($this->content_tasks as $task) {
00345                 $this->config->legal_content_tasks[] = isset($this->config->sef_content_task[$task]) ? $this->config->sef_content_task[$task] : $task;
00346             }
00347             foreach ($this->config->custom_code as $code) {
00348                 $codefile = _ALIRO_CLASS_BASE."/components/$code/sef_ext.php";
00349                 $seffile = dirname(__FILE__)."/sef_ext/$code/sef_ext.php";
00350                 if (file_exists($codefile)) $this->config->custom_PHP[] = $codefile;
00351                 elseif (file_exists($seffile)) $this->config->custom_PHP[] = $seffile;
00352                 else $this->config->custom_PHP[] = false;
00353                 $split = explode('_',$code);
00354                 $this->config->custom_short[] = $split[1];
00355             }
00356             $this->cache->save($this->config);
00357         }
00358 
00359         $this->mainmenu = aliroMenuHandler::getInstance()->getByParentOrder('mainmenu');
00360         if ($this->mainmenu) foreach ($this->mainmenu as $menu) {
00361             $stage2 = parse_url($menu->link);
00362             if (isset($stage2['query'])) {
00363                 parse_str($stage2['query'], $parms);
00364                 if (isset($parms['option']) AND 'com_content' == $parms['option']) {
00365                     if (isset($parms['task'])) $this->content_menus[$parms['task']][$menu->id] = $parms;
00366                 }
00367             }
00368         }
00369 
00370         $results = $this->cache->get('sefDataURI');
00371         if (!$results) {
00372             $results = $this->database->doSQLget("SELECT * FROM #__remosef_uri ORDER BY refreshed DESC LIMIT {$this->config->buffer_size}");
00373             $this->cache->save($results);
00374         }
00375         foreach ($results as $result) {
00376             $uri = $result->uri;
00377             $this->cachedSEF[$uri] = $result->sef;
00378             $this->cachedTime[$uri] = $result->refreshed;
00379         }
00380         unset($results);
00381     }

aliroSEF::__construct (  )  [protected]

Definition at line 75 of file Copy of aliroSEF.php.

References $config, $database, aliroCore::getInstance(), aliroDatabase::getInstance(), and name.

00075                                       {
00076         $database = aliroDatabase::getInstance();
00077         $config = mamboCore::getInstance();
00078         $this->sef_active = $config->getCfg('sef');
00079 
00080         /*******************************************************************************
00081         **  The following are parameters for the ReMOSef Search Engine
00082         **  Optimisation component.  $this->SEF_SPACE should be set to the
00083         **  character that is to replace blanks in names that form the URL.
00084         **  You can privatey this, although the only sensible choices seem to be
00085         **  underscore or hyphen (_ or -).
00086         **
00087         **  The arrays $this->custom_code and $this->custom_name must be kept exactly
00088         **  in step with each other.  $this->custom_code is a list of the components
00089         **  that are to be handled by ReMOSef.
00090         **
00091         **  The array $this->custom_name is the alternative name that will be used
00092         **  in the optimised URL to identify the component and can be whatever
00093         **  you please so long as it is unique and legal for a URL.  Apart from
00094         **  using the custom name for the component, ReMOSef will do no further
00095         **  translation of the URL than is done by the standard Mambo SEF - UNLESS
00096         **  there is a sef_ext.php file installed for that component.  The
00097         **  exception to this is ReMOSitory - the optimisation code for Remository
00098         **  is integrated in ReMOSef.  For other components, if a sef_ext.php is
00099         **  present, it will be invoked by ReMOSef.
00100         **
00101         **  The array $remosef_content_task is capable of translating the tasks
00102         **  understood by the Mambo content component.  Please DO NOT CHANGE what
00103         **  is to the left of the equals sign.  When putting different values on
00104         **  the right hand side, remember that they must all be different, and must
00105         **  also be different from any of the custom names used for components.
00106         **  Without that, Remosef cannot figure out what a SEF URL means and will
00107         **  give unpredictable results.
00108         **
00109         **  Note that the names in custom_name must not be allowed to clash with
00110         **  the names used as tasks by the content component, in their
00111         **  translated form - see below.
00112         *******************************************************************************/
00113         // Use of underscore is NOT recommended, as search engines then do not see the words
00114         global $_SEF_SPACE;                                 // divide words with hyphens
00115         $this->SEF_SPACE = $_SEF_SPACE = "-";               // divide words with hyphens
00116         /*******************************************************************************
00117         **  The following are the parameters for the optional content specific
00118         **  URL optimisation.  They are not used within the standard SEF processing
00119         **  unless you add in a sef_ext.php that is integrated with the Mambo SEF.
00120         **
00121         **  The following two lines define the translations that SEF will perform on
00122         **  names of sections and categories when translating them for inclusion in a URL.
00123         **  Each item in $this->sef_name_chars is translated into the corresponding
00124         **  element of $this->sef_translate_chars.
00125         **
00126         **  NOTE it is important that space be the last translate character, since the
00127         **  characters are processed in the order in which they appear.  Since earlier
00128         **  translates may create new spaces, it is vital that the space translation is
00129         **  done last.
00130         **
00131         **  You can extend these arrays as you wish, although it is obviously important
00132         **  to make sure that the items of one match the items of the other exactly.
00133         *******************************************************************************/
00134         $this->sef_name_chars = array('!', '?', '&', '/', ' ');
00135         $this->sef_translate_chars = array('', '', 'and', ' or ', $this->SEF_SPACE);
00136         $this->sef_name_string = '"\'';
00137         $this->sef_translate_string = '--';
00138 
00139         $database->setQuery ("SELECT * FROM #__remosef_config");
00140         $configs = $database->loadObjectList();
00141         if ($configs) foreach ($configs as $item) {
00142             if ($item->type == 'options') {
00143                 if ($item->name == 'prefix') $this->prefix = $item->modified;
00144                 if ($item->name == 'underscore') $this->translate_underscore = $item->modified;
00145             }
00146             if ($item->type == 'components') {
00147                 $this->custom_code[] = $item->name;
00148                 $this->custom_name[] = $item->modified;
00149             }
00150             if ($item->type == 'characters') {
00151                 $this->sef_name_chars[] = $item->name;
00152                 $this->sef_translate_chars[] = $item->modified;
00153             }
00154             if ($item->type == 'content') $this->sef_content_task[$item->name] = $item->modified;
00155         }
00156         unset($configs);
00157 
00158         if (!$this->prefix OR $this->prefix == 'content' OR $this->prefix == 'component') $this->prefix = 'ali';
00159         foreach ($this->custom_code as $code) {
00160             $codefile = "/components/$code/sef_ext.php";
00161             if (file_exists(_ALIRO_ABSOLUTE_PATH.$codefile)) $this->custom_PHP[] = $codefile;
00162             else $this->custom_PHP[] = false;
00163             $split = explode('_',$code);
00164             $this->custom_short[] = $split[1];
00165         }
00166 
00167     }

aliroSEF::__construct (  ) 

Definition at line 26 of file old.aliroSEF.php.

References aliroCore::get(), and aliroCore::is_set().

00026                             {
00027         /*******************************************************************************
00028         **  The following are parameters for the ReMOSef Search Engine
00029         **  Optimisation component.  $this->SEF_SPACE should be set to the
00030         **  character that is to replace blanks in names that form the URL.
00031         **  You can vary this, although the only sensible choices seem to be
00032         **  underscore or hyphen (_ or -).
00033         **
00034         **  The arrays $this->custom_code and $this->custom_name must be kept exactly
00035         **  in step with each other.  $this->custom_code is a list of the components
00036         **  that are to be handled by ReMOSef.
00037         **
00038         **  The array $this->custom_name is the alternative name that will be used
00039         **  in the optimised URL to identify the component and can be whatever
00040         **  you please so long as it is unique and legal for a URL.  Apart from
00041         **  using the custom name for the component, ReMOSef will do no further
00042         **  translation of the URL than is done by the standard Mambo SEF - UNLESS
00043         **  there is a sef_ext.php file installed for that component.  The
00044         **  exception to this is ReMOSitory - the optimisation code for Remository
00045         **  is integrated in ReMOSef.  For other components, if a sef_ext.php is
00046         **  present, it will be invoked by ReMOSef.
00047         **
00048         **  The array $remosef_content_task is capable of translating the tasks
00049         **  understood by the Mambo content component.  Please DO NOT CHANGE what
00050         **  is to the left of the equals sign.  When putting different values on
00051         **  the right hand side, remember that they must all be different, and must
00052         **  also be different from any of the custom names used for components.
00053         **  Without that, Remosef cannot figure out what a SEF URL means and will
00054         **  give unpredictable results.
00055         *******************************************************************************/
00056         $this->SEF_SPACE = "_";                 // divide words with underscores
00057                                             // can be changed to a hyphen "-"
00058         $this->custom_code = array('com_frontpage','com_contact');
00059         $this->custom_name = array('Frontpage','Contact_Us');
00060         /*******************************************************************************
00061         **  The following are the parameters for the optional content specific
00062         **  URL optimisation.
00063         **
00064         **  The following two lines define the translations that SEF will perform on
00065         **  names of sections and categories when translating them for inclusion in a URL.
00066         **  Each item in $this->sef_name_chars is translated into the corresponding
00067         **  element of $this->sef_translate_chars.
00068         **
00069         **  NOTE it is important that space be the last translate character, since the
00070         **  characters are processed in the order in which they appear.  Since earlier
00071         **  translates may create new spaces, it is vital that the space translation is
00072         **  done last.
00073         **
00074         **  You can extend these arrays as you wish, although it is obviously important
00075         **  to make sure that the items of one match the items of the other exactly.
00076         *******************************************************************************/
00077         $this->sef_name_chars = array('–', '?', '&', '/', ' ');
00078         $this->sef_translate_chars = array('-', '', 'and', ' or ', $this->SEF_SPACE);
00079 
00080 /************** DO NOT MAKE CHANGES PAST HERE EXCEPT AT YOUR OWN RISK! ********************/
00081 
00082         if (mamboCore::is_set('mosConfig_sef_prefix')) $this->prefix = mamboCore::get('mosConfig_sef_prefix');
00083         else $this->prefix = 'mos';
00084         if ($this->prefix == 'content' OR $this->prefix == 'component') $this->prefix = 'mos';
00085         foreach ($this->custom_code as $code) {
00086             $codefile = "components/$code/sef_ext.php";
00087             if (file_exists($codefile)) {
00088                 include ($codefile);
00089                 $this->custom_PHP[] = true;
00090             }
00091             else $this->custom_PHP[] = false;
00092             $split = explode('_',$code);
00093             $this->custom_short[] = $split[1];
00094         }
00095 
00096         $this->sef_content_task['findkey'] = 'findkey';
00097         $this->sef_content_task['view'] = 'view';
00098         $this->sef_content_task['section'] = 'section';
00099         $this->sef_content_task['category'] = 'category';
00100         $this->sef_content_task['blogsection'] = 'blogsection';
00101         $this->sef_content_task['blogcategorymulti'] = 'blogcategorymulti';
00102         $this->sef_content_task['blogcategory'] = 'blogcategory';
00103         $this->sef_content_task['archivesection'] = 'archivesection';
00104         $this->sef_content_task['archivecategory'] = 'archivecategory';
00105         $this->sef_content_task['save'] = 'save';
00106         $this->sef_content_task['cancel'] = 'cancel';
00107         $this->sef_content_task['emailform'] = 'emailform';
00108         $this->sef_content_task['emailsend'] = 'emailsend';
00109         $this->sef_content_task['vote'] = 'vote';
00110         $this->sef_content_task['showblogsection'] = 'showblogsection';
00111 
00112     }


Member Function Documentation

static aliroSEF::getInstance (  )  [static]

Definition at line 383 of file aliroSEF.php.

Referenced by aliroPathway::__construct(), aliroUserTemplateBase::__get(), aliroUserRequest::doControl(), aliroAbstractPageNav::fixLink(), aliroUserPageNav::getLimitBox(), aliroMenuCreator::makeMenuLink(), and aliroFolderHandler::setFolderPathway().

00383                                           {
00384         return is_object(self::$instance) ? self::$instance : (self::$instance = new self::$instance());
00385     }

aliroSEF::clearCache (  ) 

Definition at line 387 of file aliroSEF.php.

00387                                   {
00388         $this->cache->clean();
00389     }

aliroSEF::getContentMenuInfo (  ) 

Definition at line 391 of file aliroSEF.php.

00391                                           {
00392         return $this->content_menus;
00393     }

aliroSEF::nameForURL ( string  ) 

Definition at line 395 of file aliroSEF.php.

00395                                          {
00396         $strips = explode ('|', $this->config->strip_chars);
00397         $string = str_replace($strips, '', $string);
00398         $string = aliroUnaccent::getInstance()->unaccent($string);
00399         $string = str_replace($this->config->sef_name_chars, $this->config->sef_translate_chars, $string);
00400         // This may be problematic - must not urldecode the incoming URL as components may duplicate
00401         $string = urlencode($string);
00402         return $string;
00403     }

aliroSEF::translateContentTask ( task  ) 

Definition at line 405 of file aliroSEF.php.

00405                                           {
00406         if (isset($this->config->sef_content_task[$task])) return $this->config->sef_content_task[$task];
00407         else return $task;
00408     }

aliroSEF::untranslateContentTask ( tr_task  ) 

Definition at line 410 of file aliroSEF.php.

Referenced by basicJoomlaRetrieve(), and sefRetrieval().

00410                                                {
00411         $task = array_search ($tr_task, $this->config->sef_content_task);
00412         if (!$task) $task = $tr_task;
00413         if (in_array($task, $this->content_tasks)) return $task;
00414         else return null;
00415     }

aliroSEF::analyseStandardURI ( uri  )  [private]

Definition at line 417 of file aliroSEF.php.

References $_REQUEST.

Referenced by sefRetrieval().

00417                                                {
00418         $_SERVER['REQUEST_URI'] = $uri;
00419         $this->database->setQuery("SELECT * FROM #__remosef_metadata WHERE uri = '$uri'");
00420         $this->database->loadObject($this->metadata);
00421         $mainparts = explode('?', $uri);
00422         if (empty($mainparts[1])) return;
00423         $vars = explode('&', $mainparts[1]);
00424         foreach ($vars as $var) {
00425             $parts = explode('=', $var);
00426             if (!empty($parts[1])) {
00427                 $_REQUEST[$parts[0]] = $_GET[$parts[0]] = $parts[1];
00428             }
00429         }
00430     }

aliroSEF::sefRetrieval (  ) 

Definition at line 432 of file aliroSEF.php.

References analyseStandardURI(), basicJoomlaRetrieve(), retrieveURI(), and sefRelToAbs().

00432                                    {
00433         $uri = $_SERVER['REQUEST_URI'];
00434         $sublength = strlen(dirname($_SERVER['PHP_SELF']));
00435         if (1 < $sublength) $uri = substr($uri,$sublength);
00436         if (!$uri OR $uri == '/' or $uri == '/index.php') {
00437             $this->home_page = true;
00438             return 0;
00439         }
00440         if (preg_match('/(\b)GLOBALS|_REQUEST|_SERVER|_ENV|_COOKIE|_GET|_POST|_FILES|_SESSION(\b)/i', $uri) > 0) {
00441             die('Invalid Request');
00442         }
00443         $regex = '#[<>\(\)@"\']+|/\?#';
00444         if (preg_match($regex, $uri)) return 1;
00445         // if ($this->config->underscore AND $this->SEF_SPACE == '-' AND strpos($uri,'_') !== false) $uri = str_replace('_', '-', $uri);
00446         $exactback = isset($this->config->sef_substitutions_exact) ? array_search($uri, $this->config->sef_substitutions_exact) : false;
00447         if (false === $exactback AND '/' != substr($uri,-1)) {
00448             $exactback = array_search($uri.'/', $this->config->sef_substitutions_exact);
00449             if (false !== $exactback) {
00450                 header ('HTTP/1.1 301 Moved Permanently');
00451                 header ('Location:'.$this->live_site.$uri.'/');
00452                 exit;
00453             }
00454         }
00455         if (false !== $exactback) {
00456             $this->analyseStandardURI($exactback);
00457             return 0;
00458         }
00459         $uri = str_replace(array('!', '%21'), array('',''), $uri);
00460         $saveuri = $uri;
00461         if (isset($this->config->sef_substitutions_in)) $uri = @preg_replace(array_keys($this->config->sef_substitutions_in), array_values($this->config->sef_substitutions_in), $uri);
00462         if ($indexloc = strpos($uri, 'index.php?')) {
00463             if ($_SERVER['REQUEST_METHOD'] == 'GET') {
00464                 $sefagain = substr($this->sefRelToAbs(substr($uri,$indexloc), false),strlen($this->live_site));
00465                 if ($saveuri != $sefagain) {
00466                     header ('HTTP/1.1 301 Moved Permanently');
00467                     header ('Location:'.$sefagain);
00468                     exit;
00469                 }
00470             }
00471             return 0;
00472         }
00473         elseif (false !== strpos($uri,'index2.php')) return 0;
00474         elseif (false !== strpos($uri,'index3.php')) return 0;
00475         $retrieved = $this->retrieveURI ($uri);
00476         if (!$retrieved AND '/' != substr($uri,-1)) {
00477             $retrieved = $this->retrieveURI($uri.'/');
00478             if ($retrieved) {
00479                     header ('HTTP/1.1 301 Moved Permanently');
00480                     header ('Location:'.$this->live_site.$uri.'/');
00481                     exit;
00482             }
00483         }
00484         if (!$retrieved) {
00485             $retrieved = $this->basicJoomlaRetrieve($uri);
00486             trigger_error('Had to invoke basicJoomlaRetrieve: '.$uri.' : '.$retrieved);
00487         }
00488 
00489         if ($retrieved) {
00490             $retrieved = 'index.php?'.$retrieved;
00491             $sefagain = substr($this->sefRelToAbs($retrieved),strlen($this->live_site));
00492             if ($saveuri != $sefagain AND $_SERVER['REQUEST_METHOD'] == 'GET') {
00493                 header ('HTTP/1.1 301 Moved Permanently');
00494                 header ('Location:'.$sefagain);
00495                 exit;
00496             }
00497                 $this->analyseStandardURI($retrieved);
00498             $returncode = 0;
00499         }
00500         else $returncode = 1;
00501 
00502         return $returncode;
00503     }

aliroSEF::retrieveURI ( sef  )  [private]

Definition at line 505 of file aliroSEF.php.

References $sef.

Referenced by sefRetrieval().

00505                                         {
00506         $retrieved = array_search($sef, $this->cachedSEF);
00507         if ($retrieved) return $retrieved;
00508         $coded_sef = $this->database->getEscaped($sef);
00509         $this->database->setQuery("SELECT uri FROM #__remosef_uri WHERE sef='$coded_sef'");
00510         $this->database->loadObject($sefdata);
00511         if ($sefdata) return $sefdata->uri;
00512         else return false;
00513     }

aliroSEF::invoke_plugin ( i,
method,
parm1,
parm2 = 0 
) [private]

Definition at line 515 of file aliroSEF.php.

Referenced by basicJoomlaRetrieve(), and sefRelToAbs().

00515                                                                    {
00516         error_reporting(E_ALL);
00517         require_once($this->config->custom_PHP[$i]);
00518         $classname = 'sef_'.$this->config->custom_short[$i];
00519         $compname = 'com_'.$this->config->custom_short[$i];
00520         $maptags = isset($this->config->component_details[$compname]) ? $this->config->component_details[$compname] : array();
00521         $callplugin = array($classname, 'getInstance');
00522         if (is_callable($callplugin)) {
00523             $plugin = call_user_func($callplugin);
00524             if ('create' == $method) return $plugin->$method($parm1, $this->config->lower_case, $this->config->unique_id, $maptags);
00525             else return $plugin->revert($parm1, $parm2, $maptags);
00526         }
00527         else {
00528             $callplugin = array($classname, $method);
00529             if ('create' == $method) return call_user_func ($callplugin, $parm1, $this->config->lower_case, $this->config->unique_id, $maptags);
00530             else return call_user_func ($callplugin, $parm1, $parm2, $maptags);
00531         }
00532     }

aliroSEF::default_revert ( specialname  )  [private]

Definition at line 534 of file aliroSEF.php.

References $_REQUEST.

Referenced by basicJoomlaRetrieve(), and sefRetrieval().

00534                                                    {
00535         $request = explode($specialname.'/', $_SERVER['REQUEST_URI']);
00536         if (isset($request[1])) $parmset = explode("/", $request[1]);
00537         else $parmset = array();
00538         $QUERY_STRING = '';
00539         foreach($parmset as $values) {
00540             $parts = explode(",", $values);
00541             if (count($parts) > 1) {
00542                 $_REQUEST[$parts[0]] = $_GET[$parts[0]] = $parts[1];
00543                 if ($parts[0] == 'option') $QUERY_STRING .= "option=$parts[1]";
00544                 else $QUERY_STRING .= "&$parts[0]=$parts[1]";
00545             }
00546         }
00547         return $QUERY_STRING;
00548     }

aliroSEF::parse ( string,
&$  parms 
) [private]

Definition at line 550 of file aliroSEF.php.

Referenced by sefRelToAbs().

00550                                               {
00551         $parms = array();
00552         $parts = explode('&', $string);
00553         foreach ($parts as $part) {
00554             $assigns = explode('=', $part);
00555             if (count($assigns) == 2) $parms[$assigns[0]] = $assigns[1];
00556         }
00557     }

aliroSEF::getHead (  ) 

Definition at line 560 of file aliroSEF.php.

References $mainframe, aliroFriendlyBase::getCfg(), and makeMeta().

Referenced by metaData().

00560                                {
00561         global $mainframe;
00562         $head = $found = array();
00563         $block['title'] = 1;
00564         $sitename = $this->getCfg('sitename');
00565         if ($this->home_page) $extratitle = $this->config->home_title;
00566         elseif (empty($this->metadata->htmltitle)) {
00567             if (strlen($mainframe->_head['title']) > strlen($sitename)) $extratitle = substr($mainframe->_head['title'], strlen($sitename)+3);
00568             else $extratitle = '';
00569         }
00570         else $extratitle = htmlspecialchars($this->metadata->htmltitle, ENT_QUOTES, 'UTF-8');
00571         if ($extratitle) {
00572             if (strlen($extratitle) + strlen($sitename) < 60) $extratitle .= ' '.$this->config->title_separator.' '.$sitename;
00573         }
00574         else $extratitle = $sitename;
00575         $head[] = '<title>' . $extratitle . '</title>';
00576         if (!empty($this->metadata->description)) {
00577             $head[] = $this->makeMeta('description', htmlspecialchars($this->metadata->description, ENT_QUOTES, 'UTF-8'));
00578             $block['description'] = 1;
00579         }
00580 
00581         if (!empty($this->metadata->keywords)) {
00582             $head[] = $this->makeMeta('keywords', htmlspecialchars($this->metadata->keywords, ENT_QUOTES, 'UTF-8'));
00583             $block['keywords'] = 1;
00584         }
00585 
00586         if (!empty($this->metadata->robots)) {
00587             $head[] = $this->makeMeta('robots', htmlspecialchars($this->metadata->robots, ENT_QUOTES, 'UTF-8'));
00588             $block['robots'] = 1;
00589         }
00590 
00591         foreach ($mainframe->_head['meta'] as $meta) {
00592             if (isset($block[$meta[0]]) OR empty($meta[1])) continue;
00593             $found[$meta[0]] = 1;
00594             if ($meta[2]) {
00595                 $head[] = $meta[2];
00596             }
00597             $head[] = $this->makeMeta ($meta[0], $meta[1]);
00598             if ($meta[3]) {
00599                 $head[] = $meta[3];
00600             }
00601         }
00602 
00603         if (empty($block['description']) AND empty($found['description'])) $head[] = $this->makeMeta('description', htmlspecialchars($this->getCfg('MetaDesc'), ENT_QUOTES, 'UTF-8'));
00604         if (empty($block['keywords']) AND empty($found['keywords'])) $head[] = $this->makeMeta('keywords', htmlspecialchars($this->getCfg('MetaKeys'), ENT_QUOTES, 'UTF-8'));
00605         if (empty($block['robots']) AND empty($found['robots'])) $head[] = $this->makeMeta('robots', $this->config->default_robots);
00606 
00607         foreach ($mainframe->_head['custom'] as $html) {
00608             $head[] = $html;
00609         }
00610         return implode( "\n", $head ) . "\n";
00611     }

aliroSEF::makeMeta ( name,
value 
)

Definition at line 613 of file aliroSEF.php.

References name.

Referenced by getHead().

00613                                       {
00614         return <<<META_DATA
00615 <meta name="$name" content="$value" />
00616 META_DATA;
00617 
00618     }

aliroSEF::metaData (  ) 

Assembles head tags

Definition at line 623 of file aliroSEF.php.

References $database, $mainframe, aliroComponent, mosCache::getCache(), and getHead().

00623                      {
00624     global $database, $option, $my, $mainframe, $_VERSION, $task, $id;
00625     global $mosConfig_MetaDesc, $mosConfig_MetaKeys, $mosConfig_live_site, $mosConfig_sef, $mosConfig_absolute_path, $mosConfig_sitename, $mosConfig_favicon;
00626 
00627     // All this now handled conditionally in getHead
00628     // $mainframe->appendMetaTag( 'description', $mosConfig_MetaDesc );
00629     // $mainframe->appendMetaTag( 'keywords', $mosConfig_MetaKeys );
00630     // $mainframe->addMetaTag( 'robots', 'index, follow' );
00631 
00632     // cache activation
00633     // Original Joomla line next:
00634     // if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
00635     // Martin's modified 2 lines to prevent content cache destroying remository.css
00636     global $option;
00637     if ('com_content' == $option AND !empty($_SERVER['QUERY_STRING'])) {
00638         $cache =& mosCache::getCache('com_content');
00639         $GLOBALS['aliroSEFinstance'] =& $this;
00640         echo $cache->call('aliroSEFinstance->getHead', @$_SERVER['QUERY_STRING'], $id);
00641     } else {
00642         echo $this->getHead();
00643     }
00644 
00645     if ( isset($mosConfig_sef) && $mosConfig_sef ) {
00646         echo "<base href=\"$mosConfig_live_site/\" />\r\n";
00647     }
00648 
00649     if ($my->id OR $mainframe->get( 'joomlaJavascript' )) {
00650         ?>
00651         <script src="<?php echo $mosConfig_live_site;?>/includes/js/joomla.javascript.js" type="text/javascript"></script>
00652         <?php
00653     }
00654 
00655     $row = new aliroComponent();
00656     $query = "SELECT a.*"
00657     . "\n FROM #__components AS a"
00658     . "\n WHERE ( a.admin_menu_link = 'option=com_syndicate' OR a.admin_menu_link = 'option=com_syndicate&hidemainmenu=1' )"
00659     . "\n AND a.option = 'com_syndicate'"
00660     ;
00661     $this->database->setQuery( $query );
00662     $this->database->loadObject( $row );
00663 
00664     // get params definitions
00665     $syndicateParams = new mosParameters( $row->params, $mainframe->getPath( 'com_xml', $row->option ), 'component' );
00666 
00667     // needed to reduce query
00668     $GLOBALS['syndicateParams'] = $syndicateParams;
00669 
00670     $live_bookmark = $syndicateParams->get( 'live_bookmark', 0 );
00671 
00672     // and to allow disabling/enabling of selected feed types
00673     switch ( $live_bookmark ) {
00674         case 'RSS0.91':
00675             if ( !$syndicateParams->get( 'rss091', 1 ) ) {
00676                 $live_bookmark = 0;
00677             }
00678             break;
00679 
00680         case 'RSS1.0':
00681             if ( !$syndicateParams->get( 'rss10', 1 ) ) {
00682                 $live_bookmark = 0;
00683             }
00684             break;
00685 
00686         case 'RSS2.0':
00687             if ( !$syndicateParams->get( 'rss20', 1 ) ) {
00688                 $live_bookmark = 0;
00689             }
00690             break;
00691 
00692         case 'ATOM0.3':
00693             if ( !$syndicateParams->get( 'atom03', 1 ) ) {
00694                 $live_bookmark = 0;
00695             }
00696             break;
00697     }
00698 
00699     // support for Live Bookmarks ability for site syndication
00700     if ($live_bookmark) {
00701         $show = 1;
00702 
00703         $link_file  = $mosConfig_live_site . '/index2.php?option=com_rss&feed='. $live_bookmark .'&no_html=1';
00704 
00705         // xhtml check
00706         $link_file = ampReplace( $link_file );
00707 
00708         // security chcek
00709         $check = $syndicateParams->def( 'check', 1 );
00710         if($check) {
00711             // test if rssfeed module is published
00712             // if not disable access
00713             $query = "SELECT m.id"
00714             . "\n FROM #__modules AS m"
00715             . "\n WHERE m.module = 'mod_rssfeed'"
00716             . "\n AND m.published = 1"
00717             ;
00718             $this->database->setQuery( $query );
00719             $check = $this->database->loadResultArray();
00720             if(empty($check)) {
00721                 $show = 0;
00722             }
00723         }
00724         // outputs link tag for page
00725         if ($show) {
00726             // test if security check is enbled
00727             ?>
00728             <link rel="alternate" type="application/rss+xml" title="<?php echo $mosConfig_sitename; ?>" href="<?php echo $link_file; ?>" />
00729             <?php
00730         }
00731     }
00732 
00733     // favourites icon
00734     if ( !$mosConfig_favicon ) {
00735         $mosConfig_favicon = 'favicon.ico';
00736     }
00737     $icon = $mosConfig_absolute_path .'/images/'. $mosConfig_favicon;
00738     // checks to see if file exists
00739     if ( !file_exists( $icon ) ) {
00740         $icon = $mosConfig_live_site .'/images/favicon.ico';
00741     } else {
00742         $icon = $mosConfig_live_site .'/images/' .$mosConfig_favicon;
00743     }
00744 
00745     // outputs link tag for page
00746     ?>
00747     <link rel="shortcut icon" href="<?php echo $icon;?>" />
00748     <?php
00749 }

aliroSEF::sefRelToAbs ( string,
specialamp = true 
)

Definition at line 751 of file aliroSEF.php.

References componentDetails(), aliroFriendlyBase::getCfg(), invoke_plugin(), and parse().

Referenced by sefRetrieval().

00751                                                             {
00752         global $iso_client_lang;
00753         if ($string == 'index.php') return $this->live_site.'/';
00754         if (strtolower(substr($string,0,9)) != 'index.php' OR eregi('^(([^:/?#]+):)',$string)) return $string;
00755         $clean_string = str_replace('&amp;', '&', $string);
00756         $noitemid_string = preg_replace('/\&Itemid=[0-9]*/', '', $clean_string);
00757             $homelink = $this->mainmenu[0]->link;
00758         if ($noitemid_string == $homelink) return $this->live_site.'/';
00759         if (!($this->getCfg('sef')) OR !$this->config->enabled) return $this->live_site.'/'.($specialamp ? str_replace( '&', '&amp;', $clean_string ) : $clean_string);
00760         $string = substr($clean_string,10);
00761         // Do we need something like this?
00762         if (false AND strpos("lang=", strtolower($string)) === false) {
00763             $string .= "&lang=$iso_client_lang";
00764         }
00765         if (isset($this->config->sef_substitutions_exact['/'.$clean_string])) return $this->live_site.$this->config->sef_substitutions_exact['/'.$clean_string];
00766         if (isset($this->cachedSEF[$clean_string]) AND (time() - $this->config->cachedTime[$clean_string]) < $this->config->cache_time) return $this->live_site.$this->cachedSEF[$clean_string];
00767         $option = $task = '';
00768         $oktasks = true;
00769         $this->parse($string, $params);
00770         foreach ($params as $key=>$value) {
00771             $lowkey = strtolower($key);
00772             $lowvalue = strtolower($value);
00773             $unset = true;
00774             switch ($lowkey) {
00775                 case 'option':
00776                     $option = $lowvalue;
00777                     break;
00778                 case 'task':
00779                     $task = $value;
00780                     if ($lowvalue == 'new' OR $lowvalue == 'edit') $oktasks = false;
00781                     break;
00782                 default:
00783                     $check_params[$lowkey] = $key;
00784                     $unset = false;
00785             }
00786             if ($unset) unset($params[$key]);
00787         }
00788         // Process content items
00789         if (($option == 'com_content' OR $option == 'content') AND $oktasks) {
00790             /*
00791             Content
00792             index.php?option=com_content&task=$task&sectionid=$sectionid&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart
00793             */
00794             $content_sef = _ALIRO_CLASS_BASE.'/components/com_content/sef_ext.php';
00795             if (file_exists($content_sef)) {
00796                 require_once($content_sef);
00797                 $result = sef_content::create($task, $params, $this->config->lower_case, $this->config->unique_id);
00798                 return $this->live_site.$this->outSubstitution($string, $result);
00799             }
00800             $keys = array('sectionid', 'id', 'itemid', 'limit', 'limitstart', 'year', 'month', 'module', 'lang');
00801             $result = '/content/'.$task.'/';
00802             foreach ($keys as $key) {
00803                 if (isset($check_params[$key])) {
00804                     $pkey = $check_params[$key];
00805                     $result .= $params[$pkey].'/';
00806                 }
00807             }
00808             return $this->live_site.$this->outSubstitution($string, $result);
00809         }
00810         // Process customised components
00811         $i = array_search($option,$this->config->custom_code);
00812         if ($i !== false AND $i !== null) {
00813             if ($this->config->custom_PHP[$i] AND file_exists($this->config->custom_PHP[$i])) {
00814 /*
00815                 if (isset($check_params['itemid'])) {
00816                     $pkey = $check_params['itemid'];
00817                     unset($params[$pkey]);
00818                     unset($check_params['itemid']);
00819                 }
00820 */
00821                 $result = $this->invoke_plugin ($i, 'create', $noitemid_string);
00822             }
00823             else $result = $this->componentDetails($params,$task);
00824             $result = '/'.$this->config->custom_name[$i].'/'.$result;
00825             return $this->live_site.$this->outSubstitution($string, $result);
00826         }
00827         // Process ordinary components
00828         if (strpos($option,'com_')===0 AND $option != 'com_registration' AND $oktasks) {
00829             $result = "/component/option,$option/".$this->componentDetails($params,$task);
00830             return $this->live_site.$this->outSubstitution($string, $result);
00831         }
00832         // Anything else is returned as received, except it is guaranteed that & will be &amp;
00833         return $this->live_site.'/'.($specialamp ? str_replace( '&', '&amp;', $clean_string ) : $clean_string);
00834     }

aliroSEF::outSubstitution ( inuri,
outuri 
) [private]

Definition at line 836 of file aliroSEF.php.

References $sef.

00836                                                        {
00837         $now = time();
00838         // if ($this->config->underscore AND $this->SEF_SPACE == '-' AND strpos($outuri,'_') !== false) $outuri = str_replace('_', '-', $outuri);
00839         $finishedurl = isset($this->config->sef_substitutions_out) ? @preg_replace(array_keys($this->config->sef_substitutions_out), array_values($this->config->sef_substitutions_out), $outuri) : $outuri;
00840         if (isset($this->cachedSEF[$inuri]) AND $finishedurl == $this->cachedSEF[$inuri] AND ($now - $this->cachedTime[$inuri] < $this->config->cache_time)) return $finishedurl;
00841         $this->cachedSEF[$inuri] = $finishedurl;
00842         $this->cachedTime[$inuri] = $now;
00843         $sef = $this->database->getEscaped($finishedurl);
00844         $uri = $this->database->getEscaped($inuri);
00845         $this->database->doSQL("UPDATE #__remosef_uri SET sef = '$sef', refreshed = $now WHERE uri = '$uri'");
00846         if (0 == $this->database->getAffectedRows()) {
00847             $this->database->doSQL("INSERT INTO #__remosef_uri (uri, sef, refreshed) VALUES ('$uri', '$sef', $now)");
00848         }
00849         if (50 == mt_rand(0,99)) {
00850             $weekago = $now - 7*24*60*60;
00851             $chkcode = 'option=com_remository&Itemid=65&func=download&id';
00852             $this->database->doSQL("DELETE FROM #__remosef_uri WHERE uri LIKE '$chkcode%' AND refreshed < $weekago");
00853         }
00854         $this->cache->clean();
00855         return $finishedurl;
00856     }

aliroSEF::componentDetails ( &$  params,
task 
) [private]

Definition at line 858 of file aliroSEF.php.

Referenced by sefRelToAbs().

00858                                                         {
00859         $string = ($task ? "task,$task/" : '');
00860         foreach ($params as $key=>$param) {
00861                     $param = urlencode($param);
00862                     $string .= "$key,$param/";
00863                 }
00864         return $string;
00865     }

aliroSEF::basicJoomlaRetrieve ( uri  )  [private]

Content /$option/$task/$sectionid/$id/$limit/$limitstart

Definition at line 867 of file aliroSEF.php.

References $_REQUEST, $prefix, default_revert(), invoke_plugin(), and untranslateContentTask().

Referenced by sefRetrieval().

00867                                                 {
00868         $url_array = explode('/', $uri);
00869         if (0 == strlen($url_array[0])) array_shift($url_array);
00870         if ($l = count($url_array) AND 0 == strlen($url_array[$l-1])) array_pop($url_array);
00871         $prefix = $subdir = '';
00872         $legal = array_merge(array ('content', 'component'), $this->config->custom_name, $this->config->legal_content_tasks);
00873         while (count($url_array)) {
00874             $element = array_shift($url_array);
00875             if ($element) {
00876                 if (in_array($element,$legal)) {
00877                     $prefix = $element;
00878                     break;
00879                 }
00880                 elseif (strpos($this->live_site,$element) === false) break;
00881                 else $subdir .= '/'.$element;
00882             }
00883         }
00884         $QUERY_STRING = '';
00885         $foundit = false;
00890         if ($prefix == 'content') {
00891             $foundit = true;
00892             $_REQUEST['option'] = $_GET['option'] = $option = 'com_content';
00893             // language hook for content
00894             $lang = "";
00895             $parms = array();
00896             foreach($url_array as $key=>$value) {
00897                 if ( strcasecmp(substr($value,0,5),'lang,') == 0 ) {
00898                     $parts = explode(",", $value);
00899                     if (count($parts) > 1) {
00900                         $lang = $_REQUEST['lang'] = $_GET['lang'] = $parts[1];
00901                     }
00902                 }
00903                 elseif (strlen($value)) $parms[] = $value;
00904             }
00905             // $option/$task/$sectionid/$id/$limit/$limitstart
00906             $task = $this->untranslateContentTask($parms[0]);
00907             $_REQUEST['task'] = $_GET['task'] = $task;
00908             $QUERY_STRING .= "option=com_content&task=$task";
00909             if ($task == 'archivecategory') {
00910                 $_REQUEST['year'] = $_GET['year'] = $year = intval(@$parms[1]);
00911                 $_REQUEST['month'] = $_GET['month'] = $month = intval(@$parms[2]);
00912                 $_REQUEST['module'] = $_GET['module'] = $module = intval(@$parms[3]);
00913                 $QUERY_STRING .= "&year=$year&month=$month&module=$module";
00914             }
00915             else {
00916                 $num = count($parms);
00917                 for ($i = 1; $i <= $num-1; $i++) {
00918                     if (strcmp($parms[$i], (int)$parms[$i]) !== 0) return false;
00919                 }
00920                 $i = 1;
00921                 if (5 == $num OR 3 == $num) {
00922                     $_REQUEST['sectionid'] = $_GET['sectionid'] = $sectionid = $parms[$i];
00923                     $QUERY_STRING .= "&sectionid=$sectionid";
00924                     $i++;
00925                 }
00926                 if ($num > 1) {
00927                     $_REQUEST['id'] = $_GET['id'] = $id = $parms[$i];
00928                     $QUERY_STRING .= "&id=$id";
00929                 }
00930                 if ($num > 3) {
00931                     $_REQUEST['limit'] = $_GET['limit'] = $limit = $parms[$i+1];
00932                     $_REQUEST['limitstart'] = $_GET['limitstart'] = $limitstart = $parms[$i+2];
00933                     $QUERY_STRING .= "&limit=$limit&limitstart=$limitstart";
00934                 }
00935             }
00936             if ($lang!="") {
00937                 $QUERY_STRING .= "&lang=$lang";
00938             }
00939         }
00940 
00941         /*
00942         Components
00943         http://www.domain.com/component/$name,$value
00944         */
00945         elseif ($prefix == 'component') {
00946             $QUERY_STRING .= $this->default_revert('component');
00947             if ($QUERY_STRING) $foundit = true;
00948         }
00949         else {
00950             // Wouldn't be necessary, but wanted to avoid negative parameter to sef_ext.php
00951             array_unshift ($url_array, $prefix);
00952             array_unshift ($url_array, 'dummy');
00953             foreach ($this->config->custom_name as $i=>$compname) {
00954                 if (isset($url_array[1]) AND $url_array[1] == $compname) {
00955                     $origname = $this->config->custom_code[$i];
00956                     if ($this->config->custom_PHP[$i] AND file_exists($this->config->custom_PHP[$i])) {
00957                         if (isset($url_array[2]) AND $url_array[2]) {
00958                             $customsef = $this->invoke_plugin($i, 'revert', $url_array, 0);
00959                             if ($customsef) $QUERY_STRING .= 'option='.$origname.$customsef;
00960                             else return false;
00961                         }
00962                         else $QUERY_STRING .= 'option='.$origname;
00963                     }
00964                     else $QUERY_STRING .= 'option='.$origname.$this->default_revert($compname);
00965                     $_REQUEST['option'] = $_GET['option'] = $option = $origname;
00966                     $foundit = true;
00967                     break;
00968                 }
00969             }
00970             if (!$foundit AND isset($url_array[1])) {
00971                 $content_sef = _ALIRO_CLASS_BASE.'/components/com_content/sef_ext.php';
00972                 if (file_exists($content_sef)) {
00973                     require_once($content_sef);
00974                     $crevert = sef_content::revert($url_array,0);
00975                     if ($crevert) {
00976                         $foundit = true;
00977                         $QUERY_STRING .= $crevert;
00978                     }
00979                 }
00980             }
00981         }
00982         if ($foundit) return $QUERY_STRING;
00983         else return false;
00984     }

static aliroSEF::getInstance (  )  [static]

Definition at line 169 of file Copy of aliroSEF.php.

00169                                           {
00170         return is_object(self::$instance) ? self::$instance : (self::$instance = parent::getCachedSingleton(self::$instance));
00171     }

aliroSEF::saveCache (  )  [private]

Definition at line 173 of file Copy of aliroSEF.php.

References aliroSingletonObjectCache::getInstance().

Referenced by sefRelToAbs().

00173                                   {
00174         aliroSingletonObjectCache::getInstance()->store($this);
00175     }

aliroSEF::nameForURL ( string  ) 

Definition at line 177 of file Copy of aliroSEF.php.

00177                                          {
00178         //$accented = "&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;".$this->sef_name_string;
00179         //$nonaccent = "SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy".$this->sef_translate_string;
00180         //$string = strtr($string, $accented, $nonaccent);
00181         $string = aliroUnaccent::getInstance()->unaccent($string);
00182         $string = str_replace($this->sef_name_chars, $this->sef_translate_chars, $string);
00183         // This may be problematic - must not urldecode the incoming URL as components may duplicate
00184         $string = urlencode($string);
00185         return $string;
00186     }

aliroSEF::translateContentTask ( task  ) 

Definition at line 188 of file Copy of aliroSEF.php.

00188                                                  {
00189         if (isset($this->sef_content_task[$task])) return $this->sef_content_task[$task];
00190         else return $task;
00191     }

aliroSEF::untranslateContentTask ( tr_task  ) 

Definition at line 193 of file Copy of aliroSEF.php.

00193                                                       {
00194         $task = array_search ($tr_task, $this->sef_content_task);
00195         if ($task) return $task;
00196         return $tr_task;
00197     }

aliroSEF::sefRetrieval (  ) 

Content /$option/$task/$sectionid/$id/$limit/$limitstart

Definition at line 199 of file Copy of aliroSEF.php.

References $_REQUEST, $live_site, $prefix, default_revert(), aliroCore::getInstance(), sefRelToAbs(), and untranslateContentTask().

00199                                   {
00200         $live_site = aliroCore::getInstance()->getCfg('live_site');
00201         $uri = substr($_SERVER['REQUEST_URI'], aliroCore::getInstance()->getSubLen());
00202 
00203         if (!$uri OR $uri == '/' or $uri == '/index.php') return 0;
00204         if (preg_match('/(\b)GLOBALS|_REQUEST|_SERVER|_ENV|_COOKIE|_GET|_POST|_FILES|_SESSION(\b)/i', $uri) > 0) {
00205             die('Invalid Request');
00206         }
00207         $uri = str_replace(array('!', '%21'), array('',''), $uri);
00208         if ($indexloc = strpos($uri, 'index.php?')) {
00209             if ($_SERVER['REQUEST_METHOD'] == 'GET') {
00210                 $sefagain = substr($this->sefRelToAbs(substr($uri,$indexloc), false),strlen($live_site));
00211                 if ($uri != $sefagain) {
00212                     header ('HTTP/1.1 301 Moved Permanently');
00213                     header ('Location:'.$sefagain);
00214                     exit;
00215                 }
00216             }
00217             return 0;
00218         }
00219         $url_array = explode('/', $uri);
00220         $prefix = $subdir = '';
00221         $legal = array ('content', 'component', $this->prefix);
00222         while (count($url_array)) {
00223             $element = array_shift($url_array);
00224             if ($element) {
00225                 if (in_array($element,$legal)) {
00226                     $prefix = $element;
00227                     break;
00228                 }
00229                 elseif (strpos($live_site,$element) === false) break;
00230                 else $subdir .= '/'.$element;
00231             }
00232         }
00233         $QUERY_STRING = '';
00234         $foundit = false;
00239         if ($prefix == 'content') {
00240             $foundit = true;
00241             $_REQUEST['option'] = $_GET['option'] = $option = 'com_content';
00242             // language hook for content
00243             $lang = "";
00244             $parms = array();
00245             foreach($url_array as $key=>$value) {
00246                 if ( strcasecmp(substr($value,0,5),'lang,') == 0 ) {
00247                     $parts = explode(",", $value);
00248                     if (count($parts) > 1) {
00249                         $lang = $_REQUEST['lang'] = $_GET['lang'] = $parts[1];
00250                     }
00251                 }
00252                 elseif (strlen($value)) $parms[] = $value;
00253             }
00254             // $option/$task/$sectionid/$id/$limit/$limitstart
00255             $task = $this->untranslateContentTask($parms[0]);
00256             $_REQUEST['task'] = $_GET['task'] = $task;
00257             $QUERY_STRING .= "option=com_content&task=$task";
00258             if ($task == 'archivecategory') {
00259                 $_REQUEST['year'] = $_GET['year'] = $year = intval(@$parms[1]);
00260                 $_REQUEST['month'] = $_GET['month'] = $month = intval(@$parms[2]);
00261                 $_REQUEST['module'] = $_GET['module'] = $module = intval(@$parms[3]);
00262                 $QUERY_STRING .= "&year=$year&month=$month&module=$module";
00263             }
00264             else {
00265                 $num = count($parms);
00266                 for ($i = 1; $i <= $num-1; $i++) {
00267                     if (strcmp($parms[$i], (int)$parms[$i]) !== 0) return 1;
00268                 }
00269                 $i = 1;
00270                 if (5 == $num OR 3 == $num) {
00271                     $_REQUEST['sectionid'] = $_GET['sectionid'] = $sectionid = $parms[$i];
00272                     $QUERY_STRING .= "&sectionid=$sectionid";
00273                     $i++;
00274                 }
00275                 if ($num > 1) {
00276                     $_REQUEST['id'] = $_GET['id'] = $id = $parms[$i];
00277                     $QUERY_STRING .= "&id=$id";
00278                 }
00279                 if ($num > 3) {
00280                     $_REQUEST['limit'] = $_GET['limit'] = $limit = $parms[$i+1];
00281                     $_REQUEST['limitstart'] = $_GET['limitstart'] = $limitstart = $parms[$i+2];
00282                     $QUERY_STRING .= "&limit=$limit&limitstart=$limitstart";
00283                 }
00284             }
00285             if ($lang!="") {
00286                 $QUERY_STRING .= "&lang=$lang";
00287             }
00288         }
00289 
00290         /*
00291         Components
00292         http://www.domain.com/component/$name,$value
00293         */
00294         elseif ($prefix == 'component') {
00295             $QUERY_STRING .= $this->default_revert('component');
00296             if ($QUERY_STRING) $foundit = true;
00297         }
00298         elseif ($prefix = $this->prefix) {
00299             // Wouldn't be necessary, but wanted to avoid negative parameter to sef_ext.php
00300             array_unshift ($url_array, $prefix);
00301             // Forced not to run - should be an option to redirect underscore URL to hyphen
00302             if ($this->translate_underscore AND $this->SEF_SPACE == '-' AND strpos($uri,'_') !== false) {
00303                 foreach ($url_array as $key=>$element) {
00304                     if (strlen($element) > 1 AND strpos($element, ',') === false) $url_array[$key] = str_replace('_', '-', $element);
00305                 }
00306                 $newurl = '/'.implode('/',$url_array);
00307                 if ($newurl != $uri) {
00308                     header ('HTTP/1.1 301 Moved Permanently');
00309                     header ('Location:'.$newurl);
00310                     exit;
00311                 }
00312             }
00313             foreach ($this->custom_name as $i=>$compname) {
00314                 if (isset($url_array[1]) AND $url_array[1] == $compname) {
00315                     $origname = $this->custom_code[$i];
00316                     if ($this->custom_PHP[$i] AND file_exists(_ALIRO_ABSOLUTE_PATH.$this->custom_PHP[$i])) $QUERY_STRING .= 'option='.$origname.$this->invoke_plugin($i, 'revert', $url_array, 0);
00317                     else $QUERY_STRING .= 'option='.$origname.$this->default_revert($compname);
00318                     $_REQUEST['option'] = $this->custom_code[$i];
00319                     $foundit = true;
00320                     break;
00321                 }
00322             }
00323             if (!$foundit AND isset($url_array[1])) {
00324                 $content_sef = _ALIRO_ABSOLUTE_PATH.'/components/com_content/sef_ext.php';
00325                 if (file_exists($content_sef)) {
00326                     require_once($content_sef);
00327                     $crevert = sef_content::revert($url_array,0);
00328                     if ($crevert) {
00329                         $foundit = true;
00330                         $QUERY_STRING .= $crevert;
00331                     }
00332                 }
00333             }
00334         }
00335         if ($foundit) {
00336             $_SERVER['QUERY_STRING'] = $QUERY_STRING;
00337             $sefagain = substr($this->sefRelToAbs('index.php?'.$QUERY_STRING),strlen($live_site));
00338             if ($uri != $sefagain AND $_SERVER['REQUEST_METHOD'] == 'GET') {
00339                 header ('HTTP/1.1 301 Moved Permanently');
00340                 header ('Location:'.$sefagain);
00341                 exit;
00342             }
00343             $_SERVER['REQUEST_URI'] = $subdir.'/index.php?'.$QUERY_STRING;
00344             $returncode = 0;
00345         }
00346         else $returncode = 1;
00347         return $returncode;
00348     }

aliroSEF::invoke_plugin ( i,
method,
parm1,
parm2 = 0 
) [private]

Definition at line 350 of file Copy of aliroSEF.php.

00350                                                                    {
00351         error_reporting(E_ALL);
00352         require_once(_ALIRO_ABSOLUTE_PATH.$this->custom_PHP[$i]);
00353         $classname = 'sef_'.$this->custom_short[$i];
00354         /*
00355         $callplugin = array($classname, 'getInstance');
00356         if (is_callable($callplugin)) {
00357             $plugin = call_user_func($callplugin);
00358             return $plugin->$method($parm1, $parm2);
00359         }
00360         else {
00361             $callplugin = array($classname, $method);
00362             return call_user_func ($callplugin, $parm1, $parm2);
00363         }
00364         */
00365         return call_user_func (array($classname, $method), $parm1, $parm2);
00366         error_reporting(E_ALL|E_STRICT);
00367     }

aliroSEF::default_revert ( specialname  )  [private]

Definition at line 369 of file Copy of aliroSEF.php.

References $_REQUEST.

00369                                                    {
00370         $request = explode($specialname.'/', $_SERVER['REQUEST_URI']);
00371         if (isset($request[1])) $parmset = explode("/", $request[1]);
00372         else $parmset = array();
00373         $QUERY_STRING = '';
00374         foreach($parmset as $values) {
00375             $parts = explode(",", $values);
00376             if (count($parts) > 1) {
00377                 $_REQUEST[$parts[0]] = $_GET[$parts[0]] = $parts[1];
00378                 if ($parts[0] == 'option') $QUERY_STRING .= "option=$parts[1]";
00379                 else $QUERY_STRING .= "&$parts[0]=$parts[1]";
00380             }
00381         }
00382         return $QUERY_STRING;
00383     }

aliroSEF::parse ( string,
&$  parms 
) [private]

Definition at line 385 of file Copy of aliroSEF.php.

00385                                               {
00386         $parms = array();
00387         $parts = explode('&', $string);
00388         foreach ($parts as $part) {
00389             $assigns = explode('=', $part);
00390             if (count($assigns) == 2) $parms[$assigns[0]] = $assigns[1];
00391         }
00392     }

aliroSEF::sefRelToAbs ( string,
specialamp = true 
)

Definition at line 394 of file Copy of aliroSEF.php.

References componentDetails(), aliroMenuHandler::getInstance(), aliroCore::getInstance(), invoke_plugin(), parse(), and saveCache().

00394                                                             {
00395         global $iso_client_lang;
00396 
00397         $server = aliroCore::getInstance()->getCfg('live_site');
00398         if ($string == 'index.php') return $server.'/';
00399         if (strtolower(substr($string,0,9)) != 'index.php' OR eregi('^(([^:/?#]+):)',$string)) return $string;
00400         $passed_string = str_replace('&amp;', '&', $string);
00401         $passed_string = preg_replace('/\&Itemid=[0-9]*/', '', $passed_string);
00402         $handler = aliroMenuHandler::getInstance();
00403         $home = $handler->getHome();
00404         if (is_object($home) AND $passed_string == $home->link) return $server.'/';
00405         if (!$this->sef_active) return $server.'/'.($specialamp ? str_replace( '&', '&amp;', $passed_string ) : $passed_string);
00406         $string = substr($passed_string,10);
00407         // Do we need something like this?
00408         if (false AND strpos("lang=", strtolower($string)) === false) {
00409             $string .= "&lang=$iso_client_lang";
00410         }
00411         if (isset($this->cachedSEF[$string])) return $server.$this->cachedSEF[$string];
00412         $option = $task = '';
00413         $oktasks = true;
00414         $this->parse($string, $params);
00415         foreach ($params as $key=>$value) {
00416             $lowkey = strtolower($key);
00417             $lowvalue = strtolower($value);
00418             $unset = true;
00419             switch ($lowkey) {
00420                 case 'option':
00421                     $option = $lowvalue;
00422                     break;
00423                 case 'task':
00424                     $task = $value;
00425                     if ($lowvalue == 'new' OR $lowvalue == 'edit') $oktasks = false;
00426                     break;
00427                 default:
00428                     $check_params[$lowkey] = $key;
00429                     $unset = false;
00430             }
00431             if ($unset) unset($params[$key]);
00432         }
00433         // Process content items
00434         if (($option == 'com_content' OR $option == 'content') AND $oktasks) {
00435             /*
00436             Content
00437             index.php?option=com_content&task=$task&sectionid=$sectionid&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart
00438             */
00439             $content_sef = _ALIRO_ABSOLUTE_PATH.'/components/com_content/sef_ext.php';
00440             if (file_exists($content_sef)) {
00441                 require_once($content_sef);
00442                 $result = '/'.$this->prefix.sef_content::create($task, $params);
00443                 $this->cachedSEF[$string] = $result;
00444                 $this->saveCache();
00445                 return $server.$result;
00446             }
00447             $keys = array('sectionid', 'id', 'itemid', 'limit', 'limitstart', 'year', 'month', 'module', 'lang');
00448             $result = '/content/'.$task.'/';
00449             foreach ($keys as $key) {
00450                 if (isset($check_params[$key])) {
00451                     $pkey = $check_params[$key];
00452                     $result .= $params[$pkey].'/';
00453                 }
00454             }
00455             $this->cachedSEF[$string] = $result;
00456             $this->saveCache();
00457             return $server.$result;
00458         }
00459         // Other types of URL than content do not use Itemid in the SEO version
00460         if (isset($check_params['itemid'])) {
00461             $pkey = $check_params['itemid'];
00462             unset($params[$pkey]);
00463             unset($check_params['itemid']);
00464         }
00465         // Process customised components
00466         $i = array_search($option,$this->custom_code);
00467         if ($i !== false AND $i !== null) {
00468             if ($this->custom_PHP[$i] AND file_exists(_ALIRO_ABSOLUTE_PATH.$this->custom_PHP[$i])) $result = $this->invoke_plugin ($i, 'create', $passed_string);
00469             else $result = $this->componentDetails($params,$task);
00470             $result = '/'.$this->prefix.'/'.$this->custom_name[$i].'/'.$result;
00471             $this->cachedSEF[$string] = $result;
00472             $this->saveCache();
00473             return $server.$result;
00474         }
00475         // Process ordinary components
00476         if (strpos($option,'com_')===0 AND $option != 'com_registration' AND $oktasks) {
00477             $result = "/component/option,$option/".$this->componentDetails($params,$task);
00478             $this->cachedSEF[$string] = $result;
00479             $this->saveCache();
00480             return $server.$result;
00481         }
00482         // Anything else is returned as received, except it is guaranteed that & will be &amp;
00483         return $server.'/'.($specialamp ? str_replace( '&', '&amp;', $passed_string ) : $passed_string);
00484     }

aliroSEF::componentDetails ( &$  params,
task 
) [private]

Definition at line 486 of file Copy of aliroSEF.php.

00486                                                         {
00487         $string = ($task ? "task,$task/" : '');
00488         foreach ($params as $key=>$param) {
00489                     $param = urlencode($param);
00490                     $string .= "$key,$param/";
00491                 }
00492         return $string;
00493     }

static aliroSEF::getInstance (  )  [static]

Definition at line 114 of file old.aliroSEF.php.

References $instance, and aliroExtensionHandler::getInstance().

00114                                    {
00115         static $instance;
00116         if (!is_object($instance)) {
00117             $handler = aliroExtensionHandler::getInstance();
00118             $sefplugin = $handler->getExtensionByName('com_sef');
00119             if ($sefplugin AND $sefplugin->class) eval ('$instance = '.$sefplugin->class.'::getInstance();');
00120             else $instance = new aliroSEF();
00121         }
00122         return $instance;
00123     }

aliroSEF::sefRetrieval ( register_globals  ) 

Content /$option/$task/$sectionid/$id/$Itemid/$limit/$limitstart

Definition at line 125 of file old.aliroSEF.php.

References $_REQUEST, default_revert(), aliroCore::get(), aliroMenuHandler::getInstance(), and aliroCore::set().

00125                                             {
00126 
00127         if (preg_match('/(\b)GLOBALS|_REQUEST|_SERVER|_ENV|_COOKIE|_GET|_POST|_FILES|_SESSION(\b)/i', $_SERVER['REQUEST_URI']) > 0) {
00128             die('Invalid Request');
00129         }
00130         if (mamboCore::get('mosConfig_sef')) {
00131             $subdir = mamboCore::get('subdirectory');
00132             $uri = substr($_SERVER['REQUEST_URI'], strlen($subdir));
00133             $url_array = explode('/', $uri);
00139             if ('' == $url_array[1]) return 0;
00140             $foundit = false;
00141             if ($url_array[1] == 'content') {
00142                 $foundit = true;
00143                 $_REQUEST['option'] = $_GET['option'] = $option = 'com_content';
00144 
00145                 // language hook for content
00146                 $lang = "";
00147                 $parms = array();
00148                 foreach($url_array as $key=>$value) {
00149                     if ( strcasecmp(substr($value,0,5),'lang,') == 0 ) {
00150                         $parts = explode(",", $value);
00151                         if (count($parts) > 1) {
00152                             $lang = $_REQUEST['lang'] = $_GET['lang'] = $parts[1];
00153                         }
00154                     }
00155                     elseif ( $value != '' AND $key > 1 ) $parms[] = $value;
00156                 }
00157 
00158                 // $option/$task/$sectionid/$id/$Itemid/$limit/$limitstart
00159                 $task = array_search($parms[0], $this->sef_content_task);
00160                 if ($task === false OR $task === null) return 1;
00161                 $_REQUEST['task'] = $_GET['task'] = $task;
00162                 $QUERY_STRING = "option=com_content&task=$task";
00163                 $num = count($parms);
00164                 for ($i = 1; $i <= $num-1; $i++) {
00165                     if (strcmp($parms[$i], (int)$parms[$i]) !== 0) return 1;
00166                 }
00167                 $i = 1;
00168                 if ($num == 6 OR $num == 4) {
00169                     $_REQUEST['sectionid'] = $_GET['sectionid'] = $sectionid = $parms[$i];
00170                     $QUERY_STRING .= "&sectionid=$sectionid";
00171                     $i++;
00172                 }
00173                 if ($num > 1) {
00174                     $_REQUEST['id'] = $_GET['id'] = $id = $parms[$i];
00175                     $QUERY_STRING .= "&id=$id";
00176                 }
00177                 if ($num > 2) {
00178                     $_REQUEST['Itemid'] = $_GET['Itemid'] = $Itemid = $parms[$i+1];
00179                     mamboCore::set('Itemid',$Itemid);
00180                     $QUERY_STRING .= "&Itemid=$Itemid";
00181                 }
00182                 if ($num > 4) {
00183                     $_REQUEST['limit'] = $_GET['limit'] = $limit = $parms[$i+2];
00184                     $_REQUEST['limitstart'] = $_GET['limitstart'] = $limitstart = $parms[$i+3];
00185                     $QUERY_STRING .= "&limit=$limit&limitstart=$limitstart";
00186                 }
00187 
00188                 if ($lang!="") {
00189                     $QUERY_STRING .= "&lang=$lang";
00190                 }
00191             }
00192 
00193             /*
00194             Components
00195             http://www.domain.com/component/$name,$value
00196             */
00197             elseif ($url_array[1] == 'component') {
00198                 $QUERY_STRING = $this->default_revert('component');
00199                 if ($QUERY_STRING) $foundit = true;
00200             }
00201             elseif ($url_array[1] == $this->prefix) {
00202                 $menuhandler = aliroMenuHandler::getInstance();
00203                 foreach ($this->custom_name as $i=>$compname) {
00204                     if ($url_array[2] == $compname) {
00205                         $origname = $this->custom_code[$i];
00206                         $_REQUEST['Itemid'] = $_GET['Itemid'] = $Itemid = $menuhandler->getIDLikeQuery("option=$origname");
00207                         mamboCore::set('Itemid', $Itemid);
00208                         if ($this->custom_PHP[$i]) {
00209                             $fixup = '$QUERY_STRING = "option='.$origname.'&Itemid=".$Itemid.sef_'.$this->custom_short[$i].'::revert($url_array,1);';
00210                             eval($fixup);
00211                         }
00212                         else $QUERY_STRING = "option=$origname&Itemid=$Itemid".$this->default_revert($compname);
00213                         $_REQUEST['option'] = $this->custom_code[$i];
00214                         $foundit = true;
00215                         break;
00216                     }
00217                 }
00218                 if (!$foundit) {
00219                     $content_sef = mamboCore::get('mosConfig_absolute_path').'/components/com_content/sef_ext.php';
00220                     if (file_exists($content_sef)) {
00221                         require_once($content_sef);
00222                         $QUERY_STRING = sef_content::revert($url_array,1);
00223                         if ($QUERY_STRING) $foundit = true;
00224                     }
00225                 }
00226             }
00227             if ($foundit) {
00228                 $_SERVER['QUERY_STRING'] = $QUERY_STRING;
00229                 $REQUEST_URI = '/index.php?'.$QUERY_STRING;
00230                 $_SERVER['REQUEST_URI'] = $REQUEST_URI;
00231                 return 0;
00232             }
00233             else return 1;
00234         }
00235         return 0;
00236     }

aliroSEF::default_revert ( specialname  ) 

Definition at line 238 of file old.aliroSEF.php.

References $_REQUEST, aliroMenuHandler::getInstance(), and aliroCore::set().

00238                                            {
00239         $request = explode($specialname.'/', $_SERVER['REQUEST_URI']);
00240         if (isset($request[1])) $parmset = explode("/", $request[1]);
00241         else $parmset = array();
00242         $QUERY_STRING = '';
00243         $menuhandler = aliroMenuHandler::getInstance();
00244         foreach($parmset as $values) {
00245             $parts = explode(",", $values);
00246             if (count($parts) > 1) {
00247                 $_REQUEST[$parts[0]] = $_GET[$parts[0]] = $parts[1];
00248                 if ($parts[0] == 'option') {
00249                     $_REQUEST['Itemid'] = $_GET['Itemid'] = $Itemid = $menuhandler->getIDLikeQuery("option=$parts[1]");
00250                     mamboCore::set('Itemid', $Itemid);
00251                     $QUERY_STRING .= "$parts[0]=$parts[1]&Itemid=$Itemid";
00252                 }
00253                 $QUERY_STRING .= "&$parts[0]=$parts[1]";
00254             }
00255         }
00256         return $QUERY_STRING;
00257     }

aliroSEF::sefRelToAbs ( string  ) 

Definition at line 259 of file old.aliroSEF.php.

References componentDetails(), and aliroCore::get().

00259                                     {
00260         global $iso_client_lang;
00261 
00262         $server = mamboCore::get('mosConfig_live_site');
00263         if ($string == 'index.php') return $server.'/';
00264 
00265         $passed_string = str_replace('&amp;', '&', $string);
00266         if (!mamboCore::get('mosConfig_sef') OR strtolower(substr($passed_string,0,9)) != 'index.php' OR eregi('^(([^:/?#]+):)',$passed_string)) {
00267             return preg_replace('/(&)([^#]|$)/','&amp;$2', $passed_string);
00268         }
00269 
00270         $string = substr($passed_string,10);
00271         if(mamboCore::get('mosConfig_mbf_content') AND strpos("lang=", strtolower($string)) === false) {
00272             $string .= "&lang=$iso_client_lang";
00273         }
00274         $option = $task = '';
00275         $oktasks = true;
00276         parse_str($string, $params);
00277         foreach ($params as $key=>$value) {
00278             $lowkey = strtolower($key);
00279             $lowvalue = strtolower($value);
00280             $unset = true;
00281             switch ($lowkey) {
00282                 case 'option':
00283                     $option = $lowvalue;
00284                     break;
00285                 case 'task':
00286                     $task = $value;
00287                     if ($lowvalue == 'new' OR $lowvalue == 'edit') $oktasks = false;
00288                     break;
00289                 default:
00290                     $check_params[$lowkey] = $key;
00291                     $unset = false;
00292             }
00293             if ($unset) unset($params[$key]);
00294         }
00295         // Process content items
00296         if (($option == 'com_content' OR $option == 'content') AND $oktasks) {
00297             /*
00298             Content
00299             index.php?option=com_content&task=$task&sectionid=$sectionid&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart
00300             */
00301             if ($task) $task = $this->sef_content_task[$task];
00302             $content_sef = mamboCore::get('mosConfig_absolute_path').'/components/com_content/sef_ext.php';
00303             if (file_exists($content_sef)) {
00304                 require_once($content_sef);
00305                 return $server.'/'.$this->prefix.sef_content::create($task, $params);
00306             }
00307             $keys = array('sectionid', 'id', 'itemid', 'limit', 'limitstart', 'lang');
00308             $string = "/content/$task/";
00309             foreach ($keys as $key) {
00310                 if (isset($check_params[$key])) {
00311                     $pkey = $check_params[$key];
00312                     $string .= $params[$pkey].'/';
00313                 }
00314             }
00315             return $server.$string;
00316         }
00317         // Other types of URL than content do not use Itemid in the SEO version
00318         if (isset($check_params['itemid'])) {
00319             $pkey = $check_params['itemid'];
00320             unset($params[$pkey]);
00321             unset($check_params['itemid']);
00322         }
00323         // Process customised components
00324         $i = array_search($option,$this->custom_code);
00325         if ($i !== false AND $i !== null) {
00326             if ($this->custom_PHP[$i]) eval('$string = sef_'.$this->custom_short[$i].'::create($passed_string);');
00327             else $string = $this->componentDetails($params,$task);
00328             return $server.'/'.$this->prefix.'/'.$this->custom_name[$i].'/'.$string;
00329         }
00330         // Process ordinary components
00331         if (strpos($option,'com_')===0 AND $option != 'com_registration' AND $oktasks) {
00332             return "$server/component/option,$option/".$this->componentDetails($params,$task);
00333         }
00334         // Anything else is returned as received, except it is guaranteed that & will be &amp;
00335         return $server.'/'.str_replace( '&', '&amp;', $passed_string );
00336     }

aliroSEF::componentDetails ( &$  params,
task 
)

Definition at line 338 of file old.aliroSEF.php.

00338                                                 {
00339         $string = ($task ? "task,$task/" : '');
00340         foreach ($params as $key=>$param) $string .= "$key,$param/";
00341         return $string;
00342     }


Member Data Documentation

aliroSEF::$instance = __CLASS__ [static, protected]

Definition at line 157 of file aliroSEF.php.

Referenced by getInstance().

aliroSEF::$live_site = '' [private]

Definition at line 160 of file aliroSEF.php.

Referenced by sefRetrieval().

aliroSEF::$home_page = false [private]

Definition at line 161 of file aliroSEF.php.

aliroSEF::$mainmenu = array() [private]

Definition at line 162 of file aliroSEF.php.

aliroSEF::$config = null [private]

Definition at line 163 of file aliroSEF.php.

Referenced by __construct().

aliroSEF::$sef_name_string = '' [private]

Definition at line 190 of file aliroSEF.php.

aliroSEF::$sef_translate_string = '' [private]

Definition at line 191 of file aliroSEF.php.

aliroSEF::$content_tasks = array() [private]

Definition at line 192 of file aliroSEF.php.

aliroSEF::$content_menus = array() [private]

Definition at line 193 of file aliroSEF.php.

aliroSEF::$metadata = null [private]

Definition at line 194 of file aliroSEF.php.

aliroSEF::$content_data = null

Definition at line 197 of file aliroSEF.php.

aliroSEF::$content_items = array()

Definition at line 198 of file aliroSEF.php.

aliroSEF::$content_sections = array()

Definition at line 199 of file aliroSEF.php.

aliroSEF::$content_categories = array()

Definition at line 200 of file aliroSEF.php.

aliroSEF::$SEF_SPACE [private]

Definition at line 203 of file aliroSEF.php.

aliroSEF::$cachedSEF = array() [private]

Definition at line 204 of file aliroSEF.php.

aliroSEF::$cachedTime = array() [private]

Definition at line 205 of file aliroSEF.php.

aliroSEF::$cacheWritten = array() [private]

Definition at line 206 of file aliroSEF.php.

aliroSEF::$cacheObject = null [private]

Definition at line 207 of file aliroSEF.php.

aliroSEF::$database = null [private]

Definition at line 209 of file aliroSEF.php.

Referenced by __construct(), and metaData().

aliroSEF::$prefix = '' [private]

Definition at line 56 of file Copy of aliroSEF.php.

Referenced by basicJoomlaRetrieve(), and sefRetrieval().

aliroSEF::$translate_underscore = 0 [private]

Definition at line 57 of file Copy of aliroSEF.php.

aliroSEF::$sef_active = false [private]

Definition at line 58 of file Copy of aliroSEF.php.

aliroSEF::$custom_code = array() [private]

Definition at line 59 of file Copy of aliroSEF.php.

aliroSEF::$custom_name = array() [private]

Definition at line 60 of file Copy of aliroSEF.php.

aliroSEF::$custom_PHP = array() [private]

Definition at line 61 of file Copy of aliroSEF.php.

aliroSEF::$custom_short = array() [private]

Definition at line 62 of file Copy of aliroSEF.php.

aliroSEF::$sef_content_task = array() [private]

Definition at line 63 of file Copy of aliroSEF.php.

aliroSEF::$sef_name_chars = array() [private]

Definition at line 64 of file Copy of aliroSEF.php.

aliroSEF::$sef_translate_chars = array() [private]

Definition at line 65 of file Copy of aliroSEF.php.


The documentation for this class was generated from the following files:

Generated on Thu Apr 17 13:03:31 2008 for ALIRO by  doxygen 1.5.5