Source for file config.plugin.php

Documentation is available at config.plugin.php

  1. <?php
  2. /**
  3.  * Plugin Advanced Mod Rewrite initialization file.
  4.  *
  5.  * This file will be included by Contenido plugin loader routine, and the content
  6.  * of this file ensures that the AMR Plugin will be initialized correctly.
  7.  *
  8.  * @author      Murat Purc <murat@purc.de>
  9.  * @copyright   © Murat Purc 2008
  10.  * @package     Contenido
  11.  * @subpackage  ModRewrite
  12.  */
  13.  
  14.  
  15. defined('CON_FRAMEWORK'or die('Illegal call');
  16.  
  17.  
  18. // initialize client id
  19. if (isset($GLOBALS['client']&& (int) $GLOBALS['client'0{
  20.     $clientId = (int) $GLOBALS['client'];
  21. elseif (isset($GLOBALS['load_client']&& (int) $GLOBALS['load_client'0{
  22.     $clientId = (int) $GLOBALS['load_client'];
  23. else {
  24.     $clientId '';
  25. }
  26.  
  27. // load language file (internationalization ist not implemented, just a pre release)
  28. $pluginDir  $GLOBALS['cfg']['path']['contenido'$GLOBALS['cfg']['path']['plugins''mod_rewrite/';
  29. $pluginLang ($GLOBALS['i18nLanguage'== 'en_US''en_US' 'de_DE';
  30. if (is_file($pluginDir 'locale/' $pluginLang '.inc.php')) {
  31.     @include_once($pluginDir 'locale/' $pluginLang '.inc.php');
  32. else {
  33.     @include_once($pluginDir 'locale/en_US.inc.php');
  34. }
  35.  
  36.  
  37. // include necessary sources
  38. cInclude('classes''Debug/DebuggerFactory.class.php');
  39. cInclude('classes''mp/class.mpdebug.php');
  40. cInclude('classes''mp/class.mpglobals.php');
  41. plugin_include('mod_rewrite''classes/class.modrewritebase.php');
  42. plugin_include('mod_rewrite''classes/class.modrewrite.php');
  43. plugin_include('mod_rewrite''classes/class.modrewritecontroller.php');
  44. plugin_include('mod_rewrite''classes/class.modrewriteurlstack.php');
  45. plugin_include('mod_rewrite''classes/class.modrewriteurlutil.php');
  46. plugin_include('mod_rewrite''includes/functions.mod_rewrite.php');
  47. cInclude('classes''mp/class.confighandler.php');
  48.  
  49.  
  50. // set debug configuration
  51. $options array(
  52.     'enable'                    => true//{%DEPLOY_DEBUG_ENABLE%}
  53.     'ressource_urls'            => array('/contenido/logs/errorlog.txt'),
  54.     'dump_super_globals'        => array('$_GET''$_POST''$_COOKIE''$_SESSION'),
  55.     'ignore_empty_superglobals' => true
  56. );
  57.  
  58. Contenido_mpDebug::getInstance()->setConfig($options);
  59.  
  60.  
  61. // initialize mr plugin
  62. ModRewrite::initialize($clientId);
  63.  
  64. if (ModRewrite::isEnabled()) {
  65.  
  66.     $aMrCfg ModRewrite::getConfig();
  67.  
  68.     $_cecRegistry cApiCECRegistry::getInstance();
  69.  
  70.     // Add new tree function to Contenido Extension Chainer
  71.     $_cecRegistry->addChainFunction('Contenido.Action.str_newtree.AfterCall''mr_strNewTree');
  72.  
  73.     // Add move subtree function to Contenido Extension Chainer
  74.     $_cecRegistry->addChainFunction('Contenido.Action.str_movesubtree.AfterCall''mr_strMoveSubtree');
  75.  
  76.     // Add new category function to Contenido Extension Chainer
  77.     $_cecRegistry->addChainFunction('Contenido.Action.str_newcat.AfterCall''mr_strNewCategory');
  78.  
  79.     // Add rename category function to Contenido Extension Chainer
  80.     $_cecRegistry->addChainFunction('Contenido.Action.str_renamecat.AfterCall''mr_strRenameCategory');
  81.  
  82.     // Add move up category function to Contenido Extension Chainer
  83.     $_cecRegistry->addChainFunction('Contenido.Action.str_moveupcat.AfterCall''mr_strMoveUpCategory');
  84.  
  85.     // Add move down category function to Contenido Extension Chainer
  86.     $_cecRegistry->addChainFunction('Contenido.Action.str_movedowncat.AfterCall''mr_strMovedownCategory');
  87.  
  88.     // Add copy category function to Contenido Extension Chainer
  89.     $_cecRegistry->addChainFunction('Contenido.Category.strCopyCategory''mr_strCopyCategory');
  90.  
  91.     // Add save article (new and existing category) function to Contenido Extension Chainer
  92.     $_cecRegistry->addChainFunction('Contenido.Action.con_saveart.AfterCall''mr_conSaveArticle');
  93.  
  94.     // Add move article function to Contenido Extension Chainer
  95.     $_cecRegistry->addChainFunction('Contenido.Article.conMoveArticles_Loop''mr_conMoveArticles');
  96.  
  97.     // Add duplicate article function to Contenido Extension Chainer
  98.     $_cecRegistry->addChainFunction('Contenido.Article.conCopyArtLang_AfterInsert''mr_conCopyArtLang');
  99.  
  100.     // Add sync article function to Contenido Extension Chainer
  101.     $_cecRegistry->addChainFunction('Contenido.Article.conSyncArticle_AfterInsert''mr_conSyncArticle');
  102.  
  103.     if (!isset($GLOBALS['contenido'])) {
  104.         // we are not in backend, add cec functions for rewriting
  105.  
  106.         // Add mr related function for hook "after plugins loaded" to Contenido Extension Chainer
  107.         $_cecRegistry->addChainFunction('Contenido.Frontend.AfterLoadPlugins''mr_runFrontendController');
  108.  
  109.         // Add url rewriting function to Contenido Extension Chainer
  110.         // @todo: no more need since Contenido 4.8.9 provides central Url building,
  111.         //        but it is still available  because of downwards compatibility
  112.         // @deprecated
  113.         $_cecRegistry->addChainFunction('Contenido.Frontend.CreateURL''mr_buildNewUrl');
  114.  
  115.         // overwrite url builder configuration with own url bilder
  116.         $GLOBALS['cfg']['url_builder']['name''MR';
  117.         $GLOBALS['cfg']['config']              array();
  118.         cInclude('classes''Url/Contenido_Url.class.php');
  119.         cInclude('classes''UrlBuilder/Contenido_UrlBuilderConfig.class.php');
  120.         Contenido_UrlBuilderConfig::setConfig($cfg['url_builder']);
  121.  
  122.         if ($aMrCfg['rewrite_urls_at_congeneratecode'== 1{
  123.  
  124.             // Add url rewriting at code generation to Contenido Extension Chainer
  125.             $_cecRegistry->addChainFunction('Contenido.Content.conGenerateCode''mr_buildGeneratedCode');
  126.  
  127.         elseif ($aMrCfg['rewrite_urls_at_front_content_output'== 1{
  128.  
  129.             // Add url rewriting at html output to Contenido Extension Chainer
  130.             $_cecRegistry->addChainFunction('Contenido.Frontend.HTMLCodeOutput''mr_buildGeneratedCode');
  131.  
  132.         else {
  133.  
  134.             // Fallback solution: Add url rewriting at code generation to Contenido Extension Chainer
  135.             $_cecRegistry->addChainFunction('Contenido.Content.conGenerateCode''mr_buildGeneratedCode');
  136.  
  137.         }
  138.  
  139.     }
  140.  
  141. }
  142.  
  143. unset($clientId$options);

Documentation generated on Sun, 08 Feb 2009 22:00:48 +0100 by phpDocumentor 1.4.1