Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • PimPlugin
  • PimPluginArchiveExtractor
  • PimPluginCollection
  • PimPluginRelations
  • PimPluginRelationsCollection
  • PimPluginSetup
  • PimPluginSetupInstall
  • PimPluginSetupStatus
  • PimPluginSetupUninstall
  • PimPluginSetupUpdate
  • PimPluginViewDependencies
  • PimPluginViewNavSub
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains abstract class for view plugin dependencies
  4:  *
  5:  * @package Plugin
  6:  * @subpackage PluginManager
  7:  * @author Frederic Schneider
  8:  * @copyright four for business AG <www.4fb.de>
  9:  * @license http://www.contenido.org/license/LIZENZ.txt
 10:  * @link http://www.4fb.de
 11:  * @link http://www.contenido.org
 12:  */
 13: 
 14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 15: 
 16: /**
 17:  * View plugin dependencies
 18:  * TODO: Later implement into new PIM view design
 19:  *
 20:  * @package Plugin
 21:  * @subpackage PluginManager
 22:  * @author frederic.schneider
 23:  */
 24: class PimPluginViewDependencies {
 25: 
 26:     // Filename of Xml configuration file for plugins
 27:     const PLUGIN_CONFIG_FILENAME = "plugin.xml";
 28: 
 29:     // Initializing variables
 30:     private static $pluginFoldername;
 31:     private static $tempXml;
 32: 
 33:     /**
 34:      * Construct function
 35:      */
 36:     public function __construct() {
 37:         $this->_setPluginFoldername();
 38:     }
 39: 
 40:     /**
 41:      * Get method for pluginFoldername
 42:      *
 43:      * @return string $pluginFoldername
 44:      */
 45:     private function _setPluginFoldername() {
 46:         $cfg = cRegistry::getConfig();
 47:         return self::$pluginFoldername = $cfg['path']['contenido'] . $cfg['path']['plugins'];
 48:     }
 49: 
 50:     /**
 51:      * Get method for pluginFoldername
 52:      *
 53:      * @return string $pluginFoldername
 54:      */
 55:     private function _getPluginFoldername() {
 56:         return self::$pluginFoldername;
 57:     }
 58: 
 59:     /**
 60:      * Get dependencies
 61:      *
 62:      * @return boolean|string
 63:      */
 64:     private function _getPluginDependencies() {
 65: 
 66:         $tempXml = self::$tempXml;
 67: 
 68:         // Initializing dependencies string
 69:         $dependencies = '';
 70: 
 71:         $dependenciesCount = count($tempXml->dependencies);
 72:         for ($i = 0; $i < $dependenciesCount; $i++) {
 73:             $dependencies .= sprintf(i18n('This plugin has a dependency to plugin &quot;%s&quot;<br />', 'pim'), $tempXml->dependencies->depend[$i]);
 74:         }
 75: 
 76:         if ($dependencies == '') {
 77:             return i18n('This plugin has no dependencies to other plugins', 'pim');
 78:         } else {
 79:             return $dependencies;
 80:         }
 81: 
 82:     }
 83: 
 84:     /**
 85:      * Get dependencies from extracted plugins
 86:      *
 87:      * @param array $tempXml
 88:      * @return string Plugin dependencie
 89:      */
 90:     public function getPluginDependenciesExtracted($tempXml) {
 91:         // Write plugin.xml content into tempXml variable
 92:         self::$tempXml = $tempXml;
 93: 
 94:         // Call plugin dependencies
 95:         return $this->_getPluginDependencies();
 96:     }
 97: 
 98:     /**
 99:      * Get dependencies from installed plugins
100:      *
101:      * @param integer $idplugin Id of defined plugin
102:      * @return string Plugin dependencies
103:      */
104:     public function getPluginDependenciesInstalled($idplugin = 0) {
105: 
106:         // Return false if no idplugin variable is defined
107:         if ($idplugin == 0) {
108:             return false;
109:         }
110: 
111:         // Get foldername from defined plugin
112:         $pimPluginColl = new PimPluginCollection();
113:         $pimPluginColl->setWhere('idplugin', $idplugin);
114:         $pimPluginColl->query();
115:         $pimPluginSql = $pimPluginColl->next();
116:         $folderBase = $pimPluginSql->get('folder');
117: 
118:         // Reset query so we can use PimPluginCollection later again...
119:         $pimPluginColl->resetQuery();
120: 
121:         // Skip plugin if it has no plugin.xml file
122:         if (!cFileHandler::exists($this->_getPluginFoldername() . $folderBase . DIRECTORY_SEPARATOR . self::PLUGIN_CONFIG_FILENAME)) {
123:             return false;
124:         }
125: 
126:         // Read plugin.xml files from existing plugins at contenido/plugins dir
127:         $tempXmlContent = cFileHandler::read($this->_getPluginFoldername() . $folderBase . DIRECTORY_SEPARATOR . self::PLUGIN_CONFIG_FILENAME);
128: 
129:         // Write plugin.xml content into tempXml variable
130:         self::$tempXml = simplexml_load_string($tempXmlContent);
131: 
132:         // Call plugin dependencies
133:         return $this->_getPluginDependencies();
134:     }
135: 
136: 
137: }
138: ?>
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0