PHP 클래스 RCCWP_CustomField, Magic-Fields

파일 보기 프로젝트 열기: hunk/Magic-Fields 1 사용 예제들

공개 메소드들

메소드 설명
Create ( id $customGroupId, string $name, string $label, integer $order = 1, integer $required_field, integer $type, array $options = null, array $default_value = null, array $properties = null, $duplicate, $helptext = null, $css = null ) : the Create a new custom field
Delete ( integer $customFieldId = null ) Delete a field
Get ( integer $customFieldId ) : an Get the field information including properties, options and default value(s)
GetCustomFieldTypes ( integer $customFieldTypeId = null ) : a Retrieves information about a specified type
GetCustomFieldValues ( boolean $single, integer $postId, string $customFieldName, integer $groupIndex = 1, integer $fieldIndex = 1 ) : mixed Retrieves the value of a custom field for a specified post
GetDataField ( string $customFieldName, integer $groupIndex = 1, integer $fieldIndex = 1, integer $postId ) Get Data Field
GetFieldDuplicates ( integer $postId, $fieldName, $groupIndex ) : number Get number of group duplicates given field name. The function returns 1 if there are no duplicates (just he original group), 2 if there is one duplicate and so on.
GetFieldGroupDuplicates ( integer $postId, $fieldName ) : number Get number of group duplicates given field name. The function returns 1 if there are no duplicates (just the original group), 2 if there is one duplicate and so on.
GetFieldsOrder ( $postId, $fieldName, $groupId ) : array Get field duplicates
GetInfoByName ( string $customFieldName, $post_id ) : array Retrieves the id and type of a custom field given field name for the current post.
GetMetaID ( integer $postId, $customFieldName, integer $groupIndex = 1, integer $fieldIndex = 1 ) : integer Get the Meta ID from a custom field with this id is possible get the value of the custom field from the Post Meta table of wordpress
GetOrderDuplicates ( integer $postId, $fieldName ) : order Get the order of group duplicates given the field name. The function returns a array with the orden
Update ( integer $customFieldId, string $name, string $label, integer $order = 1, integer $required_field, integer $type, array $options = null, array $default_value = null, array $properties = null, $duplicate, $helptext = null ) Updates the properties of a custom field.

메소드 상세

Create() 공개 정적인 메소드

Create a new custom field
public static Create ( id $customGroupId, string $name, string $label, integer $order = 1, integer $required_field, integer $type, array $options = null, array $default_value = null, array $properties = null, $duplicate, $helptext = null, $css = null ) : the
$customGroupId id the id of the group that will contain the field
$name string the name of the field, the name is used to uniquely identify the field when retrieving its value.
$label string the label of the field, the label is displayed beside the field in Write tab.
$order integer the order of the field when it is displayed in the Write tab.
$required_field integer whether this field is a required field. Required fields doesn't allow users to save a post if they are null.
$type integer the type of the field. Use $FIELD_TYPES defined in MF_Constant.php
$options array array of strings that represent the list of the field if its type is list.
$default_value array array of strings that represent default value(s) of of the field if its type is list.
$properties array an array containing extra properties of the field.
리턴 the new field id

Delete() 공개 정적인 메소드

Delete a field
public static Delete ( integer $customFieldId = null )
$customFieldId integer field id

Get() 공개 정적인 메소드

Get the field information including properties, options and default value(s)
public static Get ( integer $customFieldId ) : an
$customFieldId integer field id
리턴 an object containing information about fields. The object contains 3 objects: properties, options and default_value

GetCustomFieldTypes() 공개 정적인 메소드

Retrieves information about a specified type
public static GetCustomFieldTypes ( integer $customFieldTypeId = null ) : a
$customFieldTypeId integer the type id, if null, a list of all types will be returned
리턴 a list/object containing information about the specified type. The information includes id, name, description, has_options, has_properties, and allow_multiple_values (whether fields of that type can have more than one default value)

GetCustomFieldValues() 공개 정적인 메소드

Retrieves the value of a custom field for a specified post
public static GetCustomFieldValues ( boolean $single, integer $postId, string $customFieldName, integer $groupIndex = 1, integer $fieldIndex = 1 ) : mixed
$single boolean
$postId integer
$customFieldName string
$groupIndex integer
$fieldIndex integer
리턴 mixed

GetDataField() 공개 정적인 메소드

@param string $customFieldName
public static GetDataField ( string $customFieldName, integer $groupIndex = 1, integer $fieldIndex = 1, integer $postId )
$customFieldName string
$groupIndex integer @param integer $fieldIndex @param integer $postId
$fieldIndex integer
$postId integer

GetFieldDuplicates() 공개 정적인 메소드

Get number of group duplicates given field name. The function returns 1 if there are no duplicates (just he original group), 2 if there is one duplicate and so on.
public static GetFieldDuplicates ( integer $postId, $fieldName, $groupIndex ) : number
$postId integer post id
리턴 number of groups

GetFieldGroupDuplicates() 공개 정적인 메소드

Get number of group duplicates given field name. The function returns 1 if there are no duplicates (just the original group), 2 if there is one duplicate and so on.
public static GetFieldGroupDuplicates ( integer $postId, $fieldName ) : number
$postId integer post id
리턴 number of groups

GetFieldsOrder() 공개 정적인 메소드

@param $postId the id of the post
public static GetFieldsOrder ( $postId, $fieldName, $groupId ) : array
$fieldName the name of the field @param $groupId the groupId @return array return the order of the field sorted
리턴 array

GetInfoByName() 공개 정적인 메소드

Retrieves the id and type of a custom field given field name for the current post.
저자: Edgar García - hunk ([email protected])
public static GetInfoByName ( string $customFieldName, $post_id ) : array
$customFieldName string
리턴 array with custom field id and custom field type

GetMetaID() 공개 정적인 메소드

@param integer $postId Post id
public static GetMetaID ( integer $postId, $customFieldName, integer $groupIndex = 1, integer $fieldIndex = 1 ) : integer
$postId integer
$groupIndex integer
$fieldIndex integer
리턴 integer

GetOrderDuplicates() 공개 정적인 메소드

Get the order of group duplicates given the field name. The function returns a array with the orden
public static GetOrderDuplicates ( integer $postId, $fieldName ) : order
$postId integer post id
리턴 order of one group

Update() 공개 정적인 메소드

Updates the properties of a custom field.
public static Update ( integer $customFieldId, string $name, string $label, integer $order = 1, integer $required_field, integer $type, array $options = null, array $default_value = null, array $properties = null, $duplicate, $helptext = null )
$customFieldId integer the id of the field to be updated
$name string the name of the field, the name is used to uniquely identify the field when retrieving its value.
$label string the label of the field, the label is displayed beside the field in Write tab.
$order integer the order of the field when it is displayed in the Write tab.
$required_field integer whether this field is a required field. Required fields doesn't allow users to save a post if they are null.
$type integer the type of the field. Use $FIELD_TYPES defined in MF_Constant.php
$options array array of strings that represent the list of the field if its type is list.
$default_value array array of strings that represent default value(s) of of the field if its type is list.
$properties array an array containing extra properties of the field.