Source for file config.plugin.php

Documentation is available at config.plugin.php

  1. <?php
  2. /**
  3.  * Plugin Advanced Mod Rewrite settings
  4.  *
  5.  * @author      Murat Purc <murat@purc.de>
  6.  * @copyright   © Murat Purc 2008
  7.  * @package     Contenido
  8.  * @subpackage  ModRewrite
  9.  */
  10.  
  11.  
  12. defined('CON_FRAMEWORK') or die('Illegal call');
  13.  
  14.  
  15. if (isset($GLOBALS['client']) && (int) $GLOBALS['client'] > 0) {
  16.     $clientId = (int) $GLOBALS['client'];
  17. } elseif (isset($GLOBALS['load_client']) && (int) $GLOBALS['load_client'] > 0) {
  18.     $clientId = (int) $GLOBALS['load_client'];
  19. } else {
  20.     $clientId = '';
  21. }
  22.  
  23.  
  24. // Include necessary sources
  25. cInclude('classes', 'Debug/DebuggerFactory.class.php');
  26. cInclude('classes', 'mp/class.mpdebug.php');
  27. cInclude('classes', 'mp/class.mpglobals.php');
  28. plugin_include('mod_rewrite', 'classes/class.modrewritebase.php');
  29. plugin_include('mod_rewrite', 'classes/class.modrewrite.php');
  30. plugin_include('mod_rewrite', 'classes/class.modrewritecontroller.php');
  31. plugin_include('mod_rewrite', 'classes/class.modrewriteurlstack.php');
  32. plugin_include('mod_rewrite', 'classes/class.modrewriteurlutil.php');
  33. plugin_include('mod_rewrite', 'includes/functions.mod_rewrite.php');
  34. cInclude('classes', 'mp/class.confighandler.php');
  35.  
  36.  
  37. // set debug configuration
  38. $options = array(
  39.     'enable'                    => true, //{%DEPLOY_DEBUG_ENABLE%}
  40.     'ressource_urls'            => array('/contenido/logs/errorlog.txt'),
  41.     'dump_super_globals'        => array('$_GET', '$_POST', '$_COOKIE', '$_SESSION'),
  42.     'ignore_empty_superglobals' => true
  43. );
  44.  
  45. Contenido_mpDebug::getInstance()->setConfig($options);
  46.  
  47.  
  48. // initialize mr plugin
  49. ModRewrite::initialize($clientId);
  50.  
  51. if (ModRewrite::isEnabled()) {
  52.  
  53.     $aMrCfg = ModRewrite::getConfig();
  54.  
  55.     $_cecRegistry = cApiCECRegistry::getInstance();
  56.  
  57.     // Add new tree function to Contenido Extension Chainer
  58.     $_cecRegistry->addChainFunction('Contenido.Action.str_newtree.AfterCall', 'mr_strNewTree');
  59.  
  60.     // Add move subtree function to Contenido Extension Chainer
  61.     $_cecRegistry->addChainFunction('Contenido.Action.str_movesubtree.AfterCall', 'mr_strMoveSubtree');
  62.  
  63.     // Add new category function to Contenido Extension Chainer
  64.     $_cecRegistry->addChainFunction('Contenido.Action.str_newcat.AfterCall', 'mr_strNewCategory');
  65.  
  66.     // Add rename category function to Contenido Extension Chainer
  67.     $_cecRegistry->addChainFunction('Contenido.Action.str_renamecat.AfterCall', 'mr_strRenameCategory');
  68.  
  69.     // Add move up category function to Contenido Extension Chainer
  70.     $_cecRegistry->addChainFunction('Contenido.Action.str_moveupcat.AfterCall', 'mr_strMoveUpCategory');
  71.  
  72.     // Add move down category function to Contenido Extension Chainer
  73.     $_cecRegistry->addChainFunction('Contenido.Action.str_movedowncat.AfterCall', 'mr_strMovedownCategory');
  74.  
  75.     // Add copy category function to Contenido Extension Chainer
  76.     $_cecRegistry->addChainFunction('Contenido.Category.strCopyCategory', 'mr_strCopyCategory');
  77.  
  78.     // Add save article (new and existing category) function to Contenido Extension Chainer
  79.     $_cecRegistry->addChainFunction('Contenido.Action.con_saveart.AfterCall', 'mr_conSaveArticle');
  80.  
  81.     // Add move article function to Contenido Extension Chainer
  82.     $_cecRegistry->addChainFunction('Contenido.Article.conMoveArticles_Loop', 'mr_conMoveArticles');
  83.  
  84.     // Add duplicate article function to Contenido Extension Chainer
  85.     $_cecRegistry->addChainFunction('Contenido.Article.conCopyArtLang_AfterInsert', 'mr_conCopyArtLang');
  86.  
  87.     // Add sync article function to Contenido Extension Chainer
  88.     $_cecRegistry->addChainFunction('Contenido.Article.conSyncArticle_AfterInsert', 'mr_conSyncArticle');
  89.  
  90.     if (!isset($GLOBALS['contenido'])) {
  91.         // we are not in backend, add cec functions for rewriting
  92.  
  93.         // Add mr related function for hook "after plugins loaded" to Contenido Extension Chainer
  94.         $_cecRegistry->addChainFunction('Contenido.Frontend.AfterLoadPlugins', 'mr_runFrontendController');
  95.  
  96.         // Add url rewriting function to Contenido Extension Chainer
  97.         $_cecRegistry->addChainFunction('Contenido.Frontend.CreateURL', 'mr_buildNewUrl');
  98.  
  99.         if ($aMrCfg['rewrite_urls_at_congeneratecode'] == 1) {
  100.  
  101.             // Add url rewriting at code generation to Contenido Extension Chainer
  102.             $_cecRegistry->addChainFunction('Contenido.Content.conGenerateCode', 'mr_buildGeneratedCode');
  103.  
  104.         } elseif ($aMrCfg['rewrite_urls_at_front_content_output'] == 1) {
  105.  
  106.             // Add url rewriting at html output to Contenido Extension Chainer
  107.             $_cecRegistry->addChainFunction('Contenido.Frontend.HTMLCodeOutput', 'mr_buildGeneratedCode');
  108.  
  109.         } else {
  110.  
  111.             // Fallback solution: Add url rewriting at code generation to Contenido Extension Chainer
  112.             $_cecRegistry->addChainFunction('Contenido.Content.conGenerateCode', 'mr_buildGeneratedCode');
  113.  
  114.         }
  115.  
  116.     }
  117.  
  118. }
  119.  
  120. unset($clientId, $options);

Documentation generated on Sun, 21 Dec 2008 21:42:50 +0100 by phpDocumentor 1.4.1