public static function get_display($post_ID, $single = false)
 {
     $meta = new Kind_Meta($post_ID);
     $kind = get_post_kind_slug($post_ID);
     $cite = $meta->get_cite();
     $hcard = 'Unknown Author';
     $content = '';
     switch ($kind) {
         case 'note':
         case 'article':
         case 'photo':
             break;
         default:
             include 'views/kind-default.php';
     }
     return apply_filters('kind-response-display', $content);
 }
 public static function get_post_kind($post = null)
 {
     $kind = get_post_kind_slug($post);
     if ($kind) {
         $strings = self::get_strings();
         return $strings[$kind];
     } else {
         return false;
     }
 }
 public static function save_post($post_id, $post)
 {
     /*
      * We need to verify this came from our screen and with proper authorization,
      * because the save_post action can be triggered at other times.
      */
     // Check if our nonce is set.
     if (!isset($_POST['tabkind_metabox_nonce'])) {
         return;
     }
     // Verify that the nonce is valid.
     if (!wp_verify_nonce($_POST['tabkind_metabox_nonce'], 'tabkind_metabox')) {
         return;
     }
     // If this is an autosave, our form has not been submitted, so we don't want to do anything.
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return;
     }
     // Check the user's permissions.
     if (isset($_POST['post_type']) && 'page' == $_POST['post_type']) {
         if (!current_user_can('edit_page', $post_id)) {
             return;
         }
     } else {
         if (!current_user_can('edit_post', $post_id)) {
             return;
         }
     }
     $kind = get_post_kind_slug($post);
     $meta = new Kind_Meta($post);
     if (isset($_POST['time'])) {
         if (isset($_POST['time']['start_date']) || isset($_POST['time']['start_time'])) {
             $start = $meta->build_time($_POST['time']['start_date'], $_POST['time']['start_time'], $_POST['time']['start_offset']);
         }
         if (isset($_POST['time']['end_date']) || isset($_POST['time']['end_time'])) {
             $end = $meta->build_time($_POST['time']['end_date'], $_POST['time']['end_time'], $_POST['time']['end_offset']);
         }
     }
     if (isset($_POST['cite'])) {
         if (in_array($kind, array('like', 'reply', 'repost', 'favorite', 'bookmark'))) {
             if (!empty($start)) {
                 $_POST['cite']['published'] = $start;
                 error_log('Start: ' . $start);
             }
             if (!empty($end)) {
                 $_POST['cite']['updated'] = $end;
                 error_log('End: ' . $end);
             }
         } else {
             $meta->set_time($start, $end);
         }
         $meta->set_cite($_POST['cite']);
     }
     if (isset($_POST['author'])) {
         $meta->set_author($_POST['author']);
     }
     if (isset($_POST['url'])) {
         $meta->set_url($_POST['url']);
     }
     // This is temporary - planning on improving this later
     if (isset($_POST['duration'])) {
         $meta->set('duration', $_POST['duration']);
     }
     $meta->save_meta($post);
 }
 /**
  * Sets URL.
  *
  * @param $url string|array Either a string indicating the URL or an array of URLs.
  */
 public function set_url($url)
 {
     if (empty($url)) {
         return;
     }
     $url = self::sanitize_text($url);
     $kind = get_post_kind_slug($this->post);
     $map = array_diff(Kind_Taxonomy::get_kind_properties(), array(''));
     if (array_key_exists($kind, $map)) {
         $this->meta[$map[$kind]] = $url;
     }
     if (!array_key_exists('cite', $this->meta)) {
         $this->meta['url'] = $url;
     }
 }