Esempio n. 1
0
 /**
  * Updates options
  *
  * @uses do_action() Provides 'k2_update_options' action
  */
 function update_options()
 {
     // Columns
     if (isset($_POST['k2']['columns'])) {
         update_option('unwakeable_columns', $_POST['k2']['columns']);
     }
     // Advanced Navigation
     if (isset($_POST['k2']['advnav'])) {
         update_option('unwakeable_livesearch', '1');
         update_option('unwakeable_rollingarchives', '1');
     } else {
         update_option('unwakeable_livesearch', '0');
         update_option('unwakeable_rollingarchives', '0');
     }
     // JavaScript Animations
     if (isset($_POST['k2']['animations'])) {
         update_option('unwakeable_animations', '1');
     } else {
         update_option('unwakeable_animations', '0');
     }
     // Archives Page (thanks to Michael Hampton, http://www.ioerror.us/ for the assist)
     if (isset($_POST['k2']['archives'])) {
         update_option('unwakeable_archives', '1');
         K2Archive::create_archive();
     } else {
         update_option('unwakeable_archives', '0');
         K2Archive::delete_archive();
     }
     // Asides
     if (isset($_POST['k2']['asidescategory'])) {
         update_option('unwakeable_asidescategory', (int) $_POST['k2']['asidescategory']);
     }
     // Top post meta
     if (isset($_POST['k2']['entrymeta1'])) {
         update_option('unwakeable_entrymeta1', stripslashes($_POST['k2']['entrymeta1']));
     }
     // Bottom post meta
     if (isset($_POST['k2']['entrymeta2'])) {
         update_option('unwakeable_entrymeta2', stripslashes($_POST['k2']['entrymeta2']));
     }
     // Ajax Success JavaScript
     if (isset($_POST['k2']['ajaxdonejs'])) {
         update_option('unwakeable_ajaxdonejs', stripslashes($_POST['k2']['ajaxdonejs']));
     }
     // K2 Hook
     do_action('k2_update_options');
 }
Esempio n. 2
0
 function update()
 {
     if (!empty($_POST)) {
         if (isset($_POST['k2'])) {
             // Advanced Navigation
             if (isset($_POST['k2']['advnav'])) {
                 update_option('k2livesearch', '1');
                 update_option('k2rollingarchives', '1');
             } else {
                 update_option('k2livesearch', '0');
                 update_option('k2rollingarchives', '0');
             }
             // Archives Page
             if (isset($_POST['k2']['archives'])) {
                 if (get_option('k2archives') != 'add_archive') {
                     update_option('k2archives', '1');
                     K2Archive::create_archive();
                 }
             } else {
                 // thanks to Michael Hampton, http://www.ioerror.us/ for the assist
                 update_option('k2archives', '0');
                 K2Archive::delete_archive();
             }
             // Live Commenting
             if (isset($_POST['k2']['livecommenting'])) {
                 update_option('k2livecommenting', '1');
             } else {
                 update_option('k2livecommenting', '0');
             }
             // Set all the options
             foreach ($_POST['k2'] as $option => $value) {
                 update_option('k2' . $option, $value);
             }
             if (isset($_POST['k2']['scheme'])) {
                 update_style_info();
             }
         }
         if (isset($_POST['configela']) and !K2Archive::setup_archive()) {
             unset($_POST['configela']);
         }
     }
 }
Esempio n. 3
0
 function install()
 {
     if ('1' == get_option('k2archives')) {
         K2Archive::create_archive();
     }
 }