/** * Add "replace" button to File pages * Add "remove" action to MenuButtons on premium video file pages * This button will remove a video from a wiki but keep it on the Video Wiki. */ public static function onSkinTemplateNavigation($skin, &$tabs) { global $wgUser; $app = F::app(); $title = $app->wg->Title; if ($title instanceof Title && $title->getNamespace() == NS_FILE && $title->exists()) { $file = wfFindFile($title); if ($file instanceof File && UploadBase::userCanReUpload($wgUser, $file->getName())) { if (WikiaFileHelper::isFileTypeVideo($file)) { $uploadTitle = SpecialPage::getTitleFor('WikiaVideoAdd'); $href = $uploadTitle->getFullURL(array('name' => $file->getName())); } else { $uploadTitle = SpecialPage::getTitleFor('Upload'); $href = $uploadTitle->getFullURL(array('wpDestFile' => $file->getName(), 'wpForReUpload' => 1)); } $tabs['actions']['replace-file'] = array('class' => 'replace-file', 'text' => wfMessage('file-page-replace-button'), 'href' => $href); } } // Ignore Video Wiki videos beyond this point if ($app->wg->CityId == self::VIDEO_WIKI) { return true; } if (WikiaFileHelper::isFileTypeVideo($title)) { $file = wfFindFile($title); if (!$file->isLocal()) { // Prevent move tab being shown. unset($tabs['actions']['move']); } } return true; }
/** * Print out the various links at the bottom of the image page, e.g. reupload, * external editing (and instructions link) etc. */ protected function uploadLinksBox() { global $wgEnableUploads; if (!$wgEnableUploads) { return; } $this->loadFile(); if (!$this->mPage->getFile()->isLocal()) { return; } $out = $this->getContext()->getOutput(); $out->addHTML("<ul>\n"); # "Upload a new version of this file" link $canUpload = $this->getTitle()->userCan('upload', $this->getContext()->getUser()); if ($canUpload && UploadBase::userCanReUpload($this->getContext()->getUser(), $this->mPage->getFile()->name)) { $ulink = Linker::makeExternalLink($this->getUploadUrl(), wfMessage('uploadnewversion-linktext')->text()); $out->addHTML("<li id=\"mw-imagepage-reupload-link\"><div class=\"plainlinks\">{$ulink}</div></li>\n"); } else { $out->addHTML("<li id=\"mw-imagepage-upload-disallowed\">" . $this->getContext()->msg('upload-disallowed-here')->escaped() . "</li>\n"); } $out->addHTML("</ul>\n"); }
/** * Print out the various links at the bottom of the image page, e.g. reupload, * external editing (and instructions link) etc. */ protected function uploadLinksBox() { global $wgUser, $wgOut, $wgEnableUploads, $wgUseExternalEditor; if (!$wgEnableUploads) { return; } $this->loadFile(); if (!$this->img->isLocal()) { return; } $sk = $wgUser->getSkin(); $wgOut->addHTML("<br /><ul>\n"); # "Upload a new version of this file" link if (UploadBase::userCanReUpload($wgUser, $this->img->name)) { $ulink = $sk->makeExternalLink($this->getUploadUrl(), wfMsg('uploadnewversion-linktext')); $wgOut->addHTML("<li id=\"mw-imagepage-reupload-link\"><div class=\"plainlinks\">{$ulink}</div></li>\n"); } # External editing link if ($wgUseExternalEditor) { $elink = $sk->link($this->mTitle, wfMsgHtml('edit-externally'), array(), array('action' => 'edit', 'externaledit' => 'true', 'mode' => 'file'), array('known', 'noclasses')); $wgOut->addHTML('<li id="mw-imagepage-edit-external">' . $elink . ' <small>' . wfMsgExt('edit-externally-help', array('parseinline')) . "</small></li>\n"); } $wgOut->addHTML("</ul>\n"); }
/** * Print out the various links at the bottom of the image page, e.g. reupload, * external editing (and instructions link) etc. */ protected function uploadLinksBox() { global $wgEnableUploads, $wgUseExternalEditor; if (!$wgEnableUploads) { return; } $this->loadFile(); if (!$this->mPage->getFile()->isLocal()) { return; } $out = $this->getContext()->getOutput(); $out->addHTML("<ul>\n"); # "Upload a new version of this file" link $canUpload = $this->getTitle()->userCan('upload', $this->getContext()->getUser()); if ($canUpload && UploadBase::userCanReUpload($this->getContext()->getUser(), $this->mPage->getFile()->name)) { $ulink = Linker::makeExternalLink($this->getUploadUrl(), wfMessage('uploadnewversion-linktext')->text()); $out->addHTML("<li id=\"mw-imagepage-reupload-link\"><div class=\"plainlinks\">{$ulink}</div></li>\n"); } else { $out->addHTML("<li id=\"mw-imagepage-upload-disallowed\">" . $this->getContext()->msg('upload-disallowed-here')->escaped() . "</li>\n"); } # External editing link if ($wgUseExternalEditor) { $elink = Linker::linkKnown($this->getTitle(), wfMessage('edit-externally')->escaped(), array(), array('action' => 'edit', 'externaledit' => 'true', 'mode' => 'file')); $out->addHTML('<li id="mw-imagepage-edit-external">' . $elink . ' <small>' . wfMessage('edit-externally-help')->parse() . "</small></li>\n"); } $out->addHTML("</ul>\n"); }
/** * Print out the various links at the bottom of the image page, e.g. reupload, * external editing (and instructions link) etc. */ protected function uploadLinksBox() { global $wgUser, $wgOut, $wgEnableUploads, $wgUseExternalEditor; if (!$wgEnableUploads) { return; } $this->loadFile(); if (!$this->mPage->getFile()->isLocal()) { return; } $wgOut->addHTML("<br /><ul>\n"); # "Upload a new version of this file" link /* Wikia change begin - @author: mech - replacing ->name with ->getName(), as File::$name is protected */ if (UploadBase::userCanReUpload($wgUser, $this->mPage->getFile()->getName())) { /* Wikia change - end */ $ulink = Linker::makeExternalLink($this->getUploadUrl(), wfMsg('uploadnewversion-linktext')); $wgOut->addHTML("<li id=\"mw-imagepage-reupload-link\"><div class=\"plainlinks\">{$ulink}</div></li>\n"); } # External editing link if ($wgUseExternalEditor) { $elink = Linker::link($this->getTitle(), wfMsgHtml('edit-externally'), array(), array('action' => 'edit', 'externaledit' => 'true', 'mode' => 'file'), array('known', 'noclasses')); $wgOut->addHTML('<li id="mw-imagepage-edit-external">' . $elink . ' <small>' . wfMsgExt('edit-externally-help', array('parseinline')) . "</small></li>\n"); } $wgOut->addHTML("</ul>\n"); }