本文整理汇总了PHP中deprecated函数的典型用法代码示例。如果您正苦于以下问题:PHP deprecated函数的具体用法?PHP deprecated怎么用?PHP deprecated使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deprecated函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($Sender)
{
deprecated('DiscussionSorterModule', 'DiscussionSortFilterModule', 'March 2016');
parent::__construct($Sender, 'Vanilla');
$this->Visible = false;
// Default options
$this->SortOptions = array('d.DateLastComment' => t('SortOptionLastComment', 'by Last Comment'), 'd.DateInserted' => t('SortOptionStartDate', 'by Start Date'));
// Get sort option selected
$this->SortFieldSelected = Gdn::session()->GetPreference('Discussions.SortField', 'd.DateLastComment');
}
示例2: setLogger
/**
* Set the logger.
*
* @param LoggerInterface $logger Specify a new value to set the logger to.
*/
public static function setLogger($logger = null)
{
if ($logger instanceof \Vanilla\Logger) {
self::$instance = $logger;
} else {
deprecated('Logger::setLogger()', 'Logger::addLogger');
// Check for class compatibility while we update plugins.
// TODO: Remove this check.
if ($logger instanceof LoggerInterface) {
static::addLogger($logger);
}
}
}
示例3: setOwner
/**
* Set the owner of the object. If multiple owners are passed then the first owner is the
* primary owner and the rest just share the object with the owner
*
* @param ComActorsDomainEntityActor $owner The owner object
*
* @return ComBaseDomainEntityNode Return the ownable object
*/
public function setOwner($owner)
{
//multiple owners are passed
$owner = KConfig::unbox($owner);
if (is_array($owner)) {
deprecated('array as owner');
}
if (is_array($owner) && $this->isSharable()) {
$owners = AnHelperArray::unique($owner);
//remove the first owner as the primary owner
$owner = array_shift($owners);
//create an edge with the story for each secondary owner
//$this->addOwner($owners);
}
$this->_mixer->set('owner', $owner);
return $this;
}
示例4: Render
/**
* @DEPRECATED: This class will be removed soon.
* Render the iCalendar object as a text string which is a single VEVENT (or other)
*
* @param boolean $as_calendar Whether or not to wrap the event in a VCALENDAR
* @param string $type The type of iCalendar object (VEVENT, VTODO, VFREEBUSY etc.)
* @param array $restrict_properties The names of the properties we want in our rendered result.
*/
function Render($as_calendar = true, $type = null, $restrict_properties = null)
{
deprecated('iCalendar::Render');
if ($as_calendar) {
return $this->component->Render();
} else {
$components = $this->component->GetComponents($type);
$rendered = "";
foreach ($components as $k => $v) {
$rendered .= $v->Render($restrict_properties);
}
return $rendered;
}
}
示例5: findThemeFiles
/**
* Deprecated.
*
* @return array Deprecated.
*/
public function findThemeFiles()
{
deprecated('Gdn_ThemeManager->findThemeFiles');
return [];
}
示例6: leave
/**
* Does actual de-authentication of a user. Used by SignOut().
*
* @access public
* @since 2.0.0
*
* @param string $AuthenticationSchemeAlias
* @param string $TransientKey Unique value to prove intent.
*/
public function leave($AuthenticationSchemeAlias = 'default', $TransientKey = '')
{
deprecated(__FUNCTION__);
$this->EventArguments['AuthenticationSchemeAlias'] = $AuthenticationSchemeAlias;
$this->fireEvent('BeforeLeave');
// Allow hijacking deauth type
$AuthenticationSchemeAlias = $this->EventArguments['AuthenticationSchemeAlias'];
try {
$Authenticator = Gdn::authenticator()->authenticateWith($AuthenticationSchemeAlias);
} catch (Exception $e) {
$Authenticator = Gdn::authenticator()->authenticateWith('default');
}
// Only sign the user out if this is an authenticated postback! Start off pessimistic
$this->Leaving = false;
$Result = Gdn_Authenticator::REACT_RENDER;
// Build these before doing anything desctructive as they are supposed to have user context
$LogoutResponse = $Authenticator->logoutResponse();
$LoginResponse = $Authenticator->loginResponse();
$AuthenticatedPostbackRequired = $Authenticator->requireLogoutTransientKey();
if (!$AuthenticatedPostbackRequired || Gdn::session()->validateTransientKey($TransientKey)) {
$Result = $Authenticator->deauthenticate();
$this->Leaving = true;
}
if ($Result == Gdn_Authenticator::AUTH_SUCCESS) {
$this->View = 'leave';
$Reaction = $LogoutResponse;
} else {
$this->View = 'auth/' . $Authenticator->getAuthenticationSchemeAlias();
$Reaction = $LoginResponse;
}
switch ($Reaction) {
case Gdn_Authenticator::REACT_RENDER:
break;
case Gdn_Authenticator::REACT_EXIT:
exit;
break;
case Gdn_Authenticator::REACT_REMOTE:
// Render the view, but set the delivery type to VIEW
$this->_DeliveryType = DELIVERY_TYPE_VIEW;
break;
case Gdn_Authenticator::REACT_REDIRECT:
default:
// If we're just told to redirect, but not where... try to figure out somewhere that makes sense.
if ($Reaction == Gdn_Authenticator::REACT_REDIRECT) {
$Route = '/';
$Target = $this->target();
if (!is_null($Target)) {
$Route = $Target;
}
} else {
$Route = $Reaction;
}
if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
$this->RedirectUrl = url($Route);
} else {
if ($Route !== false) {
redirect($Route);
} else {
redirect(Gdn::router()->getDestination('DefaultController'));
}
}
break;
}
$this->render();
}
示例7: viewLocation
/**
* Get the path of a view.
*
* @param string $View The name of the view.
* @param string $Controller The name of the controller invoking the view or blank.
* @param string $Folder The application folder or plugins/plugin folder.
* @return string|false The path to the view or false if it wasn't found.
* @deprecated
*/
function viewLocation($View, $Controller, $Folder)
{
deprecated('viewLocation()');
$Paths = array();
if (strpos($View, '/') !== false) {
// This is a path to the view from the root.
$Paths[] = $View;
} else {
$View = strtolower($View);
$Controller = strtolower(StringEndsWith($Controller, 'Controller', true, true));
if ($Controller) {
$Controller = '/' . $Controller;
}
$Extensions = array('tpl', 'php');
// 1. First we check the theme.
if (Gdn::Controller() && ($Theme = Gdn::Controller()->Theme)) {
foreach ($Extensions as $Ext) {
$Paths[] = PATH_THEMES . "/{$Theme}/views{$Controller}/{$View}.{$Ext}";
}
}
// 2. Then we check the application/plugin.
if (StringBeginsWith($Folder, 'plugins/')) {
// This is a plugin view.
foreach ($Extensions as $Ext) {
$Paths[] = PATH_ROOT . "/{$Folder}/views{$Controller}/{$View}.{$Ext}";
}
} else {
// This is an application view.
$Folder = strtolower($Folder);
foreach ($Extensions as $Ext) {
$Paths[] = PATH_APPLICATIONS . "/{$Folder}/views{$Controller}/{$View}.{$Ext}";
}
if ($Folder != 'dashboard' && StringEndsWith($View, '.master')) {
// This is a master view that can always fall back to the dashboard.
foreach ($Extensions as $Ext) {
$Paths[] = PATH_APPLICATIONS . "/dashboard/views{$Controller}/{$View}.{$Ext}";
}
}
}
}
// Now let's search the paths for the view.
foreach ($Paths as $Path) {
if (file_exists($Path)) {
return $Path;
}
}
Trace(array('view' => $View, 'controller' => $Controller, 'folder' => $Folder), 'View');
Trace($Paths, 'ViewLocation()');
return false;
}
示例8: getAddonUpdates
/**
* Deprecated.
*
* @param bool $Enabled Deprecated.
* @return array|bool Deprecated.
* @deprecated
*/
public function getAddonUpdates($Enabled = false)
{
deprecated('UpdateModel->getAddonUpdates()');
}
示例9: applySchema
/**
* Allows the explicit definition of a schema to use.
*
* @param array $Schema
* @deprecated This method has been deprecated in favor of {@link Gdn_Validation::SetSchema()}.
*/
public function applySchema($Schema)
{
deprecated('ApplySchema', 'SetSchema');
$this->setSchema($Schema);
}
示例10: findControllerMethod
/**
* Find the method to call on a controller, based on a path.
*
* @param Gdn_Controller $controller The controller or name of the controller class to look at.
* @param string[] $pathArgs An array of path arguments.
* @return array Returns an array in the form `[$methodName, $pathArgs]`.
* If the method is not found then an empty string is returned for the method name.
*/
private function findControllerMethod($controller, $pathArgs)
{
if ($this->methodExists($controller, reset($pathArgs))) {
return [array_shift($pathArgs), $pathArgs];
} elseif ($this->methodExists($controller, 'x' . reset($pathArgs))) {
$method = array_shift($pathArgs);
deprecated(get_class($controller) . "->x{$method}", get_class($controller) . "->{$method}");
return ['x' . $method, $pathArgs];
} elseif ($this->methodExists($controller, 'index')) {
// "index" is the default controller method if an explicit method cannot be found.
$this->EventArguments['PathArgs'] = $pathArgs;
$this->fireEvent('MethodNotFound');
return ['index', $pathArgs];
} else {
return ['', $pathArgs];
}
}
示例11: getContentTypeDescription
/**
* Get the description of a given content type
*
* @param $pContentType Content type GUID you want the description for
* @return Content type description
* @access public
**/
function getContentTypeDescription($pContentType)
{
deprecated('You are calling the deprecated method getContentTypeDescription, use getContentTypeName( $pPlural )');
return $this->getContentTypeName($pContentType);
}
示例12: db_byte_decode
/**
* @deprecated deprecated since version 2.0.0
*/
function db_byte_decode(&$pData)
{
deprecated($this->depText('db_byte_decode', 'dbByteDecode'));
return $this->dbByteDecode($pData);
}
示例13: hasAdminBlock
/**
* hasAdminBlock
*
* @access public
* @return TRUE on success, FALSE on failure
* @deprecated i think this isn't used any more
*/
function hasAdminBlock()
{
deprecated("i think this isn't used anymore.");
global $gBitUser;
// Let's find out if we are have admin perm or a root user
$ret = TRUE;
if (empty($gBitUser) || $gBitUser->isAdmin()) {
$ret = FALSE;
} else {
// let's try to load up user_id - if successful, we know we have one.
$rootUser = new BitPermUser(1);
$rootUser->load();
if (!$rootUser->isValid()) {
$ret = FALSE;
}
}
return $ret;
}
示例14: delete
/**
* Delete records from a table.
*
* @param array|int $where The where clause to delete or an integer value.
* @param array|true $options An array of options to control the delete.
*
* - limit: A limit to the number of records to delete.
* - reset: Deprecated. Whether or not to reset this SQL statement after the delete. Defaults to false.
* @return Gdn_Dataset Returns the result of the delete.
*/
public function delete($where = [], $options = [])
{
if (is_numeric($where)) {
deprecated('Gdn_Model->delete(int)', 'Gdn_Model->deleteID()');
$where = array($this->PrimaryKey => $where);
}
$ResetData = false;
if ($options === true || val('reset', $options)) {
deprecated('Gdn_Model->delete() with reset true');
$ResetData = true;
} elseif (is_numeric($options)) {
deprecated('The $limit parameter is deprecated in Gdn_Model->delete(). Use the limit option.');
$limit = $options;
} else {
$limit = val('limit', $options);
}
if ($ResetData) {
$Result = $this->SQL->delete($this->Name, $where, $limit);
} else {
$Result = $this->SQL->noReset()->delete($this->Name, $where, $limit);
}
return $Result;
}
示例15: save
/**
* Save conversation from form submission.
*
* @param array $formPostValues Values submitted via form.
* @param array $settings Not used.
* @return int Unique ID of conversation created or updated.
*/
public function save($formPostValues, $settings = [])
{
if ($settings instanceof ConversationMessageModel) {
deprecated('ConversationModel->save(array, ConversationMessageModel)');
$MessageModel = $settings;
} else {
$MessageModel = ConversationMessageModel::instance();
}
// Define the primary key in this model's table.
$this->defineSchema();
$MessageModel->defineSchema();
$this->EventArguments['FormPostValues'] = $formPostValues;
$this->fireEvent('BeforeSaveValidation');
if (!val('RecipientUserID', $formPostValues) && isset($formPostValues['To'])) {
$To = explode(',', $formPostValues['To']);
$To = array_map('trim', $To);
$RecipientUserIDs = $this->SQL->select('UserID')->from('User')->whereIn('Name', $To)->get()->resultArray();
$RecipientUserIDs = array_column($RecipientUserIDs, 'UserID');
$formPostValues['RecipientUserID'] = $RecipientUserIDs;
}
if (c('Garden.ForceInputFormatter')) {
$formPostValues['Format'] = c('Garden.InputFormatter');
}
// Add & apply any extra validation rules:
$this->Validation->applyRule('Body', 'Required');
$MessageModel->Validation->applyRule('Body', 'Required');
// Make sure that there is at least one recipient
$this->Validation->addRule('OneOrMoreArrayItemRequired', 'function:ValidateOneOrMoreArrayItemRequired');
$this->Validation->applyRule('RecipientUserID', 'OneOrMoreArrayItemRequired');
// Add insert/update fields
$this->addInsertFields($formPostValues);
$this->addUpdateFields($formPostValues);
// Validate the form posted values
$ConversationID = false;
if ($this->validate($formPostValues) && $MessageModel->validate($formPostValues) && !$this->checkForSpam('Conversation')) {
$Fields = $this->Validation->validationFields();
// All fields on the form that relate to the schema
// Define the recipients, and make sure that the sender is in the list
$RecipientUserIDs = val('RecipientUserID', $Fields, 0);
if (!in_array($formPostValues['InsertUserID'], $RecipientUserIDs)) {
$RecipientUserIDs[] = $formPostValues['InsertUserID'];
}
// Also make sure there are no duplicates in the recipient list
$RecipientUserIDs = array_unique($RecipientUserIDs);
sort($RecipientUserIDs);
$Fields = $this->Validation->schemaValidationFields();
// All fields on the form that relate to the schema
$ConversationID = $this->SQL->insert($this->Name, $Fields);
$formPostValues['ConversationID'] = $ConversationID;
// Notify the message model that it's being called as a direct result
// of a new conversation being created. As of now, this is being used
// so that spam checks between new conversations and conversation
// messages each have a separate counter. Without this, a new
// conversation will cause itself AND the message model spam counter
// to increment by 1.
$MessageID = $MessageModel->save($formPostValues, null, array('NewConversation' => true));
$this->SQL->update('Conversation')->set('FirstMessageID', $MessageID)->where('ConversationID', $ConversationID)->put();
// Now that the message & conversation have been inserted, insert all of the recipients
foreach ($RecipientUserIDs as $UserID) {
$CountReadMessages = $UserID == $formPostValues['InsertUserID'] ? 1 : 0;
$this->SQL->options('Ignore', true)->insert('UserConversation', array('UserID' => $UserID, 'ConversationID' => $ConversationID, 'LastMessageID' => $MessageID, 'CountReadMessages' => $CountReadMessages, 'DateConversationUpdated' => $formPostValues['DateUpdated']));
}
// And update the CountUnreadConversations count on each user related to the discussion.
$this->updateUserUnreadCount(array_diff($RecipientUserIDs, array($formPostValues['InsertUserID'])));
$this->updateParticipantCount($ConversationID);
$body = val('Body', $formPostValues, '');
$subject = val('Subject', $Fields, '');
$this->EventArguments['Recipients'] = $RecipientUserIDs;
$Conversation = $this->getID($ConversationID);
$this->EventArguments['Conversation'] = $Conversation;
$Message = $MessageModel->getID($MessageID, DATASET_TYPE_ARRAY);
$this->EventArguments['Message'] = $Message;
$this->EventArguments['Body'] =& $body;
$this->EventArguments['Subject'] =& $subject;
$this->fireEvent('AfterAdd');
// Add notifications (this isn't done by the conversationmessagemodule
// because the conversation has not yet been created at the time they are
// inserted)
$UnreadData = $this->SQL->select('uc.UserID')->from('UserConversation uc')->where('uc.ConversationID', $ConversationID)->where('uc.UserID <>', $formPostValues['InsertUserID'])->get();
$Activity = array('ActivityType' => 'ConversationMessage', 'ActivityUserID' => $formPostValues['InsertUserID'], 'HeadlineFormat' => t('HeadlineFormat.ConversationMessage', '{ActivityUserID,User} sent you a <a href="{Url,html}">message</a>'), 'RecordType' => 'Conversation', 'RecordID' => $ConversationID, 'Story' => $body, 'ActionText' => t('Reply'), 'Format' => val('Format', $formPostValues, c('Garden.InputFormatter')), 'Route' => "/messages/{$ConversationID}#Message_{$MessageID}");
if ($subject) {
$Activity['Story'] = sprintf(t('Re: %s'), $subject) . '<br>' . $body;
}
$ActivityModel = new ActivityModel();
foreach ($UnreadData->result() as $User) {
$Activity['NotifyUserID'] = $User->UserID;
$ActivityModel->queue($Activity, 'ConversationMessage');
}
$ActivityModel->saveQueue();
} else {
// Make sure that all of the validation results from both validations are present for view by the form
foreach ($MessageModel->validationResults() as $FieldName => $Results) {
foreach ($Results as $Result) {
//.........这里部分代码省略.........