function generate($source) { global $savefile; $p = new Parser(); $p->parse('types.hh'); $p->parse($source); ob_start(); $p->render('implementation.cc'); $contents = ob_get_contents(); ob_clean(); if (!$savefile) { echo $contents; } else { file_put_contents('generated/' . str_replace('.i', '.cpp', $source), $contents); } }
/** @test */ public function should_render_mention() { $text = $this->service->render('You should follow @philipbrown!'); $this->assertEquals('<p>You should follow <a href="https://cribbb.com/philipbrown">@philipbrown</a>!</p>', rtrim($text)); }
function getCategoryPost() { $id = 3; // ID заданной рубрики $count = 8; if (isset($_POST['page'])) { $paged = $_POST['page']; } else { $paged = 1; } $posts = get_posts(array('numberposts' => $count, 'offset' => $count * $paged, 'category' => $id)); $parser = new Parser(); $parser->render(TM_DIR . '/view/post.php', ['posts' => $posts]); die; }
function about_product() { $id = $_POST['id']; $product = get_post($id); $parser = new Parser(); $parser->render(TM_DIR . "/view/about.php", array('product' => $product), true); die; }
function photoShortcode() { if ($_POST) { $paged = $_POST['paged']; } else { $paged = 0; } $args = array('paged' => $paged, 'post_type' => 'photos', 'post_status' => 'publish', 'posts_per_page' => 6); $my_query = null; $my_query = new WP_Query($args); $parser = new Parser(); if ($_POST) { echo $parser->render(TM_DIR . '/view/photo.php', ['my_query' => $my_query]); die; } else { $parser->render(TM_DIR . '/view/photo.php', ['my_query' => $my_query]); } }
function productionShortcode() { $catId = get_category_by_slug('production'); $catId = $catId->term_id; $posts = get_posts(['numberposts' => -1, 'category' => $catId, 'order' => 'DESC']); $parser = new Parser(); $parser->render(TM_DIR . '/view/production.php', ['posts' => $posts]); }
function reviewShortcode() { $args = array('post_type' => 'reviews', 'post_status' => 'publish', 'posts_per_page' => -1); $my_query = null; $my_query = new WP_Query($args); $parser = new Parser(); $parser->render(TM_DIR . '/view/reviews.php', ['my_query' => $my_query]); }
function getFeed($atts) { global $wpdb; $args = shortcode_atts(array('user_id' => '', 'offset' => 0, 'current_time' => 0), $atts); if ($_POST) { $user_id = $_POST['user_id']; $offset = $_POST['offset']; $current_time = $_POST['time']; $events = $wpdb->get_results("SELECT * FROM `feed` WHERE `user_id` = '{$user_id}' ORDER BY `id` DESC LIMIT {$offset}, 10", ARRAY_A); $parser = new Parser(); $parser->render(TM_DIR . '/view/account/feed.php', ['events' => $events, 'current_time' => $current_time]); die; } else { $events = $wpdb->get_results("SELECT * FROM `feed` WHERE `user_id` = '{$args['user_id']}' ORDER BY `id` DESC LIMIT {$args['offset']}, 10", ARRAY_A); $parser = new Parser(); $parser->render(TM_DIR . '/view/account/feed.php', ['events' => $events, 'current_time' => $args['current_time']]); } }
function img_galeri($id) { $parser = new Parser(); global $wpdb; $result['img'] = $wpdb->get_results("SELECT * FROM wp_ngg_pictures WHERE galleryid=" . $id['id']); $result['link'] = $wpdb->get_results("SELECT path FROM wp_ngg_gallery WHERE gid=" . $id['id']); $p = $parser->render(TM_DIR . '/views/galery/galery.php', array('result' => $result), false); return $p; }
function c7_form_fn() { $parser = new Parser(); return $parser->render(TM_DIR . '/views/c7-form-views.php', array(), false); }
function index_channel_sc() { $channels = getDataFromDb('channels'); $parser = new Parser(); $parser->render(ADD_BARON_DIR . "/view/indexchannels.php", array('channels' => $channels), true); }
function admin_subscriptions_page() { global $wpdb; if (isset($_GET['del'])) { $wpdb->delete('subscriptions', ['id' => $_GET['del']]); } $subscriptions = $wpdb->get_results("SELECT * FROM `subscriptions`", ARRAY_A); $parser = new Parser(); $parser->render(TM_DIR . '/views/subscriptions_admin_page.php', ['subscriptions' => $subscriptions]); }
function admin_orders_page() { global $wpdb; $parser = new Parser(); if (isset($_GET['del'])) { $wpdb->delete('tea', ['id' => $_GET['del']]); } $orders = $wpdb->get_results("SELECT * FROM tea", ARRAY_A); $parser->render(TM_DIR . '/views/orders_admin_page.php', ['orders' => $orders]); }
function adminBookPage() { global $wpdb; $parser = new Parser(); if (isset($_GET['del'])) { $wpdb->delete('book', ['id' => $_GET['del']]); } if (isset($_POST['date'])) { $wpdb->insert('book', ['dt' => $_POST['date']]); } $dates = $wpdb->get_results("SELECT * FROM `book`", ARRAY_A); $parser->render(TM_DIR . '/view/admin/book.php', ['dates' => $dates]); }
function companylink_sc() { $links = getDataFromDb('companylinks'); $parser = new Parser(); $parser->render(TM_DIR . "/view/linksgrid.php", array('links' => $links), true); }