Пример #1
0
function hlik_admin_main()
{
    global $wpdb;
    ?>
    <div class="wrap">
        <h2>HotLink Image Cacher</h2>
        <?php 
    set_time_limit(0);
    if ($_POST['step'] == '2') {
        $url_method = trim($_POST['url_method']);
        $postid_list = $wpdb->get_results("SELECT DISTINCT ID FROM {$wpdb->posts} WHERE post_content LIKE ('%<img%')");
        if (!$postid_list) {
            die('No posts with images were found.');
        }
        foreach ($postid_list as $v) {
            $post_id = $v->ID;
            $options['url_method'] = $url_method;
            hlik_cache_img($post_id, $options);
        }
        ?>
            <div id="message" class="updated fade"><p><strong>Processed all post</strong></p></div>
            <?php 
    }
    ?>
        <?php 
    if (!isset($_POST['step'])) {
        ?>
            <p>Clicking on Process All Posts will process all posts with hotlinked images.</p>
            <div class="narrow">
                <form action="" method="post">
                    <input name="step" type="hidden" id="step" value="2">
                    <p class="submit"><input type="submit" name="Submit" value="Process All Posts &raquo;" /></p>
                </form>
            </div>
        <?php 
    }
    ?>
        
    </div>
        <?php 
}
Пример #2
0
function hlik_save_post($hlik_post_id)
{
    $options = array();
    hlik_cache_img($hlik_post_id, $options);
    return $hlik_post_id;
}