本文整理汇总了PHP中Deprecation类的典型用法代码示例。如果您正苦于以下问题:PHP Deprecation类的具体用法?PHP Deprecation怎么用?PHP Deprecation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Deprecation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
static function init()
{
Deprecation::notice('3.1', 'The Profiler class is deprecated, use third party tools like XHProf instead');
if (!self::$inst) {
self::$inst = new Profiler(true, true);
}
}
示例2: BackLinkTracking
/**
* Extend through {@link updateBackLinkTracking()} in your own {@link Extension}.
*
* @param string|array $filter
* @param string $sort
* @param string $join
* @param string $limit
* @return ManyManyList
*/
public function BackLinkTracking($filter = null, $sort = null, $join = null, $limit = null)
{
if ($filter !== null || $sort !== null || $join !== null || $limit !== null) {
Deprecation::notice('4.0', 'The $filter, $sort, $join and $limit parameters for
SiteTreeFileExtension::BackLinkTracking() have been deprecated.
Please manipluate the returned list directly.', Deprecation::SCOPE_GLOBAL);
}
if (class_exists("Subsite")) {
$rememberSubsiteFilter = Subsite::$disable_subsite_filter;
Subsite::disable_subsite_filter(true);
}
if ($filter || $sort || $join || $limit) {
Deprecation::notice('4.0', 'The $filter, $sort, $join and $limit parameters for
SiteTreeFileExtension::BackLinkTracking() have been deprecated.
Please manipluate the returned list directly.', Deprecation::SCOPE_GLOBAL);
}
$links = $this->owner->getManyManyComponents('BackLinkTracking');
if ($this->owner->ID) {
$links = $links->where($filter)->sort($sort)->limit($limit);
}
$this->owner->extend('updateBackLinkTracking', $links);
if (class_exists("Subsite")) {
Subsite::disable_subsite_filter($rememberSubsiteFilter);
}
return $links;
}
示例3: createTable
public function createTable($table, $fields = null, $indexes = null, $options = null, $advancedOptions = null)
{
$fieldSchemas = $indexSchemas = "";
if (!empty($options[self::ID])) {
$addOptions = $options[self::ID];
} elseif (!empty($options[get_class($this)])) {
Deprecation::notice('3.2', 'Use MySQLSchemaManager::ID for referencing mysql-specific table creation options');
$addOptions = $options[get_class($this)];
} elseif (!empty($options[get_parent_class($this)])) {
Deprecation::notice('3.2', 'Use MySQLSchemaManager::ID for referencing mysql-specific table creation options');
$addOptions = $options[get_parent_class($this)];
} else {
$addOptions = "ENGINE=InnoDB";
}
if (!isset($fields['ID'])) {
$fields['ID'] = "int(11) not null auto_increment";
}
if ($fields) {
foreach ($fields as $k => $v) {
$fieldSchemas .= "\"{$k}\" {$v},\n";
}
}
if ($indexes) {
foreach ($indexes as $k => $v) {
$indexSchemas .= $this->getIndexSqlDefinition($k, $v) . ",\n";
}
}
// Switch to "CREATE TEMPORARY TABLE" for temporary tables
$temporary = empty($options['temporary']) ? "" : "TEMPORARY";
$this->query("CREATE {$temporary} TABLE \"{$table}\" (\n\t\t\t\t{$fieldSchemas}\n\t\t\t\t{$indexSchemas}\n\t\t\t\tprimary key (ID)\n\t\t\t) {$addOptions}");
return $table;
}
示例4: __construct
/**
* @deprecated 3.0
*/
public function __construct($items = array()) {
Deprecation::notice('3.0', 'Use DataList or ArrayList instead');
if ($items) {
if (!is_array($items) || func_num_args() > 1) {
$items = func_get_args();
}
foreach ($items as $i => $item) {
if ($item instanceof ViewableData) {
continue;
}
if (is_object($item) || ArrayLib::is_associative($item)) {
$items[$i] = new ArrayData($item);
} else {
user_error(
"DataObjectSet::__construct: Passed item #{$i} is not an"
. ' and object or associative array, can\'t be properly'
. ' iterated on in templates', E_USER_WARNING
);
}
}
}
parent::__construct($items);
}
示例5: __construct
public function __construct($controller, $name)
{
$member = Member::currentUser();
$requiredFields = null;
if ($member && $member->exists()) {
$fields = $member->getMemberFormFields();
$fields->removeByName('Password');
$requiredFields = $member->getValidator();
$requiredFields->addRequiredField('Surname');
} else {
$fields = FieldList::create();
}
if (get_class($controller) == 'AccountPage_Controller') {
$actions = FieldList::create(FormAction::create('submit', _t('MemberForm.SAVE', 'Save Changes')));
} else {
$actions = FieldList::create(FormAction::create('submit', _t('MemberForm.SAVE', 'Save Changes')), FormAction::create('proceed', _t('MemberForm.SAVEANDPROCEED', 'Save and proceed to checkout')));
}
parent::__construct($controller, $name, $fields, $actions, $requiredFields);
$this->extend('updateShopAccountForm');
if ($record = $controller->data()) {
$record->extend('updateShopAccountForm', $fields, $actions, $requiredFields);
}
if ($controller->data() && $controller->data()->hasMethod('updateShopAccountForm')) {
// if accessing through the model
Deprecation::notice('2.0', 'Please access updateShopAccountForm through ShopAccountForm instead of AccountPage (this extension point is due to be removed)');
}
if ($member) {
$member->Password = "";
//prevents password field from being populated with encrypted password data
$this->loadDataFrom($member);
}
}
示例6: add_to_class
static function add_to_class($class, $extensionClass, $args = null) {
if(method_exists($class, 'extraDBFields')) {
$extraStaticsMethod = 'extraDBFields';
} else {
$extraStaticsMethod = 'extraStatics';
}
$statics = singleton($extensionClass)->$extraStaticsMethod($class, $extensionClass);
if ($statics) {
Deprecation::notice('3.1.0', "$extraStaticsMethod deprecated. Just define statics on your extension, or use add_to_class");
// TODO: This currently makes extraStatics the MOST IMPORTANT config layer, not the least
foreach (self::$extendable_statics as $key => $merge) {
if (isset($statics[$key])) {
if (!$merge) Config::inst()->remove($class, $key);
Config::inst()->update($class, $key, $statics[$key]);
}
}
// TODO - remove this
DataObject::$cache_has_own_table[$class] = null;
DataObject::$cache_has_own_table_field[$class] = null;
}
parent::add_to_class($class, $extensionClass, $args);
}
示例7: __construct
/**
* @see TextareaField::__construct()
*/
public function __construct($name, $title = null, $value = '') {
if(count(func_get_args()) > 3) Deprecation::notice('3.0', 'Use setRows() and setCols() instead of constructor arguments');
parent::__construct($name, $title, $value);
self::include_js();
}
示例8: get
public function get($class, $name, $default)
{
if (!isset($this->statics[$class])) {
if (isset($this->index[$class])) {
$info = $this->index[$class];
if (isset($info['key']) && ($details = $this->cache->load($this->key . '_' . $info['key']))) {
$this->statics += $details;
}
if (!isset($this->statics[$class])) {
$this->handleFile(null, $info['path'], null);
}
} else {
$this->statics[$class] = false;
}
}
if (isset($this->statics[$class][$name])) {
$static = $this->statics[$class][$name];
if ($static['access'] != T_PRIVATE) {
Deprecation::notice('3.2.0', "Config static {$class}::\${$name} must be marked as private", Deprecation::SCOPE_GLOBAL);
// Don't warn more than once per static
$this->statics[$class][$name]['access'] = T_PRIVATE;
}
return $static['value'];
}
return $default;
}
示例9: __construct
function __construct($controller, $name, $sourceClass, $fieldList = null, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "") {
Deprecation::notice('3.0', 'Use GridField with GridFieldConfig_RelationEditor');
parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
$classes = array_reverse(ClassInfo::ancestry($this->controllerClass()));
foreach($classes as $class) {
$singleton = singleton($class);
$manyManyRelations = $singleton->uninherited('many_many', true);
if(isset($manyManyRelations) && array_key_exists($this->name, $manyManyRelations)) {
$this->manyManyParentClass = $class;
$manyManyTable = $class . '_' . $this->name;
break;
}
$belongsManyManyRelations = $singleton->uninherited( 'belongs_many_many', true );
if( isset( $belongsManyManyRelations ) && array_key_exists( $this->name, $belongsManyManyRelations ) ) {
$this->manyManyParentClass = $class;
$manyManyTable = $belongsManyManyRelations[$this->name] . '_' . $this->name;
break;
}
}
$tableClasses = ClassInfo::dataClassesFor($this->sourceClass);
$source = array_shift($tableClasses);
$sourceField = $this->sourceClass;
if($this->manyManyParentClass == $sourceField)
$sourceField = 'Child';
$parentID = $this->controller->ID;
$this->sourceJoin .= " LEFT JOIN \"$manyManyTable\" ON (\"$source\".\"ID\" = \"$manyManyTable\".\"{$sourceField}ID\" AND \"{$this->manyManyParentClass}ID\" = '$parentID')";
$this->joinField = 'Checked';
}
示例10: upload
/**
* Process upload through UploadField,
* creates new record and link newly uploaded file
* adds record to GrifField relation list
* and return image/file data and record edit form
*
* @param SS_HTTPRequest $request
* @return string json
*/
public function upload(SS_HTTPRequest $request)
{
//create record
$recordClass = $this->gridField->list->dataClass;
$record = Object::create($recordClass);
$record->write();
// passes the current gridfield-instance to a call-back method on the new object
$record->extend("onBulkUpload", $this->gridField);
if ($record->hasMethod('onBulkImageUpload')) {
Deprecation::notice('2.0', '"onBulkImageUpload" callback is deprecated, use "onBulkUpload" instead.');
$record->extend("onBulkImageUpload", $this->gridField);
}
//get uploadField and process upload
$uploadField = $this->getUploadField();
$uploadField->setRecord($record);
$fileRelationName = $uploadField->getName();
$uploadResponse = $uploadField->upload($request);
//get uploaded File response datas
$uploadResponse = Convert::json2array($uploadResponse->getBody());
$uploadResponse = array_shift($uploadResponse);
// Attach the file to record.
$record->{"{$fileRelationName}ID"} = $uploadResponse['id'];
$record->write();
// attached record to gridField relation
$this->gridField->list->add($record->ID);
// JS Template Data
$responseData = $this->newRecordJSTemplateData($record, $uploadResponse);
$response = new SS_HTTPResponse(Convert::raw2json(array($responseData)));
$this->contentTypeNegotiation($response);
return $response;
}
开发者ID:helpfulrobot,项目名称:colymba-gridfield-bulk-editing-tools,代码行数:40,代码来源:GridFieldBulkUpload_Request.php
示例11: __construct
/**
* Returns an input field, class="text" and type="text" with an optional
* maxlength
*/
public function __construct($name, $title = null, $value = "")
{
if (count(func_get_args()) > 3) {
Deprecation::notice('3.0', 'Use setMaxLength() instead of constructor arguments', Deprecation::SCOPE_GLOBAL);
}
parent::__construct($name, $title, $value);
}
示例12: __construct
/**
* Constructor
*
* @deprecated 3.1 Use DataList to aggregate data
*
* @param string $type The DataObject type we are building an aggregate for
* @param string $filter (optional) An SQL filter to apply to the selected rows before calculating the aggregate
*/
public function __construct($type, $filter = '')
{
Deprecation::notice('3.1', 'Call aggregate methods on a DataList directly instead. In templates' . ' an example of the new syntax is <% cached List(Member).max(LastEdited) %> instead' . ' (check partial-caching.md documentation for more details.)');
$this->type = $type;
$this->filter = $filter;
parent::__construct();
}
示例13: set_default_quality
/**
* set_default_quality
*
* @deprecated 4.0 Use the "ImagickBackend.default_quality" config setting instead
* @param int $quality
* @return void
*/
public static function set_default_quality($quality)
{
Deprecation::notice('4.0', 'Use the "ImagickBackend.default_quality" config setting instead');
if (is_numeric($quality) && (int) $quality >= 0 && (int) $quality <= 100) {
Config::inst()->update('ImagickBackend', 'default_quality', (int) $quality);
}
}
示例14: __construct
/**
* Create a new action button.
* @param action The method to call when the button is clicked
* @param title The label on the button
* @param image The default image to display
* @param hoverImage The image to display on hover
* @param form The parent form, auto-set when the field is placed inside a form
*/
function __construct($action, $title = "", $image = "", $hoverImage = null, $className = null, $form = null) {
Deprecation::notice('3.0', "Use FormAction with setAttribute('src', 'myimage.png') and custom JavaScript to achieve hover effect");
$this->image = $image;
$this->hoverImage = $hoverImage;
$this->className = $className;
parent::__construct($action, $title, $form);
}
示例15: getArticlesPerPage
public static function getArticlesPerPage()
{
/* provide warnings of old static configurations */
if (self::$articles_per_page) {
Deprecation::notice('3.2.0', 'Use the "NewsPage.articles_per_page" yaml config instead');
}
return Config::inst()->get('NewsPage', 'articles_per_page');
}