PageRenderTime 51ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/kernel/ezinfo/about.php

https://github.com/granitegreg/ezpublish
PHP | 183 lines | 122 code | 17 blank | 44 comment | 7 complexity | 331e486089da25ae3b085175a3999ed8 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. //
  3. // Created on: <17-Apr-2002 11:05:08 amos>
  4. //
  5. // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
  6. // SOFTWARE NAME: eZ Publish
  7. // SOFTWARE RELEASE: 4.1.x
  8. // COPYRIGHT NOTICE: Copyright (C) 1999-2011 eZ Systems AS
  9. // SOFTWARE LICENSE: GNU General Public License v2.0
  10. // NOTICE: >
  11. // This program is free software; you can redistribute it and/or
  12. // modify it under the terms of version 2.0 of the GNU General
  13. // Public License as published by the Free Software Foundation.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of version 2.0 of the GNU General
  21. // Public License along with this program; if not, write to the Free
  22. // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  23. // MA 02110-1301, USA.
  24. //
  25. //
  26. // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
  27. //
  28. define( 'EZ_ABOUT_CONTRIBUTORS_DIR', 'var/storage/contributors' );
  29. define( 'EZ_ABOUT_THIRDPARTY_SOFTWARE_FILE', 'var/storage/third_party_software.php' );
  30. /*!
  31. Returns list of contributors;
  32. Searches all php files in \a $pathToDir and tries to fetch contributor's info
  33. */
  34. function getContributors( $pathToDir )
  35. {
  36. $contribFiles = eZDir::recursiveFind( $pathToDir, "php" );
  37. $contributors = array();
  38. if ( count( $contribFiles ) )
  39. {
  40. foreach ( $contribFiles as $contribFile )
  41. {
  42. include_once( $contribFile );
  43. if ( !isset( $contributorSettings ) )
  44. continue;
  45. $tmpFiles = explode( ',', $contributorSettings['files'] );
  46. $updatedFiles = array();
  47. foreach ( $tmpFiles as $file )
  48. {
  49. if ( trim( $file ) )
  50. $updatedFiles[] = trim( $file,"\n\r" );
  51. }
  52. $files = implode( ', ', $updatedFiles );
  53. $contributorSettings['files'] = $files;
  54. $contributors[] = $contributorSettings;
  55. }
  56. }
  57. return $contributors;
  58. }
  59. /*!
  60. Returns third-party software from \a $pathToFile
  61. */
  62. function getThirdPartySoftware( $pathToFile )
  63. {
  64. if ( !file_exists( $pathToFile ) )
  65. return array();
  66. include_once( $pathToFile );
  67. if ( !isset( $thirdPartySoftware ) )
  68. return array();
  69. $thirdPartySoftware = array_unique( $thirdPartySoftware );
  70. return $thirdPartySoftware;
  71. }
  72. /*!
  73. Returns active extentions info in run-time
  74. */
  75. function getExtensionsInfo()
  76. {
  77. $siteINI = eZINI::instance();
  78. $extensionDir = $siteINI->variable( 'ExtensionSettings', 'ExtensionDirectory' );
  79. $selectedExtensionArray = $siteINI->variable( 'ExtensionSettings', "ActiveExtensions" );
  80. $selectedAccessExtensionArray = $siteINI->variable( 'ExtensionSettings', "ActiveAccessExtensions" );
  81. $selectedExtensions = array_merge( $selectedExtensionArray, $selectedAccessExtensionArray );
  82. $selectedExtensions = array_unique( $selectedExtensions );
  83. $result = array();
  84. foreach ( $selectedExtensions as $extension )
  85. {
  86. $extensionInfo = eZExtension::extensionInfo( $extension );
  87. if ( $extensionInfo )
  88. $result[$extension] = $extensionInfo;
  89. }
  90. return $result;
  91. }
  92. /*!
  93. Replaces all occurrences (in \a $subjects) of the search string (keys of \a $searches )
  94. with the replacement string (values of \a $searches)
  95. Returns array with replacements
  96. */
  97. function strReplaceByArray( $searches = array(), $subjects = array() )
  98. {
  99. $retArray = array();
  100. foreach( $subjects as $key => $subject )
  101. {
  102. if ( is_array( $subject ) )
  103. {
  104. $retArray[$key] = strReplaceByArray( $searches, $subject );
  105. }
  106. else
  107. {
  108. $retArray[$key] = str_replace( array_keys( $searches ), $searches, $subject );
  109. }
  110. }
  111. return $retArray;
  112. }
  113. $ezinfo = eZPublishSDK::version( true );
  114. $whatIsEzPublish = 'eZ Publish is a professional PHP application framework with advanced
  115. CMS (content management system) functionality. As a CMS its most notable
  116. featureis its revolutionary, fully customizable and extendable content
  117. model. Thisis also what makes eZ Publish suitable as a platform for
  118. general PHP development,allowing you to rapidly create professional
  119. web-based applications.
  120. Standard CMS functionality (such as news publishing, e-commerce and
  121. forums) are already implemented and ready to use. Standalone libraries
  122. can be used for cross-platform database-independent browser-neutral
  123. PHP projects. Because eZ Publish 4 is a web-based application, it can
  124. be accessed from anywhere you have an internet connection.';
  125. $license =
  126. ## BEGIN LICENSE INFO ##
  127. 'This copy of eZ Publish is distributed under the terms and conditions of
  128. the GNU General Public License (GPL). Briefly summarized, the GPL gives
  129. you the right to use, modify and share this copy of eZ Publish. If you
  130. choose to share eZ Publish, you may only share it under the terms and
  131. conditions of the GPL. If you share a modified version of eZ Publish,
  132. these modifications must also be placed under the GPL. Read the
  133. complete legal terms and conditions of the GPL at
  134. http://www.gnu.org/licenses/gpl.txt or see the file named LICENSE in
  135. the root directory of this eZ Publish distribution.';
  136. ## END LICENSE INFO ##
  137. $contributors = getContributors( EZ_ABOUT_CONTRIBUTORS_DIR );
  138. $thirdPartySoftware = getThirdPartySoftware( EZ_ABOUT_THIRDPARTY_SOFTWARE_FILE );
  139. $extensions = getExtensionsInfo();
  140. list( $whatIsEzPublish,
  141. $license,
  142. $contributors,
  143. $thirdPartySoftware,
  144. $extensions ) = strReplaceByArray( array( 'eZ Systems AS' => '<a href="http://ez.no/">eZ Systems AS</a>',
  145. 'eZ Systems as' => '<a href="http://ez.no/">eZ Systems AS</a>',
  146. 'eZ systems AS' => '<a href="http://ez.no/">eZ Systems AS</a>',
  147. 'eZ systems as' => '<a href="http://ez.no/">eZ Systems AS</a>',
  148. 'eZ Publish' => '<a href="http://ez.no/ezpublish">eZ Publish</a>',
  149. 'eZ publish' => '<a href="http://ez.no/ezpublish">eZ Publish</a>' ),
  150. array( $whatIsEzPublish, $license, $contributors, $thirdPartySoftware, $extensions ) );
  151. $tpl = eZTemplate::factory();
  152. $tpl->setVariable( 'ezinfo', $ezinfo );
  153. $tpl->setVariable( 'what_is_ez_publish', $whatIsEzPublish );
  154. $tpl->setVariable( 'license', $license );
  155. $tpl->setVariable( 'contributors', $contributors );
  156. $tpl->setVariable( 'third_party_software', $thirdPartySoftware );
  157. $tpl->setVariable( 'extensions', $extensions );
  158. $Result = array();
  159. $Result['content'] = $tpl->fetch( "design:ezinfo/about.tpl" );
  160. $Result['path'] = array( array( 'url' => false,
  161. 'text' => ezpI18n::tr( 'kernel/ezinfo', 'Info' ) ),
  162. array( 'url' => false,
  163. 'text' => ezpI18n::tr( 'kernel/ezinfo', 'About' ) ) );
  164. ?>