/**
  * Display results based on qurey var `cn-view`.
  *
  * @access public
  * @since  0.7.3
  * @static
  * @uses   get_query_var()
  * @param  array $atts
  * @param  string $content [optional]
  *
  * @return string
  */
 public static function view($atts, $content = '', $tag = 'connections')
 {
     // Grab an instance of the Connections object.
     $instance = Connections_Directory();
     /*$getAllowPublic = $instance->options->getAllowPublic();
     		var_dump($getAllowPublic);
     		$getAllowPublicOverride = $instance->options->getAllowPublicOverride();
     		var_dump($getAllowPublicOverride);
     		$getAllowPrivateOverride = $instance->options->getAllowPrivateOverride();
     		var_dump($getAllowPrivateOverride);*/
     /*
      * Only show this message under the following condition:
      * - ( The user is not logged in AND the 'Login Required' is checked ) AND ( neither of the shortcode visibility overrides are enabled ).
      */
     if (!is_user_logged_in() && !$instance->options->getAllowPublic() && !($instance->options->getAllowPublicOverride() || $instance->options->getAllowPrivateOverride())) {
         $message = $instance->settings->get('connections', 'connections_login', 'message');
         // Format and texturize the message.
         $message = wptexturize(wpautop($message));
         // Make any links and such clickable.
         $message = make_clickable($message);
         // Apply the shortcodes.
         $message = do_shortcode($message);
         return $message;
     }
     $view = get_query_var('cn-view');
     switch ($view) {
         case 'submit':
             if (has_action('cn_submit_entry_form')) {
                 ob_start();
                 do_action('cn_submit_entry_form', $atts, $content, $tag);
                 return ob_get_clean();
             } else {
                 return '<p>' . __('Future home of front end submissions.', 'connections') . '</p>';
             }
             break;
         case 'landing':
             return '<p>' . __('Future home of the landing pages, such a list of categories.', 'connections') . '</p>';
             break;
         case 'search':
             if (has_action('cn_submit_search_form')) {
                 ob_start();
                 do_action('cn_submit_search_form', $atts, $content, $tag);
                 return ob_get_clean();
             } else {
                 return '<p>' . __('Future home of the search page.', 'connections') . '</p>';
             }
             break;
         case 'results':
             if (has_action('cn_submit_search_results')) {
                 ob_start();
                 do_action('cn_submit_search_results', $atts, $content, $tag);
                 return ob_get_clean();
             } else {
                 return '<p>' . __('Future home of the search results landing page.', 'connections') . '</p>';
             }
             break;
             // Show the standard result list.
         // Show the standard result list.
         case 'card':
             return cnShortcode_Connections::shortcode($atts, $content);
             break;
             // Show the "View All" result list using the "Names" template.
         // Show the "View All" result list using the "Names" template.
         case 'all':
             // Disable the output of the repeat character index.
             $atts['repeat_alphaindex'] = FALSE;
             // Force the use of the Names template.
             $atts['template'] = 'names';
             return cnShortcode_Connections::shortcode($atts, $content);
             break;
             // Show the entry detail using a template based on the entry type.
         // Show the entry detail using a template based on the entry type.
         case 'detail':
             switch (get_query_var('cn-process')) {
                 case 'edit':
                     if (has_action('cn_edit_entry_form')) {
                         // Check to see if the entry has been linked to a user ID.
                         $entryID = get_user_meta(get_current_user_id(), 'connections_entry_id', TRUE);
                         // var_dump( $entryID );
                         //
                         $results = $instance->retrieve->entries(array('status' => 'approved,pending'));
                         // var_dump( $results );
                         /*
                          * The `cn_edit_entry_form` action should only be executed if the user is
                          * logged in and they have the `connections_manage` capability and either the
                          * `connections_edit_entry` or `connections_edit_entry_moderated` capability.
                          */
                         if (is_user_logged_in() && (current_user_can('connections_manage') || $entryID == $results[0]->id) && (current_user_can('connections_edit_entry') || current_user_can('connections_edit_entry_moderated'))) {
                             ob_start();
                             if (!current_user_can('connections_edit_entry') && $results[0]->status == 'pending') {
                                 echo '<p>' . __('Your entry submission is currently under review, however, you can continue to make edits to your entry submission while your submission is under review.', 'connections') . '</p>';
                             }
                             do_action('cn_edit_entry_form', $atts, $content, $tag);
                             return ob_get_clean();
                         } else {
                             return __('You are not authorized to edit entries. Please contact the admin if you received this message in error.', 'connections');
                         }
                     }
                     break;
                 default:
                     // Ensure an array is passed the the cnRetrieve::entries method.
                     if (!is_array($atts)) {
                         $atts = (array) $atts;
                     }
                     $results = $instance->retrieve->entries($atts);
                     //var_dump($results);
                     $atts['list_type'] = $instance->settings->get('connections', 'connections_display_single', 'template') ? $results[0]->entry_type : NULL;
                     // Disable the output of the following because they do no make sense to display for a single entry.
                     $atts['show_alphaindex'] = FALSE;
                     $atts['repeat_alphaindex'] = FALSE;
                     $atts['show_alphahead'] = FALSE;
                     return cnShortcode_Connections::shortcode($atts, $content);
                     break;
             }
             break;
             // Show the standard result list.
         // Show the standard result list.
         default:
             //return cnShortcode_Connections::shortcode( $atts, $content );
             if (has_action("cn_view_{$view}")) {
                 ob_start();
                 do_action("cn_view_{$view}", $atts, $content, $tag);
                 return ob_get_clean();
             }
             break;
     }
     return cnShortcode_Connections::shortcode($atts, $content);
 }
function _connections_qtip($atts, $content = NULL, $tag)
{
    $atts = shortcode_atts(array('id' => NULL), $atts, $tag);
    if (empty($atts['id']) || !is_numeric($atts['id']) || empty($content)) {
        return '';
    }
    $qTipContent = '<span class="cn-qtip-content-card" style="display: none">' . cnShortcode_Connections::shortcode(array('id' => $atts['id'], 'template' => 'qtip-card')) . '</span>';
    return '<span class="cn-qtip-card">' . $content . $qTipContent . '</span>';
}