function initialize($feature_args) { if (!is_object($this->element)) { $html_attributes = WP_Metadata::extract_prefixed_args($feature_args, 'html'); $html_attributes['id'] = $this->html_id(); $html_attributes['name'] = $this->html_name(); $html_attributes['class'] = $this->html_class() . (!empty($html_attributes['class']) ? " {$html_attributes['class']}" : ''); $this->element = WP_Metadata::get_html_element($this->html_tag(), $html_attributes); } if (!is_object($this->wrapper)) { $wrapper_attributes = WP_Metadata::extract_prefixed_args($feature_args, 'wrapper_html'); $wrapper_attributes['id'] = $this->wrapper_html_id(); $wrapper_attributes['name'] = $this->wrapper_html_name(); $wrapper_attributes['class'] = $this->wrapper_html_class() . (!empty($wrapper_attributes['class']) ? " {$wrapper_attributes['class']}" : ''); $this->wrapper = WP_Metadata::get_html_element($this->wrapper_tag(), $wrapper_attributes); } }
/** * @param string $view_name * @param array $view_args */ function __construct($view_name, $view_args = array()) { $view_args['view_name'] = $view_name; if (!empty($view_args['field'])) { /* * Set $this->field before parent::__construct() because other initializes depend on it. */ $this->field = $view_args['field']; $this->field->view = $this; } $this->features = array_fill_keys($this->get_feature_types(), array()); parent::__construct($view_args); if (!is_object($this->wrapper)) { $wrapper_attributes = WP_Metadata::extract_prefixed_args($view_args, 'wrapper'); $wrapper_attributes['class'] = $this->wrapper_html_class() . (!empty($wrapper_attributes['class']) ? "{$wrapper_attributes['class']} " : ''); $this->wrapper = WP_Metadata::get_html_element($this->wrapper_tag(), $wrapper_attributes); } }
/** * Parse out $args for delegate properties from $args and store in $this->delegated_args array. * * @param $args * * @return mixed */ function delegate_args($args) { $class = get_class($this); // @todo Unused variable $delegates = $this->get_delegates(); $this->delegated_args = WP_Metadata::extract_prefixed_args($args, $delegates, 'strip_prefix=0'); return $args; }
/** * @param string $class_name * @param string $class_filepath * @return bool Return true if it was registered, false if not. */ function register_autoload_class($class_name, $class_filepath) { return WP_Metadata::register_autoload_class($class_name, $class_filepath); }
/** * */ static function initialize_storage_type_registry() { self::$_storage_type_registry = new WP_Registry(); }
/** * Retrieve the class name for a named view. * * @param string $view_name The name of the view that is unique for this class. * * @return string */ function get_view_class($view_name) { return WP_Metadata::get_view_class('form', $view_name, get_class($this)); }
/** * @param string $post_type * @param bool|array $form_names * * @return array */ function get_post_forms($post_type, $form_names = false) { return WP_Metadata::get_forms(wp_get_post_object_type($post_type), $form_names); }
/** * @return string */ function get_form_html() { $attributes = array('id' => $this->html_id(), 'name' => $this->html_name(), 'class' => $this->html_class() . (!empty($attributes['class']) ? " {$attributes['class']}" : '')); $form_html = WP_Metadata::get_element_html($this->html_tag(), $attributes, $this->get_form_fields_html()); return "\n<!-- WP_Metadata Form -->\n\n{$form_html}"; }
/** * @param string $form_name * @param string $option_group * @param string $form_args * * @return WP_Form */ function get_option_form($form_name, $option_group, $form_args = array()) { return WP_Metadata::get_form($form_name, "option:{$option_group}", $form_args); }
/** * Retrieve the class name for a named view. * * @param bool|string $view_name The name of the view that is unique for this class. * * @return string */ function get_view_class($view_name = false) { if (!$view_name) { $view_name = $this->view; } return is_object($this->view) ? get_class($this->view) : WP_Metadata::get_view_class('field', $view_name, get_class($this)); }
/** * @param string $form_name * @param string $comment_type * @param array $form_args * * @return WP_Form */ function get_comment_form($form_name, $comment_type, $form_args = array()) { return WP_Metadata::get_form($form_name, wp_get_comment_object_type($comment_type), $form_args); }
/** * @return array */ function attributes() { if (!$this->_attributes_parsed) { $attributes = WP_Metadata::get_html_attributes($this->tag_name); foreach ($this->_attributes as $name => $value) { $attributes[sanitize_key($name)] = esc_attr($value); } $this->_attributes = $attributes; $this->_attributes_parsed = true; } return $this->_attributes; }
/** * @param string $form_name * @param string $user_role * @param array $form_args * * @return WP_Form */ function get_user_form($form_name, $user_role, $form_args = array()) { return WP_Metadata::get_form($form_name, wp_get_user_object_type($user_role), $form_args); }