Ejemplo n.º 1
0
 public static function update_views($post_id)
 {
     $views = self::get_views($post_id);
     $views++;
     self::update_meta($post_id, 'views', $views);
     $views_week = intval(self::get_meta($post_id, 'views_week'));
     $new_week = intval(get_option('sb_new_week'));
     if (SB_PHP::is_monday() && $new_week != 1) {
         $views_week = 0;
         update_option('sb_new_week', 1);
     } else {
         if (!SB_PHP::is_monday() && $new_week != 0) {
             update_option('sb_new_week', 0);
         }
     }
     $views_week++;
     self::update_meta($post_id, 'views_week', $views_week);
 }