예제 #1
0
 public static function activate()
 {
     update_option('facebookalbum', FB_Album::default_options());
 }
<?php

/**
 * Template and actions for options page.
 */
if (!defined('DB_NAME')) {
    header('HTTP/1.0 403 Forbidden');
    die;
}
//For nonce.
global $current_user;
//Setup plugin options.
$options = get_option('facebookalbum', FB_Album::default_options());
$options['cache'] = isset($options['cache']) ? $options['cache'] : 1;
$options['pages'] = isset($options['pages']) ? $options['pages'] : array();
//If nonce, do update
if (isset($_POST["fbalbum_nonce"])) {
    $options = $_POST['facebookalbum'];
    update_option('facebookalbum', $options);
    echo '<div class="updated"><p><strong>Facebook Albums has been updated</strong></p></div>';
}
if (isset($_GET['reset_application']) && wp_verify_nonce($_GET['reset_application'], $current_user->data->user_email)) {
    unset($options['app_id']);
    unset($options['app_secret']);
    unset($options['access_token']);
    update_option('facebookalbum', $options);
    echo '<div class="updated"><p><strong>Facebook API application has been removed.</strong></p></div>';
}
if (isset($_GET['clear_cache']) && wp_verify_nonce($_GET['clear_cache'], $current_user->data->user_email)) {
    global $wpdb;
    $transient_caches_query = sprintf('DELETE FROM %1$s WHERE option_name LIKE "_transient_fbalbum_%%" ', $wpdb->options);