class-snippet-preview.php 4.16 KB
Newer Older
imac's avatar
imac committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
<?php
/**
 * @package WPSEO\Admin
 * @since      1.6.2
 *
 * @deprecated 3.0 Class inside file is removed.
 */

_deprecated_file( __FILE__, 'WPSEO 3.0', null, __( 'Use javascript instead.', 'wordpress-seo' ) );

/**
 * Class WPSEO_Snippet_Preview
 *
 * Generates a Google Search snippet preview.
 *
 * Takes a $post, $title and $description
 *
 * @deprecated 3.0 Removed, use javascript instead.
 */
class WPSEO_Snippet_Preview {
	/**
	 * @var string
	 *
	 * @deprecated 3.0 Removed, use javscript instead.
	 */
	protected $content;

	/**
	 * @var array The WPSEO options.
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	protected $options;

	/**
	 * @var object The post for which we want to generate the snippet preview.
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	protected $post;

	/**
	 * @var string The title that is shown in the snippet.
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	protected $title;

	/**
	 * @var string The description that is shown in the snippet.
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	protected $description;

	/**
	 * @var string The date that is shown at the beginning of the description in the snippet.
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	protected $date = '';

	/**
	 * @var string The url that is shown in the snippet.
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	protected $url = '';

	/**
	 * @var string The slug of the url that is shown in the snippet.
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	protected $slug = '';

	/**
	 * Generates the html for the snippet preview containing dynamically generated text components.
	 * Those components are included as properties which are set in the constructor.
	 *
	 * @param WP_Post $post        Post instance.
	 * @param string  $title       Title string.
	 * @param string  $description Description string.
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	public function __construct( $post, $title, $description ) {
		_deprecated_constructor( __CLASS__, 'WPSEO 3.0' );
	}

	/**
	 * Getter for $this->content
	 *
	 * @return string html for snippet preview
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	public function get_content() {
		_deprecated_function( __METHOD__, 'WPSEO 3.0', __( 'Use javascript instead.', 'wordpress-seo' ) );
		return $this->content;
	}

	/**
	 * Sets date if available
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	protected function set_date() {
		_deprecated_function( __METHOD__, 'WPSEO 3.0', __( 'Use javascript instead.', 'wordpress-seo' ) );
	}

	/**
	 * Retrieves a post date when post is published, or return current date when it's not.
	 *
	 * @return string
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	protected function get_post_date() {
		_deprecated_function( __METHOD__, 'WPSEO 3.0', __( 'Use javascript instead.', 'wordpress-seo' ) );
		return '';
	}

	/**
	 * Generates the url that is displayed in the snippet preview.
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	protected function set_url() {
		_deprecated_function( __METHOD__, 'WPSEO 3.0', __( 'Use javascript instead.', 'wordpress-seo' ) );
	}

	/**
	 * Sets the slug and adds it to the url if the post has been published and the post name exists.
	 *
	 * If the post is set to be the homepage the slug is also not included.
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	protected function set_slug() {
		_deprecated_function( __METHOD__, 'WPSEO 3.0', __( 'Use javascript instead.', 'wordpress-seo' ) );
	}

	/**
	 * Generates the html for the snippet preview and assign it to $this->content.
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	protected function set_content() {
		_deprecated_function( __METHOD__, 'WPSEO 3.0', __( 'Use javascript instead.', 'wordpress-seo' ) );
	}

	/**
	 * Sets the html for the snippet preview through a filter
	 *
	 * @param string $content Content string.
	 *
	 * @deprecated 3.0 Removed, use javascript instead.
	 */
	protected function set_content_through_filter( $content ) {
		_deprecated_function( __METHOD__, 'WPSEO 3.0', __( 'Use javascript instead.', 'wordpress-seo' ) );
	}
}