/** * Adds meta box to any post type * * @uses add_meta_box() * * @return void * * @access public * @since 1.0 */ function add_meta_boxes($term) { rj_ot_admin_scriptss(); rj_ot_admin_styless(); foreach ((array) $this->meta_box['id'] as $page) { $this->build_taxonomy_meta_box($term, $this->meta_box['fields'], $this->meta_box['id'], $this->meta_box['title']); } }
function rj_taxonomy_ot_export_callback() { $plugins_url = plugins_url(); rj_ot_admin_styless(); /* format setting outer wrapper */ echo '<div class="format-setting type-textarea simple has-desc">'; echo '<h2>Export Taxonomy MetaboxUI Settings</h2>'; /* description */ echo '<div class="description">'; echo '<p>' . __('Export your Settings by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the <code>Metaboxes->Import</code> <strong>Settings</strong> textarea on another web site.', 'option-tree') . '</p>'; echo '</div>'; /* get theme options data */ $settings = get_option('rj_taxonomy_' . ot_settings_id()); $settings = !empty($settings) ? ot_encode(serialize($settings)) : ''; echo '<div class="format-setting-inner">'; echo '<textarea rows="10" cols="40" name="export_user_ot_meta_settings" id="export_user_ot_meta_settings" class="textarea">' . $settings . '</textarea>'; echo '</div>'; echo '</div>'; }
/** * Adds meta box to any post type * * @uses add_meta_box() * * @return void * * @access public * @since 1.0 */ function add_widgets($widget_data) { global $page_now; if (is_admin()) { rj_ot_admin_scriptss(); rj_ot_admin_styless(); } $widget_class_name = 'Dynamic_Widget_' . $widget_data['id']; $widget_datas = var_export($widget_data, true); $dynamic_class = ' if(!class_exists("' . $widget_class_name . '")){ class ' . $widget_class_name . ' extends WP_Widget { public $widget_datas = ' . $widget_datas . '; function ' . $widget_class_name . '() { $widget_ops = array("classname" => "' . $widget_class_name . '" , "description" => "' . $widget_data["description"] . '" ); $this->WP_Widget("' . $widget_class_name . '", "' . $widget_data["title"] . '", $widget_ops); } function form($instance) { $dynamic_instances = array("title"=>""); $fields = $this->widget_datas["fields"]; if(!empty($fields)){ foreach( $fields as $field ){ $dynamic_instances[$field["id"]]=$field["std"]; } } $instance = wp_parse_args( (array) $instance, $dynamic_instances ); $field_data = array(); $field_keys = array(); foreach($dynamic_instances as $key=>$val){ $field_data[$this->get_field_name($key)] = $instance[$key]; $field_keys[$key] = $this->get_field_name($key); } $title = $instance["title"]; echo "<p><label for=\\"" . $this->get_field_id("title") . "\\">Title: <input class=\\"widefat\\" id=\\""; echo $this->get_field_id("title") . "\\" name=\\"" . $this->get_field_name("title") . "\\" type=\\"text\\" value=\\"" . attribute_escape($title) . "\\" /></label></p>"; RJ_OT_Widget_Meta_Box::build_widget_meta_box("",$this->widget_datas,$instance,$field_data,$field_keys); } function update($new_instance, $old_instance) { $instance = $old_instance; $dynamic_instances[0] = array("id"=>"title"); $fields = $this->widget_datas["fields"]; $fields = array_merge( $fields,$dynamic_instances); if(!empty($fields)){ foreach( $fields as $field ){ $fid = $field["id"]; $instance[$fid] = $new_instance[$fid]; } } return $instance; } function widget($args, $instance) { $data = array_merge($args,$instance); $widget_template = $this->widget_datas["widget_template"]; $engine = new TemplateEngine(); if(has_action("wp_widget_design_' . $widget_data['id'] . '")) { do_action("wp_widget_design_' . $widget_data['id'] . '",$args,$instance); }else{ echo do_shortcode($engine->process($widget_template, $data)); } } }; } '; //echo $dynamic_class; eval($dynamic_class); register_widget($widget_class_name); }