Exemple #1
0
function wpgplus_debug($string)
{
    $wpgplusOptions = wpgplus_getAdminOptions();
    if (!empty($wpgplusOptions)) {
        foreach ($wpgplusOptions as $key => $option) {
            $wpgplusOptions[$key] = $option;
        }
    }
    if ($wpgplusOptions['wpgplus_debug'] == true) {
        $wpgplus_debug_file = WP_PLUGIN_DIR . '/wpgplus/wpgplus_debug.txt';
        $fp = @fopen($wpgplus_debug_file, 'a');
        if ($fp) {
            fwrite($fp, $string);
            fclose($fp);
        }
    } else {
        return false;
    }
}
Exemple #2
0
function wpgplus_store_post_options($post_id, $post = false)
{
    $wpgplusOptions = wpgplus_getAdminOptions();
    $post = get_post($post_id);
    $stored_meta = get_post_meta($post_id, 'wpgplus_publish', true);
    $posted_meta = $_POST['wpgplus_publish'];
    $wpgplus_message = $_POST['wpgplus_message'];
    $save = false;
    /* if there is $posted_meta, that takes priority over stored */
    if (!empty($posted_meta)) {
        $posted_meta == 'yes' ? $meta = 'yes' : ($meta = 'no');
        $save = true;
    } else {
        if (empty($stored_meta)) {
            $meta = 'yes';
            $save = true;
            /* if there is stored meta, and user didn't touch it, don't save */
        } else {
            $save = false;
        }
    }
    update_post_meta($post_id, 'wpgplus_message', $wpgplus_message);
    if ($save) {
        update_post_meta($post_id, 'wpgplus_publish', $meta);
    }
}