示例#1
0
function Html5Setup()
{
    global $wgOut, $wgRequest, $IP, $wgTitle;
    $articleExists = $wgTitle->getArticleID() > 0;
    $editable = isHtml5Editable();
    if ($editable) {
        wfLoadExtensionMessages('Html5editor');
        $imageUpload = Easyimageupload::getUploadBoxJS(false);
        $wgOut->addScript($imageUpload);
        $vars = array('GOOGLE_SEARCH_API_KEY' => WH_GOOGLE_AJAX_IMAGE_SEARCH_API_KEY, 'articleExists' => $articleExists);
        EasyTemplate::set_path(dirname(__FILE__) . '/');
        $script = EasyTemplate::html('skin.tmpl.php', $vars);
        $wgOut->addScript($script);
    }
    return true;
}
 static function grabArticleEditLinks($isGuided)
 {
     global $wgTitle, $wgUser, $wgLanguageCode, $wgRequest;
     $article = new Article($wgTitle);
     $relHTML = '';
     $relBtn = '';
     $editLink = '';
     $edithelp = '';
     if (self::articleIsWikiHow($article) || $wgTitle->getArticleID() == 0 && $wgTitle->getNamespace() == NS_MAIN) {
         $sk = $article->getContext()->getSkin();
         if (class_exists('Html5editor') && isHtml5Editable(true)) {
             $relQuery = array('h5e' => 'true');
             // if article doesn't exist, enter into article creation mode
             if ($wgTitle->getArticleID() <= 0) {
                 $relQuery['create-new-article'] = 'true';
             }
             $editLink = Linker::linkKnown($wgTitle, wfMessage('html5_editor')->text(), array("id" => "othereditlink"), $relQuery) . wfMessage('h5e_save_first')->text();
         } else {
             $oldparameters = "";
             if ($wgRequest->getVal("oldid") != "") {
                 $oldparameters = "&oldid=" . $wgRequest->getVal("oldid");
             }
             if ($isGuided) {
                 $editLink = $sk->makeKnownLinkObj($wgTitle, wfMessage('advanced_editing_link')->text(), 'action=edit&advanced=true' . $oldparameters, '', '', '');
                 //weave links button
                 $relBtn = $wgLanguageCode == 'en' ? PopBox::getGuidedEditorButton() : '';
                 $relHTML = PopBox::getPopBoxJSGuided() . PopBox::getPopBoxDiv() . PopBox::getPopBoxCSS();
             } else {
                 $editLink = $sk->makeKnownLinkObj($wgTitle, wfMessage('guided_editing_link')->text(), 'action=edit&override=yes' . $oldparameters, '', '', '');
             }
         }
         $edithelpurl = $sk->makeInternalOrExternalUrl(wfMsgForContent('edithelppage'));
         $edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' . htmlspecialchars(wfMessage('edithelp_link')->text()) . '</a>';
     }
     // Take out switch to guided editing and editing help on edit page for logged out users on international
     if ($wgLanguageCode == "en" || $wgTitle->userCan('edit')) {
         $editlinks = $relHTML . '<div class="editpage_links">' . $editLink . ' ' . $relBtn . ' ' . $edithelp . '</div>';
     } else {
         $editlinks = '';
     }
     return $editlinks;
 }