本文整理匯總了PHP中UploadBase::userCanReUpload方法的典型用法代碼示例。如果您正苦於以下問題:PHP UploadBase::userCanReUpload方法的具體用法?PHP UploadBase::userCanReUpload怎麽用?PHP UploadBase::userCanReUpload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UploadBase
的用法示例。
在下文中一共展示了UploadBase::userCanReUpload方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: onSkinTemplateNavigation
/**
* 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;
}
示例2: uploadLinksBox
/**
* 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");
}
示例3: uploadLinksBox
/**
* 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");
}
示例4: uploadLinksBox
/**
* 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");
}
示例5: uploadLinksBox
/**
* 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");
}