sefAdminSef Class Reference

Inheritance diagram for sefAdminSef:

sefAdminControllers aliroComponentAdminControllers aliroComponentControllers aliroFriendlyBase

List of all members.

Public Member Functions

 getRequestData ()
 toolbar ()
 listuriTask ()
 listmetaTask ()
 listTask ()
 componentTask ()

Static Public Member Functions

static getInstance ($manager)
static taskTranslator ()

Protected Attributes

 $view_class = 'sefAdminHTML'

Static Protected Attributes

static $instance = __CLASS__

Private Member Functions

 getData ()
 showOptions ()
 showSubstitutions ()
 showSubstitutionsIn ()
 showSubstitutionsOut ()
 showComponents ()
 showCharacters ()
 showContentTasks ()
 headingLine ($title)
 inputBox ($title, $name, $value, $width=25)
 yesnoBox ($title, $name, $value)
 translateLine ($type, $name, $modified, $size=30, $link='')
 storeDataGroup ($type, $namecode, $modcode)


Detailed Description

Definition at line 47 of file admin.sef.php.


Member Function Documentation

static sefAdminSef::getInstance ( manager  )  [static]

Definition at line 52 of file admin.sef.php.

References aliroComponentControllers::$manager.

00052                                                   {
00053         return is_object(self::$instance) ? self::$instance : (self::$instance = new self::$instance($manager));
00054     }

sefAdminSef::getRequestData (  ) 

Definition at line 56 of file admin.sef.php.

00056                                       {
00057     }

static sefAdminSef::taskTranslator (  )  [static]

Definition at line 59 of file admin.sef.php.

References T_().

00059                                              {
00060         return array (
00061         'save' => T_('Save'),
00062         'listmeta' => T_('List Metadata'),
00063         'listuri' => T_('List URIs'),
00064         'list' => T_('Cancel'),
00065         'savecomponent' => T_('Save Codes')
00066         );
00067     }

sefAdminSef::toolbar (  ) 

Reimplemented from aliroComponentAdminControllers.

Definition at line 69 of file admin.sef.php.

References $_REQUEST, aliroComponentAdminControllers::$task, aliroFriendlyBase::getParam(), and aliroComponentAdminControllers::toolBarButton().

00069                                {
00070         $task = $this->getParam($_REQUEST, 'task');
00071         if ('component' == $task) {
00072             $this->toolBarButton('savecomponent');
00073             $this->toolBarButton('list');
00074         }
00075         else {
00076             $this->toolBarButton('save');
00077             $this->toolBarButton('listuri');
00078             $this->toolBarButton('listmeta');
00079         }
00080     }

sefAdminSef::listuriTask (  ) 

Definition at line 82 of file admin.sef.php.

References aliroFriendlyBase::redirect().

00082                                    {
00083         $this->redirect('index.php?core=cor_sef&act=uri');
00084     }

sefAdminSef::listmetaTask (  ) 

Definition at line 86 of file admin.sef.php.

References aliroFriendlyBase::redirect().

00086                                     {
00087         $this->redirect('index.php?core=cor_sef&act=metadata');
00088     }

sefAdminSef::listTask (  ) 

Definition at line 90 of file admin.sef.php.

References getData(), name, showCharacters(), showComponents(), showContentTasks(), showOptions(), showSubstitutions(), showSubstitutionsIn(), and showSubstitutionsOut().

00090                                 {
00091         $view = new $this->view_class($this);
00092         echo $view->sefNotes();
00093         $this->getData();
00094         echo "\n<div id='remosefadmin'>";
00095         $this->showOptions();
00096         $this->showSubstitutions();
00097         $this->showSubstitutionsIn();
00098         $this->showSubstitutionsOut();
00099         $this->showCharacters();
00100         $this->showComponents();
00101         $this->showContentTasks();
00102         ?>
00103         <input type="hidden" name="core" value="cor_sef" />
00104         <?php
00105         echo "\n</div>";
00106         echo "\n\t</form>";
00107         echo "\n<!-- End of code from Remosef -->";
00108     }

sefAdminSef::getData (  )  [private]

Definition at line 110 of file admin.sef.php.

Referenced by listTask().

00110                                 {
00111         $configs = $this->database->doSQLget ("SELECT * FROM #__remosef_config");
00112         $vars = get_object_vars($this);
00113         foreach ($configs as $item) {
00114             if ('options' == $item->type) {
00115                 $name = $item->name;
00116                 if (isset($vars[$name]) AND !is_array($this->$name)) $this->$name = $item->modified;
00117             }
00118             elseif ('components' == $item->type) {
00119                 $this->custom_code[$item->name] = $item->modified;
00120             }
00121             elseif ('characters' == $item->type) {
00122                 $this->sef_name_chars[] = $item->name;
00123                 $this->sef_translate_chars[] = $item->modified;
00124             }
00125             elseif ('substitutions' == $item->type) {
00126                 $this->sef_substitutions_exact_name[$item->id] = $item->name;
00127                 $this->sef_substitutions_exact_mod[$item->id] = $item->modified;
00128             }
00129             elseif ('substitutions_in' == $item->type) {
00130                 $this->sef_substitutions_in[$item->name] = $item->modified;
00131             }
00132             elseif ('substitutions_out' == $item->type) {
00133                 $this->sef_substitutions_out[$item->name] = $item->modified;
00134             }
00135             elseif ('content' == $item->type) $this->sef_content_task[$item->name] = $item->modified;
00136             else $this->component_details[$item->type][$item->name] = $item->modified;
00137         }
00138         unset($configs);
00139     }

sefAdminSef::showOptions (  )  [private]

Definition at line 141 of file admin.sef.php.

References headingLine(), inputBox(), and yesnoBox().

Referenced by listTask().

00141                                     {
00142         $this->headingLine('Remosef Options');
00143         $this->yesnoBox('Enable SEF', 'enabled', $this->enabled);
00144         $this->inputBox('Count of URI buffer entries', 'buffer_size', $this->buffer_size);
00145         $this->yesnoBox('Use Joomla cache (if enabled)', 'use_cache', $this->use_cache);
00146         $this->inputBox('Cache time in seconds', 'cache_time', $this->cache_time);
00147         $this->inputBox('Characters to be removed, separated by |', 'strip_chars', htmlspecialchars($this->strip_chars), 60);
00148         $this->yesnoBox('Make all URIs lowercase', 'lower_case', $this->lower_case);
00149         $this->yesnoBox('Force unique ID number in URIs', 'unique_id', $this->unique_id);
00150         $this->yesnoBox('Redirect underscore URLs to hyphen', 'underscore', $this->underscore);
00151         $this->yesnoBox('Log incoming transformations', 'log_transform', $this->log_transform);
00152         $this->inputBox('Home page title', 'home_title', $this->home_title);
00153         $this->inputBox('Robots default meta data', 'default_robots', $this->default_robots);
00154         $this->inputBox('Title separator (from site name)', 'title_separator', $this->title_separator);
00155     }

sefAdminSef::showSubstitutions (  )  [private]

Definition at line 157 of file admin.sef.php.

References aliroFriendlyBase::getCfg(), headingLine(), and translateLine().

Referenced by listTask().

00157                                           {
00158         $link = $this->getCfg('live_site').'/administrator/index2.php?option=com_sef&amp;act=config&amp;task=metadata&amp;cid=';
00159         $this->headingLine('URI Substitutions - Exact');
00160         echo "\n\t<p>The left box should be the exact standard CMS URI (e.g. /index.php?option=com_content&amp;task=view&amp;id=21&amp;Itemid=93), the right box what it is to be translated to (e.g. /about/john-smith/).  The translation will be exact and will be applied immediately a URI is received.";
00161         foreach ($this->sef_substitutions_exact_name as $id=>$name) {
00162             $linkmeta = <<<LINK_META
00163 
00164             <a href="$link$id">Edit metadata</a>
00165 
00166 LINK_META;
00167             $this->translateLine('subst', $name, $this->sef_substitutions_exact_mod[$id], 50, $linkmeta);
00168         }
00169         for ($i = 0; $i < 5; $i++) $this->translateLine('subst', '', '',50);
00170     }

sefAdminSef::showSubstitutionsIn (  )  [private]

Definition at line 172 of file admin.sef.php.

References headingLine(), and translateLine().

Referenced by listTask().

00172                                             {
00173         $this->headingLine('URI Substitutions - Inbound');
00174         echo "\n\t<p>The left box must be a valid regular expression that is to be applied to an incoming URI.  The right box must be what it is to be translated to.  The substitution will be applied immediately on receipt of a URI unless the URI has an exact match in the table above.</p>";
00175         echo "\n\t<p>This is designed to handle transformation of old URIs and care must be taken to avoid disrupting the normal decoding process.";
00176         echo "\n\t<p>Remember that regular expressions use metacharacters such as * or ? or ].  To use them as ordinary characters, they must be escaped with backslash.";
00177         foreach ($this->sef_substitutions_in as $key=>$name) $this->translateLine('subst_in', $key, $name, 50);
00178         for ($i = 0; $i < 5; $i++) $this->translateLine('subst_in', '', '',50);
00179     }

sefAdminSef::showSubstitutionsOut (  )  [private]

Definition at line 181 of file admin.sef.php.

References headingLine(), and translateLine().

Referenced by listTask().

00181                                              {
00182         $this->headingLine('URI Substitutions - Outbound');
00183         echo "\n\t<p>The left box must be a valid regular expression.  The right hand box will be substituted for it.  The substitution will be applied after all other outgoing URI processing.";
00184         echo "\n\t<p>Remember that regular expressions use metacharacters such as * or ? or ].  To use them as ordinary characters, they must be escaped with backslash.";
00185         foreach ($this->sef_substitutions_out as $key=>$name) $this->translateLine('subst_out', $key, $name, 50);
00186         for ($i = 0; $i < 5; $i++) $this->translateLine('subst_out', '', '',50);
00187     }

sefAdminSef::showComponents (  )  [private]

Definition at line 189 of file admin.sef.php.

References headingLine(), and translateLine().

Referenced by listTask().

00189                                        {
00190         $link = 'index.php?core=cor_sef&amp;task=component&amp;component=';
00191         $this->headingLine('Component names');
00192         echo "\n\t<p>If a component is listed here, its sef_ext.php (if any) will be used; the name will be translated in any case.  Make sure the translated name does not conflict with content component tasks.  Editing details depends on the sef_ext file being present and supporting the extended Remosef interface.</p>";
00193         foreach ($this->custom_code as $key=>$name) {
00194             $linkhtml = <<<COMP_LINK
00195 
00196             <a href="$link$key">Edit details</a>
00197 
00198 COMP_LINK;
00199 
00200             $this->translateLine('comp', $key, $name, 30, $linkhtml);
00201         }
00202         for ($i = 0; $i < 5; $i++) $this->translateLine('comp', '', '', 30, '<span>Edit details</span>');
00203     }

sefAdminSef::showCharacters (  )  [private]

Definition at line 205 of file admin.sef.php.

References headingLine(), and translateLine().

Referenced by listTask().

00205                                        {
00206         $this->headingLine('Character string translations');
00207         echo "\n\t<p>The box on the left must be a string of one or more characters; so must the box on the right.  Any occurrences of left hand strings will be substituted by the corresponding right string.  Character string translations are applied to names used to build the SEF URI.</p>";
00208         echo "\n\t<p>The dash (often created by MS Word) is always translated to hyphen, and single quote is always translated to hyphen</p>";
00209         echo "\n\t<p>Accents are automatically removed for accented characters in the Latin1 set; URL encoding is used if necessary</p>";
00210         foreach ($this->sef_name_chars as $key=>$name) $this->translateLine ('char', $name, $this->sef_translate_chars[$key]);
00211         for ($i = 0; $i < 5; $i++) $this->translateLine('char', '', '');
00212     }

sefAdminSef::showContentTasks (  )  [private]

Definition at line 214 of file admin.sef.php.

References aliroComponentAdminControllers::$task, headingLine(), and translateLine().

Referenced by listTask().

00214                                          {
00215         $content_tasks = array ('findkey',
00216         'view',
00217         'section',
00218         'category',
00219         'blogsection',
00220         'blogcategorymulti',
00221         'blogcategory',
00222         'archivesection',
00223         'archivecategory',
00224         'save',
00225         'cancel',
00226         'emailform',
00227         'emailsend',
00228         'vote',
00229         'showblogsection'
00230         );
00231         $this->headingLine('Content task translations');
00232         echo "\n\t<p>You can give alternative names for the content component task words.  Make sure that they do not conflict with component names.</p>";
00233         foreach ($this->sef_content_task as $key=>$name) $this->translateLine ('ctask', $key, $name);
00234         foreach ($content_tasks as $task) if (!isset($this->sef_content_task[$task])) $this->translateLine ('ctask', $task, '');
00235         for ($i = 0; $i < 3; $i++) $this->translateLine('ctask', '', '');
00236     }

sefAdminSef::headingLine ( title  )  [private]

Definition at line 238 of file admin.sef.php.

Referenced by showCharacters(), showComponents(), showContentTasks(), showOptions(), showSubstitutions(), showSubstitutionsIn(), and showSubstitutionsOut().

00238                                           {
00239         echo <<<HEADING
00240 
00241         <div class="remosefhead">$title</div>
00242 
00243 HEADING;
00244 
00245     }

sefAdminSef::inputBox ( title,
name,
value,
width = 25 
) [private]

Definition at line 247 of file admin.sef.php.

References name, and size.

Referenced by showOptions().

00247                                                                  {
00248         echo <<<INPUT_BOX
00249 
00250             <div class="remosefinput">
00251                 <label for="$name">$title</label>
00252                 <input class="inputbox" type="text" id="$name" name="$name" size="$width" value="$value" />
00253             </div>
00254 
00255 INPUT_BOX;
00256 
00257     }

sefAdminSef::yesnoBox ( title,
name,
value 
) [private]

Definition at line 259 of file admin.sef.php.

References name.

Referenced by showOptions().

00259                                                       {
00260         $no = $yes = '';
00261         if ($value) $yes = "selected='selected'";
00262         else $no = "selected='selected'";
00263         echo <<<YES_NO
00264 
00265             <div class="remosefinput">
00266                 <label for="$name">$title</label>
00267                 <select id="$name" name="$name">
00268                     <option value="0" $no>No</option>
00269                     <option value="1" $yes>Yes</option>
00270                 </select>
00271             </div>
00272 
00273 YES_NO;
00274 
00275     }

sefAdminSef::translateLine ( type,
name,
modified,
size = 30,
link = '' 
) [private]

Definition at line 277 of file admin.sef.php.

References INTO(), name, and size.

Referenced by showCharacters(), showComponents(), showContentTasks(), showSubstitutions(), showSubstitutionsIn(), and showSubstitutionsOut().

00277                                                                                  {
00278         echo <<<TRANSLATE_LINE
00279 
00280         <div class="remosefboxes">
00281             <input name="{$type}[]" value="$name" class="inputbox" size="$size"" />
00282             <input name="{$type}mod[]" value="$modified" class="inputbox" size="$size" />
00283             $link
00284         </div>
00285 
00286 TRANSLATE_LINE;
00287 
00288     }
00289     
00290     public function saveTask () {
00291         $this->database->doSQL("DELETE FROM #__remosef_config WHERE type IN ('components', 'options', 'characters', 'content', 'substitutions', 'substitutions_in', 'substitutions_out')");
00292         $names = array_keys(get_object_vars($this));
00293         foreach ($names as $name) {
00294             if (is_array($this->$name) OR 'database' == $name) continue;
00295             $value = $this->getParam($_POST, $name);
00296             if (get_magic_quotes_gpc()) $value = stripslashes($value);
00297             if (null !== $value) {
00298                 if ('strip_chars' == $name) $value = htmlspecialchars_decode ($value);
00299                 if (is_numeric($this->$name)) $value = intval($value);
00300                 else $value = $this->database->getEscaped($value);
00301                 $this->$name = $value;
00302             }
00303             $this->database->setQuery("INSERT INTO #__remosef_config VALUES (0, 'options', '$name', '{$this->$name}')");
00304             $this->database->query();
00305         }
00306         $this->custom_code = $this->custom_name = array();
00307         $this->storeDataGroup ('components','comp','compmod');
00308         $this->sef_name_chars = $this->sef_translate_chars = array();
00309         $this->storeDataGroup ('characters', 'char', 'charmod');
00310         $this->sef_content_task = array();
00311         $this->storeDataGroup ('content', 'ctask', 'ctaskmod');
00312         $this->sef_substitutions_exact = array();
00313         $this->storeDataGroup ('substitutions', 'subst', 'substmod');
00314         $this->sef_substitutions_in = array();
00315         $this->storeDataGroup ('substitutions_in', 'subst_in', 'subst_inmod');
00316         $this->sef_substitutions_out = array();
00317         $this->storeDataGroup ('substitutions_out', 'subst_out', 'subst_outmod');
00318         aliroSEF::getInstance()->clearCache();
00319         $this->redirect('index.php?core=cor_sef', T_('SEF configuration saved'));
00320     }

sefAdminSef::storeDataGroup ( type,
namecode,
modcode 
) [private]

Definition at line 322 of file admin.sef.php.

00322                                                                  {
00323         $codes = $this->getParam($_POST, $namecode, array());
00324         $names = $this->getParam($_POST, $modcode, array());
00325 
00326         foreach ($codes as $key=>$code) {
00327             if (get_magic_quotes_gpc()) {
00328                 $code = stripslashes($code);
00329                 if (!empty($names[$key])) $names[$key] = stripslashes($names[$key]);
00330             }
00331             $code = $this->database->getEscaped($code);
00332             $name = !empty($names[$key]) ? $this->database->getEscaped($names[$key]) : '';
00333             if ($name AND $code) $this->database->doSQL("INSERT INTO #__remosef_config VALUES (0, '$type', '$code', '$name')");
00334         }
00335     }

sefAdminSef::componentTask (  ) 

Definition at line 337 of file admin.sef.php.

00337                                      {
00338         $this->getData();
00339         $component = $this->getParam($_REQUEST, 'component');
00340         if (false !== strpos($component, '..')) die ('Illegal component specified');
00341         echo "\n\t\t<h3>Function codes for $component</h3>";
00342         $sefext = _ALIRO_ABSOLUTE_PATH.'/components/'.$component.'/sef_ext.php';
00343         if (file_exists($sefext)) {
00344             require_once($sefext);
00345             $class_name = str_replace('com', 'sef', $task);
00346             if (class_exists($class_name, false)) {
00347                 if (method_exists($class_name, 'getInstance')) {
00348                     $sef = call_user_func(array($class_name, 'getInstance'));
00349                     if (method_exists($sef,'tags')) $tags = $sef->tags();
00350                 }
00351                 else {
00352                     if (method_exists($class_name, 'tags')) $tags = call_user_func(array($class_name, 'tags'));
00353                 }
00354             }
00355         }
00356         echo "\n<div id='remosefadmin'>";
00357         if (isset($tags)) {
00358             foreach ($tags as $tag) {
00359                 if (isset($this->component_details[$task][$tag])) $translated = $this->component_details[$task][$tag];
00360                 else $translated = '';
00361                 $this->translateLine ($task, $tag, $translated);
00362             }
00363         }
00364         else echo "<p>No function codes found</p>";
00365         echo <<<END_FORM
00366                 <input type="hidden" name="core" value="cor_sef" />
00367                 <input type="hidden" name="component" value="$component" />
00368             </div>
00369             </form>
00370             <!-- End of code from Remosef -->
00371 
00372 END_FORM;
00373 
00374     }


Member Data Documentation

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

Definition at line 48 of file admin.sef.php.

sefAdminSef::$view_class = 'sefAdminHTML' [protected]

Definition at line 50 of file admin.sef.php.


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

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