Esempio n. 1
0
 /**
  * Show the metabox.
  *
  * @since 1.0
  * @access public
  *
  * @todo Allow users to add custom code before meta box content through filters
  */
 public function show_metaboxes()
 {
     global $post;
     $saved = self::has_been_saved($post->ID, $this->fields);
     wp_nonce_field("wppf-save-{$this->_meta_box['id']}", "nonce_{$this->_meta_box['id']}");
     do_action('wppf_before', $this);
     do_action("wppf_before_{$this->_meta_box['id']}", $this);
     self::before_fields();
     // Display regular fields markup only for regular metaboxes.
     // Dispaly simple markup depending on the context.
     if ($this->get_context() == 'side') {
         foreach ($this->fields as $field) {
             // Display content before markup of the single field
             echo Pretty_Fields::before_field_simple($field);
             // Run actions before field markup
             do_action('wppf_before_field', $field);
             do_action("wppf_before_field_{$field['type']}", $this);
             do_action("wppf_before_field_{$field['id']}", $this);
             // Get single field markup
             call_user_func(array(self::get_class_name($field), 'show'), $field, $saved);
             // Run actions after field markup
             do_action('wppf_after_field', $field);
             do_action("wppf_after_field_{$field['type']}", $this);
             do_action("wppf_after_field_{$field['id']}", $this);
             // Display content after markup of the single field.
             echo Pretty_Fields::after_field_simple($field);
         }
     } else {
         foreach ($this->fields as $field) {
             // Display content before markup of the single field
             echo Pretty_Fields::before_field($field, $this->has_tabs());
             // Run actions before field markup
             do_action('wppf_before_field', $field);
             do_action("wppf_before_field_{$field['type']}", $this);
             do_action("wppf_before_field_{$field['id']}", $this);
             // Get single field markup
             call_user_func(array(self::get_class_name($field), 'show'), $field, $saved);
             // Run actions after field markup
             do_action('wppf_after_field', $field);
             do_action("wppf_after_field_{$field['type']}", $this);
             do_action("wppf_after_field_{$field['id']}", $this);
             // Display content after markup of the single field.
             echo Pretty_Fields::after_field($field, $this->has_tabs());
         }
     }
     self::after_fields();
     do_action('wppf_after', $this);
     do_action("wppf_after_{$this->_meta_box['id']}", $this);
 }