• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wfReplaceImageServer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wfReplaceImageServer函数的典型用法代码示例。如果您正苦于以下问题:PHP wfReplaceImageServer函数的具体用法?PHP wfReplaceImageServer怎么用?PHP wfReplaceImageServer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wfReplaceImageServer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: executeIndex

	public function executeIndex() {
		OasisController::addBodyClass('wikinav2');

		$themeSettings = new ThemeSettings();
		$settings = $themeSettings->getSettings();

		$this->wordmarkText = $settings["wordmark-text"];
		$this->wordmarkType = $settings["wordmark-type"];
		$this->wordmarkSize = $settings["wordmark-font-size"];
		$this->wordmarkFont = $settings["wordmark-font"];

		if ($this->wordmarkType == "graphic") {
			wfProfileIn(__METHOD__ . 'graphicWordmarkV2');
			$this->wordmarkUrl = wfReplaceImageServer($settings['wordmark-image-url'], SassUtil::getCacheBuster());
			$imageTitle = Title::newFromText($themeSettings::WordmarkImageName,NS_IMAGE);
			if($imageTitle instanceof Title) {
				$attributes = array();
				$file = wfFindFile($imageTitle);
				if($file instanceof File) {
					$attributes []= 'width="' . $file->width . '"';
					$attributes []= 'height="' . $file->height. '"';
			
					if(!empty($attributes)) {
						$this->wordmarkStyle = ' ' . implode(' ',$attributes) . ' ';
					}
				}
			}
			wfProfileOut(__METHOD__. 'graphicWordmarkV2');
		}

		$this->mainPageURL = Title::newMainPage()->getLocalURL();
		
		$this->displaySearch = !empty($this->wg->EnableAdminDashboardExt) && AdminDashboardLogic::displayAdminDashboard($this, $this->wg->Title);
	}
开发者ID:schwarer2006,项目名称:wikia,代码行数:34,代码来源:WikiHeaderV2Controller.class.php


示例2: executeWordmark

	public function executeWordmark() {
		$themeSettings = new ThemeSettings();
		$settings = $themeSettings->getSettings();

		$this->wordmarkText = $settings['wordmark-text'];
		$this->wordmarkType = $settings['wordmark-type'];
		$this->wordmarkSize = $settings['wordmark-font-size'];
		$this->wordmarkFont = $settings['wordmark-font'];
		$this->wordmarkFontClass = !empty($settings["wordmark-font"]) ? "font-{$settings['wordmark-font']}" : '';
		$this->wordmarkUrl = '';
		if ($this->wordmarkType == "graphic") {
			wfProfileIn(__METHOD__ . 'graphicWordmark');
			$this->wordmarkUrl = wfReplaceImageServer($settings['wordmark-image-url'], SassUtil::getCacheBuster());			
			$imageTitle = Title::newFromText($themeSettings::WordmarkImageName,NS_IMAGE);
			if($imageTitle instanceof Title) {
				$attributes = array();
				$file = wfFindFile($imageTitle);
				if($file instanceof File) {
					$attributes []= 'width="' . $file->width . '"';
					$attributes []= 'height="' . $file->height. '"';
	
					if(!empty($attributes)) {
						$this->wordmarkStyle = ' ' . implode(' ',$attributes) . ' ';
					}
				}
			}
			wfProfileOut(__METHOD__. 'graphicWordmark');
		}

		$this->mainPageURL = Title::newMainPage()->getLocalURL();
	}
开发者ID:schwarer2006,项目名称:wikia,代码行数:31,代码来源:WikiHeaderController.class.php


示例3: addWikiaVars

 public function addWikiaVars(&$obj, BaseTemplate &$tpl)
 {
     global $wgUser;
     wfProfileIn(__METHOD__);
     // ads
     $this->setupAds($tpl);
     // setup footer links
     $tpl->set('footerlinks', wfMsgExt('Shared-Monobook-footer-wikia-links', 'parse'));
     # rt33045
     $tpl->set('contact', '<a href="' . $wgUser->getSkin()->makeUrl('Special:Contact') . '" title="Contact Wikia">Contact Wikia</a>');
     # BAC-1036, CE-278
     /* Replace Wikia logo path
     		   This functionality is for finding proper path of Wiki.png instead of const one from wgLogo
     		   wikia logo should be stored under File:Wiki.png on current wikia. If wfFindFile doesn't find it
     		   on current wikia it tires to fallback to starter.wikia.com where the default one is stored
     		*/
     $logoPage = Title::newFromText('Wiki.png', NS_FILE);
     $logoFile = wfFindFile($logoPage);
     if ($logoFile) {
         $tpl->set('logopath', $logoFile->getUrl());
     } else {
         $tpl->set('logopath', wfReplaceImageServer($tpl->data['logopath']));
     }
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:yusufchang,项目名称:app,代码行数:26,代码来源:WikiaMonoBook.php


示例4: getBadge

 public static function getBadge($badgeTypeId)
 {
     wfProfileIn(__METHOD__);
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select('ach_custom_badges', array('id', 'enabled', 'sponsored', 'badge_tracking_url', 'hover_tracking_url', 'click_tracking_url'), array('id' => $badgeTypeId), __METHOD__);
     if ($row = $dbr->fetchObject($res)) {
         $badge = array();
         $image = wfFindFile(AchConfig::getInstance()->getBadgePictureName($row->id));
         if ($image) {
             $hoverImage = wfFindFile(AchConfig::getInstance()->getHoverPictureName($row->id));
             $badge['type_id'] = $row->id;
             $badge['enabled'] = $row->enabled;
             $badge['thumb_url'] = $image->createThumb(90);
             $badge['awarded_users'] = AchPlatinumService::getAwardedUserNames($row->id);
             $badge['is_sponsored'] = $row->sponsored;
             $badge['badge_tracking_url'] = $row->badge_tracking_url;
             $badge['hover_tracking_url'] = $row->hover_tracking_url;
             $badge['click_tracking_url'] = $row->click_tracking_url;
             $badge['hover_content_url'] = is_object($hoverImage) ? wfReplaceImageServer($hoverImage->getFullUrl()) : null;
             wfProfileOut(__METHOD__);
             return $badge;
         }
     }
     wfProfileOut(__METHOD__);
     return false;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:26,代码来源:AchPlatinumService.class.php


示例5: wfMakeSignatureCommon

function wfMakeSignatureCommon($href, $title, $iurl = null)
{
    global $wgBlankImgUrl;
    if (empty($iurl)) {
        $iurl = wfReplaceImageServer('/extensions/wikia/StaffSig/images/WikiaStaff.png');
    }
    return '<a href="' . $href . '" title="' . $title . '" class="staffSigLink"><img src="' . $wgBlankImgUrl . '" style="background-image: url(\'' . $iurl . '\')" alt="@Wikia" class="staffSig" width="41" height="12" /></a>';
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:8,代码来源:StaffSig.php


示例6: egOgmcParserOutputApplyValues

function egOgmcParserOutputApplyValues($out, $parserOutput, $data)
{
    global $wgTitle;
    $articleId = $wgTitle->getArticleID();
    $titleImage = $titleDescription = null;
    wfRunHooks('OpenGraphMeta:beforeCustomFields', array($articleId, &$titleImage, &$titleDescription));
    // Only use ImageServing if no main image is already specified.  This lets people override the image with the parser function: [[File:{{#setmainimage:Whatever.png}}]].
    if (!isset($out->mMainImage)) {
        if (is_null($titleImage)) {
            // Get image from ImageServing
            // TODO: Make sure we automatically respect these restrictions from Facebook:
            // 		"An image URL which should represent your object within the graph.
            //		The image must be at least 50px by 50px and have a maximum aspect ratio of 3:1.
            //		We support PNG, JPEG and GIF formats."
            $imageServing = F::build('ImageServing', array($articleId));
            foreach ($imageServing->getImages(1) as $key => $value) {
                $titleImage = Title::newFromText($value[0]['name'], NS_FILE);
            }
        }
        // If ImageServing was not able to deliver a good match, fall back to the wiki's wordmark.
        if (empty($titleImage) && !is_object($titleImage) && F::app()->checkSkin('oasis')) {
            $themeSettings = new ThemeSettings();
            $settings = $themeSettings->getSettings();
            if ($settings["wordmark-type"] == "graphic") {
                $titleImage = Title::newFromText($settings['wordmark-image-name'], NS_FILE);
            }
        }
        // If we have a Title object for an image, convert it to an Image object and store it in mMainImage.
        if (!empty($titleImage) && is_object($titleImage)) {
            $mainImage = wfFindFile($titleImage);
            if ($mainImage !== false) {
                $parserOutput->setProperty('mainImage', $mainImage);
                $out->mMainImage = $parserOutput->getProperty('mainImage');
            }
        } else {
            // Fall back to using a Wikia logo.  There aren't any as "File:" pages, so we use a new config var for one that
            // is being added to skins/common.
            global $wgBigWikiaLogo;
            $logoUrl = wfReplaceImageServer($wgBigWikiaLogo);
            $parserOutput->setProperty('mainImage', $logoUrl);
            $out->mMainImage = $parserOutput->getProperty('mainImage');
        }
    }
    // Get description from ArticleService
    if (is_null($titleDescription)) {
        $DESC_LENGTH = 100;
        $articleService = new ArticleService($articleId);
        $titleDescription = $articleService->getTextSnippet($DESC_LENGTH);
    }
    if (!empty($titleDescription)) {
        $parserOutput->setProperty('description', $titleDescription);
        $out->mDescription = $parserOutput->getProperty('description');
    }
    if ($page_id = Wikia::getFacebookDomainId()) {
        $out->addMeta('property:fb:page_id', $page_id);
    }
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:57,代码来源:OpenGraphMetaCustomizations.setup.php


示例7: testForDevbox

 /**
  * @dataProvider devboxDataProvider
  */
 public function testForDevbox($url, $timestamp, $expected)
 {
     $devImageServer = 'images.hakarl.wikia-dev.com';
     $this->mockGlobalVariable('wgDevBoxImageServerOverride', $devImageServer);
     // test logic for the old thumbnailer
     $this->mockGlobalVariable('wgEnableVignette', false);
     $testURL = wfReplaceImageServer($url, $timestamp);
     $this->assertEquals($expected, $testURL, 'URL returned by wfReplaceImageServer should match expected one');
     // test logic for the Vignette
     $this->mockGlobalVariable('wgEnableVignette', true);
     $testURL = wfReplaceImageServer($url, $timestamp);
     $this->assertEquals(0, preg_match('/images\\.hakarl\\.wikia-dev\\.com/', $testURL), 'URL returned by wfReplaceImageServer be the original with wgEnableVignette = true');
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:ReplaceImageServerTest.php


示例8: index

 public function index()
 {
     /**
      * @var $themeSettings ThemeSettings
      */
     $themeSettings = F::build('ThemeSettings');
     $settings = $themeSettings->getSettings();
     $this->response->setVal('wordmarkText', $settings["wordmark-text"]);
     $this->response->setVal('wordmarkType', $settings["wordmark-type"]);
     $this->response->setVal('wordmarkFont', $settings["wordmark-font"]);
     if ($settings["wordmark-type"] == "graphic") {
         $this->response->setVal('wordmarkUrl', wfReplaceImageServer($settings['wordmark-image-url'], SassUtil::getCacheBuster()));
     } else {
         $this->response->setVal('wikiName', !empty($settings['wordmark-text']) ? $settings['wordmark-text'] : $this->wg->SiteName);
     }
     //$this->response->setVal( 'searchOpen', ($this->wg->Title->getText() == SpecialPage::getTitleFor( 'Search' )->getText() ) );
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:17,代码来源:WikiaMobileNavigationService.class.php


示例9: downloadWordmark

 private function downloadWordmark()
 {
     $themeSettings = new ThemeSettings();
     $settings = $themeSettings->getSettings();
     $wordmark = wfReplaceImageServer($settings['wordmark-image-url'], SassUtil::getCacheBuster());
     $folder_path = $this->wikiName;
     if (!is_dir($folder_path)) {
         mkdir($folder_path, 0700);
     }
     $file_path = $folder_path . '/wordmark.png';
     if (file_exists($file_path)) {
         system("rm " . $file_path);
     }
     file_put_contents($file_path, Http::get($wordmark));
     if (file_get_contents($file_path) == '') {
         system("rm " . $file_path);
         system("cp default_wordmark.png " . $file_path);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:19,代码来源:EvolutionModel.class.php


示例10: execute

 /**
  * See functions below for expected URL params
  */
 public function execute()
 {
     global $wgRequest, $wgCacheBuster;
     wfProfileIn(__METHOD__);
     extract($this->extractRequestParams());
     // Allow optionally using a prefixed-title instead of the page_id.
     if (empty($Id)) {
         $title = Title::newFromText($Title);
         if (is_object($title)) {
             $Id = $title->getArticleID();
         }
     }
     $article = Article::newFromID($Id);
     if (is_object($article)) {
         // Automatically follow redirects.
         if ($article->isRedirect()) {
             $title = $article->followRedirect();
             if (is_object($title)) {
                 // if this is not an object, then we're pretty unlikely to get any good image matches, but more likely to get them for the original ID.
                 $Id = $title->getArticleID();
             }
         }
         $imageUrl = null;
         $imageServing = new ImageServing(array($Id));
         foreach ($imageServing->getImages(1) as $key => $value) {
             $imgTitle = Title::newFromText($value[0]['name'], NS_FILE);
             $imgFile = wfFindFile($imgTitle);
             if (!empty($imgFile)) {
                 $imageUrl = wfReplaceImageServer($imgFile->getFullUrl(), $wgCacheBuster);
             }
         }
         $result = $this->getResult();
         if (empty($imageUrl)) {
             $result->addValue('image', "error", "No good, representiative image was found for this page.");
             // TODO: i18n
         } else {
             $result->addValue('image', $this->getModuleName(), $imageUrl);
         }
     }
     wfProfileOut(__METHOD__);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:44,代码来源:WikiaApiImageServing.php


示例11: executePlayQuiz

 public function executePlayQuiz($params)
 {
     global $wgUser, $wgOut, $wgRequest, $wgSiteName;
     $this->data = $params['data'];
     $themeSettings = new ThemeSettings();
     $settings = $themeSettings->getSettings();
     $this->wordmarkType = $settings['wordmark-type'];
     $this->wordmarkText = $settings['wordmark-text'];
     if ($this->wordmarkType == 'graphic') {
         $this->wordmarkUrl = wfReplaceImageServer($settings['wordmark-image-url'], SassUtil::getCacheBuster());
     }
     // Facebook opengraph meta data
     $wgOut->addMeta('property:og:title', $this->data['titlescreentext']);
     $wgOut->addMeta('property:og:type', 'game');
     $wgOut->addMeta('property:og:url', $wgRequest->getFullRequestURL());
     $wgOut->addMeta('property:og:site_name', $wgSiteName);
     // mech: simply stripping the tags wont work, as some tags have to be replaced with a space
     $descrition = $this->data['fbrecommendationtext'];
     if (!$descrition) {
         /* mech: fbrecommendationtext field was intoduced while fixing bug 14843.
          * For older quizes the FB recommendation description defaults to titlescreentext
          */
         $descrition = str_replace('<', ' <', $this->data['titlescreentext']);
         // introduce an extra space at in front of tags
         $descrition = strip_tags($descrition);
         $descrition = preg_replace('/\\s\\s+/u', ' ', $descrition);
         // eliminate extraneous whitespaces
     }
     $wgOut->addMeta('property:og:description', $descrition);
     $wgOut->addMeta('property:og:image', $this->wordmarkUrl);
     $this->username = $wgUser->getName();
     $this->isAnonUser = $wgUser->isAnon();
     // render this array in PHP and encode it properly for JS
     $this->quizVars = array('cadence' => array(wfMsg('wikiaquiz-game-cadence-3'), wfMsg('wikiaquiz-game-cadence-2'), wfMsg('wikiaquiz-game-cadence-1')), 'correctLabel' => wfMsg('wikiaquiz-game-correct-label'), 'incorrectLabel' => wfMsg('wikiaquiz-game-incorrect-label'));
     // prefill with user's email
     $this->defaultEmail = $wgUser->isLoggedIn() ? $wgUser->getEmail() : '';
     // use token to prevent direct requests to the backend for storing emails
     $this->token = $wgUser->getEditToken('WikiaQuiz');
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:39,代码来源:WikiaQuizController.class.php


示例12: getOasisSettings

 /**
  * Gets theme settings from following places:
  *  - theme designer ($wgOasisThemeSettings)
  *  - theme chosen using usetheme URL param
  */
 public static function getOasisSettings()
 {
     global $wgOasisThemes, $wgContLang;
     wfProfileIn(__METHOD__);
     // Load the 5 deafult colors by theme here (eg: in case the wiki has an override but the user doesn't have overrides).
     static $oasisSettings = array();
     if (empty($oasisSettings)) {
         $themeSettings = new ThemeSettings();
         $settings = $themeSettings->getSettings();
         $oasisSettings["color-body"] = self::sanitizeColor($settings["color-body"]);
         $oasisSettings["color-page"] = self::sanitizeColor($settings["color-page"]);
         $oasisSettings["color-buttons"] = self::sanitizeColor($settings["color-buttons"]);
         $oasisSettings["color-links"] = self::sanitizeColor($settings["color-links"]);
         $oasisSettings["color-header"] = self::sanitizeColor($settings["color-header"]);
         $oasisSettings["background-image"] = wfReplaceImageServer($settings['background-image'], self::getCacheBuster());
         $oasisSettings["background-align"] = $settings["background-align"];
         $oasisSettings["background-tiled"] = $settings["background-tiled"];
         $oasisSettings["background-fixed"] = $settings["background-fixed"];
         $oasisSettings["page-opacity"] = $settings["page-opacity"];
         if (isset($settings["wordmark-font"]) && $settings["wordmark-font"] != "default") {
             $oasisSettings["wordmark-font"] = $settings["wordmark-font"];
         }
         // RTL
         if ($wgContLang && $wgContLang->isRTL()) {
             $oasisSettings['rtl'] = 'true';
         }
     }
     // RT:70673
     foreach ($oasisSettings as $key => $val) {
         if (!empty($val)) {
             $oasisSettings[$key] = trim($val);
         }
     }
     wfDebug(__METHOD__ . ': ' . json_encode($oasisSettings) . "\n");
     wfProfileOut(__METHOD__);
     return $oasisSettings;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:42,代码来源:SassUtil.php


示例13: cropURL

 /**
  * Return a URL that displays $file shrunk to have the closest dimension meet $box.  Images smaller than the
  * bounding box will not be affected.  The part of the image that extends beyond the $box dimensions will be
  * cropped out.  The result is an image that completely fills the box with no empty space, but is cropped.
  *
  * @param File $file
  * @param array $box
  *
  * @return String
  */
 private function cropURL(File $file, array $box)
 {
     global $wgEnableVignette;
     if ($wgEnableVignette) {
         $cropUrl = $file->getUrlGenerator()->zoomCropDown()->width($box['w'])->height($box['h'])->url();
     } else {
         list($adjWidth, $adjHeight) = $this->fitClosest($file, $box);
         $height = $file->getHeight();
         $width = $file->getWidth();
         if ($adjHeight == $box['h']) {
             $width = $box['w'] * ($file->getHeight() / $box['h']);
         }
         if ($adjWidth == $box['w']) {
             $height = $box['h'] * ($file->getWidth() / $box['w']);
         }
         $cropStr = sprintf("%dpx-0,%d,0,%d", $adjWidth, $width, $height);
         $append = '';
         $mime = strtolower($file->getMimeType());
         if ($mime == 'image/svg+xml' || $mime == 'image/svg') {
             $append = '.png';
         }
         $cropUrl = wfReplaceImageServer($file->getThumbUrl($cropStr . '-' . $file->getName() . $append));
     }
     return $cropUrl;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:35,代码来源:WikiaPhotoGallery.class.php


示例14: getWikiWordmark

 public function getWikiWordmark($wikiId)
 {
     $url = '';
     $history = WikiFactory::getVarByName('wgOasisThemeSettingsHistory', $wikiId);
     $settings = unserialize($history->cv_value);
     if ($settings !== false) {
         $currentSettings = end($settings);
         if (isset($currentSettings['settings']['wordmark-type']) && $currentSettings['settings']['wordmark-type'] == 'text') {
             return '';
         }
         if (isset($currentSettings['settings']) && !empty($currentSettings['settings']['wordmark-image-url'])) {
             $url = wfReplaceImageServer($currentSettings['settings']['wordmark-image-url'], $currentSettings['timestamp']);
         }
     }
     return $url;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:WikiService.class.php


示例15: wfRenderTimeline

/**
 * @param $timelinesrc string
 * @return string
 */
function wfRenderTimeline($timelinesrc)
{
    global $wgUploadDirectory, $wgUploadPath, $wgArticlePath, $wgTmpDirectory, $wgRenderHashAppend;
    global $wgTimelineSettings;
    // Get the backend to store plot data and pngs
    if ($wgTimelineSettings->fileBackend != '') {
        $backend = FileBackendGroup::singleton()->get($wgTimelineSettings->fileBackend);
    } else {
        $backend = new FSFileBackend(array('name' => 'timeline-backend', 'lockManager' => 'nullLockManager', 'containerPaths' => array('timeline-render' => "{$wgUploadDirectory}/timeline"), 'fileMode' => 777));
    }
    // Get a hash of the plot data
    $hash = md5($timelinesrc);
    if ($wgRenderHashAppend != '') {
        $hash = md5($hash . $wgRenderHashAppend);
    }
    // Storage destination path (excluding file extension)
    $fname = 'mwstore://' . $backend->getName() . "/timeline-render/{$hash}";
    // Wikia change - begin
    wfRunHooks('BeforeRenderTimeline', [&$backend, &$fname, $hash]);
    // Wikia change - end
    $previouslyFailed = $backend->fileExists(array('src' => "{$fname}.err"));
    $previouslyRendered = $backend->fileExists(array('src' => "{$fname}.png"));
    if ($previouslyRendered) {
        $timestamp = $backend->getFileTimestamp(array('src' => "{$fname}.png"));
        $expired = $timestamp < $wgTimelineSettings->epochTimestamp;
    } else {
        $expired = false;
    }
    // Create a new .map, .png (or .gif), and .err file as needed...
    if ($expired || !$previouslyRendered && !$previouslyFailed) {
        if (!is_dir($wgTmpDirectory)) {
            mkdir($wgTmpDirectory, 0777);
        }
        $tmpFile = TempFSFile::factory('timeline_');
        if ($tmpFile) {
            $tmpPath = $tmpFile->getPath();
            file_put_contents($tmpPath, $timelinesrc);
            // store plot data to file
            // Get command for ploticus to read the user input and output an error,
            // map, and rendering (png or gif) file under the same dir as the temp file.
            $cmdline = wfEscapeShellArg($wgTimelineSettings->perlCommand, $wgTimelineSettings->timelineFile) . " -i " . wfEscapeShellArg($tmpPath) . " -m -P " . wfEscapeShellArg($wgTimelineSettings->ploticusCommand) . " -T " . wfEscapeShellArg($wgTmpDirectory) . " -A " . wfEscapeShellArg($wgArticlePath) . " -f " . wfEscapeShellArg($wgTimelineSettings->fontFile);
            // Actually run the command...
            wfDebug("Timeline cmd: {$cmdline}\n");
            $retVal = null;
            $ret = wfShellExec($cmdline, $retVal);
            // Copy the output files into storage...
            // @TODO: store error files in another container or not at all?
            $opt = array('force' => 1, 'nonLocking' => 1, 'allowStale' => 1);
            // performance
            $backend->prepare(array('dir' => dirname($fname)));
            $backend->store(array('src' => "{$tmpPath}.map", 'dst' => "{$fname}.map"), $opt);
            $backend->store(array('src' => "{$tmpPath}.png", 'dst' => "{$fname}.png"), $opt);
            $backend->store(array('src' => "{$tmpPath}.err", 'dst' => "{$fname}.err"), $opt);
        } else {
            return "<div id=\"toc\" dir=\"ltr\"><tt>Timeline error. " . "Could not create temp file</tt></div>";
            // ugh
        }
        if ($ret == "" || $retVal > 0) {
            // Message not localized, only relevant during install
            return "<div id=\"toc\" dir=\"ltr\"><tt>Timeline error. " . "Command line was: " . htmlspecialchars($cmdline) . "</tt></div>";
        }
    }
    // Wikia change - begin
    if ($backend->fileExists(array('src' => "{$fname}.err", 'latest' => true))) {
        $err = $backend->getFileContents(array('src' => "{$fname}.err"));
    } else {
        $err = '';
    }
    // Wikia change - end
    if ($err != "") {
        // Convert the error from poorly-sanitized HTML to plain text
        $err = strtr($err, array('</p><p>' => "\n\n", '<p>' => '', '</p>' => '', '<b>' => '', '</b>' => '', '<br>' => "\n"));
        $err = Sanitizer::decodeCharReferences($err);
        // Now convert back to HTML again
        $encErr = nl2br(htmlspecialchars($err));
        $txt = "<div id=\"toc\" dir=\"ltr\"><tt>{$encErr}</tt></div>";
    } else {
        // Wikia change - begin
        if ($backend->fileExists(array('src' => "{$fname}.map", 'latest' => true))) {
            $map = $backend->getFileContents(array('src' => "{$fname}.map"));
        } else {
            $map = '';
        }
        // Wikia change - end
        $map = str_replace(' >', ' />', $map);
        $map = "<map name=\"timeline_" . htmlspecialchars($hash) . "\">{$map}</map>";
        $map = easyTimelineFixMap($map);
        $url = "{$wgUploadPath}/timeline/{$hash}.png";
        // Wikia change - begin
        $url = wfReplaceImageServer($url);
        // Wikia change - end
        $txt = $map . "<img usemap=\"#timeline_" . htmlspecialchars($hash) . "\" " . "src=\"" . htmlspecialchars($url) . "\">";
        if ($expired) {
            // Replacing an older file, we may need to purge the old one.
            global $wgUseSquid;
            if ($wgUseSquid) {
//.........这里部分代码省略.........
开发者ID:yusufchang,项目名称:app,代码行数:101,代码来源:Timeline.php


示例16: __construct

 /**
  * Get a thumbnail object from a file and parameters.
  * If $path is set to null, the output file is treated as a source copy.
  * If $path is set to false, no output file will be created.
  *
  * @param File $file File object
  * @param string $url URL path to the thumb
  * @param int $width File's width
  * @param int $height File's height
  * @param string|bool|null $path Filesystem path to the thumb
  * @param int|bool $page Page number, for multi-page files
  */
 function __construct($file, $url, $width, $height, $path = false, $page = false)
 {
     $this->file = $file;
     $this->url = $url;
     # start wikia change
     $timestamp = !empty($file) ? $file->getTimestamp() : false;
     $this->url = wfReplaceImageServer($this->url, $timestamp);
     # end wikia change
     # These should be integers when they get here.
     # If not, there's a bug somewhere.  But let's at
     # least produce valid HTML code regardless.
     $this->width = round($width);
     $this->height = round($height);
     $this->path = $path;
     $this->page = $page;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:28,代码来源:MediaTransformOutput.php


示例17: getImageFromPageId

 /**
  * Returns image from page.
  * @param $mPageId int page id
  * @return string - image url
  */
 protected function getImageFromPageId($mPageId)
 {
     if (!is_array($mPageId)) {
         $mPageId = array($mPageId);
     }
     $imageServing = new ImageServing($mPageId, $this->thumbWidth, array("w" => $this->thumbWidth, "h" => $this->thumbHeight));
     $imageUrl = '';
     foreach ($imageServing->getImages(1) as $value) {
         if (!empty($value[0]['name'])) {
             $tmpTitle = Title::newFromText($value[0]['name'], NS_FILE);
             $image = wfFindFile($tmpTitle);
             if (empty($image)) {
                 return '';
             }
             $imageUrl = wfReplaceImageServer($image->getThumbUrl($imageServing->getCut($image->getWidth(), $image->getHeight()) . "-" . $image->getName()));
         }
     }
     return $imageUrl;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:24,代码来源:CategoryExhibitionSection.class.php


示例18: parseInput

 /**
  * parser hook for <Cube file=f size=i input={mouse,keyboard}> tag
  * @return string tag body
  */
 static function parseInput($input)
 {
     $pics_urls = array(7);
     $i = 0;
     if (strpos($input, "\n") == 0) {
         $input = substr($input, strpos($input, "\n") + 1);
     }
     while (strpos($input, "\n") > -1) {
         //echo trim(substr($input,0,strpos($input,"\n")));
         $title = Title::newFromText(trim(substr($input, 0, strpos($input, "\n"))), NS_FILE);
         $imageFile = wfFindFile($title);
         $pics_urls[$i + 1] = wfReplaceImageServer($imageFile->getFullUrl());
         $input = substr($input, strpos($input, "\n") + 1);
         $i++;
     }
     //echo"i=$i";
     //print_r($pics_urls);
     $pics = "var pics_names=[";
     switch ($i) {
         case 0:
             for ($i = 1; $i < 7; $i++) {
                 if ($i > 1) {
                     $pics .= ",";
                 }
                 $pics .= "'" . $wgExtensionsPath . "/wikia/WebGL/images/{$i}.png'";
             }
             break;
         case 1:
             for ($i = 1; $i < 7; $i++) {
                 if ($i > 1) {
                     $pics .= ",";
                 }
                 $pics .= "'http://aurbanski.wikia-dev.com/wikia.php?controller=Cube&method=getData&format=html&url=" . $pics_urls[1] . "'";
             }
             break;
         case 2:
             for ($i = 1; $i < 7; $i++) {
                 if ($i > 1) {
                     $pics .= ",";
                 }
                 $pics .= "'http://aurbanski.wikia-dev.com/wikia.php?controller=Cube&method=getData&format=html&url=";
                 switch ($i) {
                     case 1:
                         $pics .= $pics_urls[1];
                         break;
                     case 2:
                         $pics .= $pics_urls[1];
                         break;
                     case 3:
                         $pics .= $pics_urls[2];
                         break;
                     case 4:
                         $pics .= $pics_urls[2];
                         break;
                     case 5:
                         $pics .= $pics_urls[2];
                         break;
                     case 6:
                         $pics .= $pics_urls[2];
                         break;
                 }
                 $pics .= "'";
             }
             break;
         case 3:
             for ($i = 1; $i < 7; $i++) {
                 if ($i > 1) {
                     $pics .= ",";
                 }
                 $pics .= "'http://aurbanski.wikia-dev.com/wikia.php?controller=Cube&method=getData&format=html&url=";
                 switch ($i) {
                     case 1:
                         $pics .= $pics_urls[1];
                         break;
                     case 2:
                         $pics .= $pics_urls[2];
                         break;
                     case 3:
                         $pics .= $pics_urls[3];
                         break;
                     case 4:
                         $pics .= $pics_urls[3];
                         break;
                     case 5:
                         $pics .= $pics_urls[3];
                         break;
                     case 6:
                         $pics .= $pics_urls[3];
                         break;
                 }
                 $pics .= "'";
             }
             break;
         case 4:
             for ($i = 1; $i < 7; $i++) {
                 if ($i > 1) {
//.........这里部分代码省略.........
开发者ID:yusufchang,项目名称:app,代码行数:101,代码来源:Cube.class.php


示例19: makeMediaLinkFile

 /**
  * Create a direct link to a given uploaded file.
  * This will make a broken link if $file is false.
  *
  * @param $title Title object.
  * @param $file File|false mixed File object or false
  * @param $html String: pre-sanitized HTML
  * @return String: HTML
  *
  * @todo Handle invalid or missing images better.
  */
 public static function makeMediaLinkFile(Title $title, $file, $html = '')
 {
     $nofollow = '';
     #wikia addition;
     if ($file && $file->exists()) {
         $url = wfReplaceImageServer($file->getURL(), $file->getTimestamp());
         $class = 'internal';
     } else {
         $url = self::getUploadUrl($title);
         $class = 'new';
         global $wgWikiaUseNoFollow;
         if (!empty($wgWikiaUseNoFollow)) {
             $nofollow = ' rel="nofollow"';
         }
     }
     $alt = htmlspecialchars($title->getText(), ENT_QUOTES);
     if ($html == '') {
         $html = $alt;
     }
     $u = htmlspecialchars($url);
     return "<a href=\"{$u}\" class=\"{$class}\" title=\"{$alt}\"{$nofollow}>{$html}</a>";
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:33,代码来源:Linker.php


示例20: getUrlIMG

 public static function getUrlIMG($imgName)
 {
     $imgFile = wfFindFile($imgName);
     //find file
     if ($imgFile) {
         $urlIMG = wfReplaceImageServer($imgFile->getUrl());
     } else {
         // if not set default img
         $imgFile = wfFindFile('iOtherIcon.png');
         $urlIMG = wfReplaceImageServer($imgFile->getUrl());
     }
     return $urlIMG;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:13,代码来源:GamingMapsHooks.class.php



注:本文中的wfReplaceImageServer函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wfReportTime函数代码示例发布时间:2022-05-23
下一篇:
PHP wfRemoveDotSegments函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap