示例#1
0
 /**
  * Insert plugin box on post edit panel.
  */
 function editbox_post()
 {
     global $post;
     $gdsr_options = $this->o;
     $post_id = $post->ID;
     $default = false;
     $countdown_value = $gdsr_options["default_timer_countdown_value"];
     $countdown_type = $gdsr_options["default_timer_countdown_type"];
     $recc_countdown_value = $gdsr_options["default_timer_countdown_value"];
     $recc_countdown_type = $gdsr_options["default_timer_countdown_type"];
     $timer_date_value = $recc_timer_date_value = "";
     if ($post_id == 0) {
         $default = true;
     } else {
         $post_data = GDSRDatabase::get_post_edit($post_id);
         if (count($post_data) > 0) {
             $rating = explode(".", strval($post_data->review));
             $rating_decimal = intval($rating[1]);
             $rating = intval($rating[0]);
             $recc_vote_rules = $post_data->recc_rules_articles;
             $recc_moderation_rules = $post_data->recc_moderate_articles;
             $recc_cmm_vote_rules = $post_data->recc_rules_comments;
             $recc_cmm_moderation_rules = $post_data->recc_moderate_comments;
             $recc_timer_restrictions = $post_data->recc_expiry_type;
             if ($recc_timer_restrictions == "T") {
                 $recc_countdown_type = substr($post_data->recc_expiry_value, 0, 1);
                 $recc_countdown_value = substr($post_data->recc_expiry_value, 1);
             } else {
                 if ($recc_timer_restrictions == "D") {
                     $recc_timer_date_value = $post_data->recc_expiry_value;
                 }
             }
             $vote_rules = $post_data->rules_articles;
             $moderation_rules = $post_data->moderate_articles;
             $cmm_vote_rules = $post_data->rules_comments;
             $cmm_moderation_rules = $post_data->moderate_comments;
             $timer_restrictions = $post_data->expiry_type;
             if ($timer_restrictions == "T") {
                 $countdown_type = substr($post_data->expiry_value, 0, 1);
                 $countdown_value = substr($post_data->expiry_value, 1);
             } else {
                 if ($timer_restrictions == "D") {
                     $timer_date_value = $post_data->expiry_value;
                 }
             }
         } else {
             $default = true;
         }
     }
     if ($default) {
         $rating_decimal = $rating = -1;
         $recc_vote_rules = $gdsr_options["default_voterules_articles"];
         $recc_moderation_rules = $gdsr_options["default_moderation_articles"];
         $recc_cmm_vote_rules = $gdsr_options["default_voterules_comments"];
         $recc_cmm_moderation_rules = $gdsr_options["default_moderation_comments"];
         $recc_timer_restrictions = $gdsr_options["default_timer_type"];
         $vote_rules = $gdsr_options["default_voterules_articles"];
         $moderation_rules = $gdsr_options["default_moderation_articles"];
         $cmm_vote_rules = $gdsr_options["default_voterules_comments"];
         $cmm_moderation_rules = $gdsr_options["default_moderation_comments"];
         $timer_restrictions = $gdsr_options["default_timer_type"];
     }
     include $this->plugin_path . 'integrate/edit.php';
 }