本文整理汇总了PHP中wfDeprecated函数的典型用法代码示例。如果您正苦于以下问题:PHP wfDeprecated函数的具体用法?PHP wfDeprecated怎么用?PHP wfDeprecated使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfDeprecated函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Creates an ImportXMLReader drawing from the source provided
* @param ImportSource $source
* @param Config $config
*/
function __construct(ImportSource $source, Config $config = null)
{
$this->reader = new XMLReader();
if (!$config) {
wfDeprecated(__METHOD__ . ' without a Config instance', '1.25');
$config = ConfigFactory::getDefaultInstance()->makeConfig('main');
}
$this->config = $config;
if (!in_array('uploadsource', stream_get_wrappers())) {
stream_wrapper_register('uploadsource', 'UploadSourceAdapter');
}
$id = UploadSourceAdapter::registerSource($source);
if (defined('LIBXML_PARSEHUGE')) {
$this->reader->open("uploadsource://{$id}", null, LIBXML_PARSEHUGE);
} else {
$this->reader->open("uploadsource://{$id}");
}
// Default callbacks
$this->setPageCallback(array($this, 'beforeImportPage'));
$this->setRevisionCallback(array($this, "importRevision"));
$this->setUploadCallback(array($this, 'importUpload'));
$this->setLogItemCallback(array($this, 'importLogItem'));
$this->setPageOutCallback(array($this, 'finishImportPage'));
$this->importTitleFactory = new NaiveImportTitleFactory();
}
示例2: __construct
/**
* @param &$reader LogReader: where to get our data from
* @param $flags Integer: Bitwise combination of flags:
* LogEventsList::NO_ACTION_LINK Don't show restore/unblock/block links
*
* @deprecated since 1.14
*/
function __construct(&$reader, $flags = 0)
{
wfDeprecated(__METHOD__);
$this->reader =& $reader;
$this->reader->pager->mLogEventsList->flags = $flags;
# Aliases for shorter code...
$this->pager =& $this->reader->pager;
$this->list =& $this->reader->pager->mLogEventsList;
}
示例3: __construct
/**
* @param string|null $prefix
* @since 1.26 The prefix argument should be omitted, as the strip marker
* prefix string is now a constant.
*/
public function __construct($prefix = null)
{
if ($prefix !== null) {
wfDeprecated(__METHOD__ . ' with called with $prefix argument' . ' (call with no arguments instead)', '1.26');
}
$this->data = ['nowiki' => [], 'general' => []];
$this->regex = '/' . Parser::MARKER_PREFIX . "([^<>&'\"]+)" . Parser::MARKER_SUFFIX . '/';
$this->circularRefGuard = [];
}
示例4: getLBFactoryClass
/**
* Returns the LBFactory class to use and the load balancer configuration.
*
* @param array $config (e.g. $wgLBFactoryConf)
* @return string Class name
*/
public static function getLBFactoryClass(array $config)
{
// For configuration backward compatibility after removing
// underscores from class names in MediaWiki 1.23.
$bcClasses = array('LBFactory_Simple' => 'LBFactorySimple', 'LBFactory_Single' => 'LBFactorySingle', 'LBFactory_Multi' => 'LBFactoryMulti', 'LBFactory_Fake' => 'LBFactoryFake');
$class = $config['class'];
if (isset($bcClasses[$class])) {
$class = $bcClasses[$class];
wfDeprecated('$wgLBFactoryConf must be updated. See RELEASE-NOTES for details', '1.23');
}
return $class;
}
示例5: imageUrl
/**
* Return the URL of an image, provided its name.
*
* Backwards-compatibility for extensions.
* Note that fromSharedDirectory will only use the shared path for files
* that actually exist there now, and will return local paths otherwise.
*
* @param string $name Name of the image, without the leading "Image:"
* @param boolean $fromSharedDirectory Should this be in $wgSharedUploadPath?
* @return string URL of $name image
* @deprecated
*/
static function imageUrl($name, $fromSharedDirectory = false)
{
wfDeprecated(__METHOD__);
$image = null;
if ($fromSharedDirectory) {
$image = wfFindFile($name);
}
if (!$image) {
$image = wfLocalFile($name);
}
return $image->getUrl();
}
示例6: showHeader
/**
* Set page title and show header for this log type
* @param $type Array
* @deprecated in 1.19
*/
public function showHeader( $type ) {
wfDeprecated( __METHOD__, '1.19' );
// If only one log type is used, then show a special message...
$headerType = count( $type ) == 1 ? $type[0] : '';
$out = $this->getOutput();
if ( LogPage::isLogType( $headerType ) ) {
$page = new LogPage( $headerType );
$out->setPageTitle( $page->getName()->text() );
$out->addHTML( $page->getDescription()->parseAsBlock() );
} else {
$out->addHTML( $this->msg( 'alllogstext' )->parse() );
}
}
示例7: __construct
/**
* @param string $address String with an email address, or a User object
* @param string $name Human-readable name if a string address is given
* @param string $realName Human-readable real name if a string address is given
*/
function __construct($address, $name = null, $realName = null)
{
if (is_object($address) && $address instanceof User) {
// Old calling format, now deprecated
wfDeprecated(__METHOD__ . ' with a User object', '1.24');
$this->address = $address->getEmail();
$this->name = $address->getName();
$this->realName = $address->getRealName();
} else {
$this->address = strval($address);
$this->name = strval($name);
$this->realName = strval($realName);
}
}
示例8: makeLike
/**
* Make a string to go after an SQL LIKE, which will match the specified
* string. There are several kinds of filter entry:
* *.domain.com - Produces http://com.domain.%, matches domain.com
* and www.domain.com
* domain.com - Produces http://com.domain./%, matches domain.com
* or domain.com/ but not www.domain.com
* *.domain.com/x - Produces http://com.domain.%/x%, matches
* www.domain.com/xy
* domain.com/x - Produces http://com.domain./x%, matches
* domain.com/xy but not www.domain.com/xy
*
* Asterisks in any other location are considered invalid.
*
* @param $filterEntry String: domainparts
* @param $prot String: protocol
* @return String
* @deprecated Use makeLikeArray() and pass result to Database::buildLike() instead
*/
public static function makeLike($filterEntry, $prot = 'http://')
{
wfDeprecated(__METHOD__);
$like = self::makeLikeArray($filterEntry, $prot);
if (!$like) {
return false;
}
$dbw = wfGetDB(DB_MASTER);
$s = $dbw->buildLike($like);
$m = false;
if (preg_match("/^ *LIKE '(.*)' *\$/", $s, $m)) {
return $m[1];
} else {
throw new MWException(__METHOD__ . ': this DBMS is not supported by this function.');
}
}
示例9: _newObject
function _newObject()
{
/* Put the caller offset for wfDeprecated as 6, as
* that gives the function that uses this object, since:
* 1 = this function ( _newObject )
* 2 = StubObject::_unstub
* 3 = StubObject::_call
* 4 = StubObject::__call
* 5 = DeprecatedGlobal::<method of global called>
* 6 = Actual function using the global.
* Of course its theoretically possible to have other call
* sequences for this method, but that seems to be
* rather unlikely.
*/
wfDeprecated('$' . $this->mGlobal, $this->mVersion, false, 6);
return $this->mRealValue;
}
示例10: wfGetAgent
/**
* Returns the browser/OS data from the request header
* Note: headers are spoofable
*
* @deprecated in 1.18; use $wgRequest->getHeader( 'User-Agent' ) instead.
* @return string
*/
function wfGetAgent()
{
wfDeprecated(__FUNCTION__);
if (function_exists('apache_request_headers')) {
// More reliable than $_SERVER due to case and -/_ folding
$set = array();
foreach (apache_request_headers() as $tempName => $tempValue) {
$set[strtoupper($tempName)] = $tempValue;
}
$index = strtoupper('User-Agent');
} else {
// Subject to spoofing with headers like X_Forwarded_For
$set = $_SERVER;
$index = 'HTTP_USER_AGENT';
}
if (isset($set[$index])) {
return $set[$index];
} else {
return '';
}
}
示例11: __construct
function __construct($p = null)
{
global $wgSharedDB, $wgSQLiteDataDir;
if (!is_array($p)) {
// legacy calling pattern
wfDeprecated(__METHOD__ . " method called without parameter array.", "1.22");
$args = func_get_args();
$p = array('host' => isset($args[0]) ? $args[0] : false, 'user' => isset($args[1]) ? $args[1] : false, 'password' => isset($args[2]) ? $args[2] : false, 'dbname' => isset($args[3]) ? $args[3] : false, 'flags' => isset($args[4]) ? $args[4] : 0, 'tablePrefix' => isset($args[5]) ? $args[5] : 'get from global', 'schema' => 'get from global', 'foreign' => isset($args[6]) ? $args[6] : false);
}
$this->mDBname = $p['dbname'];
parent::__construct($p);
// parent doesn't open when $user is false, but we can work with $dbName
if ($p['dbname'] && !$this->isOpen()) {
if ($this->open($p['host'], $p['user'], $p['password'], $p['dbname'])) {
if ($wgSharedDB) {
$this->attachDatabase($wgSharedDB);
}
}
}
$this->lockMgr = new FSLockManager(array('lockDirectory' => "{$wgSQLiteDataDir}/locks"));
}
示例12: __construct
/**
* Creates an ImportXMLReader drawing from the source provided
* @param ImportSource $source
* @param Config $config
* @throws Exception
*/
function __construct(ImportSource $source, Config $config = null)
{
if (!class_exists('XMLReader')) {
throw new Exception('Import requires PHP to have been compiled with libxml support');
}
$this->reader = new XMLReader();
if (!$config) {
wfDeprecated(__METHOD__ . ' without a Config instance', '1.25');
$config = ConfigFactory::getDefaultInstance()->makeConfig('main');
}
$this->config = $config;
if (!in_array('uploadsource', stream_get_wrappers())) {
stream_wrapper_register('uploadsource', 'UploadSourceAdapter');
}
$id = UploadSourceAdapter::registerSource($source);
// Enable the entity loader, as it is needed for loading external URLs via
// XMLReader::open (T86036)
$oldDisable = libxml_disable_entity_loader(false);
if (defined('LIBXML_PARSEHUGE')) {
$status = $this->reader->open("uploadsource://{$id}", null, LIBXML_PARSEHUGE);
} else {
$status = $this->reader->open("uploadsource://{$id}");
}
if (!$status) {
$error = libxml_get_last_error();
libxml_disable_entity_loader($oldDisable);
throw new MWException('Encountered an internal error while initializing WikiImporter object: ' . $error->message);
}
libxml_disable_entity_loader($oldDisable);
// Default callbacks
$this->setPageCallback(array($this, 'beforeImportPage'));
$this->setRevisionCallback(array($this, "importRevision"));
$this->setUploadCallback(array($this, 'importUpload'));
$this->setLogItemCallback(array($this, 'importLogItem'));
$this->setPageOutCallback(array($this, 'finishImportPage'));
$this->importTitleFactory = new NaiveImportTitleFactory();
}
示例13: moveNoAuth
/**
* Move this page without authentication
*
* @deprecated since 1.25 use MovePage class instead
* @param Title $nt The new page Title
* @return array|bool True on success, getUserPermissionsErrors()-like array on failure
*/
public function moveNoAuth(&$nt)
{
wfDeprecated(__METHOD__, '1.25');
return $this->moveTo($nt, false);
}
示例14: newFromUser
/**
* Fetch an appropriate changes list class for the main context
* This first argument used to be an User object.
*
* @deprecated in 1.18; use newFromContext() instead
* @param $unused Unused
* @return ChangesList|EnhancedChangesList|OldChangesList derivative
*/
public static function newFromUser($unused)
{
wfDeprecated(__METHOD__, '1.18');
return self::newFromContext(RequestContext::getMain());
}
示例15: replaceMultiple
/**
* $magicarr is an associative array of (magic word ID => replacement)
* This method uses the php feature to do several replacements at the same time,
* thereby gaining some efficiency. The result is placed in the out variable
* $result. The return value is true if something was replaced.
* @deprecated since 1.25, unused
*
* @param array $magicarr
* @param string $subject
* @param string $result
*
* @return bool
*/
function replaceMultiple($magicarr, $subject, &$result)
{
wfDeprecated(__METHOD__, '1.25');
$search = array();
$replace = array();
foreach ($magicarr as $id => $replacement) {
$mw = MagicWord::get($id);
$search[] = $mw->getRegex();
$replace[] = $replacement;
}
$result = preg_replace($search, $replace, $subject);
return $result !== $subject;
}