Deprecate

Код используемого шаблона:

<div id="{$block_id}">
	<div class="sect-cont sect-items clearfix">
	{foreach $list as $key => $el}	
	<div class="th-item">
		<a class="th-in with-mask"  href="{$el.url}">
		<div>
			{*Пробегаем по массиву с сериями*}
				{* Определяем переменную, в которой будет картинка *}
				{set $image}
					{if $el.xfields}
						{* Если в допполе есть ссылка на картинку - подставим её *}
						<img src="{$el.xfields}">
					{else}
						{* Если ссылки нет, подставим заглушку *}
						<img src="{$theme}/blockpro/noimage.png">				
					{/if}
				{/set}
				{* А теперь работаем с полученной картинкой *}
				<img src="{$image|image:$noimage:'small':'1':'265x165':'75':'':true:false}" alt="{$el.title}">
		</div>
			{if $el.xfields}
			<div class="th-desc">
				{$el.xfields}
			</div>
			{else}
			{/if}
		<center><div class="ntvn">{$el.title}</div></center>
		</a>
	</div>
				{foreachelse}
					{*Если серий нет - выведем информацию об этом*}
					<div>Серий нет</div>
	{/foreach}
		<div style="clear:both;"></div>
		<center>{$pages}</center>
	</div>
</div> <!-- #{$block_id} -->

Статистика генерации:

Содержимое блока в красной рамке в конце блока с новостями


Запрос(ы):
 SELECT p.id, p.autor, p.date, p.short_story, p.full_story, p.xfields, p.title, p.category, p.alt_name, p.allow_comm, p.comm_num, p.fixed, p.allow_main, p.symbol, p.tags, e.news_read, e.allow_rate, e.rating, e.vote_num, e.votes, e.related_ids, e.view_edit, e.editdate, e.editor, e.reason, SUBSTRING_INDEX(SUBSTRING_INDEX(p.xfields, 'seria|', -1 ) , '||', 1 ) as sort_xfield FROM `dle_post` p LEFT JOIN `dle_post_extras` e ON (p.id=e.news_id) WHERE approve AND category regexp "](2)]" AND id NOT IN (99) AND (p.xfields LIKE '%field_for_related_news|%Ветреный%') AND p.date < "2019-11-16 16:00:48" ORDER BY fixed ASC, CAST(sort_xfield AS DECIMAL(12,2)) ASC LIMIT , 12
 ,11996603012085
 SELECT COUNT(*) as count FROM `dle_post` as p LEFT JOIN `dle_post_extras` e ON (p.id=e.news_id) WHERE approve AND category regexp "](2)]" AND id NOT IN (99) AND (p.xfields LIKE '%field_for_related_news|%Ветреный%') AND p.date < "2019-11-16 16:00:48"
 ,033895969390869
Время выполнения запросов: ,15386199951172
Время выполнения скрипта: ,17566 c.
Расход памяти: 3,55Мб 

Deprecated Features

PHP Core

Nested ternary operators without explicit parentheses

Nested ternary operations must explicitly use parentheses to dictate the order of the operations. Previously, when used without parentheses, the left-associativity would not result in the expected behaviour in most cases.

(real) cast and is_real() function

The (real) cast is deprecated, use (float) instead.

The is_real() function is also deprecated, use is_float() instead.

parent keyword without parent class

Using parent inside a class without a parent is deprecated, and will throw a compile-time error in the future. Currently an error will only be generated if/when the parent is accessed at run-time.

Invalid characters in base conversion functions

Passing invalid characters to base_convert(), bindec(), octdec() and hexdec() will now generate a deprecation notice. The result will still be computed as if the invalid characters did not exist. Leading and trailing whitespace, as well as prefixes of type 0x (depending on base) continue to be allowed.

hebrevc() function

The hebrevc() function is deprecated. It can be replaced with nl2br(hebrev($str)) or, preferably, the use of Unicode RTL support.

convert_cyr_string() function

The convert_cyr_string() function is deprecated. It can be replaced by one of mb_convert_string(), iconv() or UConverter.

Implode with historical parameter order

Passing parameters to implode() in reverse order is deprecated, use implode($glue, $parts) instead of implode($parts, $glue).

Multibyte String

Passing a non-string pattern to mb_ereg_replace() is deprecated. Currently, non-string patterns are interpreted as ASCII codepoints. In PHP 8, the pattern will be interpreted as a string instead.

Passing the encoding as 3rd parameter to mb_strrpos() is deprecated. Instead pass a 0 offset, and encoding as 4th parameter.

Lightweight Directory Access Protocol

ldap_control_paged_result_response() and ldap_control_paged_result() are deprecated. Pagination controls can be sent along with ldap_search() instead.

Reflection

Calls to ReflectionType::__toString() now generate a deprecation notice. This method has been deprecated in favor of ReflectionNamedType::getName() in the documentation since PHP 7.1, but did not throw a deprecation notice for technical reasons.

The export() methods on all Reflection classes are deprecated. Construct a Reflection object and convert it to string instead:

The and flags for socket_addrinfo_lookup() are deprecated, due to an upstream deprecation in glibc.

How to Deprecate

Starting with J2SE 5.0, you deprecate a class, method, or field by using the annotation. Additionally, you can use the Javadoc tag tell developers what to use instead.

Using the annotation causes the Java compiler to generate warnings when the deprecated class, method, or field is used. The compiler suppresses deprecation warnings if a deprecated item is used within an entity which itself is deprecated or is used within the same outermost class or is used in an entity that is annotated to suppress the warning.

You are strongly recommended to use the Javadoc tag with appropriate comments explaining how to use the new API. This ensures developers will have a workable migration path from the old API to the new API. For more information, see .

NOTE: The Java Language Specification requires compilers to issue warnings when classes, methods, or fields marked with the annotation are used. Compilers are not required by the Java Language Specification to issue warnings when classes, methods, or fields marked with the Javadoc tag are accessed, although the Sun compilers currently do so. However, there is no guarantee that the Sun compiler will always issue such warnings.

Using the @Deprecated Annotation

J2SE 5.0 introduces a new language feature called annotations (also called metadata). One of the Java language’s built-in annotations is the annotation. To use it, you simply precede the class, method, or member declaration with «@Deprecated.»

Using the annotation to deprecate a class, method, or field ensures that all compilers will issue warnings when code uses that program element. In contrast, there is no guarantee that all compilers will always issue warnings based on the Javadoc tag, though the Sun compilers currently do so. Other compilers may not issue such warnings. Thus, using the annotation to generate warnings is more portable that relying on the Javadoc tag.

In addition, the @Deprecated annotation causes the javadoc-generated documentation to be marked «Deprecated» wherever that program element appears.

NOTE: Deprecation applies to classes and to individual methods or properties, not to their names. It is possible for a single method to have deprecated and non-deprecated overloadings. It is possible for a non-deprecated property to hide or override a deprecated one, which removes deprecation. As developer of an API, it is your responsibility to deprecate overrides of a deprecated method, if in fact they should be deprecated.

Example

The following is a simple example of using the @Deprecated annotation from :

public
class Thread implements Runnable {
...
@Deprecated
    public final void stop() {
  synchronized (this) {
...

Using the @deprecated Javadoc Tag

You can use the tag to make Javadoc show a program element as deprecated. The tag must be followed by a space or newline. In the paragraph following the tag, explain why the item has been deprecated and suggest what to use instead.

Javadoc generates special HTML based on tags: it moves the paragraph following the tag to the front of the description, placing it in italics and preceding it with a warning, «Note: foo is deprecated», in bold. It also adds «Deprecated» in bold to any index entries mentioning the deprecated entity.

The tagged paragraph can be empty, but empty deprecation paragraphs are bad form, because they do not help the user fix the warnings that arise from the deprecation. Include paragraphs marked with or tags that refer to the new versions of the same functionality. It is usually not a good idea to mention a timetable for phase-out of the deprecated API; this is a business decision that is best communicated other ways.

For more information on using the Javadoc tag, see .

Example

The following examples show how to use the Javadoc tag. They also illustrate the annotation, to emphasize that the two should be used together.

Here is an example of the most common form of a deprecated method (for Javadoc 1.2 and later):

/**
 * @deprecated  As of release 1.3, replaced by {@link #getPreferredSize()}
 */
@Deprecated public Dimension preferredSize() {
return getPreferredSize();
}

If the API reorganization was more than renaming, the deprecation may be more complex. Here is an example of a method that is being retracted:

/**
 * Delete multiple items from the list.
 *
 * @deprecated  Not for public use.
 *    This method is expected to be retained only as a package
 *    private method.  Replaced by
 *    {@link #remove(int)} and {@link #removeAll()}
 */
@Deprecated public synchronized void delItems(int start, int end) {
...
}

Copyright 1993, 2020, Oracle and/or its affiliates. All rights reserved.

Contact Us

When to Deprecate

When you design an API, carefully consider whether it supersedes an old API. If it does, and you wish to encourage developers (users of the API) to migrate to the new API, then deprecate the old API. Valid reasons to deprecate an API include:

  • It is insecure, buggy, or highly inefficient
  • It is going away in a future release
  • It encourages bad coding practices

Deprecation is a reasonable choice in all these cases because it preserves «backward compatibility» while encouraging developers to change to the new API. Also, the deprecation comments help developers decide when to move to the new API, and so should briefly mention the technical reasons for deprecation.

It is not necessary to deprecate individual member fields (properties) of a deprecated class, unless of course you want to explain a specific point about a property.

English[edit]

Etymologyedit

From Latin , past participle of (“to pray against (a present or impending evil), pray for, intercede for (that which is in danger), rarely imprecate”), from (“off”) + (“to pray”).

Verbedit

deprecate (third-person singular simple present , present participle , simple past and past participle )

  1. () To belittle or express disapproval

    2012, James Lambert, “Beyond Hobson-Jobson: A new lexicography for Indian English”, in World Englishes‎, page 295:Prior to the 1980s, Australian English had been widely deprecated by Australians themselves, principally as a result of a sense of inferiority known as «cultural cringe».

    of.
    He deprecates any praise of his own merits.
    They deprecated the attempt to deny aid to homeless people.
    She deprecated any action which might disturb the peace.
  2. (, chiefly ) To declare something obsolescent

    2003, Dave Evans et al., Perl, CGI, and JavaScript Complete, Sybex, →ISBN A deprecated function works in the currently released version of Perl 5 but may not be supported in future releases of Perl 5.

    ; to recommend against a function, technique, command, etc. that still works but has been replaced.
    The ‘bold’ tag has been deprecated in favour of the ‘strong’ tag.
    It is still supported but strongly deprecated.
  3. (, ) To pray against.
    • 1701, Nehemiah Grew, Cosmologia Sacra, London: W. Rogers, S. Smith, and B. Walford, page 126:
      And in deprecating of Evil, we make an humble Acknowledgement of Guilt; and of God’s Juſtice in chaſtizing, as well as Clemency, in ſparing the Guilty.
    • 1712, George Smalridge, “A Sermon, Preach’d at the Royal Chapel at St. James’s on Wedneſday, January the 16th, 1711/12”, London: Jonah Bowyer, page 18:
      …, though the Temporal Judgments which We Deprecate, are not remov’d.
  4. (, ) To regret deeply.

Translationsedit



express disapproval of

  • Bulgarian: (ne odobrjávam)
  • Czech: neschvalovat,
  • Dutch:  (nl)
  • Finnish:  (fi),  (fi),  (fi),  (fi)
  • French:  (fr) de
  • German:  (de),  (de), nicht gutheißen
  • Hungarian: helytelenít (hu), elítél (hu), rosszall (hu)
  • Ido:  (io)
  • Italian:  (it)
  • Japanese:  (ja) (hinan suru)
  • Portuguese:  (pt)
  • Russian:  (ru) impf (vozražátʹ),  (ru) pf (vozrazítʹ),  (ru) impf (protestovátʹ),  impf (vystupátʹ prótiv),  impf (rézko osuždátʹ),  impf (ne odobrjátʹ)
  • Swedish: avråda (sv), avstyrka (sv), avsvära

to discontinue

  • Finnish: ,
  • German: als überholt einstufen, als veraltet einstufen
  • Hungarian:
  • Japanese:  (ja) (shūryō suru)
  • Norwegian: utdatere
  • Portuguese:
  • Russian:  (ru) impf (priostanávlivatʹ),  (ru) pf (priostanovítʹ),  (ru) impf (prekraščátʹ),  (ru) pf (prekratítʹ)
  • Spanish:  (es)
  • Swedish: avråda (sv)

to pray against

What «Deprecated» Means

You may have heard the term, «self-deprecating humor,» or humor that minimizes the speaker’s importance. A deprecated class or method is like that. It is no longer important. It is so unimportant, in fact, that you should no longer use it, since it has been superseded and may cease to exist in the future.

Java provides a way to express deprecation because, as a class evolves, its API (application programming interface) inevitably changes: methods are renamed for consistency, new and better methods are added, and fields change. But such changes introduce a problem. You need to keep the old API around until developers make the transition to the new one, but you don’t want them to continue programming to the old API.

The ability to deprecate a class, method, or member field solves the problem. Java supports two mechanisms for deprecation: and an annotation, (supported starting with J2SE 5.0) and a Javadoc tag (supported since 1.1). Existing calls to the old API continue to work, but the annotation causes the compiler to issue a warning when it finds references to deprecated program elements. The Javadoc tag and associated comments warn users against using the deprecated item and tell them what to use instead.


С этим читают