本文整理汇总了PHP中Wikia::getProps方法的典型用法代码示例。如果您正苦于以下问题:PHP Wikia::getProps方法的具体用法?PHP Wikia::getProps怎么用?PHP Wikia::getProps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wikia
的用法示例。
在下文中一共展示了Wikia::getProps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertImage
/**
* This functions handle the third step of the WMU, image insertion
*
* @return bool|String
*/
function insertImage()
{
global $wgRequest, $wgUser, $wgContLang;
$type = $wgRequest->getVal('type');
$name = $wgRequest->getVal('name');
$mwname = $wgRequest->getVal('mwname');
$tempid = $wgRequest->getVal('tempid');
$gallery = $wgRequest->getVal('gallery', '');
$title_main = urldecode($wgRequest->getVal('article', ''));
$ns = $wgRequest->getVal('ns', '');
$link = urldecode($wgRequest->getVal('link', ''));
// Are we in the ck editor?
$ck = $wgRequest->getVal('ck');
$extraId = $wgRequest->getVal('extraId');
$newFile = true;
$file = null;
if ($name !== NULL) {
$name = urldecode($name);
if ($name == '') {
header('X-screen-type: error');
return WfMsg('wmu-warn3');
} else {
$name = preg_replace("/[^" . Title::legalChars() . "]|:/", '-', $name);
// did they give no extension at all when they changed the name?
$ext = explode('.', $name);
array_shift($ext);
if (count($ext)) {
$finalExt = $ext[count($ext) - 1];
} else {
$finalExt = '';
}
if ('' == $finalExt) {
header('X-screen-type: error');
return wfMsg('wmu-filetype-missing');
}
$title = Title::makeTitleSafe(NS_IMAGE, $name);
if (is_null($title)) {
header('X-screen-type: error');
return wfMsg('wmu-filetype-incorrect');
}
if ($title->exists()) {
if ($type == 'overwrite') {
$title = Title::newFromText($name, 6);
// is the target protected?
$permErrors = $title->getUserPermissionsErrors('edit', $wgUser);
$permErrorsUpload = $title->getUserPermissionsErrors('upload', $wgUser);
$permErrorsCreate = $title->exists() ? array() : $title->getUserPermissionsErrors('create', $wgUser);
if ($permErrors || $permErrorsUpload || $permErrorsCreate) {
header('X-screen-type: error');
return wfMsg('wmu-file-protected');
}
$file_name = new LocalFile($title, RepoGroup::singleton()->getLocalRepo());
$file_mwname = new FakeLocalFile(Title::newFromText($mwname, 6), RepoGroup::singleton()->getLocalRepo());
if (!empty($extraId)) {
$flickrResult = $this->getFlickrPhotoInfo($extraId);
$nsid = $flickrResult['owner']['nsid'];
// e.g. 49127042@N00
$username = $flickrResult['owner']['username'];
// e.g. bossa67
$license = $flickrResult['license'];
$caption = '{{MediaWiki:Flickr' . intval($license) . '|1=' . wfEscapeWikiText($extraId) . '|2=' . wfEscapeWikiText($nsid) . '|3=' . wfEscapeWikiText($username) . '}}';
} else {
$caption = '';
}
$file_name->upload($file_mwname->getPath(), '', $caption);
$file_mwname->delete('');
$this->tempFileClearInfo($tempid);
$newFile = false;
} else {
if ($type == 'existing') {
$file = wfFindFile(Title::newFromText($name, 6));
if (!empty($file)) {
header('X-screen-type: existing');
$props = array();
$props['file'] = $file;
$props['mwname'] = $name;
$props['default_caption'] = Wikia::getProps($file->getTitle()->getArticleID(), 'default_caption');
return $this->detailsPage($props);
} else {
header('X-screen-type: error');
return wfMsg('wmu-file-error');
}
} else {
header('X-screen-type: conflict');
$tmpl = new EasyTemplate(dirname(__FILE__) . '/templates/');
// extensions check
list($partname, $ext) = UploadBase::splitExtensions($name);
if (count($ext)) {
$finalExt = $ext[count($ext) - 1];
} else {
$finalExt = '';
}
// for more than one "extension"
if (count($ext) > 1) {
for ($i = 0; $i < count($ext) - 1; $i++) {
//.........这里部分代码省略.........
示例2: getType
/**
* Returns the main classification type of the template.
* @return string
*/
public function getType()
{
return Wikia::getProps($this->title->getArticleId(), self::TEMPLATE_CLASSIFICATION_MAIN_PROP);
}