Ejemplo n.º 1
0
 public function pre_get_posts($query)
 {
     global $wpdb, $et_global;
     if (!$query->is_main_query() && !is_search()) {
         return $query;
     }
     $c_str = ET_AdCatergory::slug();
     $l_str = ET_AdLocation::slug();
     $taxs = CE_Fields::get_taxs();
     if (is_array($taxs) && !empty($taxs)) {
         foreach ($taxs as $key => $tax) {
             if (get_query_var($tax['tax_name'])) {
                 $query->query_vars['tax_query'][] = array('taxonomy' => $tax['tax_name'], 'field' => 'slug', 'terms' => get_query_var($tax['tax_name']));
                 $query->query_vars['tax_query']['relation'] = 'AND';
             }
         }
     }
     return $query;
 }
Ejemplo n.º 2
0
 /**
  * add new a field to site.
  * @return [type] [description]
  */
 public function ce_add_field()
 {
     $resp = array();
     $request = $_POST;
     $request['field_des'] = isset($request['field_des']) ? stripslashes(trim($request['field_des'])) : '';
     $request['field_label'] = isset($request['field_label']) ? stripslashes(trim($request['field_label'])) : '';
     $request['field_pholder'] = isset($request['field_pholder']) ? stripslashes(trim($request['field_pholder'])) : '';
     $request['field_type'] = isset($request['field_type']) ? trim($request['field_type']) : 'text';
     $request['field_name'] = isset($request['field_name']) ? trim($request['field_name']) : '';
     $fields = (array) CE_Fields::get_fields();
     $name = trim($request['field_name']);
     $required = isset($_POST['field_required']) ? 1 : 0;
     if (isset($request['field_cats'])) {
         $request['field_cats'] = array_unique($request['field_cats']);
     }
     //get cat field name
     // assgin required to data, it for assign value to model.
     $request['field_required'] = $required;
     if (empty($name)) {
         wp_send_json(array('success' => false, 'msg' => __('Field name empty.')));
     }
     if (isset($fields[$name])) {
         $fields[$name] = $request;
         $resp = array('success' => true, 'msg' => __('Update field success!'), 'data' => $request);
     } else {
         $fields[$name] = $request;
         $resp = array('success' => true, 'msg' => __('Add a field success!'), 'data' => $request);
     }
     //Get category name, id and add to resp object
     if (isset($request["field_cats"])) {
         $categories = ET_AdCatergory::get_category_list(array('include' => implode(',', $request['field_cats'])));
         //add property : id
         foreach ($categories as $index => $cat) {
             $resp['data']['field_cats'][$index] = $cat;
             $resp['data']['field_cats'][$index]->id = $cat->term_id;
         }
         $resp['data']['field_cats'] = $categories;
     }
     CE_Fields::set_fields($fields);
     wp_send_json($resp);
 }
Ejemplo n.º 3
0
    function roll_template_front()
    {
        $html = '<div id="ce_adroll" class="roll-view"><form class="form form-roll-admin" id="frm_roll">
							<div class="form-item">
								<div class="title font-quicksand">
									Content	
								</div>
							</div>							
							<div class="form-item">
								<div class="half alignleft">
									<label>' . __('Select Category', ET_DOMAIN) . '</label>
									<div class="select-style et-button-select">
					        			<select style="z-index: 10; opacity: 0;"  class="change" name="ad_cat">
					        			<option value="">' . __('All Categories', ET_DOMAIN) . '</option>';
        $cats = ET_AdCatergory::get_category_list();
        if ($cats) {
            foreach ($cats as $key => $cat) {
                $html .= '<option value="' . $cat->term_id . '">' . $cat->name . '</option>';
            }
        }
        $html .= '</select>
					        		</div>
					        	</div>
								<div class="half alignright">
									<label>' . __('Select locations', ET_DOMAIN) . '</label>
									<div class="select-style et-button-select">
					        			<select class="change" style="z-index: 10; opacity: 0;" name="ad_location">
						        			<option value="">' . __('All Location', ET_DOMAIN) . '</option>';
        $locations = ET_AdLocation::get_location_list();
        if ($locations) {
            foreach ($locations as $key => $local) {
                $html .= '<option value="' . $local->term_id . '">' . $local->name . '</option>';
            }
        }
        $html .= '</select>		
					        		</div>
								</div>
							</div>
							<div class="form-item">
								<div class="title font-quicksand">
									Display								</div>
							</div>
							<div class="form-item">
								<div class="half alignleft">
								 	<label> Number ads </label>
								 	<input type="text" name="number" class="number" value="5">
								</div>
								<div class="half alignright">
								 	<label> ' . __('Width', ET_DOMAIN) . '</label>
								 	<input type="text"  id="width" value="240">
								</div>
							</div>
							<div class="form-item">
								<div class="half alignleft">
								 	<label> Background Color </label>
								 	<input type="text" name="bgcolor" id="colorpicker" class="bgcolor" value="f5f5f5">
								 	
								</div>
								<div class="half alignright">
								 	<label> Title  </label>
								 	<input type="text" name="title" value="' . __("Ads from Website", ET_DOMAIN) . '">
								</div>
							</div>';
        $id = self::get_page_adroll();
        $link = get_permalink($id);
        $link = add_query_arg(array('adroll_request' => 1), $link);
        $frame = '<iframe scrolling="no" id="frame_preview" style="border:0; overflow:hidden;" src="' . $link . '" width="240px" frameborder="0" height="478px" allowtransparency="true" marginheight="0" marginwidth="0"></iframe>';
        $html .= '<div class="form-item">
								<label> Copy this code and past into your site:</label>
								<textarea class="code-content" cols="10" rows="16">' . $frame . '</textarea>
							</div>


						</form>';
        $html .= '<div class="quick_view alignright">
							<iframe  scrolling="no" id="frame_preview" style="border:0; overflow:hidden;" src="' . $link . '" frameborder="0" width="240px" height="478px" allowtransparency="true" marginheight="0" marginwidth="0"></iframe>
						</div>
						</div>';
        return $html;
    }
			<div class="row-item">
				<div  class=" label title font-quicksand"><?php 
_e('Assign to categoriese', ET_DOMAIN);
?>
 </div>
				<div class="form-item">
					<div class="select-style et-button-select">

						<select name = "field_cats[]" id = "field_cats" style="z-index: 10; opacity: 0;">
							<option value='-1' disabled selected><?php 
_e('Select categoy', ET_DOMAIN);
?>
</option>
						<?php 
$categories = ET_AdCatergory::get_category_list();
foreach ($categories as $key => $cat) {
    echo '<option value="' . $cat->term_id . '">' . $cat->name . '</option>';
}
?>
						</select>
						</div>

				</div>
				<ul class="cat-list form-item"  id ="cat-list"> </ul>
			</div>


			<div class="row-item">
				<div class="label title font-quicksand"> <?php 
_e('Required', ET_DOMAIN);
Ejemplo n.º 5
0
        /**
         * view in backend this plugin.
         */
        function menu_view($args)
        {
            ?>
			<div class="et-main-header">
				<div class="title font-quicksand"><?php 
            _e('CE Ad Roll', ET_DOMAIN);
            ?>
</div>
				<div class="desc"><?php 
            _e('Create a adroll for publisher.', ET_DOMAIN);
            ?>
</div>
			</div>
			
			<div id="ce_adroll" class="et-main-content roll-view">

				<div class="settings-content et-main-main no-margin overview">					
					<div class="title font-quicksand">Install sample data</div>
					<div class="desc">
						<div class="row-item row-top">
							<label><?php 
            _e('Select a page for your adroll tempalte:', ET_DOMAIN);
            ?>
 </label>
							<div class="select-style et-button-select btn-effect">
			        			<select id="select-page-roll" class="page-roll" style="z-index: 10; opacity: 0;">

			        			<?php 
            $id = CE_AddRoll::get_page_adroll();
            $pages = get_posts(array('meta_key' => '_wp_page_template', 'meta_value' => '', 'post_type' => 'page', 'post_status' => 'publish'));
            if (!empty($pages)) {
                foreach ($pages as $page) {
                    $class = $id == $page->ID ? 'selected ="selected"' : '';
                    $url = get_permalink($page->ID);
                    $url = add_query_arg(array('adroll_request' => 1), $url);
                    echo '<option ' . $class . ' data-url ="' . $url . '" value="' . $page->ID . '">' . $page->post_title . '</option>';
                }
            }
            ?>
				        								        					
				        		</select>		
			        		</div>

						</div>
						<div class="row-roll">
							<form id="frm_roll" class="form form-roll-admin">
								<div class="form-item">
									<div class="title font-quicksand">
										<?php 
            _e('Content', ET_DOMAIN);
            ?>
									</div>
								</div>
								<div class="form-item">
									<div class="half alignleft">
										<label><?php 
            _e('Select Category', ET_DOMAIN);
            ?>
</label>
										<div class="select-style et-button-select">
						        			<select name = "ad_cat" class="change" style="z-index: 10; opacity: 0;">
						        				<option value=""><?php 
            _e('All Categories', ET_DOMAIN);
            ?>
</option>';
						        				<?php 
            $cats = ET_AdCatergory::get_category_list();
            if ($cats) {
                foreach ($cats as $key => $cat) {
                    echo '<option value="' . $cat->term_id . '">' . $cat->name . '</option>';
                }
            }
            ?>
	
							        								        					
							        		</select>		
						        		</div>
						        	</div>
									<div class="half alignright">
										<label><?php 
            _e('Select locations', ET_DOMAIN);
            ?>
 </label>
										<div class="select-style et-button-select">
						        			<select name="ad_location" class="change" style="z-index: 10; opacity: 0;">
						        				<option value=""><?php 
            _e('All Location', ET_DOMAIN);
            ?>
</option>';
							        			<?php 
            $locations = get_terms(ET_AdLocation::AD_LOCATION, array('hide_empty' => false, 'hierarchical' => false));
            if ($locations) {
                foreach ($locations as $key => $local) {
                    echo '<option value="' . $local->term_id . '">' . $local->name . '</option>';
                }
            }
            ?>
						        								        					
							        		</select>		
						        		</div>
									</div>
								</div>
								<div class="form-item">
									<div class="title font-quicksand">
										<?php 
            _e('Display', ET_DOMAIN);
            ?>
									</div>
								</div>
								<div class="form-item">
									<div class="half alignleft">
									 	<label> <?php 
            _e('Number ads', ET_DOMAIN);
            ?>
 </label>
									 	<input type="text" name="number" class="number" value="5" />
									</div>
									<div class="half alignright">
									 	<label><?php 
            _e('Width', ET_DOMAIN);
            ?>
 </label>
									 	<input type="text" id="width" value="240"  />
									</div>
								</div>
								<div class="form-item">
									<div class="half alignleft">
									 	<label> <?php 
            _e('Background Color', ET_DOMAIN);
            ?>
 </label>
									 	

									 	<input type="text" class="bgcolor" value="d9d9d9" name="bgcolor" />

									</div>
									<div class="half alignright">
									 	<label> <?php 
            _e('Title', ET_DOMAIN);
            ?>
  </label>
									 	<input type="text" value="<?php 
            _e('Ads from Website', ET_DOMAIN);
            ?>
" name="title" />
									</div>
								</div>
								<div class="form-item">
									<?php 
            $url = get_permalink($id);
            $link = add_query_arg(array('adroll_request' => 1, 'number' => 5), $url);
            ?>

									<label> <?php 
            _e('Copy this code and past into your site', ET_DOMAIN);
            ?>
:</label>
									<textarea class="code-content" rows="16" cols="10"><iframe id="frame_preview" style="border:0; overflow:hidden;" src="<?php 
            echo $link;
            ?>
" frameborder="0" height="467px" width="250px" allowtransparency="true" marginheight="0" marginwidth="0"></iframe></textarea>

								</div>
								<div class="form-item">
							 		<?php 
            printf(__('Note: You can also allow your users to create a adroll in the frontend by providing this link to them: <a id = "url_front" target="_blank" href="%s">Adroll</a>', ET_DOMAIN), $url);
            ?>

								</div>

							</form>
							
							<div class="quick_view alignright">
								<div class="main-title title font-quicksand"><?php 
            _e('QUICK VIEW', ET_DOMAIN);
            ?>
</div>
								<iframe title ="<?php 
            _e(" Title Ad roll", ET_DOMAIN);
            ?>
" id="frame_preview" style="border:0; overflow:hidden;" src="<?php 
            echo $link;
            ?>
" frameborder="0" height="467px" allowtransparency="true" marginheight="0" marginwidth="0"></iframe>
							</div>
						</div><!-- row-roll !-->
						</div>
					</div>
					
				</div>
		
			<?php 
        }
Ejemplo n.º 6
0
    function map_add_template()
    {
        $is_mobile = et_is_mobile();
        if (et_is_mobile() && !et_is_table()) {
            return;
        }
        if (!is_page_template('page-post-ad.php')) {
            ?>
            <div class="modal-map modal-dialog" id="modal_ad_map" style="" >
                <div class="header-filter">
                    <div class="main-center f-left-all">
                        <div class="location map-item">
                            <input type="text" name="ad_location" class="search-box ad-searchbox input-search-box border-radius" placeholder="Enter a location ..." value="">
                            <span class="icon" data-icon="@"></span>
                        </div>
                        <div class="form-item map-item">
                            <div class="select-style btn-background border-radius et-button-select">
                                <?php 
            $cats = ET_AdCatergory::get_category_list();
            if ($cats) {
                echo '<select name="cateogory">';
                echo '<option value="none" >' . __('All Categories', ET_DOMAIN) . '</option>';
                foreach ($cats as $key => $cat) {
                    echo '<option value = "' . $cat->slug . '">' . $cat->name . ' </option>';
                }
                echo '</select>';
            }
            ?>
                            </div>
                        </div>

                    </div>
                </div>
                <div  id="modal_map_inner" style="" ></div>
                <button class="close" type="button">&times;</button>
                <div id="map-overlay" style="display:none;" >
                    <div id="map-fadingBarsG" class="map-fadingBar">
                        <div id="map-fadingBarsG_1" class="fadingBarsG">
                        </div>
                        <div id="map-fadingBarsG_2" class="fadingBarsG">
                        </div>
                        <div id="map-fadingBarsG_3" class="fadingBarsG">
                        </div>
                        <div id="map-fadingBarsG_4" class="fadingBarsG">
                        </div>
                        <div id="map-fadingBarsG_5" class="fadingBarsG">
                        </div>
                        <div id="map-fadingBarsG_6" class="fadingBarsG">
                        </div>
                        <div id="map-fadingBarsG_7" class="fadingBarsG">
                        </div>
                        <div id="map-fadingBarsG_8" class="fadingBarsG">
                        </div>
                    </div>
                </div>
            </div>
            <?php 
        }
    }