/** * Translate URL to Title object. Can transparently upload new video if it doesn't exist * @param string $url * @param string $sTitle - if $requestedTitle new Video will be created you can optionally request * it's title (otherwise Video name from provider is used) * @param string $sDescription * @return null|Title */ public static function URLtoTitle($url, $sTitle = '', $sDescription = '') { wfProfileIn(__METHOD__); $oTitle = null; $oUploader = new self(); $oUploader->setExternalUrl($url); $oUploader->setTargetTitle($sTitle); if (!empty($sDescription)) { $categoryVideosTxt = self::getCategoryVideosWikitext(); if (strpos($sDescription, $categoryVideosTxt) === false) { $sDescription .= $categoryVideosTxt; } $oUploader->setDescription($sDescription); } $status = $oUploader->upload($oTitle); if ($status->isOK()) { wfProfileOut(__METHOD__); return $oTitle; } wfProfileOut(__METHOD__); return null; }