PHP 클래스 Dynamic_Featured_Image, Dynamic-Featured-Image

저자: Ankit Pokhrel ([email protected])
파일 보기 프로젝트 열기: ankitpokhrel/dynamic-featured-image

보호된 프로퍼티들

프로퍼티 타입 설명
$_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