示例#1
0
 public static function setup(\Parser &$parser)
 {
     if (!array_key_exists('SemanticRating_DefaultMax', $GLOBALS)) {
         $GLOBALS['SemanticRating_DefaultMax'] = 5;
     }
     if (!array_key_exists('SemanticRating_CSSSelector', $GLOBALS)) {
         $GLOBALS['SemanticRating_CSSSelector'] = "#firstHeading";
     }
     $imagepath = $GLOBALS['wgServer'] . $GLOBALS['wgScriptPath'] . "/extensions/SemanticRating/images/";
     $renderer = new SemanticRatingHtmlRenderer($imagepath);
     $parser->setFunctionHook('rating', function ($parser) use($renderer) {
         return $renderer->renderInline($parser, func_get_args());
     });
     $parser->setFunctionHook('ratingBeforeTitle', function ($parser) use($renderer) {
         return $renderer->renderBeforeTitle($parser, func_get_args());
     });
     $parser->setFunctionHook('ratingAfterTitle', function ($parser) use($renderer) {
         return $renderer->renderAfterTitle($parser, func_get_args());
     });
     SemanticRatingFormInput::setImagePath($imagepath);
     $GLOBALS['sfgFormPrinter']->registerInputType('SemanticRatingFormInput');
     return true;
 }
 public static function setImagePath($value)
 {
     self::$imagepath = $value;
 }