/** * Page HTML Callback */ public function adminPage() { if (!isset($_REQUEST['updated'])) { $_REQUEST['updated'] = false; } echo Fruitframe_Renderer::render($this->_adminTemplate, array('images' => $this->getImages())); }
/** * 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)); }
/** * Page HTML Callback */ public function adminPage() { if (!empty($_GET['action'])) { $this->{$_GET}['action'](); } else { echo Fruitframe_Renderer::render(realpath(dirname(__FILE__)) . '/template-reimport.php'); } }
/** * 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)); }
/** * 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); } }
/** * 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); }
/** * 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; }
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'); }