function __construct($title)
 {
     parent::__construct($title);
     if (!$this->get_datastore()) {
         $this->set_datastore(new Resume_DataStore_UserMeta());
     }
 }
 /**
  * Revert the result of attach()
  *
  * @return void
  **/
 function detach()
 {
     parent::detach();
     remove_action('admin_init', array($this, '_attach'));
     foreach ($this->settings['taxonomy'] as $taxonomy) {
         remove_action('edited_' . $taxonomy, array($this, '_save'), 10, 2);
         remove_action('created_' . $taxonomy, array($this, '_save'), 10, 2);
     }
     // unregister field names
     foreach ($this->fields as $field) {
         $this->drop_unique_field_name($field->get_name());
     }
 }
 function form($instance)
 {
     $this->store_data = $instance;
     $custom_fields = array();
     foreach ($this->custom_fields as $field) {
         $tmp_field = clone $field;
         $tmp_field->load();
         $field_id = $this->get_field_id($tmp_field->get_name());
         $field_name = $this->get_field_name($tmp_field->get_name());
         $tmp_field->set_name($field_name);
         $custom_fields[] = $tmp_field;
     }
     Resume_Container::factory('widget', $this->id)->add_fields($custom_fields)->init();
 }
 function resume_get_json_data()
 {
     global $wp_registered_sidebars;
     $resume_data = array('containers' => array(), 'sidebars' => array());
     $containers = Resume_Container::get_active_containers();
     foreach ($containers as $container) {
         $container_data = $container->to_json(true);
         $resume_data['containers'][] = $container_data;
     }
     foreach ($wp_registered_sidebars as $sidebar) {
         // Check if we have inactive sidebars
         if (isset($sidebar['class']) && strpos($sidebar['class'], 'inactive-sidebar') !== false) {
             continue;
         }
         $resume_data['sidebars'][] = array('name' => $sidebar['name']);
     }
     return $resume_data;
 }
 /**
  * Revert the result of attach()
  *
  * @return void
  **/
 function detach()
 {
     parent::detach();
     remove_action('admin_init', array($this, '_attach'));
     remove_action('save_post', array($this, '_save'));
     // unregister field names
     foreach ($this->fields as $field) {
         $this->drop_unique_field_name($field->get_name());
     }
 }
 function to_json($load)
 {
     return parent::to_json(false);
 }
 function add_fields($fields)
 {
     parent::add_fields($fields);
     foreach ($this->fields as $field) {
         $field->set_prefix('');
     }
     return $this;
 }
function rb_register_resume_meta_boxes()
{
    Resume_Container::factory('custom_fields', __('Resume Builder'))->show_on_post_type('rb_resume')->add_fields(array(Resume_Field::factory('separator', 'rb_resume_shortcode_title', __('Resume Shortcodes', 'resume-builder')), Resume_Field::factory('html', 'rb_resume_shortcode')->set_html(rb_get_resume_shortcode_help_text()), Resume_Field::factory('separator', 'rb_resume_sections_title', __('The Resume Builder', 'resume-builder')), Resume_Field::factory('complex', 'rb_resume_sections', __('Resume Sections', 'resume-builder'))->setup_labels(array('singular_name' => __('Resume Section', 'resume-builder'), 'plural_name' => __('Resume Sections', 'resume-builder')))->add_fields('introduction_block', array(Resume_Field::factory('text', 'sectiontitle', __('Introduction Title', 'resume-builder')), Resume_Field::factory('text', 'sectionsubtitle', __('Introduction Subtitle', 'resume-builder')), Resume_Field::factory('attachment', 'sectionimage', __('Introduction Image', 'resume-builder'))->help_text(__('The image should be sized to 237 x 303 pixels.', 'resume-builder')), Resume_Field::factory('rich_text', 'sectiontext', __('Introduction Text', 'resume-builder')), Resume_Field::factory('complex', 'sectionbuttons', __('Introduction Buttons', 'resume-builder'))->setup_labels(array('singular_name' => __('Button', 'resume-builder'), 'plural_name' => __('Buttons', 'resume-builder')))->add_fields(array(Resume_Field::factory('text', 'label', __('Button Label', 'resume-builder'))->set_required(true), Resume_Field::factory('text', 'link', __('Button Link', 'resume-builder'))->set_required(true), Resume_Field::factory('select', 'type', __('Button Style', 'resume-builder'))->set_required(true)->add_options(array('filled' => __('Filled', 'resume-builder'), 'open' => __('Open', 'resume-builder')))))))->add_fields('default_block', array(Resume_Field::factory('text', 'sectiontitle', __('Section Title', 'resume-builder')), Resume_Field::factory('complex', 'sectioncontent', __('Section Content', 'resume-builder'))->setup_labels(array('singular_name' => __('Subsection', 'resume-builder'), 'plural_name' => __('Subsections', 'resume-builder')))->add_fields('text_block', array(Resume_Field::factory('rich_text', 'text', __('Text', 'resume-builder'))->set_required(true)))->add_fields('detailed_row', array(Resume_Field::factory('text', 'rowtitle', __('Row Title', 'resume-builder')), Resume_Field::factory('text', 'rowsubtitle', __('Row Subtitle', 'resume-builder')), Resume_Field::factory('text', 'rowsidetext', __('Row Side Text', 'resume-builder')), Resume_Field::factory('rich_text', 'rowtext', __('Row Text', 'resume-builder')))))), Resume_Field::factory('separator', 'rb_resume_widget', __('Resume Widgets', 'resume-builder')), Resume_Field::factory('text', 'rb_resume_widget_contacts_title', __('Contact Info Title', 'resume-builder')), Resume_Field::factory('text', 'rb_resume_widget_contacts_email', __('Email', 'resume-builder')), Resume_Field::factory('text', 'rb_resume_widget_contacts_phone', __('Phone', 'resume-builder')), Resume_Field::factory('text', 'rb_resume_widget_contacts_website', __('Website', 'resume-builder')), Resume_Field::factory('text', 'rb_resume_widget_contacts_address', __('Address', 'resume-builder')), Resume_Field::factory('text', 'rb_resume_widget_skills_title', __('Skills Title', 'resume-builder')), Resume_Field::factory('complex', 'rb_resume_widget_skills', __('Skills', 'resume-builder'))->setup_labels(array('singular_name' => __('Skill', 'resume-builder'), 'plural_name' => __('Skills', 'resume-builder')))->add_fields(array(Resume_Field::factory('text', 'title', __('Title', 'resume-builder')), Resume_Field::factory('select', 'rating', __('Star Rating', 'resume-builder'))->add_options(rb_generate_rating()), Resume_Field::factory('textarea', 'text', __('Description', 'resume-builder'))))));
}