/**
 * Views-Shortcode: wpv-if
 *
 * Description: Conditional shortcode to be used to display a specific area
 * based on a custom field condition. \n
 * Supported actions and symbols:\n
 * Integer and floating-point numbers \n
 * Math operators: +, -, *, / \n
 * Comparison operators: <, >, =, <=, >=, != \n
 * Boolean operators: AND, OR, NOT \n
 * Nested expressions - several levels of parentheses \n
 * Variables defined as shortcode parameters starting with a dollar sign \n
 * empty() function that checks for empty or non-existing fields
 *
 * Parameters:
 * 'condition' => Define expected result from evaluate - either true or false
 * 'evaluate' => Evaluate expression with fields involved, sample use: "($field1 > $field2) AND !empty($field3)"
 * 'debug' => Enable debug to display error messages in the shortcode 
 * 'fieldX' => Define fields to be taken into account during evaluation 
 *
 * Example usage:
 * [wpv-if evaluate="boolean condition"]
 *    Execute code for true
 * [/wpv-if]
 * Sing a variable and comparing its value to a constant
 * [wpv-if f1="wpcf-condnum1" evaluate="$f1 = 1" debug="true"]Number1=1[/wpv-if]
 * Two numeric variables in a mathematical expression with boolean operators
 * [wpv-if f1="wpcf-condnum1" f2="wpcf-condnum2" evaluate="(2 < 3 AND (((3+$f2)/2) > 3 OR NOT($f1 > 3)))" debug="true"]Visible block[/wpv-if]
 * Compare custom field with a value
 * [wpv-if f1="wpcf-condstr1" evaluate="$f1 = 'My text'" debug="true"]Text1='My text' [/wpv-if]
 * Display condition if evaluates to false (use instead of else-if)
 * [wpv-if condition="false" evaluate="2 > 3"] 2 > 3 [/wpv-if]
 * Custom function support
 * [wpv-if evaluate="my_func() = '1'"]my_func returns 1[/wpv-if]
 *
 * Link:
 * <a href="http://wp-types.com/documentation/user-guides/conditional-html-output-in-views/?utm_source=viewsplugin&utm_campaign=views&utm_medium=views-conditional-help-link&utm_term=Conditional HTML output in Views">Conditional HTML output in Views</a>
 *
 * Note:
 *
 */
function wpv_shortcode_wpv_if($args, $content)
{
    $result = wpv_condition($args);
    extract(shortcode_atts(array('evaluate' => FALSE, 'debug' => FALSE, 'condition' => TRUE), $args));
    $condition = $condition == 'true' || $condition === TRUE ? true : false;
    // show the view area if condition corresponds to the evaluate returned result 1=1 or 0=0
    if ($result === true && $condition || $result === false && !$condition) {
        $out = wpv_do_shortcode($content);
        apply_filters('wpv_shortcode_debug', 'wpv-if', json_encode($args), '', 'Conditional output: evaluated to true', $out);
        return $out;
    } else {
        // output empty string or the error message if debug is true
        // empty for different condition and evaluate result
        if ($result === false && $condition || $result === true && !$condition) {
            apply_filters('wpv_shortcode_debug', 'wpv-if', json_encode($args), '', 'Conditional output: evaluated to false');
            return '';
        } else {
            if ($debug) {
                return $result;
            } else {
                return '';
            }
            apply_filters('wpv_shortcode_debug', 'wpv-if', json_encode($args), '', 'Conditional output: error', $result);
        }
    }
}
function wpv_filter_meta_html($atts)
{
    extract(shortcode_atts(array(), $atts));
    global $WP_Views;
    $view_settings = $WP_Views->get_view_settings();
    if (isset($view_settings['filter_meta_html'])) {
        return wpv_do_shortcode($view_settings['filter_meta_html']);
    } else {
        return '';
    }
}
function wpv_filter_meta_html($atts)
{
    extract(shortcode_atts(array(), $atts));
    global $WP_Views;
    $view_settings = $WP_Views->get_view_settings();
    if (isset($view_settings['filter_meta_html'])) {
        $content = wpml_content_fix_links_to_translated_content($view_settings['filter_meta_html']);
        return wpv_do_shortcode($content);
    } else {
        return '';
    }
}
function wpv_for_each_shortcode($atts, $value)
{
    extract(shortcode_atts(array('field' => ''), $atts));
    if ($field == '') {
        return wpv_do_shortcode($value);
    }
    $out = '';
    global $post, $wpv_for_each_index;
    if (!empty($post)) {
        $meta = get_post_meta($post->ID, $field);
        if (!$meta) {
            return $value;
        }
        // iterate through the items and set the for-each index
        $wpv_for_each_index[] = 0;
        for ($i = 0; $i < count($meta); $i++) {
            // set the for-each index and output
            $wpv_for_each_index[count($wpv_for_each_index) - 1] = $i;
            $out .= wpv_do_shortcode($value);
        }
        array_pop($wpv_for_each_index);
    }
    return $out;
}
function wpv_shortcode_wpv_filter_controls($atts, $value)
{
    /**
     *
     * This is a do nothing shortcode. It's just a place holder for putting the
     * wpv-control shortcodes and allows for easier editing inside the meta HTML
     *
     * This shortcode now has a function: when hide="true"
     * it does not display the wpv-control shortcodes
     * This is usefull if you need to show pagination controls but not filter controls
     * For View Forms, this hide parameter is overriden and controls are always shown
     */
    $value = str_replace("<!-- ADD USER CONTROLS HERE -->", '', $value);
    if (isset($atts['hide']) && $atts['hide'] == 'true') {
        return '';
    } else {
        return wpv_do_shortcode($value);
    }
}
 /**
  * Render the view and loops through the found posts
  */
 function render_view($view_id, $hash)
 {
     global $post, $WPVDebug, $wplogger;
     static $processed_views = array();
     // increment the view count.
     // TODO this code is duplicated, maybe create function for it?
     if (!isset($this->view_count[$this->view_depth])) {
         $this->view_count[$this->view_depth] = 0;
     }
     $this->view_count[$this->view_depth]++;
     $view = get_post($view_id);
     $this->view_used_ids[] = $view_id;
     $out = '';
     $view_caller_id = isset($post) && isset($post->ID) ? get_the_ID() : 0;
     // post or widget
     if (!isset($processed_views[$view_caller_id][$hash]) || 0 === $view_caller_id) {
         //$processed_views[$view_caller_id][$hash] = true; // mark view as processed for this post
         $status = get_post_status($view_id);
         // Views should be 'publish'ed to be allowed to produce an output
         // FIXME: Check also that user has permissions to render this view
         if (!empty($view) && $status == 'publish') {
             $post_content = $view->post_content;
             // apply the layout meta html if we have some.
             $view_layout_settings = $this->get_view_layout_settings();
             if (isset($view_layout_settings['layout_meta_html'])) {
                 $post_content = str_replace('[wpv-layout-meta-html]', $view_layout_settings['layout_meta_html'], $post_content);
             }
             $post_content = wpml_content_fix_links_to_translated_content($post_content);
             $view_settings = $this->get_view_settings();
             // find the loop
             if (preg_match('#\\<wpv-loop(.*?)\\>(.*)</wpv-loop>#is', $post_content, $matches)) {
                 // get the loop arguments.
                 $args = $matches[1];
                 $exp = array_map('trim', explode(' ', $args));
                 $args = array();
                 foreach ($exp as $e) {
                     $kv = explode('=', $e);
                     if (sizeof($kv) == 2) {
                         $args[$kv[0]] = trim($kv[1], '\'"');
                     }
                 }
                 if (isset($args['wrap'])) {
                     $args['wrap'] = intval($args['wrap']);
                 }
                 if (isset($args['pad'])) {
                     $args['pad'] = $args['pad'] == 'true';
                 } else {
                     $args['pad'] = false;
                 }
                 // Get templates for items (differentiated by their indices, see [wpv-item] documentation).
                 $tmpl = $matches[2];
                 $item_indexes = $this->_get_item_indexes($tmpl);
                 if ($view_settings['query_type'][0] == 'posts') {
                     // get the posts using the query settings for this view.
                     $archive_query = null;
                     if ($view_settings['view-query-mode'] == 'archive') {
                         // check for an archive loop
                         global $WPV_view_archive_loop;
                         if (isset($WPV_view_archive_loop)) {
                             $archive_query = $WPV_view_archive_loop->get_archive_loop_query();
                         }
                     } else {
                         if ($view_settings['view-query-mode'] == 'layouts-loop') {
                             global $wp_query;
                             $archive_query = isset($wp_query) && $wp_query instanceof WP_Query ? clone $wp_query : null;
                         }
                     }
                     if ($archive_query) {
                         $this->post_query = $archive_query;
                     } else {
                         $this->post_query = wpv_filter_get_posts($view_id);
                     }
                     $items = $this->post_query->posts;
                     $wplogger->log('Found ' . count($items) . ' posts');
                     if ($wplogger->isMsgVisible(WPLOG_DEBUG)) {
                         // simplify the output
                         $out_items = array();
                         foreach ($items as $item) {
                             $out_items[] = array('ID' => $item->ID, 'post_title' => $item->post_title);
                         }
                         $wplogger->log($out_items, WPLOG_DEBUG);
                     }
                 }
                 // save original post
                 global $post, $authordata, $id;
                 $tmp_post = isset($post) && $post instanceof WP_Post ? clone $post : null;
                 $tmp_authordata = isset($authordata) && is_object($authordata) ? clone $authordata : null;
                 $tmp_id = $id;
                 if ($view_settings['query_type'][0] == 'taxonomy') {
                     $items = $this->taxonomy_query($view_settings);
                     $wplogger->log($items, WPLOG_DEBUG);
                     // taxonomy views can be recursive so remove from the processed array
                     //unset($processed_views[$view_caller_id][$hash]);
                 } else {
                     if ($view_settings['query_type'][0] == 'users') {
                         $items = $this->users_query($view_settings);
                         $wplogger->log($items, WPLOG_DEBUG);
                     }
                 }
                 global $WPV_settings;
                 if (isset($WPV_settings->wpv_debug_mode) && !empty($WPV_settings->wpv_debug_mode)) {
                     $WPVDebug->add_log('items_count', count($items));
                 }
                 // The actual loop - render all items
                 $loop = '';
                 for ($i = 0; $i < count($items); $i++) {
                     $WPVDebug->set_index();
                     $index = $i;
                     if (isset($args['wrap'])) {
                         $index %= $args['wrap'];
                     }
                     // [wpv-item index=xx] uses base 1
                     $index++;
                     $index = strval($index);
                     if ($view_settings['query_type'][0] == 'posts') {
                         $post = clone $items[$i];
                         $authordata = new WP_User($post->post_author);
                         $id = $post->ID;
                         $temp_variables = $this->variables;
                         $this->variables = array();
                         do_action('wpv-before-display-post', $post, $view_id);
                     } elseif ($view_settings['query_type'][0] == 'taxonomy') {
                         $this->taxonomy_data['term'] = $items[$i];
                         do_action('wpv-before-display-taxonomy', $items[$i], $view_id);
                     } elseif ($view_settings['query_type'][0] == 'users') {
                         $user_id = $items[$i]->ID;
                         $user_meta = get_user_meta($user_id);
                         $items[$i]->meta = $user_meta;
                         $this->users_data['term'] = $items[$i];
                         do_action('wpv-before-display-user', $items[$i], $view_id);
                     }
                     $WPVDebug->add_log($view_settings['query_type'][0], $items[$i]);
                     // first output the "all" index.
                     $shortcodes_output = wpv_do_shortcode($item_indexes['all']);
                     $loop .= $shortcodes_output;
                     $WPVDebug->add_log_item('shortcodes', $item_indexes['all']);
                     $WPVDebug->add_log_item('output', $shortcodes_output);
                     /* Select a template for this item based on it's index.
                      * Note: It is possible that we won't be rendering this item's content if the index 'other'
                      * isn't set and there is no other match. */
                     $selected_index = null;
                     if (isset($item_indexes[$index])) {
                         $selected_index = $index;
                     } elseif (isset($item_indexes['odd']) && $index % 2 == 1) {
                         $selected_index = 'odd';
                     } elseif (isset($item_indexes['even']) && $index % 2 == 0) {
                         $selected_index = 'even';
                     } elseif (isset($item_indexes['other'])) {
                         $selected_index = 'other';
                     }
                     // Output the item with appropriate template (if we found one)
                     if (null !== $selected_index) {
                         $shortcodes_output = wpv_do_shortcode($item_indexes[$selected_index]);
                         $loop .= $shortcodes_output;
                         $WPVDebug->add_log_item('shortcodes', $item_indexes[$selected_index]);
                         $WPVDebug->add_log_item('output', $shortcodes_output);
                     }
                     // Do wpv-after-display-* action after displaying the item
                     if ($view_settings['query_type'][0] == 'posts') {
                         do_action('wpv-after-display-post', $post, $view_id);
                         $this->variables = $temp_variables;
                     } elseif ($view_settings['query_type'][0] == 'taxonomy') {
                         do_action('wpv-after-display-taxonomy', $items[$i], $view_id);
                     } elseif ($view_settings['query_type'][0] == 'users') {
                         do_action('wpv-after-display-user', $items[$i], $view_id);
                     }
                 }
                 // see if we should pad the remaining items.
                 if (isset($args['wrap']) && isset($args['pad'])) {
                     while ($i % $args['wrap'] && $args['pad']) {
                         $index = $i;
                         $index %= $args['wrap'];
                         if ($index == $args['wrap'] - 1) {
                             $loop .= wpv_do_shortcode($item_indexes['pad-last']);
                         } else {
                             $loop .= wpv_do_shortcode($item_indexes['pad']);
                         }
                         $i++;
                     }
                 }
                 $WPVDebug->clean_index();
                 $out .= str_replace($matches[0], $loop, $post_content);
                 // restore original $post
                 $post = isset($tmp_post) && $tmp_post instanceof WP_Post ? clone $tmp_post : null;
                 $authordata = isset($tmp_authordata) && is_object($tmp_authordata) ? clone $tmp_authordata : null;
                 $id = $tmp_id;
             }
         } else {
             $out .= sprintf('<!- %s ->', __('View not found', 'wpv-views'));
         }
     } else {
         if ($processed_views[$view_caller_id][$hash] !== true) {
             // use output from cache
             $out .= $processed_views[$view_caller_id][$hash];
         }
     }
     return $out;
 }
	/**
	 * Handle the_excerpt filter when it's used in an archive loop
	 *
	 */
	function the_excerpt_for_archives($content) {
		global $WPV_settings, $post, $wp_query;

		static $archive_type_has_been_checked = false;
		static $taxonomy_loop = null;
		static $archive_loop = null;
		if ( !$archive_type_has_been_checked ) {
            $archive_type_has_been_checked = true;

            if ( is_archive() ) {

				/* Taxonomy archives. */

				if ( is_tax() || is_category() || is_tag() ) {

					$term = $wp_query->get_queried_object();
					$taxonomy_loop = 'views_template_loop_' . $term->taxonomy;

				} else if (is_post_type_archive($post->post_type)) {
					$archive_loop = 'views_template_archive_for_' . $post->post_type;
				}
			}
		}

		if ( $taxonomy_loop && isset( $WPV_settings[$taxonomy_loop] ) ) {
            // this is a taxonomy loop. Get the Content Template using the_content function
            $content = wpv_do_shortcode( $this->the_content( $content ) );
        } else if ( $archive_loop && isset( $WPV_settings[$archive_loop] ) ) {
            // this is an archive loop. Get the Content Template using the_content function
            $content = wpv_do_shortcode( $this->the_content( $content ) );
        }

        return $content;
	}
 function widget($args, $instance)
 {
     global $WP_Views;
     extract($args);
     $instance = wp_parse_args((array) $instance, array('title' => '', 'view' => false, 'target_id' => false));
     if ($instance['view'] && $instance['target_id']) {
         $WP_Views->set_widget_view_id($instance['view']);
         $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         $atts = array();
         $atts['id'] = $instance['view'];
         $atts['target_id'] = $instance['target_id'];
         $out = $WP_Views->short_tag_wpv_view_form($atts);
         $out = wpv_do_shortcode($out);
         $post_type_object = get_post_type_object('view');
         if (current_user_can($post_type_object->cap->edit_post, $instance['view'])) {
             $out .= widget_view_link($instance['view']);
         }
         echo $out;
         echo $after_widget;
         $WP_Views->set_widget_view_id(0);
     }
 }
function wpv_pager_next_page_shortcode($atts, $value)
{
    extract(shortcode_atts(array(), $atts));
    global $WP_Views;
    $page = $WP_Views->get_current_page_number();
    $view_settings = $WP_Views->get_view_settings();
    $display = false;
    if ($view_settings['pagination']['mode'] == 'rollover') {
        $display = true;
    } else {
        if ($page < $WP_Views->get_max_pages()) {
            $display = true;
        }
    }
    if ($display) {
        $page++;
        $value = wpv_do_shortcode($value);
        // TODO remove
        //        return '<a href="#" onclick="return wpv_pager_click_' . $WP_Views->get_view_count() . '(\'' . $page. '\')">' . $value . '</a>';
        $ajax = $view_settings['ajax_pagination'][0] == 'enable' ? 'true' : 'false';
        $effect = isset($view_settings['ajax_pagination']['style']) ? $view_settings['ajax_pagination']['style'] : 'fade';
        $stop_rollover = 'false';
        if ($view_settings['pagination']['mode'] == 'rollover') {
            $ajax = 'true';
            $effect = $view_settings['rollover']['effect'];
            $stop_rollover = 'true';
            if ($effect == 'slideright') {
                $effect = 'slideleft';
            }
            if ($effect == 'slideup') {
                $effect = 'slidedown';
            }
        }
        $cache_pages = $view_settings['pagination']['cache_pages'];
        $preload_pages = $view_settings['pagination']['preload_pages'];
        $spinner = $view_settings['pagination']['spinner'];
        $spinner_image = $view_settings['pagination']['spinner_image'];
        $callback_next = $view_settings['pagination']['callback_next'];
        if ($page <= 0) {
            $page = $WP_Views->get_max_pages();
        } else {
            if ($page > $WP_Views->get_max_pages()) {
                $page = 1;
            }
        }
        return '<a href="#" class="wpv-filter-next-link" onclick="return wpv_pagination_replace_view(' . $WP_Views->get_view_count() . ',' . $page . ', ' . $ajax . ', \'' . $effect . '\',' . $WP_Views->get_max_pages() . ', ' . $cache_pages . ', ' . $preload_pages . ', \'' . $spinner . '\', \'' . $spinner_image . '\', \'' . $callback_next . '\', ' . $stop_rollover . ')">' . $value . '</a>';
    } else {
        return '';
    }
}
Example #10
0
 private function CRED_User_build()
 {
     // get refs here
     $out_ =& $this->out_;
     $formHelper = $this->_formHelper;
     $shortcodeParser = $this->_shortcodeParser;
     $zebraForm = $this->_zebraForm;
     $zebraForm->out_ =& $out_;
     $zebraForm->_shortcodeParser = $shortcodeParser;
     $zebraForm->_formHelper = $formHelper;
     $zebraForm->_formData = $this->_formData;
     $zebraForm->_post_ID = $this->_post_ID;
     if ($zebraForm->preview) {
         $preview_content = $this->_content;
     }
     // remove any HTML comments before parsing, allow to comment-out parts
     $this->_content = $shortcodeParser->removeHtmlComments($this->_content);
     // do WP shortcode here for final output, moved here to avoid replacing post_content
     // call wpv_do_shortcode instead to fix render wpv shortcodes inside other shortcodes
     $this->_content = apply_filters('cred_content_before_do_shortcode', $this->_content);
     //New CRED shortcode to retrieve current container post_id
     if (isset(StaticClass::$_cred_container_id)) {
         $this->_content = str_replace("[cred-container-id]", StaticClass::$_cred_container_id, $this->_content);
     }
     //_pre($this->_content);
     if (function_exists('wpv_do_shortcode')) {
         $this->_content = wpv_do_shortcode($this->_content);
     } else {
         $this->_content = do_shortcode($this->_content);
     }
     // parse all shortcodes internally
     $shortcodeParser->remove_all_shortcodes();
     $shortcodeParser->add_shortcode('creduserform', array(&$zebraForm, 'cred_user_form_shortcode'));
     $this->_content = $shortcodeParser->do_shortcode($this->_content);
     $shortcodeParser->remove_shortcode('creduserform', array(&$zebraForm, 'cred_user_form_shortcode'));
     // add any custom attributes eg class
     /* if (
        isset($zebraForm->form_properties['attributes'])
        && is_array($zebraForm->form_properties['attributes'])
        && !empty($zebraForm->form_properties['attributes'])
        )
        $zebraForm->form_properties['attributes']=array_merge($zebraForm->form_properties['attributes'],
        $this->_attributes);
        else
        $zebraForm->form_properties['attributes']=$this->_attributes; */
     // render any external third-party shortcodes first (enables using shortcodes as values to cred shortcodes)
     $zebraForm->_form_content = do_shortcode($zebraForm->_form_content);
     // build shortcodes, (backwards compatibility, render first old shortcode format with dashes)
     $shortcodeParser->add_shortcode('cred-field', array(&$zebraForm, 'cred_field_shortcodes'));
     $shortcodeParser->add_shortcode('cred-generic-field', array(&$zebraForm, 'cred_generic_field_shortcodes'));
     $shortcodeParser->add_shortcode('cred-show-group', array(&$zebraForm, 'cred_conditional_shortcodes'));
     // build shortcodes, render new shortcode format with underscores
     $shortcodeParser->add_shortcode('cred_field', array(&$zebraForm, 'cred_field_shortcodes'));
     $shortcodeParser->add_shortcode('cred_generic_field', array(&$zebraForm, 'cred_generic_field_shortcodes'));
     $shortcodeParser->add_shortcode('cred_show_group', array(&$zebraForm, 'cred_conditional_shortcodes'));
     $out_['child_groups'] = array();
     //$this->_form_content=$shortcodeParser->do_recursive_shortcode('cred-show-group', $this->_form_content);
     $zebraForm->_form_content = $shortcodeParser->do_recursive_shortcode('cred_show_group', $zebraForm->_form_content);
     $out_['child_groups'] = array();
     /* Watch out for Toolset forms library in commons outputting HTML before header()
      * In the do_shortcode parser
      * https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/185336518/comments#282283111
      */
     $zebraForm->_form_content = $shortcodeParser->do_shortcode($zebraForm->_form_content);
     $shortcodeParser->remove_shortcode('cred_show_group', array(&$zebraForm, 'cred_conditional_shortcodes'));
     $shortcodeParser->remove_shortcode('cred_generic_field', array(&$zebraForm, 'cred_generic_field_shortcodes'));
     $shortcodeParser->remove_shortcode('cred_field', array(&$zebraForm, 'cred_field_shortcodes'));
     $shortcodeParser->remove_shortcode('cred-show-group', array(&$zebraForm, 'cred_conditional_shortcodes'));
     $shortcodeParser->remove_shortcode('cred-generic-field', array(&$zebraForm, 'cred_generic_field_shortcodes'));
     $shortcodeParser->remove_shortcode('cred-field', array(&$zebraForm, 'cred_field_shortcodes'));
     // add some auxilliary fields to form
     // add nonce hidden field
     //$nonceobj=$zebraForm->add('hidden', StaticClass::NONCE, wp_create_nonce($zebraForm->form_properties['name']), array('style'=>'display:none;'));
     if (is_user_logged_in()) {
         $nonceobj = $zebraForm->add2form_content('hidden', StaticClass::NONCE, wp_create_nonce($zebraForm->form_properties['name']), array('style' => 'display:none;'));
     }
     //$out_['nonce_field']=$nonce_field;
     // add post_id hidden field
     if ($this->_post_ID) {
         $post_id_obj = $zebraForm->add2form_content('hidden', StaticClass::PREFIX . 'post_id', $this->_post_ID, array('style' => 'display:none;'));
         //$out_['post_id_field']=$post_id_obj->attributes['id'];
     }
     if (isset(StaticClass::$_cred_container_id)) {
         $cred_container_id_obj = $zebraForm->add2form_content('hidden', StaticClass::PREFIX . 'cred_container_id', StaticClass::$_cred_container_id, array('style' => 'display:none;'));
     }
     // add to form
     $_fields = $this->_formData->getFields();
     $form_type = $_fields['form_settings']->form['type'];
     $form_id = $this->_formData->getForm()->ID;
     $form_count = $out_['count'];
     $post_type = $_fields['form_settings']->post['post_type'];
     //$post_type=$this->_postType;
     if ($zebraForm->preview) {
         // add temporary content for form preview
         //$obj=$zebraForm->add('textarea', StaticClass::PREFIX.'form_preview_content', $preview_content, array('style'=>'display:none;'));
         $zebraForm->add2form_content('textarea', StaticClass::PREFIX . 'form_preview_content', $preview_content, array('style' => 'display:none;'));
         // add temporary content for form preview (not added automatically as there is no shortcode to render this)
         //$this->_form_content.=$obj->toHTML();
         // hidden fields are rendered automatically
         //$obj=$zebraForm->add('hidden',StaticClass::PREFIX.'form_preview_post_type', $post_type, array('style'=>'display:none;'));
         $obj = $zebraForm->add2form_content('hidden', StaticClass::PREFIX . 'form_preview_post_type', $post_type, array('style' => 'display:none;'));
         //$obj=$zebraForm->add('hidden',StaticClass::PREFIX.'form_preview_form_type', $form_type, array('style'=>'display:none;'));
         $obj = $zebraForm->add2form_content('hidden', StaticClass::PREFIX . 'form_preview_form_type', $form_type, array('style' => 'display:none;'));
         if ($_fields['form_settings']->form['has_media_button']) {
             //$zebraForm->add_form_error('preview_media', __('Media Upload will not work with form preview','wp-cred'));
             $zebraForm->add_field_message(__('Media Upload will not work with form preview', 'wp-cred'));
         }
         //https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/195892843/comments#309778558
         //Created a separated preview messages
         //$zebraForm->add_form_message('preview_mode', __('Form Preview Mode','wp-cred'));
         $zebraForm->add_preview_message(__('Form Preview Mode', 'wp-cred'));
     }
     // hidden fields are rendered automatically
     // add form id
     //$obj=$zebraForm->add('hidden', StaticClass::PREFIX.'form_id', $form_id, array('style'=>'display:none;'));
     $obj = $zebraForm->add2form_content('hidden', StaticClass::PREFIX . 'form_id', $form_id, array('style' => 'display:none;'));
     //$out_['form_id_field']=$obj->attributes['id'];
     // add form count
     //$obj=$zebraForm->add('hidden', StaticClass::PREFIX.'form_count', $form_count, array('style'=>'display:none;'));
     $obj = $zebraForm->add2form_content('hidden', StaticClass::PREFIX . 'form_count', $form_count, array('style' => 'display:none;'));
     //$out_['form_count_field']=$obj->attributes['id'];
     // check conditional expressions for javascript
     //$formHelper->parseConditionalExpressions($out_);
     if (!empty(StaticClass::$_mail_error)) {
         echo '<label id="lbl_generic" class="wpt-form-error">' . StaticClass::$_mail_error . "</label>";
         StaticClass::$_mail_error = "";
         delete_option('_' . $form_id . '_last_mail_error');
     }
     // Set cache variable for all forms ( Custom JS)
     $js_content = $_fields['extra']->js;
     if (!empty($js_content)) {
         $custom_js_cache = wp_cache_get('cred_custom_js_cache');
         if (false === $custom_js_cache) {
             $custom_js_cache = '';
         }
         $custom_js_cache .= "\n\n" . $js_content;
         wp_cache_set('cred_custom_js_cache', $custom_js_cache);
     }
     // Set cache variable for all forms ( Custom CSS)
     $css_content = $_fields['extra']->css;
     if (!empty($css_content)) {
         $custom_css_cache = wp_cache_get('cred_custom_css_cache');
         if (false === $custom_css_cache) {
             $custom_css_cache = '';
         }
         $custom_css_cache .= "\n\n" . $css_content;
         wp_cache_set('cred_custom_css_cache', $custom_css_cache);
     }
     //$js_content = $_fields['extra']->js;
     //$zebraForm->addJsFormContent($js_content);
     //$css_content = $js_content = $_fields['extra']->css;
 }
function wpv_pager_next_page_shortcode($atts, $value)
{
    extract(shortcode_atts(array(), $atts));
    global $WP_Views;
    $page = $WP_Views->get_current_page_number();
    $view_settings = $WP_Views->get_view_settings();
    $display = false;
    if ($view_settings['pagination']['mode'] == 'rollover') {
        $display = true;
    } else {
        if ($page < $WP_Views->get_max_pages()) {
            $display = true;
        }
    }
    if ($WP_Views->get_max_pages() <= 1.0) {
        // only 1 page so we display nothing.
        $display = false;
    }
    if ($display) {
        $page++;
        $value = wpv_do_shortcode($value);
        $ajax = $view_settings['ajax_pagination'][0] == 'enable' ? 'true' : 'false';
        $effect = isset($view_settings['ajax_pagination']['style']) ? $view_settings['ajax_pagination']['style'] : 'fade';
        $stop_rollover = 'false';
        if ($view_settings['pagination']['mode'] == 'rollover') {
            $ajax = 'true';
            $effect = $view_settings['rollover']['effect'];
            $stop_rollover = 'true';
            if ($effect == 'slideright') {
                $effect = 'slideleft';
            }
            if ($effect == 'slideup') {
                $effect = 'slidedown';
            }
        }
        $cache_pages = $view_settings['pagination']['cache_pages'];
        $preload_pages = $view_settings['pagination']['preload_pages'];
        $spinner = $view_settings['pagination']['spinner'];
        $spinner_image = $view_settings['pagination']['spinner_image'];
        // $spinner_image might contain SSL traces, adjust if needed
        if (!is_ssl()) {
            $spinner_image = str_replace('https://', 'http://', $spinner_image);
        }
        $callback_next = $view_settings['pagination']['callback_next'];
        // adjust pages when reaching beyond the last or first
        if ($page <= 0) {
            $page = $WP_Views->get_max_pages();
        } else {
            if ($page > $WP_Views->get_max_pages()) {
                $page = 1;
            }
        }
        return '<a href="#" data-viewnumber="' . $WP_Views->get_view_count() . '" data-page="' . $page . '" data-ajax="' . $ajax . '" data-effect="' . $effect . '" data-maxpages="' . $WP_Views->get_max_pages() . '" data-cachepages="' . $cache_pages . '" data-preloadimages="' . $preload_pages . '" dapa-spinner="' . $spinner . '" data-spinnerimage="' . $spinner_image . '" data-callbacknext="' . $callback_next . '" data-stoprollover="' . $stop_rollover . '" class="wpv-filter-next-link js-wpv-pagination-next-link">' . $value . '</a>';
    } else {
        return '';
    }
}
Example #12
0
/**
 * Views-Shortcode: wpv-if
 *
 * Description: Conditional shortcode to be used to display a specific area
 * based on a custom field condition. \n
 * Supported actions and symbols:\n
 * Integer and floating-point numbers \n
 * Math operators: +, -, *, / \n
 * Comparison operators: &lt;, &gt;, =, &lt;=, &gt;=, != \n
 * Boolean operators: AND, OR, NOT \n
 * Nested expressions - several levels of parentheses \n
 * Variables defined as shortcode parameters starting with a dollar sign \n
 * empty() function that checks for empty or non-existing fields
 *
 * Parameters:
 * 'condition' => Define expected result from evaluate - either true or false
 * 'evaluate' => Evaluate expression with fields involved, sample use: "($field1 > $field2) AND !empty($field3)"
 * 'debug' => Enable debug to display error messages in the shortcode 
 * 'fieldX' => Define fields to be taken into account during evaluation 
 *
 * Example usage:
 * [wpv-if evaluate="boolean condition"]
 *    Execute code for true
 * [/wpv-if]
 * Sing a variable and comparing its value to a constant
 * [wpv-if f1="wpcf-condnum1" evaluate="$f1 = 1" debug="true"]Number1=1[/wpv-if]
 * Two numeric variables in a mathematical expression with boolean operators
 * [wpv-if f1="wpcf-condnum1" f2="wpcf-condnum2" evaluate="(2 < 3 AND (((3+$f2)/2) > 3 OR NOT($f1 > 3)))" debug="true"]Visible block[/wpv-if]
 * Compare custom field with a value
 * [wpv-if f1="wpcf-condstr1" evaluate="$f1 = 'My text'" debug="true"]Text1='My text' [/wpv-if]
 * Display condition if evaluates to false (use instead of else-if)
 * [wpv-if condition="false" evaluate="2 > 3"] 2 > 3 [/wpv-if]
 * Custom function support
 * [wpv-if evaluate="my_func() = '1'"]my_func returns 1[/wpv-if]
 *
 * Link:
 * <a href="http://wp-types.com/documentation/user-guides/conditional-html-output-in-views/?utm_source=viewsplugin&utm_campaign=views&utm_medium=views-conditional-help-link&utm_term=Conditional HTML output in Views">Conditional HTML output in Views</a>
 *
 * Note:
 *
 */

function wpv_shortcode_wpv_if( $args, $content ) {
	$evaluation_result = wpv_condition_manage_and_evaluate( $args );
    extract(
        shortcode_atts( 
			array(
				'evaluate' => false, 
				'debug' => false, 
				'condition' => true
			), 
			$args
		)
    );
    $condition = ( $condition == 'true' || $condition === TRUE ) ? true : false;
	$out = '';
    
    if (
		( 
			$evaluation_result['result'] === true 
			&& $condition 
		) 
		|| ( 
			$evaluation_result['result'] === false 
			&& ! $condition 
		)
	) {
		
		if ( strpos( $content, 'wpv-b64-' ) === 0) {
			$content = substr( $content, 7 );
			$content = base64_decode( $content );
		}

    	$out = wpv_do_shortcode( $content );
    	apply_filters('wpv_shortcode_debug','wpv-if', json_encode( $args ), '', 'Conditional output: evaluated to true', $out );
    } else {
		$out = '';
    	if ( 
			( 
				$evaluation_result['result'] === false 
				&& $condition
			) 
			|| (
				$evaluation_result['result'] === true 
				&& ! $condition
			) 
		) {
			apply_filters('wpv_shortcode_debug','wpv-if', json_encode( $args ), '', 'Conditional output: evaluated to false');
    	} else {
			apply_filters('wpv_shortcode_debug','wpv-if', json_encode( $args ), '', 'Conditional output: error', $evaluation_result['debug'] );
    	}
    }
	if ( 
		$debug 
		&& current_user_can( 'manage_options' )
	) {
		$out .= '<pre>' . $evaluation_result['debug'] . '</pre>';
	}
	return $out;
}
Example #13
0
function wpv_archive_pager_next_page_shortcode( $atts, $value ) {
	return get_previous_posts_link( wpv_do_shortcode( $value ) );
}
/**
 * Views-Shortcode: wpv-for-each
 *
 * Description: Iterate through multple items in a post meta field and output the enclosed text for each item
 *
 * Parameters:
 * 'field' => The name of post meta field.
 *
 * Example usage:
 * Output the field values as an ordered list
 * <ol>[wpv-for-each field="my-field"]<li>[wpv-post-field name="my-field"]</li>[/wpv-for-each]<ol>
 *
 * Link:
 *
 * Note:
 * <a href="#wpv-if">wpv-if</a> shortcode won't work inside a wpv-for-each shortcode
 */
function wpv_for_each_shortcode($atts, $value)
{
    extract(shortcode_atts(array('field' => '', 'start' => 1, 'end' => null), $atts));
    if (strpos($value, 'wpv-b64-') === 0) {
        $value = substr($value, 7);
        $value = base64_decode($value);
    }
    if ($field == '') {
        return wpv_do_shortcode($value);
    }
    $out = '';
    global $post;
    if (!empty($post)) {
        $meta = get_post_meta($post->ID, $field);
        if (!$meta) {
            // return $value; // old behaviour
            // This happens when there is no meta with that key asociated with that post, so return nothing
            // From 1.4
            return '';
        }
        // When the metavalue for this key is empty, $meta is an array with just an empty first element
        // In that case, return nothing either
        // From 1.4
        if (is_array($meta) && count($meta) == 1 && empty($meta[0])) {
            return '';
        }
        $start = (int) $start;
        $start = $start - 1;
        if (is_null($end)) {
            $end = count($meta);
        }
        $end = (int) $end;
        if ($start < 0) {
            $start = 0;
        }
        if ($end > count($meta)) {
            $end = count($meta);
        }
        $inner_loopers = "/\\[(wpv-post-field|types).*?\\]/i";
        $counts = preg_match_all($inner_loopers, $value, $matches);
        $value_arr = array();
        for ($i = $start; $i < $end; $i++) {
            // Set indexes in the wpv-post-field shortcode
            if ($counts > 0) {
                $new_value = $value;
                foreach ($matches[0] as $index => $match) {
                    // execute shortcode content and replace
                    $shortcode = $matches[1][$index];
                    $apply_index = wpv_should_apply_index_for_each_field($shortcode, $match, $field);
                    if ($apply_index) {
                        $resolved_match = str_replace('[' . $shortcode . ' ', '[' . $shortcode . ' index="' . $i . '" ', $match);
                        $new_value = str_replace($match, $resolved_match, $new_value);
                    }
                }
                $value_arr[] = $new_value;
            } else {
                $value_arr[] = $value;
            }
        }
        $out .= implode('', $value_arr);
    }
    apply_filters('wpv_shortcode_debug', 'wpv-for-each', json_encode($atts), '', 'Data received from cache.', $out);
    return $out;
}
function wpv_shortcode_wpv_filter_spinner( $atts, $value ) {
	extract(
		shortcode_atts(array(
				'container' => 'span',
				'class' => '',
				'position' => 'before',
				'spinner' => '',
                'style' => ''
			), $atts)
	);
	
	if (
		empty( $spinner ) 
		&& ! empty( $position )
		&& $position != 'none'
	) {
		// Keep the spinner coming from the View settings for backward compatibility
		global $WP_Views;
		$view_settings = $WP_Views->get_view_settings();
		if (
			isset( $view_settings['dps'] ) 
			&& isset( $view_settings['dps']['spinner'] ) 
			&& $view_settings['dps']['spinner'] != 'none'
		) {
			if ( $view_settings['dps']['spinner'] == 'custom' ) {
				if ( isset( $view_settings['dps']['spinner_image_uploaded'] ) ) {
					$spinner = $view_settings['dps']['spinner_image_uploaded'];
				}
			} else if ( $view_settings['dps']['spinner'] == 'inhouse' ) {
				if ( isset( $view_settings['dps']['spinner_image'] ) ) {
					$spinner = $view_settings['dps']['spinner_image'];
				}
			}
		}
	}
	
	// $spinner_image might contain SSL traces, adjust if needed
	if ( !is_ssl() ) {
		$spinner = str_replace( 'https://', 'http://', $spinner );
	}
	
    if ( ! empty( $style ) ) {
        $style = '; '. esc_attr( $style );
    }
    
	$return = '<' . $container . ' style="display:none'. $style .'" class="js-wpv-dps-spinner';
	if ( !empty( $class ) ) {
		$return .= ' ' . $class;
	}
	$return .= '">';
	if ( ! empty( $position ) && ! empty( $spinner ) && $position == 'before' ) {
		$return .= '<img src="' . $spinner . '" />';
	}
	$return .= wpv_do_shortcode( $value );
	if ( ! empty( $position ) && ! empty( $spinner ) && $position == 'after' ) {
		$return .= '<img src="' . $spinner . '" />';
	}
	$return .= '</' . $container . '>';
	return $return;
}
function wpv_for_each_shortcode($atts, $value)
{
    extract(shortcode_atts(array('field' => ''), $atts));
    if ($field == '') {
        return wpv_do_shortcode($value);
    }
    $out = '';
    global $post, $wpv_for_each_index;
    if (!empty($post)) {
        $meta = get_post_meta($post->ID, $field);
        if (!$meta) {
            // return $value; // old behaviour
            // This happens when there is no meta with that key asociated with that post, so return nothing
            // From 1.4
            return '';
        }
        // When the metavalue for this key is empty, $meta is an array with just an empty first element
        // In that case, return nothing either
        // From 1.4
        if (is_array($meta) && count($meta) == 1 && empty($meta[0])) {
            return '';
        }
        // iterate through the items and set the for-each index
        $wpv_for_each_index[] = 0;
        for ($i = 0; $i < count($meta); $i++) {
            // set the for-each index and output
            $wpv_for_each_index[count($wpv_for_each_index) - 1] = $i;
            $out .= wpv_do_shortcode($value);
        }
        array_pop($wpv_for_each_index);
    }
    apply_filters('wpv_shortcode_debug', 'wpv-for-each', json_encode($atts), '', 'Data received from cache.', $out);
    return $out;
}
 /**
  * Render the view and loops through the found posts
  *
  */
 function render_view($view_id, $hash)
 {
     global $post;
     global $wplogger;
     static $processed_views = array();
     // increment the view count.
     if (!isset($this->view_count[$this->view_depth])) {
         $this->view_count[$this->view_depth] = 0;
     }
     $this->view_count[$this->view_depth]++;
     $view = get_post($view_id);
     $this->view_used_ids[] = $view_id;
     $out = '';
     /*
     $css = get_post_meta($view_id, '_wpv_css', true);
     if ($css) {
         $out .= "<style type='text/css'>\n";
         $out .= $css;
         $out .= "\n</style>";
     }
     */
     $view_caller_id = isset($post) && isset($post->ID) ? get_the_ID() : 0;
     // post or widget
     if (!isset($processed_views[$view_caller_id][$hash]) || 0 === $view_caller_id) {
         //$processed_views[$view_caller_id][$hash] = true; // mark view as processed for this post
         if (!empty($view)) {
             $post_content = $view->post_content;
             // apply the layout meta html if we have some.
             $view_layout_settings = $this->get_view_layout_settings();
             if (isset($view_layout_settings['layout_meta_html'])) {
                 $post_content = str_replace('[wpv-layout-meta-html]', $view_layout_settings['layout_meta_html'], $post_content);
             }
             $post_content = wpml_content_fix_links_to_translated_content($post_content);
             $view_settings = $this->get_view_settings();
             // find the loop
             if (preg_match('#\\<wpv-loop(.*?)\\>(.*)</wpv-loop>#is', $post_content, $matches)) {
                 // get the loop arguments.
                 $args = $matches[1];
                 $exp = array_map('trim', explode(' ', $args));
                 $args = array();
                 foreach ($exp as $e) {
                     $kv = explode('=', $e);
                     if (sizeof($kv) == 2) {
                         $args[$kv[0]] = trim($kv[1], '\'"');
                     }
                 }
                 if (isset($args['wrap'])) {
                     $args['wrap'] = intval($args['wrap']);
                 }
                 if (isset($args['pad'])) {
                     $args['pad'] = $args['pad'] == 'true';
                 } else {
                     $args['pad'] = false;
                 }
                 $tmpl = $matches[2];
                 $item_indexes = $this->_get_item_indexes($tmpl);
                 if ($view_settings['query_type'][0] == 'posts') {
                     // get the posts using the query settings for this view.
                     $archive_query = null;
                     if ($view_settings['view-query-mode'] == 'archive') {
                         // check for an archive loop
                         global $WPV_view_archive_loop;
                         if (isset($WPV_view_archive_loop)) {
                             $archive_query = $WPV_view_archive_loop->get_archive_loop_query();
                         }
                     }
                     if ($archive_query) {
                         $this->post_query = $archive_query;
                     } else {
                         $this->post_query = wpv_filter_get_posts($view_id);
                     }
                     $items = $this->post_query->posts;
                     $wplogger->log('Found ' . count($items) . ' posts');
                     if ($wplogger->isMsgVisible(WPLOG_DEBUG)) {
                         // simplify the output
                         $out_items = array();
                         foreach ($items as $item) {
                             $out_items[] = array('ID' => $item->ID, 'post_title' => $item->post_title);
                         }
                         $wplogger->log($out_items, WPLOG_DEBUG);
                     }
                 }
                 // save original post
                 global $post, $authordata, $id;
                 $tmp_post = isset($post) ? clone $post : null;
                 if ($authordata) {
                     $tmp_authordata = clone $authordata;
                 } else {
                     $tmp_authordata = null;
                 }
                 $tmp_id = $id;
                 if ($view_settings['query_type'][0] == 'taxonomy') {
                     $items = $this->taxonomy_query($view_settings);
                     $wplogger->log($items, WPLOG_DEBUG);
                     // taxonomy views can be recursive so remove from
                     // the processed array
                     //unset($processed_views[$view_caller_id][$hash]);
                 }
                 $loop = '';
                 for ($i = 0; $i < count($items); $i++) {
                     $index = $i;
                     if (isset($args['wrap'])) {
                         $index %= $args['wrap'];
                     }
                     $index++;
                     // [wpv-item index=xx] uses base 1
                     $index = strval($index);
                     if ($view_settings['query_type'][0] == 'posts') {
                         $post = clone $items[$i];
                         $authordata = new WP_User($post->post_author);
                         $id = $post->ID;
                         $temp_variables = $this->variables;
                         $this->variables = array();
                         do_action('wpv-before-display-post', $post, $view_id);
                     }
                     if ($view_settings['query_type'][0] == 'taxonomy') {
                         $this->taxonomy_data['term'] = $items[$i];
                     }
                     // first output the "all" index.
                     $loop .= wpv_do_shortcode($item_indexes['all']);
                     // Output each index we find
                     // otherwise output 'other'
                     if (isset($item_indexes[$index])) {
                         $loop .= wpv_do_shortcode($item_indexes[$index]);
                     } elseif (isset($item_indexes['other'])) {
                         $loop .= wpv_do_shortcode($item_indexes['other']);
                     }
                     if ($view_settings['query_type'][0] == 'posts') {
                         do_action('wpv-after-display-post', $post, $view_id);
                         $this->variables = $temp_variables;
                     }
                 }
                 // see if we should pad the remaining items.
                 if (isset($args['wrap']) && isset($args['pad'])) {
                     while ($i % $args['wrap'] && $args['pad']) {
                         $index = $i;
                         $index %= $args['wrap'];
                         if ($index == $args['wrap'] - 1) {
                             $loop .= wpv_do_shortcode($item_indexes['pad-last']);
                         } else {
                             $loop .= wpv_do_shortcode($item_indexes['pad']);
                         }
                         $i++;
                     }
                 }
                 $out .= str_replace($matches[0], $loop, $post_content);
                 $post = isset($tmp_post) ? clone $tmp_post : null;
                 // restore original $post
                 if ($tmp_authordata) {
                     $authordata = clone $tmp_authordata;
                 } else {
                     $authordata = null;
                 }
                 $id = $tmp_id;
             }
         } else {
             $out .= sprintf('<!- %s ->', __('View not found', 'wpv-views'));
         }
     } else {
         if ($processed_views[$view_caller_id][$hash] !== true) {
             $out .= $processed_views[$view_caller_id][$hash];
             // use output from cache
         }
     }
     return $out;
 }
function wpv_no_taxonomy_found($atts, $value)
{
    extract(shortcode_atts(array(), $atts));
    global $WP_Views;
    if ($WP_Views->get_taxonomy_found_count() == 0) {
        // display the message when no taxonomys are found.
        return wpv_do_shortcode($value);
    } else {
        return '';
    }
}
function wpv_shortcode_wpv_filter_controls($atts, $value)
{
    /**
     *
     * This is a do nothing shortcode. It's just a place holder for putting the
     * wpv-control shortcodes and allows for easier editing inside the meta HTML
     *
     */
    $value = str_replace("<!-- ADD USER CONTROLS HERE -->", '', $value);
    return wpv_do_shortcode($value);
}
function wpv_pager_next_page_shortcode( $atts, $value ) {
    extract(
        shortcode_atts(
			array(
                'style' => '',
                'class' => ''
            ), 
			$atts
		)
    );

    global $WP_Views;
    $page = $WP_Views->get_current_page_number();
    $view_settings = $WP_Views->get_view_settings();
	
    $display = false;
    if ( 
		$WP_Views->get_max_pages() > 1.0 
		&& (
			$view_settings['pagination']['mode'] == 'rollover'
			|| $page < $WP_Views->get_max_pages()
		)
	) {
        $display = true;
    }

    if ( $display ) {
        $page++;
        $value = wpv_do_shortcode( $value );
		$pagination_data = wpv_get_view_pagination_data( $view_settings );
		if ( $view_settings['pagination']['mode'] == 'rollover' ) {
            if ( $pagination_data['effect'] == 'slideright' ) {
                $pagination_data['effect'] = 'slideleft';
            } else if ( $pagination_data['effect'] == 'slideup' ) {
                $pagination_data['effect'] = 'slidedown';
            }
        }
		
		if ( ! empty( $style ) ) {
            $style = ' style="'. esc_attr( $style ) .'"';
        }
        if ( ! empty( $class ) ) {
            $class = ' ' . esc_attr( $class );
        } 
        // adjust pages when reaching beyond the last or first
        if ( $page <= 0 ) {
            $page = $WP_Views->get_max_pages();
        } else if ( $page > $WP_Views->get_max_pages() ) {
            $page = 1;
        }
        
		$return = '<a href="#"'
			. ' data-viewnumber="' . esc_attr( $WP_Views->get_view_count() ) . '"'
			. ' data-page="' . esc_attr( $page ) . '"'
			. ' data-ajax="' . esc_attr( $pagination_data['ajax'] ) . '"'
			. ' data-effect="' . esc_attr( $pagination_data['effect'] ) . '"'
			. ' data-maxpages="' . esc_attr( $WP_Views->get_max_pages() ) . '"'
			. ' data-cachepages="' . esc_attr( $pagination_data['cache_pages'] ) . '"'
			. ' data-preloadimages="' . esc_attr( $pagination_data['preload_pages'] ) . '"'
			. ' data-spinner="' . esc_attr( $pagination_data['spinner'] ) . '"'
			. ' data-spinnerimage="' . esc_attr( $pagination_data['spinner_image'] ) . '"'
			. ' data-callbacknext="' . esc_attr( $pagination_data['callback_next'] ) . '"'
			. ' data-stoprollover="' . esc_attr( $pagination_data['stop_rollover'] ) . '"'
			. ' class="wpv-filter-next-link js-wpv-pagination-next-link'. $class .'"'. $style .'>' 
			. $value 
			. '</a>';
			
		return $return;
    } else {
        return '';
    }
}