PHP Класс Dynamic_Featured_Image, Dynamic-Featured-Image

Автор: Ankit Pokhrel ([email protected])
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$_metabox_title * Title for dfi metabox
$_textDomain * Plugin text domain
$_userFilter * Users post type filter for dfi metabox

Открытые методы

Метод Описание
__construct ( ) Constructor. Hooks all interactions to initialize the class.
add_metabox_classes ( $classes ) : string Add custom class 'featured-meta-box' to meta box
ajax_callback ( ) : Void Load new featured meta box via ajax
dfi_action_links ( array $links ) : array Add upgrade link
enqueue_admin_scripts ( ) : Void Add required admin scripts
featured_meta_box ( Object $post, Array $featured ) : Void Featured meta box as seen in the admin
get_all_featured_images ( integer $post_id = null ) : Array Retrieve featured images for specific post(s) including the default Featured Image
get_featured_images ( integer $post_id = null ) : Array Retrieve featured images for specific post(s)
get_image_alt ( String $image_url ) : String Get image alternate text
get_image_alt_by_id ( integer $attachment_id ) : String Get image alternate text by attachment id
get_image_caption ( String $image_url ) : String Get image caption
get_image_caption_by_id ( integer $attachment_id ) : String Get image caption by id
get_image_description ( String $image_url ) : String Get image description
get_image_description_by_id ( integer $attachment_id ) : String Get image description by id
get_image_id ( String $image_url ) : integer | Null Gets attachment id from given image url
get_image_thumb ( String $image_url, String $size = 'thumbnail' ) : String Get image thumbnail url of specific size by image url
get_image_title ( String $image_url ) : String Get image title
get_image_title_by_id ( integer $attachment_id ) : String Get image title by id
get_image_url ( integer $attachment_id, String $size = 'full' ) : String Get image url of the image by attachment id
get_link_to_image ( integer $attachment_id ) : string | null Get link to image
get_nth_featured_image ( integer $position, integer $post_id = null ) : Array Fetches featured image data of nth position
get_post_attachment_ids ( integer $post_id ) : Array Get all attachment ids of the post
initialize_featured_box ( ) : Void Add featured meta boxes dynamically
is_attached ( $attachment_id, $post_id ) : boolean Check if the image is attached with the particular post
load_plugin_textdomain ( ) : void Load the plugin's textdomain hooked to 'plugins_loaded'.
media_attachment_custom_fields ( $form_fields, $post ) : Array Add custom fields in media uploader
media_attachment_custom_fields_save ( $post, $attachment ) : Array Save values of media uploader custom fields
save_meta ( integer $post_id ) : Void Update featured images in the database
update_notice ( ) : Void Add update notice. Displayed in plugin update page.

Защищенные методы

Метод Описание
_get_attachment_id ( String $image_url ) : string Get attachment id of the image by image url
_get_number_translation ( integer $number ) : String Translates more than one digit number digit by digit.
_get_real_upload_path ( string $img ) : string Check to see if the upload url is already available in path.
_nonce_field ( string $key ) : string Create a nonce field
_verify_nonces ( ) : boolean Verify metabox nonces

Приватные методы

Метод Описание
__get_protocol ( ) : string Return site protocol
_dfi_add_meta_box ( Array $postTypes, Object $featured = null, integer $i = null ) : Void adds meta boxes
_get_featured_box ( String $featuredImgTrimmed, String $featuredImg, String $featuredId, String $thumbnail, $postId ) : String Returns featured box html content
_separate ( string $urlString, string $state = 'thumb' ) : string | null Separate thumb and full image url from given URL string
execute_query ( $query ) Helper functions

Описание методов

__construct() публичный Метод

Constructor. Hooks all interactions to initialize the class.
См. также: add_action()
С версии: 1.0.0
public __construct ( )

_get_attachment_id() защищенный Метод

Get attachment id of the image by image url
С версии: 3.1.7
protected _get_attachment_id ( String $image_url ) : string
$image_url String url of the image
Результат string

_get_number_translation() защищенный Метод

Translates more than one digit number digit by digit.
protected _get_number_translation ( integer $number ) : String
$number integer Integer to be translated
Результат String Translated number

_get_real_upload_path() защищенный Метод

Check to see if the upload url is already available in path.
С версии: 3.1.14
protected _get_real_upload_path ( string $img ) : string
$img string
Результат string

_nonce_field() защищенный Метод

Create a nonce field
См. также: wp_nonce_field()
См. также: plugin_basename()
С версии: 3.5.0
protected _nonce_field ( string $key ) : string
$key string Nonce key
Результат string

_verify_nonces() защищенный Метод

Verify metabox nonces
См. также: wp_verify_nonce()
protected _verify_nonces ( ) : boolean
Результат boolean

add_metabox_classes() публичный Метод

Add custom class 'featured-meta-box' to meta box
См. также: add_metabox_classes
С версии: 1.0.0
public add_metabox_classes ( $classes ) : string
$classes classes to add in the meta box
Результат string

ajax_callback() публичный Метод

Load new featured meta box via ajax
С версии: 1.0.0
public ajax_callback ( ) : Void
Результат Void

enqueue_admin_scripts() публичный Метод

Add required admin scripts
См. также: wp_enque_style()
См. также: wp_register_script()
См. также: wp_enqueue_script()
С версии: 1.0.0
public enqueue_admin_scripts ( ) : Void
Результат Void

get_image_alt() публичный Метод

Get image alternate text
См. также: get_post_meta()
С версии: 2.0.0
public get_image_alt ( String $image_url ) : String
$image_url String url of an image
Результат String

get_image_alt_by_id() публичный Метод

Get image alternate text by attachment id
См. также: get_post_meta()
С версии: 2.0.0
public get_image_alt_by_id ( integer $attachment_id ) : String
$attachment_id integer attachment id of an image
Результат String

get_image_caption() публичный Метод

Get image caption
С версии: 2.0.0
public get_image_caption ( String $image_url ) : String
$image_url String url of an image
Результат String

get_image_caption_by_id() публичный Метод

Get image caption by id
С версии: 2.0.0
public get_image_caption_by_id ( integer $attachment_id ) : String
$attachment_id integer attachment id of an image
Результат String

get_image_description() публичный Метод

Get image description
С версии: 3.0.0
public get_image_description ( String $image_url ) : String
$image_url String url of an image
Результат String

get_image_description_by_id() публичный Метод

Get image description by id
С версии: 3.0.0
public get_image_description_by_id ( integer $attachment_id ) : String
$attachment_id integer attachment id of an image
Результат String

get_image_id() публичный Метод

Gets attachment id from given image url
С версии: 2.0.0
public get_image_id ( String $image_url ) : integer | Null
$image_url String url of an image
Результат integer | Null attachment id of an image

get_image_thumb() публичный Метод

Get image thumbnail url of specific size by image url
См. также: get_image_id()
См. также: wp_get_attachment_image_src()
С версии: 2.0.0
public get_image_thumb ( String $image_url, String $size = 'thumbnail' ) : String
$image_url String url of an image
$size String size of the image to fetch (thumbnail, medium, full)
Результат String

get_image_title() публичный Метод

Get image title
С версии: 2.0.0
public get_image_title ( String $image_url ) : String
$image_url String url of an image
Результат String

get_image_title_by_id() публичный Метод

Get image title by id
С версии: 2.0.0
public get_image_title_by_id ( integer $attachment_id ) : String
$attachment_id integer attachment id of an image
Результат String

get_image_url() публичный Метод

Get image url of the image by attachment id
См. также: wp_get_attachment_image_src()
С версии: 2.0.0
public get_image_url ( integer $attachment_id, String $size = 'full' ) : String
$attachment_id integer attachment id of an image
$size String size of the image to fetch (thumbnail, medium, full)
Результат String

get_post_attachment_ids() публичный Метод

Get all attachment ids of the post
См. также: get_post_meta()
С версии: 2.0.0
public get_post_attachment_ids ( integer $post_id ) : Array
$post_id integer id of the current post
Результат Array

is_attached() публичный Метод

Check if the image is attached with the particular post
См. также: get_post_attachment_ids()
С версии: 2.0.0
public is_attached ( $attachment_id, $post_id ) : boolean
$attachment_id attachment id of an image
$post_id id of the current post
Результат boolean

load_plugin_textdomain() публичный Метод

Load the plugin's textdomain hooked to 'plugins_loaded'.
См. также: load_plugin_textdomain()
См. также: plugin_basename()
С версии: 1.0.0
public load_plugin_textdomain ( ) : void
Результат void

media_attachment_custom_fields() публичный Метод

Add custom fields in media uploader
С версии: 3.4.0
public media_attachment_custom_fields ( $form_fields, $post ) : Array
$form_fields Array Fields to include in media attachment form
$post Array Post data
Результат Array

media_attachment_custom_fields_save() публичный Метод

Save values of media uploader custom fields
С версии: 3.4.0
public media_attachment_custom_fields_save ( $post, $attachment ) : Array
$post Array The post data for database
$attachment Array Attachment fields from $_POST form
Результат Array

save_meta() публичный Метод

Update featured images in the database
См. также: plugin_basename()
См. также: update_post_meta()
См. также: current_user_can()
С версии: 1.0.0
public save_meta ( integer $post_id ) : Void
$post_id integer current post id
Результат Void

update_notice() публичный Метод

Add update notice. Displayed in plugin update page.
С версии: 2.0.0
public update_notice ( ) : Void
Результат Void

Описание свойств

$_metabox_title защищенное свойство

* Title for dfi metabox
protected $_metabox_title

$_textDomain защищенное свойство

* Plugin text domain
protected $_textDomain

$_userFilter защищенное свойство

* Users post type filter for dfi metabox
protected $_userFilter