PHP Класс GitHubCustomFieldType

Наследование: extends AdminPageFramework_FieldType
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$_bAddedScriptToFooter
$aFieldTypeSlugs The slug is used for the type key in a field definition array. $this->addSettingFields( array( 'section_id' => '...', 'type' => 'github', // <--- THIS PART 'field_id' => '...', 'title' => '...', ) );

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

Свойство Тип Описание
$aDefaultKeys The keys are used for the field definition array. $this->addSettingFields( array( 'section_id' => '...', 'type' => '...', 'field_id' => '...', 'my_custom_key' => '...', // <-- THIS PART ) );

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

Метод Описание
_replyToAddScript ( )

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

Метод Описание
construct ( ) User constructor.
getEnqueuingScripts ( ) Returns an array holding the urls of enqueuing scripts.
getEnqueuingStyles ( ) Returns an array holding the urls of enqueuing styles.
getField ( $aField ) Returns the output of the field type.
getIEStyles ( ) Returns IE specific CSS rules.
getScripts ( ) Returns the field type specific JavaScript script.
getStyles ( ) Returns the field type specific CSS rules.
setUp ( ) Loads the field type necessary components.

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

Метод Описание
_getButtonLabelByType ( $sButtonType, $sUserName, $sValue )
_getCountAPIByType ( $sButtonType, $sUserName, $sRepository )
_getCountHrefByType ( $sButtonType, $sUserName, $sRepository )
_getGitHubAPICountSlugByType ( $sType ) Returns the API count slug used for the given type.
_getGitHubAPISlugByType ( $sType ) Returns the API slug used for the given type.
_getHrefByType ( $sButtonType, $sUserName, $sRepository )
_getIcontByType ( $sButtonType )

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

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

public _replyToAddScript ( )

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

Loaded at the end of the constructor.
protected construct ( )

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

The returning array should be composed with all numeric keys. Each element can be either a string( the url or the path of the source file) or an array of custom argument.

Custom Argument Array

  • src - ( required, string ) The url or path of the target source file
  • handle_id - ( optional, string ) The handle ID of the script.
  • dependencies - ( optional, array ) The dependency array. For more information, see codex.
  • version - ( optional, string ) The stylesheet version number.
  • translation - ( optional, array ) The translation array. The handle ID will be used for the object name.
  • in_footer - ( optional, boolean ) Whether to enqueue the script before < / head > or before < / body > Default: false.
  • arguments - ( optional, array ) [3.3.0+] argument array. array( 'async' => '', 'data-id' => '...' )

Example

array( 'src' => dirname( __FILE__ ) . '/asset/github-buttons/buttons.js', 'handle_id' => 'github-bjs', 'in_footer' => true, 'attributes' => array( 'async' => '', 'defer' => '', ), )
protected getEnqueuingScripts ( )

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

Custom Argument Array

  • src - ( required, string ) The url or path of the target source file
  • handle_id - ( optional, string ) The handle ID of the stylesheet.
  • dependencies - ( optional, array ) The dependency array. For more information, see codex.
  • version - ( optional, string ) The stylesheet version number.
  • media - ( optional, string ) the description of the field which is inserted into the after the input field tag.
  • arguments - ( optional, array ) [3.3.0+] argument array. array( 'data-id' => '...' )

Example

array( array( 'src' => dirname( __FILE__ ) . '/assets/css/main.css', 'handle_id' => 'custom_button_css', ), );
protected getEnqueuingStyles ( )

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

Returns the output of the field type.
protected getField ( $aField )

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

Returns IE specific CSS rules.
protected getIEStyles ( )

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

Returns the field type specific JavaScript script.
protected getScripts ( )

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

Returns the field type specific CSS rules.
protected getStyles ( )

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

This method is triggered when a field definition array that calls this field type is parsed.
protected setUp ( )

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

$_bAddedScriptToFooter публичное статическое свойство

public static $_bAddedScriptToFooter

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

The keys are used for the field definition array. $this->addSettingFields( array( 'section_id' => '...', 'type' => '...', 'field_id' => '...', 'my_custom_key' => '...', // <-- THIS PART ) );
protected $aDefaultKeys

$aFieldTypeSlugs публичное свойство

The slug is used for the type key in a field definition array. $this->addSettingFields( array( 'section_id' => '...', 'type' => 'github', // <--- THIS PART 'field_id' => '...', 'title' => '...', ) );
public $aFieldTypeSlugs