Ejemplo n.º 1
0
/**
 * Returns all search instances with decoded data
 *
 * @return array of search instances
 */
function get_search_instances_and_data()
{
    $instances = get_search_instances();
    foreach ($instances as $k => $instance) {
        $instances[$k]['data'] = json_decode($instance['data'], true);
    }
    return $instances;
}
Ejemplo n.º 2
0
 public function integrateWithVC()
 {
     // Check if Visual Composer is installed
     if (!defined('WPB_VC_VERSION')) {
         return;
     }
     $instances = get_search_instances();
     $vc_asp_instances = array();
     foreach ($instances as $k => $v) {
         $vc_asp_instances[] = "(" . $v['id'] . ") " . $v['name'];
     }
     /* Return if there are no search instances created */
     if (count($vc_asp_instances) < 1) {
         return false;
     }
     /* The search bar shortcode */
     vc_map(array("name" => "Search shortcode", "description" => "Adds a search bar.", "base" => "vc_asp_search", "class" => "", "controls" => "full", "icon" => plugins_url('assets/magnifier.png', __FILE__), "category" => __('Ajax Search Pro', 'js_composer'), "params" => array(array("type" => "dropdown", "holder" => "", "class" => "", "heading" => __("Search instance", 'vc_extend'), "param_name" => "id", "value" => $vc_asp_instances, "description" => __("Select the search instance to show", 'vc_extend')), array("type" => "textfield", "holder" => "", "class" => "", "heading" => __("Extra class names", 'vc_extend'), "param_name" => "extra_class", "value" => "", "description" => __("An extra class names for the search field", 'vc_extend')))));
     /* Results shortcode */
     vc_map(array("name" => "Results shortcode", "description" => "Adds a results list.", "base" => "vc_asp_results", "class" => "", "controls" => "full", "icon" => plugins_url('assets/results.png', __FILE__), "category" => __('Ajax Search Pro', 'js_composer'), "params" => array(array("type" => "dropdown", "holder" => "", "class" => "", "heading" => __("Search instance", 'vc_extend'), "param_name" => "id", "value" => $vc_asp_instances, "description" => __("Select the search instance to show", 'vc_extend')), array("type" => "textfield", "holder" => "", "class" => "", "heading" => __("Extra class names", 'vc_extend'), "param_name" => "extra_class", "value" => "", "description" => __("An extra class names for the search field", 'vc_extend')))));
     /* Settings shortcode */
     vc_map(array("name" => "Settings shortcode", "description" => "Adds a settings list.", "base" => "vc_asp_settings", "class" => "", "controls" => "full", "icon" => plugins_url('assets/settings.png', __FILE__), "category" => __('Ajax Search Pro', 'js_composer'), "params" => array(array("type" => "dropdown", "holder" => "", "class" => "", "heading" => __("Search instance", 'vc_extend'), "param_name" => "id", "value" => $vc_asp_instances, "description" => __("Select the search instance to show", 'vc_extend')), array("type" => "textfield", "holder" => "", "class" => "", "heading" => __("Extra class names", 'vc_extend'), "param_name" => "extra_class", "value" => "", "description" => __("An extra class names for the search field", 'vc_extend')))));
     /* Settings shortcode */
     vc_map(array("name" => "Two column shortcode", "description" => "Adds a search box and a result list next to it.", "base" => "vc_asp_twocolumn", "class" => "", "controls" => "full", "icon" => plugins_url('assets/twocolumn.png', __FILE__), "category" => __('Ajax Search Pro', 'js_composer'), "params" => array(array("type" => "dropdown", "holder" => "", "class" => "", "heading" => __("Search instance", 'vc_extend'), "param_name" => "id", "value" => $vc_asp_instances, "description" => __("Select the search instance to show", 'vc_extend')), array("type" => "textfield", "holder" => "", "class" => "", "heading" => __("Search width (%)", 'vc_extend'), "param_name" => "search_width", "value" => 50, "description" => __("The search field width in %", 'vc_extend')), array("type" => "textfield", "holder" => "", "class" => "", "heading" => __("Result list width (%)", 'vc_extend'), "param_name" => "results_width", "value" => 50, "description" => __("Result list width in %", 'vc_extend')), array("type" => "dropdown", "holder" => "", "class" => "", "heading" => __("Layout", 'vc_extend'), "param_name" => "invert", "value" => array("Search left, results right", "Results left, search right"), "description" => __("Select the search instance to show", 'vc_extend')), array("type" => "textfield", "holder" => "", "class" => "", "heading" => __("Extra class names", 'vc_extend'), "param_name" => "extra_class", "value" => "", "description" => __("An extra class names for the search field", 'vc_extend')))));
 }