ID, '_wpv_layout_settings', true);
view_layout_style($post, $view_layout_settings);
view_layout_fields($post, $view_layout_settings);
view_layout_additional_js($post, $view_layout_settings);
wpv_layout_meta_html_admin($post, $view_layout_settings);
?>
>
>
>
>
>
', ' »');?>
style="display:none;">
'. $i . '';
}
?>
type = $type;
$this->prefix = $prefix;
$this->suffix = $suffix;
$this->row_title = $row_title;
$this->edittext = $edittext;
}
function render_to_table($index) {
global $wpv_shortcodes, $WPV_templates, $WP_Views;
$view_template = null;
$taxonomy_view = null;
if (strpos($this->type, 'wpv-post-field - ') === 0) {
$name = substr($this->type, strlen('wpv-post-field - '));
$title = $name;
} elseif (strpos($this->type, 'types-field - ') === 0) {
$name = substr($this->type, strlen('types-field - '));
$title = $name;
} elseif(strpos($this->type, 'wpvtax') === 0) {
// $name = substr($this->type, strlen('wpvtax-'));
$name = 'Taxonomy - '. $this->type;
$title = $name;
} elseif (strpos($this->type, 'wpv-post-body ') === 0) {
$name = $wpv_shortcodes['wpv-post-body'][1];
$parts = explode(' ', $this->type);
if (isset($parts[1])) {
$view_template = $parts[1];
}
$title = $name;
} elseif (strpos($this->type, 'wpv-view ') === 0) {
$name = 'Taxonomy View';
$parts = explode(' ', $this->type);
if (isset($parts[1])) {
$taxonomy_view = $parts[1];
}
$title = $name;
} else {
$name = $wpv_shortcodes[$this->type][1];
$title = $name;
}
?>
get_view_template_select_box($index, $view_template);
$view_template_select_box = ' - ' . __('Using view template:' , 'wpv-views') . ' ' . $view_template_select_box . '
';
echo $view_template_select_box;
}
if ($taxonomy_view) {
$taxonomy_view_select_box = $WP_Views->get_taxonomy_view_select_box($index, $taxonomy_view);
$taxonomy_view_select_box = '' . $taxonomy_view_select_box . '
';
echo $taxonomy_view_select_box;
}
?>
row_title;
?>
type, 'wpv-taxonomy-') === 0 || strpos($this->type, 'wpv-view') === 0) {
// taxonomy type.
$output = 'class="wpv-taxonomy-field"';
if ($view_settings['query_type'][0] != 'taxonomy') {
$output .= ' style="display:none"';
}
} else {
// post type
$output = 'class="wpv-post-type-field"';
if ($view_settings['query_type'][0] != 'posts') {
$output .= ' style="display:none"';
}
}
return $output;
}
function get_body_template() {
if (strpos($this->type, 'wpv-post-body ') === 0) {
$parts = explode(' ', $this->type);
return $parts[1];
} else {
return -1;
}
}
}
$link_layout_number = 0;
function view_layout_fields_to_classes($fields) {
$output = array();
for ($i = 0; $i < sizeof($fields) / 4; $i++) {
$output[] = new View_layout_field($fields["name_{$i}"],
$fields["prefix_{$i}"],
$fields["suffix_{$i}"],
isset($fields["row_title_{$i}"]) ? $fields["row_title_{$i}"] : '',
isset($fields["edittext_{$i}"]) ? $fields["edittext_{$i}"] : '');
}
return $output;
}
function view_layout_fields($post, $view_layout_settings) {
global $WP_Views;
$view_settings = $WP_Views->get_view_settings($post->ID);
if (isset($view_layout_settings['fields'])) {
$view_layout_settings['fields'] = view_layout_fields_to_classes($view_layout_settings['fields']);
} else {
$view_layout_settings['fields'] = array();
}
view_layout_javascript();
global $WPV_templates;
$template_selected = 0;
foreach ($view_layout_settings['fields'] as $field) {
$posible_template = $field->get_body_template();
if ($posible_template >= 0) {
$template_selected = $posible_template;
break;
}
}
// Add a select control so that we can chose the view template for the body.
$view_template_select_box = $WPV_templates->get_view_template_select_box('', '');
$view_template_select_box = ' - ' . __('Using View template:' , 'wpv-views') . ' ' . $view_template_select_box . '
';
// Add a select control so that we can chose the Taxonomy View.
$taxonomy_view_select_box = $WP_Views->get_taxonomy_view_select_box('', '');
$taxonomy_view_select_box = '' . $taxonomy_view_select_box . '
';
?>
Add field to insert additional fields. Drag them to reorder, or delete fields that you don't need.", 'wpv-views'); ?>
Add field to insert fields to this View.", 'wpv-views'); ?>
$field) {
?>
render_table_row_attributes($view_settings); ?>>
render_to_table($index); ?>
>
editor_addon->add_form_button('', '#wpv_layout_meta_html_content', false); ?>
>
>',
' »'); ?>
>',
' »'); ?>
$value) {
if (strpos($index, 'name_') === 0) {
if (strpos($value, __('Field', 'wpv-views') . ' - ') === 0) {
$fields[$index] = 'wpv-post-field' . ' - ' . $value;
} else if (strpos($value, 'Types - ') === 0) {
$fields[$index] = 'types-field' . ' - ' . $value;
} else if (strpos($value, 'Taxonomy - ') === 0) {
$fields[$index] = substr($value, 11);
} else {
$fields[$index] = wpv_get_shortcode($value);
if ($fields[$index] == 'wpv-post-body') {
$row = substr($index, 5);
if (isset($_POST['views_template_' . $row]) && $_POST['views_template_' . $row] != 0) {
$fields[$index] .= ' ' . $_POST['views_template_' . $row];
}
}
// Check for a taxonomy view (A view for laying out the child terms)
if ($fields[$index] == 'wpv-view') {
$row = substr($index, 5);
if (isset($_POST['taxonomy_view_' . $row]) && $_POST['taxonomy_view_' . $row] != 0) {
$fields[$index] .= ' ' . $_POST['taxonomy_view_' . $row];
}
}
}
} else if (strpos($index, 'suffix_') == 0 || strpos($index, 'prefix_') == 0) {
$fields[$index] = htmlspecialchars_decode($value);
}
}
$_POST['_wpv_layout_settings']['fields'] = $fields;
if (!isset($_POST['_wpv_layout_settings']['include_field_names'])) {
// set it to 0 if it's not in the $_POST data
$_POST['_wpv_layout_settings']['include_field_names'] = 0;
}
update_post_meta($post_id, '_wpv_layout_settings', $_POST['_wpv_layout_settings']);
}
}
function short_code_menu_callback($index, $cf_key, $function_name, $menu, $shortcode) {
global $link_layout_number, $wpdb;
static $fields_started = false;
static $templates_started = false;
if ($menu == __('View template', 'wpv-views') && !$templates_started) {
$templates_started = true;
echo ' ' ;
echo ' ' . __('View templates', 'wpv-views') . ' ' ;
echo '' ;
$link_layout_number = 0;
}
if ($menu != '' && $menu != __('View template', 'wpv-views') && !$fields_started) {
$fields_started = true;
echo ' ' ;
echo ' ' . __('Fields', 'wpv-views') . ' ' ;
echo '' ;
$link_layout_number = 0;
}
if (!($link_layout_number % 2)) {
if ($link_layout_number != 0) {
echo ' ' ;
}
}
if ($menu == __('View template', 'wpv-views')) {
// get the View template title.
$field_name = $wpdb->get_var($wpdb->prepare("SELECT post_title FROM {$wpdb->posts} WHERE post_type='view-template' AND post_name=%s", $cf_key));
if (!$field_name) {
$field_name = $cf_key;
}
} else {
$field_name = $cf_key;
if (function_exists('wpcf_types_get_meta_prefix')) {
// we have types.
// Get the field name for display
$types_prefix = wpcf_types_get_meta_prefix();
if (strpos($cf_key, $types_prefix) === 0) {
$field_info = wpcf_fields_get_field_by_slug(substr($cf_key, strlen($types_prefix)));
if (isset($field_info['name'])) {
$field_name = $field_info['name'];
}
}
}
}
echo '';
echo $field_name;
echo ' ';
$link_layout_number++;
}
function short_code_taxonomy_menu_callback($index, $cf_key, $function_name, $menu, $shortcode) {
global $link_layout_number;
static $taxonomy_view_started = false;
static $post_view_started = false;
static $suffix = '';
if (!$taxonomy_view_started && $menu == __('Taxonomy View', 'wpv-views')) {
echo ' ';
echo '';
echo '' . $menu . ' ' . __(' - Use to layout child taxonomy terms', 'wpv-views') . ' ';
echo ' ';
$link_layout_number = 0;
$taxonomy_view_started = true;
$suffix = ' - ' . __('Taxonomy View', 'wpv-views');
}
if (!$post_view_started && $menu == __('Post View', 'wpv-views')) {
echo ' ';
echo '';
echo '' . $menu . ' ' . __(' - Use to layout posts for the current taxonomy term', 'wpv-views') . ' ';
echo ' ';
$link_layout_number = 0;
$post_view_started = true;
$suffix = ' - ' . __('Post View', 'wpv-views');
}
if (!($link_layout_number % 2)) {
if ($link_layout_number != 0) {
echo ' ' ;
}
}
echo '';
echo $cf_key;
echo ' ';
$link_layout_number++;
}
function short_code_variable_callback($index, $cf_key, $function_name, $menu, $shortcode) {
?>
wpv_shortcodes[] = new Array('', '');