/** * Generate html markup for data preview */ public function __action_DataPreview() { if (!empty($_POST)) { $data = stripslashes_deep($_POST); meAnjanWqg_Utils::saveData($data); } $wqgData = meAnjanWqg_Utils::getData(); if (empty($wqgData)) { $wqgData = array(); } $gen = new meAnjanWqg_Generator($wqgData); $gen->generateCode(); $args = $gen->getGeneratedArgs(); $query = new WP_Query($args); $posts = $query->get_posts(); require_once ME_ANJAN_PLUGIN_WQG_DIR . 'includes/templates/preview/posts-list.php'; exit; }
<?php $main = meAnjanWqg_Main::getInstance(); $idPrefix = $main->getConfig('idPrefix'); $wqgData = meAnjanWqg_Utils::getData(); if (empty($wqgData)) { $wqgData = array(); } $current_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $main = meAnjanWqg_Main::getInstance(); $tabs = array(array('id' => $idPrefix . 'tab-author', 'label' => 'Author', 'slug' => 'author', 'active' => TRUE), array('id' => $idPrefix . 'tab-category', 'label' => 'Category', 'slug' => 'category', 'active' => FALSE), array('id' => $idPrefix . 'tab-tag', 'label' => 'Tag', 'slug' => 'tag', 'active' => FALSE), array('id' => $idPrefix . 'tab-taxonomy', 'label' => 'Taxonomy', 'slug' => 'taxonomy', 'active' => FALSE), array('id' => $idPrefix . 'tab-search', 'label' => 'Search', 'slug' => 'search', 'active' => FALSE), array('id' => $idPrefix . 'tab-post', 'label' => 'Post', 'slug' => 'post', 'active' => FALSE), array('id' => $idPrefix . 'tab-date', 'label' => 'Date (Simple)', 'slug' => 'date', 'active' => FALSE), array('id' => $idPrefix . 'tab-date-query', 'label' => 'Date (Advanced)', 'slug' => 'date-query', 'active' => FALSE), array('id' => $idPrefix . 'tab-meta', 'label' => 'Meta/Custom Field', 'slug' => 'meta', 'active' => FALSE), array('id' => $idPrefix . 'tab-meta-query', 'label' => 'Meta Query', 'slug' => 'meta-query', 'active' => FALSE), array('id' => $idPrefix . 'tab-sorting', 'label' => 'Sorting', 'slug' => 'sorting', 'active' => FALSE), array('id' => $idPrefix . 'tab-pagination', 'label' => 'Pagination', 'slug' => 'pagination', 'active' => FALSE)); $currentTab = trim(meAnjanWqg_Utils::arrayValue($wqgData, 'currentTab')); if ($currentTab == '') { $currentTab = $idPrefix . 'tab-author'; } foreach ($tabs as &$t) { $t['active'] = $currentTab == $t['id']; } ?> <div class="wrap" id="<?php echo $idPrefix . $main->getConfig('html/ids/generator_container'); ?> "> <h2>WP_Query Parameters Generator</h2> <form action="" method="POST" class="form-horizontal" role="form" id="<?php echo $idPrefix . $main->getConfig('html/ids/generator_form'); ?> ">