PATH:
home
/
letacommog
/
metras
/
wp-content
/
plugins
/
wp-lastweets
/
vendor
/
htmlburger
/
carbon-fields
/
core
/
Field
<?php namespace Carbon_Fields\Field; /** * Abstract scripts field class. * Intended only for use in theme options container. */ abstract class Scripts_Field extends Textarea_Field { /** * Hook to putput scripts in * * @var string */ protected $hook_name = ''; /** * Hook priority to use * * @var integer */ protected $hook_priority = 10; /** * Initialization actions */ public function init() { $this->set_help_text( $this->get_default_help_text() ); add_action( 'wp', array( $this, 'attach_hook' ) ); parent::init(); } /** * Attach the assigned hook */ public function attach_hook() { if ( strlen( $this->get_hook_name() ) > 0 ) { add_action( $this->get_hook_name(), array( $this, 'print_scripts' ), $this->get_hook_priority() ); } } /** * Display the field value in the front-end header. */ public function print_scripts() { $is_valid_datastore = ( is_a( $this->get_datastore(), 'Carbon_Fields\\Datastore\\Theme_Options_Datastore' ) || is_a( $this->get_datastore(), 'Carbon_Fields\\Datastore\\Network_Datastore' ) ); if ( ! $this->get_datastore() || ! $is_valid_datastore ) { return; } $this->load(); echo $this->get_formatted_value(); } /** * Get the hook name * * @return string */ public function get_hook_name() { return $this->hook_name; } /** * Set the hook name * * @param string $hook_name * @return self $this */ public function set_hook_name( $hook_name ) { $this->hook_name = $hook_name; return $this; } /** * Get the hook priority * * @return integer */ public function get_hook_priority() { return $this->hook_priority; } /** * Set the hook priority * * @param integer $hook_priority * @return self $this */ public function set_hook_priority( $hook_priority ) { $this->hook_priority = $hook_priority; return $this; } /** * Set the hook name and priority * * @param string $hook_name * @param integer $hook_priority * @return self $this */ public function set_hook( $hook_name, $hook_priority = 10 ) { $this->set_hook_name( $hook_name ); $this->set_hook_priority( $hook_priority ); return $this; } /** * Get the default help text to be displayed for this field type. * * @return string */ abstract protected function get_default_help_text(); }
[+]
..
[-] Date_Field.php
[edit]
[-] Checkbox_Field.php
[edit]
[-] Broken_Field.php
[edit]
[-] Sidebar_Field.php
[edit]
[-] Textarea_Field.php
[edit]
[-] Radio_Image_Field.php
[edit]
[-] Text_Field.php
[edit]
[-] Multiselect_Field.php
[edit]
[-] Set_Field.php
[edit]
[-] Radio_Field.php
[edit]
[-] Group_Field.php
[edit]
[-] Header_Scripts_Field.php
[edit]
[-] Oembed_Field.php
[edit]
[-] Scripts_Field.php
[edit]
[-] Hidden_Field.php
[edit]
[-] Field.php
[edit]
[-] Date_Time_Field.php
[edit]
[-] Footer_Scripts_Field.php
[edit]
[-] Time_Field.php
[edit]
[-] Image_Field.php
[edit]
[-] Gravity_Form_Field.php
[edit]
[-] Color_Field.php
[edit]
[-] Complex_Field.php
[edit]
[-] Select_Field.php
[edit]
[-] Predefined_Options_Field.php
[edit]
[-] Rich_Text_Field.php
[edit]
[-] Separator_Field.php
[edit]
[-] File_Field.php
[edit]
[-] Association_Field.php
[edit]
[-] Media_Gallery_Field.php
[edit]
[-] Map_Field.php
[edit]
[-] Html_Field.php
[edit]