Пример #1
0
    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();
    }
Пример #2
0
    public static function javo_search_form_callback($atts, $content = '')
    {
        global $javo_tso, $javo_tso_map;
        self::$load_script = true;
        extract(shortcode_atts(array('action' => '', 'hide_field' => array()), $atts));
        $errors = new wp_error();
        $javo_query = new javo_ARRAY($_GET);
        $javo_redirect = home_url();
        if ((int) $action > 0 && !is_archive() && !is_search()) {
            $javo_redirect = apply_filters('javo_wpml_link', $action);
        }
        $hide_field = @explode(',', $hide_field);
        if (!empty($hide_field)) {
            foreach ($hide_field as $idx => $item) {
                $hide_field[$item] = 'hide';
                unset($hide_field[$idx]);
            }
        }
        $javo_setVisibleLocation = array();
        $javo_this_onoff = new javo_ARRAY($hide_field);
        $javo_getCurrentPageArchive = is_archive() || is_search();
        $javo_getVisibleLocationType = $javo_tso_map->get('tab_location_field', '') != 'select' ? 'gg_ac' : 'term';
        if (!$javo_getCurrentPageArchive) {
            if ($javo_getVisibleLocationType == 'gg_ac') {
                $javo_setVisibleLocation['term'] = " hidden";
                $javo_setVisibleLocation['gg_ac'] = "";
            } else {
                $javo_setVisibleLocation['term'] = "";
                $javo_setVisibleLocation['gg_ac'] = " hidden";
            }
        } else {
            $javo_setVisibleLocation['term'] = "";
            $javo_setVisibleLocation['gg_ac'] = " hidden";
        }
        if ($javo_this_onoff->get('location', null) == 'hide') {
            $javo_setVisibleLocation['term'] = " hidden";
        }
        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_setVisibleLocation['term'];
        ?>
">
						<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<?php 
        echo $javo_setVisibleLocation['gg_ac'];
        ?>
">
						<input type="text" name="filter[location]" class="form-control">
					</div><!-- /.col-md-2 -->



					<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 ? apply_filters('javo_wpml_link', $action) : null;
        ?>
" data-javo-search-action-template-url>
				<input type="hidden" value="<?php 
        echo (int) $action > 0 ? '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="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="radius_key">
				<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]"]');
						var eloc = $( this.el.origin ).find( '[name="filter[location]"]' );
						
						
						var javo_ac = new google.maps.places.Autocomplete( eloc[0] );




						$(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('[name="radius_key"]')		.val( r.find('[name="filter[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();
    }
    public static function javo_search_form_callback($atts, $content = "")
    {
        global $javo_tso, $javo_tso_map;
        self::$load_script = true;
        extract(shortcode_atts(array('action' => '', 'hide_field' => array(), 'input_field' => 'location', 'place_holder' => '', 'single_search_button_color' => ''), $atts));
        $errors = new wp_error();
        $javo_query = new javo_ARRAY($_GET);
        $javo_redirect = home_url();
        $javo_all_tags = "";
        if ($input_field == 'keyword') {
            foreach (get_tags(array('fields' => 'names')) as $tags) {
                $javo_all_tags .= "{$tags}|";
            }
            $javo_all_tags = substr($javo_all_tags, 0, -1);
        }
        if ((int) $action > 0 && !is_archive() && !is_search()) {
            $javo_redirect = apply_filters('javo_wpml_link', $action);
        }
        // No setup result page
        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 javo-single-search-form" id="javo-single-search-form">
			<form role="form" data-javo-search-form class="search-form-type">

				<div class="search-type-a-inner">


					<div class="search-box-inline search-box-inline-position">
						<input type="text" class="search-type-inner-position-text" placeholder="<?php 
        echo $place_holder;
        ?>
">
						<div class="inner-marker"><i class="fa fa-map-marker javo-current-position"></i></div>
						<div class="search-box-inline search-box-inline-position-button">
							<button type="submit" class="search-submit admin-color-setting"
							<?php 
        if ($single_search_button_color != '') {
            echo 'style="background-color:' . $single_search_button_color . ';"';
        }
        ?>
	>
								<i class="fa fa-search search-box-inline-icon"></i>
								<span class="search-submit-text"><?php 
        _e("search", 'javo_fr');
        ?>
</span>
							</button>
						</div><!-- /.col-md-2 -->

					</div><!-- /.col-md-2 -->

				</div> <!-- search-type-inner -->

			</form><!--search-form-type-->

			<fieldset>
				<input type="hidden" value="<?php 
        echo (int) $action > 0 ? apply_filters('javo_wpml_link', $action) : null;
        ?>
" data-javo-search-action-template-url>
				<input type="hidden" value="<?php 
        echo (int) $action > 0 ? 'data-javo-patch-form-for-template' : 'data-javo-patch-form-for-result';
        ?>
" data-javo-search-form-action-type>
				<input type="hidden" javo-map-all-tags value="<?php 
        echo $javo_all_tags;
        ?>
">
				<input type="hidden" javo-input-field-type value="<?php 
        echo $input_field;
        ?>
">
			</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="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="location" data-javo-sf-location-keyword>
				<input type="hidden" name="radius_key" data-javo-sf-google-keyword>
				<input type="hidden" name="keyword" data-javo-sf-keyword>
				<input type="hidden" name="geolocation" data-javo-sf-geolocation>
			</form><!-- /data-javo-patch-form-for-template : Go to Map -->
		</div>

		<script type="text/javascript">

		jQuery( function($){
			window.javo_single_search_func = {

				init: function()
				{

					this.el_org		= $( "[data-javo-search-form]" );
					this.el			= $( "[" + $("[data-javo-search-form-action-type]").val() + "]" );
					this.type		= this.el.closest( "#javo-single-search-form" ).find( "[javo-input-field-type]" ).val();
					this.tags		= $('[javo-map-all-tags]').val().toLowerCase().split( '|' );
					this.el_keyword = $("#javo-single-search-form input.search-type-inner-position-text");

					if( this.type == "keyword" )
					{
						this.setKeywordAutoComplete();
					}else{
						var javo_ac = new google.maps.places.Autocomplete( this.el_keyword[0] );
					}

					;$( document )
									.on( 'submit'	, this.el_org.selector, this.submit )
									.on( 'click'	, '.javo-current-position', this.position )
				}

				, setKeywordAutoComplete: function()
				{
					this.el_keyword.typeahead({
						hint			: false
						, highlight		: true
						, minLength		: 1
					}, {
						name			: 'tags'
						, displayKey	: 'value'
						, source		: this.keywordMatchesCallback( this.tags )
					});
				}

				, keywordMatchesCallback: function( tags )
				{
					return function keywordFindMatches( q, cb )
					{
						var matches, substrRegex;

						substrRegex		= new RegExp( q, 'i');
						matches			= [];

						$.each( tags, function( i, tag ){
							if( substrRegex.test( tag ) ){

								matches.push({ value : tag });
							}
						});
						cb( matches );
					}
				}

				, position: function( e )
				{
					e.preventDefault();

					var obj		= javo_single_search_func;

					if( $( this ).hasClass( 'active' ) )
					{
						obj.el.find( "[data-javo-sf-geolocation]" ).val( 0 );
						$( this ).removeClass( 'active' );
					}else{
						obj.el.find( "[data-javo-sf-geolocation]" ).val( 1 );
						$( this ).addClass( 'active' ).addClass( 'fa-spin' );
					}

					obj.submit(e);
				}

				, submit: function( e )
				{
					e.preventDefault();

					var obj		= javo_single_search_func;
					var el_org	= obj.el_org;
					var el		= obj.el;
					var type	= obj.type;
					var input	= el_org.find( "input.search-type-inner-position-text" );

					if( type == "keyword" )
					{
						// Keyword
						el.find( "[data-javo-sf-keyword]" ).val( input.val() );
					}else{
						// Locaiton
						el.find( "[data-javo-sf-google-keyword]" ).val( input.val() );
					}
					el.submit();
				}
			}
			window.javo_single_search_func.init();
		});
		</script>
		<?php 
        return ob_get_clean();
    }
Пример #4
0
    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();
    }