Example #1
0
 /**
  * Page HTML Callback
  */
 public function adminPage()
 {
     if (!isset($_REQUEST['updated'])) {
         $_REQUEST['updated'] = false;
     }
     echo Fruitframe_Renderer::render($this->_adminTemplate, array('images' => $this->getImages()));
 }
Example #2
0
 /**
  * Page HTML Callback
  */
 public function adminPage()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         update_option('qtranslate-phrases-data', $this->_sanitizePostData());
     }
     $phrasesData = get_option('qtranslate-phrases-data');
     echo Fruitframe_Renderer::render(realpath(dirname(__FILE__)) . '/template.php', array('phrasesData' => $phrasesData));
 }
Example #3
0
 /**
  * Page HTML Callback
  */
 public function adminPage()
 {
     if (!empty($_GET['action'])) {
         $this->{$_GET}['action']();
     } else {
         echo Fruitframe_Renderer::render(realpath(dirname(__FILE__)) . '/template-reimport.php');
     }
 }
Example #4
0
 /**
  * Page HTML Callback
  */
 public function adminPage()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         update_option('exchanger-data', $this->_sanitizePostData());
     }
     $exchangerData = get_option('exchanger-data');
     $exchangerData = empty($exchangerData) ? array() : $exchangerData;
     echo Fruitframe_Renderer::render(realpath(dirname(__FILE__)) . '/template.php', array('exchangerData' => $exchangerData));
 }
Example #5
0
 /**
  * Page HTML Callback
  */
 public function adminPage()
 {
     global $wpdb;
     $data['error'] = '';
     if (!empty($_GET['action'])) {
         $this->{$_GET}['action']();
     } else {
         if (empty($_POST['rates']) || empty($_POST['save']) || empty($_POST['rates']['usd']) || empty($_POST['rates']['text_ru']) || empty($_POST['rates']['text_ro'])) {
             $data['error'] = 'Заполните все поля!!!';
         } elseif (empty($data['error'])) {
             $rates = $_POST['rates'];
             $wpdb->query("INSERT INTO allmoldova_exchange (id,usd,eur,ron,rub,uah,usd_sale,eur_sale,ron_sale,rub_sale,uah_sale,usd_buy,eur_buy,ron_buy,rub_buy,uah_buy,text_ru,text_ro, date)\n\t\t\t\t\t\t\t\tVALUES ('', '" . $rates['usd'] . "', '" . $rates['eur'] . "','" . $rates['ron'] . "','" . $rates['rub'] . "','" . $rates['uah'] . "','" . $rates['usd_sale'] . "','" . $rates['eur_sale'] . "','" . $rates['ron_sale'] . "','" . $rates['rub_sale'] . "','" . $rates['uah_sale'] . "','" . $rates['usd_buy'] . "','" . $rates['eur_buy'] . "','" . $rates['ron_buy'] . "','" . $rates['rub_buy'] . "','" . $rates['uah_buy'] . "','" . $rates['text_ru'] . "','" . $rates['text_ro'] . "','" . $rates['date'] . "')");
         }
         $data['path'] = $this->_url;
         $data['rates'] = $wpdb->get_row("SELECT * FROM allmoldova_exchange ORDER BY id DESC LIMIt 1", ARRAY_A);
         echo Fruitframe_Renderer::render(realpath(dirname(__FILE__)) . '/template.php', $data);
     }
 }
Example #6
0
    /**
     * Page HTML Callback
     */
    public function adminPage()
    {
        $posts = $GLOBALS['wpdb']->get_results('SELECT * FROM ' . $GLOBALS['wpdb']->posts . ' WHERE
			(lang = 1 OR lang = 0)
			AND post_status = "publish"
			ORDER BY menu_order DESC
			LIMIT 20
		');
        $results = array();
        foreach ($posts as $post) {
            if ($post->menu_order > 0) {
                $results[$this->_getPosition($post->menu_order)] = $this->_getItem($post);
            }
        }
        for ($x = 1; $x < 21; $x++) {
            if (empty($results[$x])) {
                $results[$x] = NULL;
            }
        }
        $data = array('publications' => $results, 'path' => $this->_path . 'images/');
        echo Fruitframe_Renderer::render(realpath(dirname(__FILE__)) . '/template.php', $data);
    }
Example #7
0
 /**
  * Send contact through AJAX
  */
 function send()
 {
     try {
         $fields = $this->_config['contact']['fields'];
         $values = array();
         $errors = array();
         foreach ($fields as $field => $config) {
             $values[$field] = $this->filterValue($_POST[$field]);
             if (isset($config['required']) && $config['required'] && !$values[$field]) {
                 throw new Exception('Please enter your ' . $field);
             }
         }
         if (!isset($values['subject'])) {
             $values['subject'] = 'New message from ' . $values['name'];
         }
         $body = Fruitframe_Renderer::render($this->_path . '/template_contact_mail.php', array('values' => $values));
         wp_mail(get_option('admin_email'), $values['subject'], $body, "From {$values['name']} <{$values['email']}>");
         $data = array('success' => 1, 'msg' => 'Thank you for your message!');
     } catch (Exception $e) {
         $data = array('error' => 1, 'msg' => $e->getMessage());
     }
     echo json_encode($data);
     exit;
 }
Example #8
0
										<div class="cat-name"><a href="#" title=""></a></div>
										<p></p>
									</div>
								</div>
							</div>
						</div>
					</div>

					<!-- Cat Thumb Carousel display -->
					<div class="tabbys-cat-product-slider">
						<div id="tabbys-cat-product-slider" class="owl-carousel">
							<?php 
    while ($catsQuery->have_posts()) {
        $catsQuery->the_post();
        $articleObj = Article_Object::init();
        echo Fruitframe_Renderer::render_template_part('single-mobile-product', '', ['post' => $articleObj->getPostObject(), 'type' => 'adopt']);
    }
    ?>
						</div>
						<div class="owl-controls">
							<div class="owl-buttons">
								<div class="owl-prev custom-prev"></div>
								<div class="owl-next custom-next"></div>
							</div>
						</div>
					</div>
				</div>
				<div class="tabby-loader"></div>
			</div>
		</div>
	<?php 
Example #9
0
 public function get_questions()
 {
     global $wpdb;
     $alldb = new wpdb('root', 'root', 'allmoldova_old', 'localhost');
     $page = @$_GET['num'];
     if (!$page) {
         $from = 0;
     } else {
         $from = $page * 1000;
     }
     $next_page = $page + 1;
     //$news = $alldb->get_results( "SELECT * FROM experts_question LIMIT 1" );
     $news = $alldb->get_results("SELECT * FROM experts_question LIMIT " . $from . ", 1000");
     if (count($news) == 0) {
         echo "Я закончил!!!";
         wp_die();
     }
     foreach ($news as $key => $new) {
         if ($new->lang == 0) {
             $langs = array('ru');
         } else {
             $langs = array('ro');
         }
         if ($new->publick == 1) {
             $status = 'publish';
         } else {
             $status = 'trash';
         }
         $post = array('post_title' => $new->name, 'post_content' => ' ', 'post_category' => '', 'post_status' => $status, 'post_type' => 'question', 'post_date' => $new->data);
         $post_id = wp_insert_post($post);
         $answers = $alldb->get_results("SELECT * FROM experts_answer a LEFT JOIN experts e on a.expert = e.id  WHERE question = '" . $new->id . "'", ARRAY_A);
         foreach ($answers as $key => $answer) {
             $name = "<!--:ru-->" . $answer['first_name'] . " " . $answer['last_name'] . "<!--:--><!--:ro-->" . $answer['first_name_md'] . " " . $answer['last_name_md'] . "<!--:-->";
             $desc = "<!--:ru-->" . $answer['workplace'] . "<!--:--><!--:ro-->" . $answer['workplace_md'] . "<!--:-->";
             $text = "<!--:ru-->" . $answer['answer'] . "<!--:--><!--:ro-->" . $answer['answer'] . "<!--:-->";
             add_post_meta($post_id, 'answers_' . $key . '_person_photo_old', $answer['image']);
             add_post_meta($post_id, '_answers_' . $key . '_person_photo_old', 'field_525c09e4d2297');
             add_post_meta($post_id, 'answers_' . $key . '_person_name', $name);
             add_post_meta($post_id, '_answers_' . $key . '_person_name', 'field_525c0a06d2298');
             add_post_meta($post_id, 'answers_' . $key . '_person_description', $desc);
             add_post_meta($post_id, '_answers_' . $key . '_person_description', 'field_526e833b4af50');
             add_post_meta($post_id, 'answers_' . $key . '_answer', $text);
             add_post_meta($post_id, '_answers_' . $key . '_answer', 'field_525c0a25d2299');
         }
         add_post_meta($post_id, 'old_post_id', $new->id);
         add_post_meta($post_id, 'question', $new->name);
         add_post_meta($post_id, 'answers', count($answers));
         add_post_meta($post_id, '_answers', 'field_525c0662d2296');
         add_post_meta($post_id, 'material_lang', $langs);
         do_action('wp_insert_post', 'wp_insert_post');
     }
     echo '<meta http-equiv="refresh" content="0; url=' . site_url('/') . 'wp-admin/options-general.php?page=fruitframe-import&action=get_questions&num=' . $next_page . '" />';
     echo Fruitframe_Renderer::render(realpath(dirname(__FILE__)) . '/template-action.php');
 }
Example #10
0
 public function getProductsAction()
 {
     try {
         if (!isset($_POST['filters'])) {
             throw new Exception('Not have come data make a quick search.');
         }
         $filters = $_POST['filters'];
         $params = explode(',', $filters);
         $updatedParams = [];
         foreach ($params as $k => $param) {
             if ($k % 2) {
                 $key = $params[$k - 1];
                 if (is_array($updatedParams[$key])) {
                     $updatedParams[$key][] = $param;
                 } else {
                     $updatedParams[$key] = $param;
                 }
             } else {
                 if (!isset($updatedParams[$param])) {
                     $updatedParams[$param] = $param;
                 } else {
                     $updatedParams[$param] = (array) $updatedParams[$param];
                 }
             }
         }
         $offset = $_POST['offset'];
         $args = ['post_type' => 'product', 'posts_per_page' => 15 + $offset, 'orderby' => 'title', 'order' => 'ASC'];
         $meta = ['relation' => 'AND'];
         foreach ($updatedParams as $key => $filter) {
             unset($oneMeta);
             switch ($key) {
                 case 'personality':
                 case 'cat_marking':
                 case 'cat_color':
                 case 'gender':
                 case 'special_needs':
                 case 'breed':
                     $oneMeta = ['key' => $key, 'value' => $filter, 'compare' => is_array($filter) ? 'in' : '='];
                     break;
                 case 'age':
                     if (is_array($filter)) {
                         $filter = max($filter);
                         $oneMeta = ['key' => 'calculated_age', 'value' => $filter, 'compare' => '<='];
                     } else {
                         $oneMeta = ['key' => 'calculated_age', 'value' => $filter, 'compare' => '<='];
                     }
                     break;
                 case 'order':
                     if ($filter == 'oldest') {
                         $args['order'] = 'DESC';
                     } else {
                         $args['order'] = 'ASC';
                     }
                     break;
                 case 'favorites':
                     if (isset($_COOKIE["favourites"])) {
                         $args['post__in'] = explode(',', $_COOKIE["favourites"]);
                     }
                     break;
                 default:
                     break;
             }
             if (isset($oneMeta)) {
                 $meta[] = $oneMeta;
             }
         }
         $type = 'sponsor';
         if (isset($_POST['type']) && $_POST['type'] == 'adopt') {
             $type = 'adopt';
             $meta[] = ['key' => 'can_be_adopted', 'value' => 1, 'compare' => '='];
         }
         $meta[] = ['key' => 'is_service', 'compare' => 'NOT EXISTS'];
         $args['meta_query'] = $meta;
         $products = get_posts($args);
         $html = '';
         if (count($products)) {
             foreach ($products as $product) {
                 $html .= Fruitframe_Renderer::render_template_part('single-product', '', ['post' => $product, 'type' => $type]);
             }
         }
         $data = array('success' => 1, 'html' => $html, 'offset' => count($products));
     } catch (Exception $e) {
         $data = array('error' => 1, 'msg' => $e->getMessage());
     }
     echo json_encode($data);
     exit;
 }