public function javo_item_price_callback($atts, $content = "") { global $post; $temp = $post; $errors = new wp_error(); if (!defined('PMPRO_VERSION')) { $errors->add('test-error', __('Please activate "Paid Membership Pro" plugin to use price table shortcodes.', 'javo_fr')); } extract(shortcode_atts(array('title' => '', 'sub_title' => '', 'title_text_color' => '#000', 'sub_title_text_color' => '#000', 'line_color' => '#fff'), $atts)); if ($errors->get_error_code() != null) { ob_start(); ?> <div class="alert alert-danger"> <strong><?php _e('Error!', 'javo_fr'); ?> </strong> <div><?php echo $errors->get_error_message(); ?> </div> </div> <?php return ob_get_clean(); } $pmpro_levels = pmpro_getAllLevels(); ob_start(); echo apply_filters('javo_shortcode_title', $title, $sub_title, array('title' => 'color:' . $title_text_color . ';', 'subtitle' => 'color:' . $sub_title_text_color . ';', 'line' => 'border-color:' . $line_color . ';')); $post->post_content = "[pmpro_levels]"; if (function_exists('pmpro_wp')) { pmpro_wp(); } echo do_shortcode('[pmpro_levels]'); $post = $temp; return ob_get_clean(); }
public static function callback($atts, $content = '') { global $javo_tso; extract(shortcode_atts(array('list_id' => ''), $atts)); $errors = new wp_error(); $javo_cmp_action = trailingslashit(home_url()); // Parameter // API KEY if ('' === $javo_tso->get('mailchimp_api', '')) { $errors->add('mailchimp-no-api', sprintf("<strong>%s</strong><br>%s", __("The API Key does not exist", 'javo_fr'), __("Please insert API Key in Theme Settings > General > API Key", 'javo_fr'))); } // MAILCHIMP LIST if ('' === $list_id) { $errors->add('mailchimp-no-list', sprintf("<strong>%s</strong><br>%s", __("List is not selected.", 'javo_fr'), __("Please select list in Shortcode Edit.", 'javo_fr'))); } ob_start(); if (!count($errors->get_error_codes()) > 0) { ?> <div id="javo_mailchimp" class="javo-mailchimp-container"> <form id="newsletter-form" name="newsletter-form" data-url="<?php echo $javo_cmp_action; ?> " method="post" role="form"> <div class="javo-mailchimp-wrap"> <div class="form-group javo-mailchimp-inner"> <div class="input-group input-group-sm javo-mailchimp-inner-name"> <!--<label class="input-group-addon" for="javo_cmp_name"> <span class="glyphicon glyphicon-envelope"></span> </label>--> <input type="text" name="yname" id="javo_cmp_name" class="javo-mailchimp-inner-name-input" placeholder="<?php _e("Your name", 'javo_fr'); ?> " class="form-control" required> </div><!-- /.input-group --> <div class="input-group input-group-sm javo-mailchimp-inner-mail"> <input type="email" name="mc_email" id="javo_cmp_email" class="javo-mailchimp-inner-mail-input"placeholder="<?php _e("Your email", 'javo_fr'); ?> " class="form-control" required> <div class="form-group javo-mailchimp-inner-sand"> <button type="submit" class="btn btn-primary javo-mailchimp-inner-sand-icon"> <span><i class="fa fa-location-arrow"><?php _e("", 'javo_fr'); ?> </i></span> </button> </div><!--javo-mailchimp-inner-sand--> </div><!-- /.input-group --> </div><!-- /.form-group --> </div> <fieldset> <input type="hidden" name="javo_mailchimp_security" value="<?php echo wp_create_nonce("javo-mailchimp-shortcode"); ?> "> <input type="hidden" name="cm_list" value="<?php echo $list_id; ?> "> <input type="hidden" name="ajaxurl" value="<?php echo admin_url("admin-ajax.php"); ?> "> <input type="hidden" name="no_msg" value="<?php _e("Failed to register", 'javo_fr'); ?> "> </fieldset> </form> </div> <?php } else { ?> <div class="well well-sm"> <span class="glyphicon glyphicon-exclamation-sign"></span> <?php foreach ($errors->get_error_messages() as $messages) { echo "<p>{$messages}</p>"; } ?> </div> <?php } // End if return ob_get_clean(); }
public static function javo_search_form_callback($atts, $content = '') { global $javo_tso; extract(shortcode_atts(array('action' => '', 'hide_field' => array()), $atts)); $errors = new wp_error(); $javo_query = new javo_ARRAY($_GET); $javo_redirect = home_url(); if ($action == 'map') { $javo_tso_map_result = $javo_tso->get('page_item_result', null); if ((int) $javo_tso_map_result <= 0 && !is_archive() && !is_search()) { $errors->add('no-set-search-result', __("There is no Javo map (box style) (Setup : Theme Setting > Item Page > Search Result )", 'javo_fr')); } else { $javo_redirect = get_permalink($javo_tso_map_result); } } $hide_field = @explode(',', $hide_field); if (!empty($hide_field)) { foreach ($hide_field as $idx => $item) { $hide_field[$item] = 'hide'; unset($hide_field[$idx]); } } $javo_this_onoff = new javo_ARRAY($hide_field); if ($errors->get_error_code() != "") { ob_start(); echo "<div class='container'><div class='alert alert-warning' role='alert'>{$errors->get_error_message()}}</div></div>"; return ob_get_clean(); } ob_start(); ?> <div class="container search-type-a-wrap"> <form role="form" data-javo-search-form> <div class="search-type-a-inner"> <div class="search-box-inline<?php echo $javo_this_onoff->get('keyword', null) == 'hide' ? ' hidden' : ''; ?> "> <input type="text" class="search-a-items form-control" name="s" placeholder="<?php _e('Keyword', 'javo_fr'); ?> " value="<?php echo $javo_query->get('s', null); ?> "> </div><!-- /.search-box-inline --> <div class="search-box-inline<?php echo $javo_this_onoff->get('category', null) == 'hide' ? ' hidden' : ''; ?> "> <select name="filter[item_category]" class="form-control"> <option value=""><?php _e('Category', 'javo_fr'); ?> </option> <?php echo apply_filters('javo_get_selbox_child_term_lists', 'item_category', null, 'select', $javo_query->get('category', 0), 0, 0, "-"); ?> </select> </div><!-- /.search-box-inline --> <div class="search-box-inline<?php echo $javo_this_onoff->get('location', null) == 'hide' ? ' hidden' : ''; ?> "> <select name="filter[item_location]" class="form-control"> <option value=""><?php _e('Location', 'javo_fr'); ?> </option> <?php echo apply_filters('javo_get_selbox_child_term_lists', 'item_location', null, 'select', $javo_query->get('location', 0), 0, 0, "-"); ?> </select> </div><!-- /.search-box-inline --> <div class="search-box-inline"> <input type="submit" class="btn btn-block btn-primary admin-color-setting" value="<?php _e('Search', 'javo_fr'); ?> "> </div><!-- /.col-md-2 --> </div> <!-- search-type-a-inner --> </form> <fieldset> <input type="hidden" value="<?php echo (int) $action > 0 ? get_permalink($action) : null; ?> " data-javo-search-action-template-url> <input type="hidden" value="<?php echo $action == 'map' ? 'data-javo-patch-form-for-template' : 'data-javo-patch-form-for-result'; ?> " data-javo-search-form-action-type> </fieldset> <!-- Search Result Page --> <form action="<?php echo home_url('/'); ?> " method="get" data-javo-patch-form-for-result> <input type="hidden" name="post_type" value="item"> <input type="hidden" name="category" value="<?php echo $javo_query->get('category'); ?> " data-javo-sf-category> <input type="hidden" name="location" value="<?php echo $javo_query->get('location'); ?> " data-javo-sf-location> <input type="hidden" name="s" data-javo-sf-keyword> </form><!-- /data-javo-patch-form-for-result : Go to Archive Page --> <!-- Javo Map Template --> <form action="<?php echo $javo_redirect; ?> " method="post" data-javo-patch-form-for-template> <input type="hidden" name="filter[item_category]" value="<?php echo $javo_query->get('category'); ?> " data-javo-sf-category> <input type="hidden" name="filter[item_location]" value="<?php echo $javo_query->get('location'); ?> " data-javo-sf-location> <input type="hidden" name="keyword" data-javo-sf-keyword> </form><!-- /data-javo-patch-form-for-template : Go to Map --> </div> <!-- container search-type-a-wrap --> <script type="text/javascript"> jQuery(function($){ var javo_search_bar_script = { el:{ origin: '[data-javo-search-form]' , result: '[data-javo-patch-form-for-result]' , template: '[data-javo-patch-form-for-template]' , type: '[data-javo-search-form-action-type]' } , template_url: $('[data-javo-search-action-template-url]').val() , msg: function(str){ $.javo_msg({content:str, delay:10000}); } , init: function(){ var $cat = this.setAutoComplete('[name="filter[item_category]"]'); var $loc = this.setAutoComplete('[name="filter[item_location]"]'); $(document) .on('submit', this.el.origin, this.submit) } , setAutoComplete: function(el){ $(this.el.origin).find(el).chosen(); return $(this.el.origin).find(el); } , submit: function(e){ e.preventDefault(); var o = javo_search_bar_script; var r = $( o.el.origin ); var t = $('[' + $(o.el.type).val() + ']'); t.find('[data-javo-sf-category]').val( r.find('[name="filter[item_category]"]').val() ); t.find('[data-javo-sf-location]').val( r.find('[name="filter[item_location]"]').val() ); t.find('[data-javo-sf-keyword]').val( r.find('input[name="s"]').val() ); t.submit(); } } javo_search_bar_script.init(); }); </script> <?php return ob_get_clean(); }