/**
  * Delete the entry.
  *
  * @access public
  * @since  Unknown
  *
  * @param int $id The entry ID.
  */
 public function delete($id)
 {
     /**
      * @var connectionsLoad $connections
      * @var wpdb            $wpdb
      */
     global $wpdb, $connections;
     do_action('cn_delete-entry', $this);
     do_action('cn_process_delete-entry', $this);
     // KEEP! This action must exist for Link, however, do not ever use it!
     // Get the core WP uploads info.
     // $uploadInfo = wp_upload_dir();
     // The entry slug is saved in the db URL encoded, so it needs to be decoded.
     $slug = rawurldecode($this->getSlug());
     // Ensure the entry slug is not empty in case a user added an entry with no name.
     // If this check is not done all the images in the CN_IMAGE_DIR_NAME will be deleted
     // by cnFileSystem::xrmdir() which would be very bad, indeed.
     if (!empty($slug)) {
         // Build path to the subfolder in which all the entry's images are saved.
         $path = CN_IMAGE_PATH . $slug . DIRECTORY_SEPARATOR;
         // Delete the entry image and its variations.
         cnEntry_Action::deleteImages($this->getImageNameOriginal(), $slug);
         // Delete any legacy images, pre 8.1, that may exist.
         cnEntry_Action::deleteLegacyImages($this);
         // Delete the entry logo.
         cnEntry_Action::deleteImages($this->getLogoName(), $slug);
         // Delete logo the legacy logo, pre 8.1.
         cnEntry_Action::deleteLegacyLogo($this);
         // Delete the entry subfolder from CN_IMAGE_DIR_NAME.
         cnFileSystem::xrmdir($path);
     }
     $wpdb->query($wpdb->prepare('DELETE FROM ' . CN_ENTRY_TABLE . ' WHERE id = %d', $id));
     /**
      *
      *
      * @TODO Only delete the addresses if deleting the entry was successful
      */
     $wpdb->query($wpdb->prepare('DELETE FROM ' . CN_ENTRY_ADDRESS_TABLE . ' WHERE entry_id = %d', $id));
     /**
      *
      *
      * @TODO Only delete the phone numbers if deleting the entry was successful
      */
     $wpdb->query($wpdb->prepare('DELETE FROM ' . CN_ENTRY_PHONE_TABLE . ' WHERE entry_id = %d', $id));
     /**
      *
      *
      * @TODO Only delete the email addresses if deleting the entry was successful
      */
     $wpdb->query($wpdb->prepare('DELETE FROM ' . CN_ENTRY_EMAIL_TABLE . ' WHERE entry_id = %d', $id));
     /**
      *
      *
      * @TODO Only delete the IM IDs if deleting the entry was successful
      */
     $wpdb->query($wpdb->prepare('DELETE FROM ' . CN_ENTRY_MESSENGER_TABLE . ' WHERE entry_id = %d', $id));
     /**
      *
      *
      * @TODO Only delete the social network IDs if deleting the entry was successful
      */
     $wpdb->query($wpdb->prepare('DELETE FROM ' . CN_ENTRY_SOCIAL_TABLE . ' WHERE entry_id = %d', $id));
     /**
      *
      *
      * @TODO Only delete the links if deleting the entry was successful
      */
     $wpdb->query($wpdb->prepare('DELETE FROM ' . CN_ENTRY_LINK_TABLE . ' WHERE entry_id = %d', $id));
     /**
      *
      *
      * @TODO Only delete the dates if deleting the entry was successful
      */
     $wpdb->query($wpdb->prepare('DELETE FROM ' . CN_ENTRY_DATE_TABLE . ' WHERE entry_id = %d', $id));
     /**
      *
      *
      * @TODO Only delete the category relationships if deleting the entry was successful
      */
     $connections->term->deleteTermRelationships($id);
     do_action('cn_deleted-entry', $this);
 }