[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/extensions/SyntaxHighlight_GeSHi/ -> ResourceLoaderGeSHiModule.php (source)

   1  <?php
   2  
   3  /**
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License along
  15   * with this program; if not, write to the Free Software Foundation, Inc.,
  16   * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17   * http://www.gnu.org/copyleft/gpl.html
  18   */
  19  
  20  class ResourceLoaderGeSHiModule extends ResourceLoaderModule {
  21  
  22      /**
  23       * @var string
  24       */
  25      protected $lang;
  26  
  27      /**
  28       * @param array $info Module definition.
  29       */
  30  	function __construct( $info ) {
  31          $this->lang = $info['lang'];
  32      }
  33  
  34      /**
  35       * @param ResourceLoaderContext $context
  36       * @return array
  37       */
  38  	public function getStyles( ResourceLoaderContext $context ) {
  39          $geshi = SyntaxHighlight_GeSHi::prepare( '', $this->lang );
  40          if ( !$geshi->error ) {
  41              $css = SyntaxHighlight_GeSHi::getCSS( $geshi );
  42          } else {
  43              $css = ResourceLoader::makeComment( $geshi->error() );
  44          }
  45  
  46          return array( 'all' => $css );
  47      }
  48  
  49      /**
  50       * @param ResourceLoaderContext $context
  51       * @return int
  52       */
  53  	public function getModifiedTime( ResourceLoaderContext $context ) {
  54          return max( array(
  55              $this->getDefinitionMtime( $context ),
  56              self::safeFilemtime( __FILE__ ),
  57              self::safeFilemtime( __DIR__ . '/SyntaxHighlight_GeSHi.class.php' ),
  58              self::safeFilemtime( __DIR__ . '/geshi/geshi.php' ),
  59              self::safeFilemtime( GESHI_LANG_ROOT . "/{$this->lang}.php" ),
  60          ) );
  61      }
  62  
  63      /**
  64       * @param $context ResourceLoaderContext
  65       * @return array
  66       */
  67  	public function getDefinitionSummary( ResourceLoaderContext $context ) {
  68          return array(
  69              'class' => get_class( $this ),
  70              'lang' => $this->lang,
  71          );
  72      }
  73  }


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1