private function wp_template_loader()
 {
     global $pagenow;
     $pagenow = 'index.php';
     if (!defined('WP_USE_THEMES')) {
         define('WP_USE_THEMES', true);
     }
     wp();
     if ($_SERVER['REQUEST_URI'] === $this->user_trailingslashit(str_repeat('-/', 10))) {
         $_SERVER['REQUEST_URI'] = $this->user_trailingslashit('/wp-login-php/');
     }
     require_once ABSPATH . WPINC . '/template-loader.php';
     die;
 }
Exemple #2
0
 public function index()
 {
     static $wp_did_header;
     global $wpdb, $current_site;
     define('WP_ONLY', true);
     if (!defined('ABSPATH')) {
         if (!isset($wp_did_header)) {
             define('WP_USE_THEMES', true);
             $wp_did_header = true;
             require_once dirname(base_path()) . '/app/article/wp-load.php';
             wp();
             require_once dirname(base_path()) . '/app/includes/template-loader.php';
         }
         //require_once dirname(base_path()) . '/app/article/index.php';
     }
     return view('main::index');
 }
 public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
 {
     if ($type !== self::MASTER_REQUEST) {
         throw new \LogicException('Wordpress\\HttpKernel cannot handle SUB_REQUESTS');
     }
     unset($type);
     $this->catch = $catch;
     unset($catch);
     $this->timezone = date_default_timezone_get();
     $this->startOutputBuffer();
     try {
         $wp_the_query = null;
         $this->storeGlobals();
         $request->overrideGlobals();
         if ($globalNames = @(include $this->wordpressGlobalNamesCacheFile)) {
             foreach ($globalNames ?: array() as $name) {
                 @eval('global $' . $name . ';');
             }
         } else {
             throw new \RuntimeException('The global names cache file has to be generated with "app/console startplatz:wordpress-integration:build-global-names-cache"');
         }
         define('WP_USE_THEMES', true);
         $time_start = microtime(true);
         require_once "{$this->wordpressRootDir}/wp-load.php";
         global $wp_query;
         $wp_query = $wp_the_query;
         \wp();
         require_once "{$this->wordpressRootDir}/wp-includes/template-loader.php";
         $content = $this->endOutputBuffer();
         $statusCode = is_404() ? 404 : 200;
         $headers = $this->flushHeaders();
         $this->restoreGlobals();
         date_default_timezone_set($this->timezone);
         return new Response($content, $statusCode, $headers);
     } catch (\Exception $e) {
         $this->endOutputBuffer();
         $this->flushHeaders();
         $this->restoreGlobals();
         date_default_timezone_set($this->timezone);
         if ($this->catch) {
             return new Response($e->getMessage(), 500);
         } else {
             throw $e;
         }
     }
 }
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     //
     global $wpdb, $current_site, $wp_did_header;
     global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
     if (!defined('ABSPATH') && PHP_SAPI != 'cli') {
         if (!isset($wp_did_header)) {
             $wp_did_header = true;
             require_once ROOT . '/home/wp-load.php';
             wp();
             require WP_CORE_DIR . '/includes/template-loader.php';
         }
         //require_once dirname(base_path()) . '/app/article/index.php';
     }
     if (defined('ABSPATH')) {
     }
 }
 public function provide()
 {
     $this->setupLaravelEnvironment();
     /*
      * Tells WordPress to load the WordPress theme and output it.
      *
      * @var bool
      */
     define('WP_USE_THEMES', true);
     // Process
     wp();
     // remove admin redirect action
     remove_action('template_redirect', 'wp_redirect_admin_locations', 1000);
     // Generate blank .php files
     $this->prepareTemplates(false);
     // Install high priority filter
     add_filter('template_include', [$this, 'evaluateTemplate'], 1);
     /* Loads the WordPress Template */
     return $this->runScript('wp-includes/template-loader.php');
 }
function wpu_wp_template_load()
{
    global $phpbbForum, $wpUtdInt, $wpUnited;
    $phpbbForum->background();
    // get the page
    ob_start();
    $oldGET = $_GET;
    $_GET = array();
    wpu_initialise_wp();
    // items usually set by wordpress template loads:
    define("WP_USE_THEMES", true);
    global $wp_did_header;
    $wp_did_header = true;
    wp();
    if (!$wpUnited->should_do_action('template-p-in-w')) {
        $wpUtdInt->load_template();
    }
    $_GET = $oldGET;
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
 public function provide()
 {
     $this->setupLaravelEnvironment();
     /*
      * Tells WordPress to load the WordPress theme and output it.
      *
      * @var bool
      */
     define('WP_USE_THEMES', true);
     // Process
     wp();
     // remove admin redirect action
     remove_action('template_redirect', 'wp_redirect_admin_locations', 1000);
     if (config('wordpress.themes.blade.precompile')) {
         // Compile blade files
         $this->prepareTemplates(true);
         add_filter('template_include', [$this, 'renderPhpTemplate']);
     } else {
         $this->prepareTemplates(false);
         add_filter('template_include', [$this, 'evaluateTemplate']);
     }
     /* Loads the WordPress Template */
     require wordpress_path('wp-includes/template-loader.php');
 }
Exemple #8
0
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $q
 * @return unknown
 */
function wp_edit_attachments_query($q = false)
{
    if (false === $q) {
        $q = $_GET;
    }
    $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
    $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
    $q['post_type'] = 'attachment';
    $q['post_status'] = 'any';
    $q['posts_per_page'] = 15;
    $post_mime_types = array('image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')), 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')), 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')));
    $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
        unset($q['post_mime_type']);
    }
    wp($q);
    return array($post_mime_types, $avail_post_mime_types);
}
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $q
 * @return unknown
 */
function wp_edit_attachments_query($q = false)
{
    if (false === $q) {
        $q = $_GET;
    }
    $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
    $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
    $q['post_type'] = 'attachment';
    $q['post_status'] = isset($q['status']) && 'trash' == $q['status'] ? 'trash' : 'inherit';
    $media_per_page = (int) get_user_option('upload_per_page', 0, false);
    if (empty($media_per_page) || $media_per_page < 1) {
        $media_per_page = 20;
    }
    $q['posts_per_page'] = apply_filters('upload_per_page', $media_per_page);
    $post_mime_types = get_post_mime_types();
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
        unset($q['post_mime_type']);
    }
    wp($q);
    return array($post_mime_types, $avail_post_mime_types);
}
        ?>
	.</p>

<?php 
    }
    ?>

</div>
<?php 
}
?>

<div class="wrap">
<h2>
<?php 
wp('what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1');
if (is_month()) {
    single_month_title(' ');
} elseif (is_search()) {
    printf(__('Search for &#8220;%s&#8221;'), wp_specialchars($_GET['s']));
} else {
    if (is_single()) {
        printf(__('Comments on %s'), apply_filters("the_title", $post->post_title));
    } elseif (!is_paged() || get_query_var('paged') == 1) {
        _e('Last 15 Posts');
    } else {
        _e('Previous Posts');
    }
}
?>
</h2>
Exemple #11
0
function wpmp_msma_post_list()
{
    $base = get_option('home');
    wp('orderby=modified');
    if (have_posts()) {
        global $post;
        print "<p>" . __("Select a post to edit:", 'wpmp') . "</p>";
        add_filter('get_pagenum_link', 'wpmp_msma_get_pagenum_link');
        while (have_posts()) {
            the_post();
            print "<p>" . "<strong><a href='{$base}/wp-admin/post.php?action=edit&post={$post->ID}'>" . get_the_title() . "</a></strong>" . "<br />" . get_the_modified_date() . "<br />" . wpmp_msma_post_status($post->post_status) . "</p>";
        }
        next_posts_link('Older');
        previous_posts_link('Newer');
    } else {
        print "<p>" . __("There are no posts to edit.", 'wpmp') . "</p>";
    }
}
 /**
  * Clone the core WP function, add the possibility to manage the post type
  *
  * @param string $q
  * @return void
  * @author Amaury Balmer
  */
 public static function edit_data_query($q = false)
 {
     if (false === $q) {
         $q = $_GET;
     }
     // Date
     if (isset($q['m'])) {
         $q['m'] = (int) $q['m'];
     }
     // Category
     if (isset($q['cat'])) {
         $q['cat'] = (int) $q['cat'];
     }
     // Quantity
     $q['posts_per_page'] = isset($q['posts_per_page']) ? (int) $q['posts_per_page'] : 0;
     if ($q['posts_per_page'] == 0) {
         $q['posts_per_page'] = 15;
     }
     // Content type
     $q['post_type'] = SimpleTags_Admin::$post_type;
     // Post status
     $post_stati = array('publish' => array(_x('Published', 'post'), __('Published posts'), _n_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>')), 'future' => array(_x('Scheduled', 'post'), __('Scheduled posts'), _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>')), 'pending' => array(_x('Pending Review', 'post'), __('Pending posts'), _n_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')), 'draft' => array(_x('Draft', 'post'), _x('Drafts', 'manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')), 'private' => array(_x('Private', 'post'), __('Private posts'), _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')));
     $post_stati = apply_filters('post_stati', $post_stati);
     $avail_post_stati = get_available_post_statuses(SimpleTags_Admin::$post_type);
     $post_status_q = '';
     if (isset($q['post_status']) && in_array($q['post_status'], array_keys($post_stati))) {
         $post_status_q = '&post_status=' . $q['post_status'];
         $post_status_q .= '&perm=readable';
     } elseif (!isset($q['post_status'])) {
         $q['post_status'] = '';
     }
     if ('pending' === $q['post_status']) {
         $order = 'ASC';
         $orderby = 'modified';
     } elseif ('draft' === $q['post_status']) {
         $order = 'DESC';
         $orderby = 'modified';
     } else {
         $order = 'DESC';
         $orderby = 'date';
     }
     wp("post_type={$q['post_type']}&what_to_show=posts{$post_status_q}&posts_per_page={$q['posts_per_page']}&order={$order}&orderby={$orderby}");
     return array($post_stati, $avail_post_stati);
 }
Exemple #13
0
    /**
     * Retrieve feed XML.
     *
     * @since 2.2.0
     *
     * @param int $page Page ID.
     * @param string $post_type Optional, default is post. Post type.
     * @return string
     */
    function get_feed($page = 1, $post_type = 'post')
    {
        global $post, $wp, $wp_query, $posts, $wpdb, $blog_id;
        log_app('function', "get_feed({$page}, '{$post_type}')");
        ob_start();
        $this->ENTRY_PATH = $post_type;
        if (!isset($page)) {
            $page = 1;
        }
        $page = (int) $page;
        $count = get_option('posts_per_rss');
        wp('posts_per_page=' . $count . '&offset=' . ($count * ($page - 1) . '&orderby=modified'));
        $post = $GLOBALS['post'];
        $posts = $GLOBALS['posts'];
        $wp = $GLOBALS['wp'];
        $wp_query = $GLOBALS['wp_query'];
        $wpdb = $GLOBALS['wpdb'];
        $blog_id = (int) $GLOBALS['blog_id'];
        log_app('function', "query_posts(# " . print_r($wp_query, true) . "#)");
        log_app('function', "total_count(# {$wp_query->max_num_pages} #)");
        $last_page = $wp_query->max_num_pages;
        $next_page = $page + 1 > $last_page ? NULL : $page + 1;
        $prev_page = $page - 1 < 1 ? NULL : $page - 1;
        $last_page = (int) $last_page == 1 || (int) $last_page == 0 ? NULL : (int) $last_page;
        $self_page = $page > 1 ? $page : NULL;
        ?>
<feed xmlns="<?php 
        echo $this->ATOM_NS;
        ?>
" xmlns:app="<?php 
        echo $this->ATOMPUB_NS;
        ?>
" xml:lang="<?php 
        echo get_option('rss_language');
        ?>
" <?php 
        do_action('app_ns');
        ?>
 >
<id><?php 
        $this->the_entries_url();
        ?>
</id>
<updated><?php 
        echo mysql2date('Y-m-d\\TH:i:s\\Z', get_lastpostmodified('GMT'), false);
        ?>
</updated>
<title type="text"><?php 
        bloginfo_rss('name');
        ?>
</title>
<subtitle type="text"><?php 
        bloginfo_rss("description");
        ?>
</subtitle>
<link rel="first" type="<?php 
        echo $this->ATOM_CONTENT_TYPE;
        ?>
" href="<?php 
        $this->the_entries_url();
        ?>
" />
<?php 
        if (isset($prev_page)) {
            ?>
<link rel="previous" type="<?php 
            echo $this->ATOM_CONTENT_TYPE;
            ?>
" href="<?php 
            $this->the_entries_url($prev_page);
            ?>
" />
<?php 
        }
        if (isset($next_page)) {
            ?>
<link rel="next" type="<?php 
            echo $this->ATOM_CONTENT_TYPE;
            ?>
" href="<?php 
            $this->the_entries_url($next_page);
            ?>
" />
<?php 
        }
        ?>
<link rel="last" type="<?php 
        echo $this->ATOM_CONTENT_TYPE;
        ?>
" href="<?php 
        $this->the_entries_url($last_page);
        ?>
" />
<link rel="self" type="<?php 
        echo $this->ATOM_CONTENT_TYPE;
        ?>
" href="<?php 
        $this->the_entries_url($self_page);
        ?>
" />
<rights type="text">Copyright <?php 
        echo date('Y');
        ?>
</rights>
<?php 
        do_action('app_head');
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                $this->echo_entry();
            }
        }
        ?>
</feed>
<?php 
        $feed = ob_get_contents();
        ob_end_clean();
        return $feed;
    }
}
if (empty($title)) {
    $title = __('Edit Pages');
}
$parent_file = 'edit-pages.php';
wp_enqueue_script('inline-edit-post');
$post_stati = array('publish' => array(__('Published|page'), __('Published pages'), _n_noop('Published <span class="count">(%s)</span>|page', 'Published <span class="count">(%s)</span>')), 'future' => array(__('Scheduled|page'), __('Scheduled pages'), _n_noop('Scheduled <span class="count">(%s)</span>|page', 'Scheduled <span class="count">(%s)</span>')), 'pending' => array(__('Pending Review|page'), __('Pending pages'), _n_noop('Pending Review <span class="count">(%s)</span>|page', 'Pending Review <span class="count">(%s)</span>')), 'draft' => array(__('Draft|page'), _c('Drafts|manage posts header'), _n_noop('Draft <span class="count">(%s)</span>|page', 'Drafts <span class="count">(%s)</span>')), 'private' => array(__('Private|page'), __('Private pages'), _n_noop('Private <span class="count">(%s)</span>|page', 'Private <span class="count">(%s)</span>')));
$query = array('post_type' => 'page', 'orderby' => 'menu_order title', 'what_to_show' => 'posts', 'posts_per_page' => -1, 'posts_per_archive_page' => -1, 'order' => 'asc');
$post_status_label = __('Pages');
if (isset($_GET['post_status']) && in_array($_GET['post_status'], array_keys($post_stati))) {
    $post_status_label = $post_stati[$_GET['post_status']][1];
    $query['post_status'] = $_GET['post_status'];
    $query['perm'] = 'readable';
}
$query = apply_filters('manage_pages_query', $query);
wp($query);
if (is_singular()) {
    wp_enqueue_script('admin-comments');
    enqueue_comment_hotkeys_js();
}
require_once 'admin-header.php';
?>

<div class="wrap">
<?php 
screen_icon();
?>
<h2><?php 
echo wp_specialchars($title);
if (isset($_GET['s']) && $_GET['s']) {
    printf('<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars(get_search_query()));
<?php

if (empty($wp)) {
	require_once('wp-config.php');
	wp('feed=rss2&withcomments=1');
}

require (ABSPATH . WPINC . '/feed-rss2-comments.php');

?>
<?php

if (empty($wp)) {
    require_once 'wp-config.php';
    wp('tb=1');
}
function trackback_response($error = 0, $error_message = '')
{
    header('Content-Type: text/xml; charset=' . get_option('blog_charset'));
    if ($error) {
        echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
        echo "<response>\n";
        echo "<error>1</error>\n";
        echo "<message>{$error_message}</message>\n";
        echo "</response>";
        die;
    } else {
        echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
        echo "<response>\n";
        echo "<error>0</error>\n";
        echo "</response>";
    }
}
// trackback is done by a POST
$request_array = 'HTTP_POST_VARS';
if (!$_GET['tb_id']) {
    $tb_id = explode('/', $_SERVER['REQUEST_URI']);
    $tb_id = intval($tb_id[count($tb_id) - 1]);
}
$tb_url = $_POST['url'];
$charset = $_POST['charset'];
function yit_load_portfolio_quick_view_ajax()
{
    if (!isset($_REQUEST['item_id'])) {
        die;
    }
    $item_id = intval($_REQUEST['item_id']);
    // set the main wp query for the product
    wp('p=' . $item_id . '&post_type=' . get_post_type($item_id));
    // force classic layout
    add_filter('yit_portfolio_layout', 'yit_force_classic_portfolio_layout');
    ?>
	<link type="text/css" rel="stylesheet" href="<?php 
    echo YIT_THEME_TEMPLATES_URL . '/portfolios/single/css/style.css';
    ?>
" />
	<?php 
    do_action('yit_primary');
    die;
}
Exemple #18
0
<?php

/**
 * Outputs the Atom feed XML format using the feed-atom.php file in wp-includes
 * folder. This file only sets the feed format and includes the feed-atom.php.
 *
 * This file is no longer used in WordPress and while it is not deprecated now.
 * This file will most likely be deprecated or removed in a later version.
 *
 * The link for the atom feed is /index.php?feed=atom with permalinks off.
 *
 * @package WordPress
 */
if (empty($wp)) {
    require_once './wp-load.php';
    wp('feed=atom');
}
require ABSPATH . WPINC . '/feed-atom.php';
function yit_load_product_quick_view_ajax()
{
    if (!isset($_REQUEST['item_id'])) {
        die;
    }
    $product_id = intval($_REQUEST['item_id']);
    // set the main wp query for the product
    wp('p=' . $product_id . '&post_type=product');
    // remove parts from single product page
    remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5);
    remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10);
    remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 10);
    remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40);
    remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50);
    remove_all_actions('woocommerce_after_single_product_summary');
    remove_all_actions('woocommerce_after_single_product');
    // change template for variable products
    if (isset($GLOBALS['yith_wccl'])) {
        $GLOBALS['yith_wccl']->obj = new YITH_WCCL_Frontend(YITH_WCCL_VERSION);
        $GLOBALS['yith_wccl']->obj->override();
    }
    //wp_head();
    while (have_posts()) {
        the_post();
        ?>

        <?php 
        woocommerce_template_single_title();
        ?>
        <?php 
        woocommerce_template_single_rating();
        ?>
        <?php 
        woocommerce_template_single_price();
        ?>

        <div class="single-product woocommerce">

            <?php 
        wc_get_template_part('content', 'single-product');
        ?>

        </div>

    <?php 
    }
    // end of the loop.
    //wp_footer();
    die;
}
Exemple #20
0
 /**
  * Runs through the entirety of the WP bootstrap process
  */
 private function load_wordpress_with_template()
 {
     global $wp_query;
     WP_CLI::get_runner()->load_wordpress();
     // Set up the main WordPress query.
     wp();
     $interpreted = array();
     foreach ($wp_query as $key => $value) {
         if (0 === stripos($key, 'is_') && $value) {
             $interpreted[] = $key;
         }
     }
     WP_CLI::debug('Main WP_Query: ' . implode(', ', $interpreted), 'redis-debug');
     define('WP_USE_THEMES', true);
     add_filter('template_include', function ($template) {
         $display_template = str_replace(dirname(get_template_directory()) . '/', '', $template);
         WP_CLI::debug("Theme template: {$display_template}", 'redis-debug');
         return $template;
     }, 999);
     // Template is normally loaded in global scope, so we need to replicate
     foreach ($GLOBALS as $key => $value) {
         global ${$key};
     }
     // Load the theme template.
     ob_start();
     require_once ABSPATH . WPINC . '/template-loader.php';
     ob_get_clean();
 }
Exemple #21
0
/**
 * Executes a query for attachments. An array of WP_Query arguments
 * can be passed in, which will override the arguments set by this function.
 *
 * @since 2.5.0
 * @uses apply_filters() Calls 'upload_per_page' on posts_per_page argument
 *
 * @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal.
 * @return array
 */
function wp_edit_attachments_query($q = false)
{
    if (false === $q) {
        $q = $_GET;
    }
    $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
    $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
    $q['post_type'] = 'attachment';
    $post_type = get_post_type_object('attachment');
    $states = 'inherit';
    if (current_user_can($post_type->cap->read_private_posts)) {
        $states .= ',private';
    }
    $q['post_status'] = isset($q['status']) && 'trash' == $q['status'] ? 'trash' : $states;
    $media_per_page = (int) get_user_option('upload_per_page');
    if (empty($media_per_page) || $media_per_page < 1) {
        $media_per_page = 20;
    }
    $q['posts_per_page'] = apply_filters('upload_per_page', $media_per_page);
    $post_mime_types = get_post_mime_types();
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
        unset($q['post_mime_type']);
    }
    if (isset($q['detached'])) {
        add_filter('posts_where', '_edit_attachments_query_helper');
    }
    wp($q);
    if (isset($q['detached'])) {
        remove_filter('posts_where', '_edit_attachments_query_helper');
    }
    return array($post_mime_types, $avail_post_mime_types);
}
 /**
  * Ajax action to load product in quick view
  *
  * @access public
  * @return void
  * @since 1.0.0
  * @author Francesco Licandro <*****@*****.**>
  */
 public function yith_load_product_quick_view_ajax()
 {
     if (!isset($_REQUEST['product_id'])) {
         die;
     }
     $product_id = intval($_REQUEST['product_id']);
     // set the main wp query for the product
     wp('p=' . $product_id . '&post_type=product');
     // remove product thumbnails gallery
     remove_action('woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20);
     // change template for variable products
     if (isset($GLOBALS['yith_wccl'])) {
         $GLOBALS['yith_wccl']->obj = new YITH_WCCL_Frontend(YITH_WCCL_VERSION);
         $GLOBALS['yith_wccl']->obj->override();
     }
     ob_start();
     // load content template
     wc_get_template('yith-quick-view-content.php', array(), '', YITH_WCQV_DIR . 'templates/');
     echo ob_get_clean();
     die;
 }
Exemple #23
0
/**
 * Executes a query for attachments. An array of WP_Query arguments
 * can be passed in, which will override the arguments set by this function.
 *
 * @since 2.5.0
 *
 * @param array|false $q Array of query variables to use to build the query or false to use $_GET superglobal.
 * @return array
 */
function wp_edit_attachments_query($q = false)
{
    wp(wp_edit_attachments_query_vars($q));
    $post_mime_types = get_post_mime_types();
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    return array($post_mime_types, $avail_post_mime_types);
}
if (isset($_GET['s'])) {
    echo attribute_escape($_GET['s']);
}
?>
" size="17" /> 
  <input type="submit" name="submit" value="<?php 
_e('Search');
?>
"  /> 
  </fieldset>
</form>

<?php 
$show_post_type = 'page';
if (isset($_GET['s'])) {
    wp();
} else {
    $posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_status = 'static'");
}
if ($posts) {
    ?>
<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3"> 
  <tr> 
    <th scope="col"><?php 
    _e('ID');
    ?>
</th> 
    <th scope="col"><?php 
    _e('Title');
    ?>
</th> 
 /**
  * Outputs the contents of a meta editing table.
  * 
  * @since 2.9
  * 
  * @param string $genus The type of object being handled (either 'post' or 'term')
  * @param string $tab The ID of the current tab; used to generate a URL hash (e.g. #$tab)
  * @param string $type The type of post/taxonomy type being edited (examples: post, page, attachment, category, post_tag)
  * @param string $type_label The singular label for the post/taxonomy type (examples: Post, Page, Attachment, Category, Post Tag)
  * @param array $fields The array of meta fields that the user can edit with the tables. The data for each meta field are stored in an array with these elements: "type" (can be textbox, textarea, or checkbox), "name" (the meta field, e.g. title or description), "term_settings_key" (the key of the setting for cases when term meta data are stored in the settings array), and "label" (the internationalized label of the field, e.g. "Meta Description" or "Title Tag")
  */
 function meta_edit_table($genus, $tab, $type, $type_label, $fields)
 {
     //Pseudo-constant
     $per_page = 100;
     //Sanitize parameters
     if (!is_array($fields) || !count($fields)) {
         return false;
     }
     if (!isset($fields[0]) || !is_array($fields[0])) {
         $fields = array($fields);
     }
     //Get search query
     $type_s = $type . '_s';
     $search = isset($_REQUEST[$type_s]) ? $_REQUEST[$type_s] : '';
     //Save meta if applicable
     if ($is_update = $this->is_action('update') && !strlen(trim($search))) {
         foreach ($_POST as $key => $value) {
             $value = stripslashes($value);
             if (sustr::startswith($key, $genus . '_')) {
                 foreach ($fields as $field) {
                     if (preg_match("/{$genus}_([0-9]+)_{$field['name']}/", $key, $matches)) {
                         $id = (int) $matches[1];
                         switch ($genus) {
                             case 'post':
                                 update_post_meta($id, "_su_{$field['name']}", $value);
                                 break;
                             case 'term':
                                 $this->update_setting($field['term_settings_key'], $value, null, $id);
                                 break;
                         }
                         continue 2;
                         //Go to next $_POST item
                     }
                 }
             }
         }
     }
     $pagenum = isset($_GET[$type . '_paged']) ? absint($_GET[$type . '_paged']) : 0;
     if (empty($pagenum)) {
         $pagenum = 1;
     }
     //Load up the objects based on the genus
     switch ($genus) {
         case 'post':
             //Get the posts
             wp(array('post_type' => $type, 'posts_per_page' => $per_page, 'post_status' => 'any', 'paged' => $pagenum, 'order' => 'ASC', 'orderby' => 'title', 's' => $search));
             global $wp_query;
             $objects =& $wp_query->posts;
             $num_pages = $wp_query->max_num_pages;
             $total_objects = $wp_query->found_posts;
             break;
         case 'term':
             $objects = get_terms($type, array('search' => $search));
             $total_objects = count($objects);
             $num_pages = ceil($total_objects / $per_page);
             $objects = array_slice($objects, $per_page * ($pagenum - 1), $per_page);
             break;
         default:
             return false;
             break;
     }
     if ($total_objects < 1) {
         return false;
     }
     echo "\n<div class='su-meta-edit-table'>\n";
     $page_links = paginate_links(array('base' => add_query_arg($type . '_paged', '%#%') . '#' . $tab, 'format' => '', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => $num_pages, 'current' => $pagenum));
     if ($page_links) {
         $page_links_text = '<div class="tablenav"><div class="tablenav-pages">';
         $page_links_text .= sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($pagenum - 1) * $per_page + 1), number_format_i18n(min($pagenum * $per_page, $total_objects)), number_format_i18n($total_objects), $page_links);
         $page_links_text .= "</div></div>\n";
         echo $page_links_text;
     } else {
         $page_links_text = '';
     }
     //Get object identification headers
     $headers = array('actions' => __('Actions', 'seo-ultimate'), 'id' => __('ID', 'seo-ultimate'), 'name' => $type_label);
     //Get meta field headers
     foreach ($fields as $field) {
         $headers[$field['name']] = $field['label'];
     }
     //Output all headers
     $this->admin_wftable_start($headers);
     //Output rows
     foreach ($objects as $object) {
         switch ($genus) {
             case 'post':
                 $id = intval($object->ID);
                 $name = $object->post_title;
                 $view_url = get_permalink($id);
                 $edit_url = get_edit_post_link($id);
                 $status_obj = get_post_status_object($object->post_status);
                 switch ($object->post_status) {
                     case 'publish':
                         $status = '';
                         break;
                     case 'inherit':
                         $status = '';
                         break;
                     case 'auto-draft':
                         continue;
                         break;
                     default:
                         $status = $status_obj->label;
                         break;
                 }
                 if ($status) {
                     $name .= "<span class='su-meta-table-post-status'> &mdash; {$status}</span>";
                 }
                 break;
             case 'term':
                 $id = intval($object->term_id);
                 $name = $object->name;
                 $view_url = get_term_link($id, $type);
                 $edit_url = suwp::get_edit_term_link($id, $type);
                 break;
             default:
                 return false;
                 break;
         }
         $view_url = su_esc_attr($view_url);
         $edit_url = su_esc_attr($edit_url);
         $actions = array(sprintf('<a href="%s">%s</a>', $view_url, __('View', 'seo-ultimate')));
         if ($edit_url) {
             $actions[] = sprintf('<a href="%s">%s</a>', $edit_url, __('Edit', 'seo-ultimate'));
         }
         $actions = implode(' | ', $actions);
         $cells = compact('actions', 'id', 'name');
         //Get meta field cells
         foreach ($fields as $field) {
             $inputid = "{$genus}_{$id}_{$field['name']}";
             switch ($genus) {
                 case 'post':
                     $value = $this->get_postmeta($field['name'], $id);
                     break;
                 case 'term':
                     $value = $this->get_setting($field['term_settings_key'], array());
                     $value = isset($value[$id]) ? $value[$id] : null;
                     break;
             }
             if ($is_update && $field['type'] == 'checkbox' && $value == '1' && !isset($_POST[$inputid])) {
                 switch ($genus) {
                     case 'post':
                         delete_post_meta($id, "_su_{$field['name']}");
                         $value = 0;
                         break;
                     case 'term':
                         $this->update_setting($field['term_settings_key'], false, null, $id);
                         break;
                 }
             }
             $cells[$field['name']] = $this->get_input_element($field['type'], $inputid, $value, isset($field['options']) ? $field['options'] : false);
         }
         //Output all cells
         $this->table_row($cells, $id, $type);
     }
     //End table
     $this->admin_wftable_end();
     echo $page_links_text;
     echo "</div>\n";
     return true;
 }
<?php

if (empty($wp)) {
    require_once 'wp-config.php';
    wp('feed=rss');
}
header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
$more = 1;
echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
?>
<!-- generator="wordpress/<?php 
echo $wp_version;
?>
" -->
<rss version="0.92">
<channel>
	<title><?php 
bloginfo_rss('name');
?>
</title>
	<link><?php 
bloginfo_rss('url');
?>
</link>
	<description><?php 
bloginfo_rss('description');
?>
</description>
	<lastBuildDate><?php 
echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false);
?>
Exemple #27
0
<?php

/**
 * Outputs the RDF feed using the feed-rdf.php
 * file in wp-includes folder.
 *
 * This file only sets the feed format and includes the
 * feed-rdf.php.
 *
 * This file is no longer used in WordPress and while it is
 * not deprecated now. This file will most likely be
 * deprecated or removed in a later version.
 *
 * @package WordPress
 */
if (empty($wp)) {
    require_once './wp-load.php';
    wp('feed=rdf');
}
require ABSPATH . WPINC . '/feed-rdf.php';
<?php

/**
 * Handle Trackbacks and Pingbacks Sent to WordPress
 *
 * @since 0.71
 *
 * @package WordPress
 * @subpackage Trackbacks
 */
if (empty($wp)) {
    require_once dirname(__FILE__) . '/wp-load.php';
    wp(array('tb' => '1'));
}
/**
 * Response to a trackback.
 *
 * Responds with an error or success XML message.
 *
 * @since 0.71
 *
 * @param int|bool $error         Whether there was an error.
 *                                Default '0'. Accepts '0' or '1'.
 * @param string   $error_message Error message if an error occurred.
 */
function trackback_response($error = 0, $error_message = '')
{
    header('Content-Type: text/xml; charset=' . get_option('blog_charset'));
    if ($error) {
        echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
        echo "<response>\n";
Exemple #29
0
<?php

/**
 * Outputs the RSS2 feed XML format using the feed-rss2.php file in wp-includes
 * folder. This file only sets the feed format and includes the feed-rss2.php.
 *
 * This file is no longer used in WordPress and while it is not deprecated now.
 * This file will most likely be deprecated or removed in a later version.
 *
 * The link for the rss2 feed is /index.php?feed=rss2 with permalinks off.
 *
 * @package WordPress
 */
if (empty($wp)) {
    require_once './wp-load.php';
    wp('feed=rss2');
}
require ABSPATH . WPINC . '/feed-rss2.php';
Exemple #30
0
/**
 * Executes a query for attachments. An array of WP_Query arguments
 * can be passed in, which will override the arguments set by this function.
 *
 * @since 2.5.0
 *
 * @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal.
 * @return array
 */
function wp_edit_attachments_query($q = false)
{
    if (false === $q) {
        $q = $_GET;
    }
    $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
    $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
    $q['post_type'] = 'attachment';
    $post_type = get_post_type_object('attachment');
    $states = 'inherit';
    if (current_user_can($post_type->cap->read_private_posts)) {
        $states .= ',private';
    }
    $q['post_status'] = isset($q['status']) && 'trash' == $q['status'] ? 'trash' : $states;
    $q['post_status'] = isset($q['attachment-filter']) && 'trash' == $q['attachment-filter'] ? 'trash' : $states;
    $media_per_page = (int) get_user_option('upload_per_page');
    if (empty($media_per_page) || $media_per_page < 1) {
        $media_per_page = 20;
    }
    /**
     * Filter the number of items to list per page when listing media items.
     *
     * @since 2.9.0
     *
     * @param int $media_per_page Number of media to list. Default 20.
     */
    $q['posts_per_page'] = apply_filters('upload_per_page', $media_per_page);
    $post_mime_types = get_post_mime_types();
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
        unset($q['post_mime_type']);
    }
    foreach (array_keys($post_mime_types) as $type) {
        if (isset($q['attachment-filter']) && "post_mime_type:{$type}" == $q['attachment-filter']) {
            $q['post_mime_type'] = $type;
            break;
        }
    }
    if (isset($q['detached']) || isset($q['attachment-filter']) && 'detached' == $q['attachment-filter']) {
        $q['post_parent'] = 0;
    }
    wp($q);
    return array($post_mime_types, $avail_post_mime_types);
}