Exemple #1
0
 /**
  * Convenience methods for SkinBooty
  */
 public static function setOptions($options, $reset = false)
 {
     if ($reset === true) {
         self::$skinOptions = array();
     }
     self::$skinOptions = Skinny::mergeOptionsArrays(self::$skinOptions, $options);
 }
Exemple #2
0
 public function __construct($options = array())
 {
     if (!empty(Booty::$skinOptions)) {
         $options = Skinny::mergeOptionsArrays(Booty::$skinOptions, $options);
     }
     parent::__construct($options);
 }
Exemple #3
0
 public function main()
 {
     // Skinny 呼び出し
     $out = new Skinny();
     // Skinnyへ渡す配列宣言($outとします)
     $data = array();
     // テンプレートで出力したい内容を連想配列に追加
     $data['title'] = "Hello world.";
     $data['nowtime'] = time();
     // 現在時刻とか
     $data['my_age'] = 25;
     // 年齢とか
     $data['message'] = "動きました\nおめでとう!!\n";
     // メッセージとか
     // $outの内容をSkinnyで出力
     $out->SkinnyDisplay("skinny_sample.html", $data);
 }
Exemple #4
0
 /**
  * This is called by MediaWiki to render the skin.
  */
 final function execute()
 {
     //parse content first, to allow for any ADDTEMPLATE items
     $content = $this->parseContent($this->data['bodycontent']);
     if (!$this->getLayoutClass()) {
         throw new \Exception('No layout class defined.');
     }
     $layoutClass = $this->getLayoutClass();
     $layout = new $layoutClass($this->getSkin(), $this);
     //set up standard content zones
     //head element (including opening body tag)
     $layout->addHTMLTo('head', $this->html('headelement'));
     //the logo image defined in LocalSettings
     $layout->addHTMLTo('logo', $this->data['logopath']);
     $layout->addHTMLTo('prepend:body', $this->html('prebodyhtml'));
     //the article title
     if ($this->showTitle) {
         $layout->addHTMLTo('content-container.class', 'has-title');
         $layout->addHTMLTo('title-html', $this->data['title']);
     }
     //article content
     $layout->addHTMLTo('content-html', $content);
     //the site notice
     if (!empty($this->data['sitenotice'])) {
         $layout->addHTMLTo('site-notice', $this->data['sitenotice']);
     }
     //the site tagline, if there is one
     if ($this->showTagline) {
         $layout->addHTMLTo('content-container.class', 'has-tagline');
         $layout->addHTMLTo('tagline', $this->getMsg('tagline'));
     }
     $breadcrumbTrees = $this->breadcrumbs();
     $layout->addTemplateTo('breadcrumbs', 'breadcrumbs', array('trees' => $breadcrumbTrees));
     if (\Skinny::hasContent('toc')) {
         // $layout->addHTMLTo('toc', \Skinny::getContent('toc')[0]['html']);
     }
     // if ( $this->data['dataAfterContent'] ) {
     // 	$layout->addHTMLTo('append:content', $this->data['dataAfterContent']);
     // }
     //the contents of Mediawiki:Sidebar
     // $layout->addTemplate('classic-sidebar', 'classic-sidebar', array(
     // 	'sections'=>$this->data['sidebar']
     // ));
     // //list of language variants
     // $layout->addTemplate('language-variants', 'language-variants', array(
     // 	'variants'=>$this->data['language_urls']
     // ));
     //page footer
     $layout->addHookTo('footer-links', array($this, 'getFooterLinks'));
     $layout->addHookTo('footer-icons', array($this, 'getFooterIcons'));
     //mediawiki needs this to inject script tags after the footer
     $layout->addHookTo('append:body', array($this, 'afterFooter'));
     $this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageViewLanguage()->getCode();
     //allow skins to set up before render
     $this->initialize();
     echo $layout->render();
     // $this->printTrail();
 }
Exemple #5
0
 protected function superhero()
 {
     $content = '';
     //Skinny can be used to content from the article into the
     if (class_exists('Skinny') && Skinny::hasContent('superhero')) {
         $content = Skinny::getContent('superhero');
         return $this->renderTemplate('superhero', array('content' => $content));
     }
 }
Exemple #6
0
 public function getLayoutClass()
 {
     if (!isset(static::$layouts[\Skinny::getLayout()])) {
         throw new \Exception("Layout {$name} does not exist");
     }
     return static::$layouts[\Skinny::getLayout()];
 }
     *  @param param    array    スキンに展開する変数(配列)
     *  @param tplcode  string   スキン内容コード(指定された場合はtplより優先で使用)
     */
    public function SkinnyFetchCache($tpl = null, $param = null, $tplcode = null)
    {
        $code = $this->_skReplacedCode($tpl, $param, $tplcode);
        $code .= $this->_skBenchMarkTime();
        return $code;
    }
}
/***  /End of Skinny Class  ***/
/** Execution of skinny processing **/
$skOutput = array();
$skLoopCount = array();
if (!isset($Skinny)) {
    $Skinny = new Skinny();
}
// externalの事前展開処理
function _callback_external_parse_skin($all)
{
    global $Skinny;
    $ret = $Skinny->_sfExternalParseSkin($all);
    return $ret;
}
// 全スキンタグ展開
function _callback_parse_skin($all)
{
    global $Skinny;
    $ret = $Skinny->_sfParseSkin($all);
    return $ret;
}
Exemple #8
0
 public function getAncestors($class = null)
 {
     if (!$class) {
         $class = get_class($this);
     }
     return \Skinny::getClassAncestors($class);
 }
Exemple #9
0
 public static function getSkin($context, &$skin)
 {
     //there's probably a better way to check for this...
     if (!isset($_GET['useskin'])) {
         $key = $GLOBALS['wgDefaultSkin'];
         if (self::$pageSkin) {
             $key = new self::$pageSkin();
         }
         $key = \Skin::normalizeKey($key);
         $skinNames = \Skin::getSkinNames();
         $skinName = $skinNames[$key];
         $className = "\\Skin{$skinName}";
         $skin = new $className();
         if (isset(self::$skinLayout)) {
             $skin->setLayout(self::$skinLayout);
         }
     }
     self::$skin = $skin;
     return true;
 }