/**
  * Locate the file paths of the template, CSS and JS files
  * based on the supplied array of file names. The file name
  * array should be in order of highest priority first, lowest
  * priority last.
  *
  * @access public
  * @since  0.8
  * @static
  * @uses   filePaths()
  *
  * @param  array $files An indexed array of file names to search for.
  * @param  string $return
  *
  * @return mixed bool|string The absolute file system path to the located file. False is file not found.
  */
 public static function file($files, $return = 'path')
 {
     $path = FALSE;
     $files = array_filter((array) $files);
     // Try locating this template file by looping through the template paths.
     foreach (self::filePaths() as $filePath) {
         // Try to find a template file.
         foreach ($files as $fileName) {
             // var_dump( $filePath . $fileName );
             if (file_exists($filePath . $fileName)) {
                 // var_dump( $filePath . $fileName );
                 $path = $filePath . $fileName;
                 break 2;
             }
         }
     }
     switch ($return) {
         case 'url':
             $result = $path ? cnURL::fromPath($path) : $path;
             break;
         default:
             $result = $path;
             break;
     }
     return $result;
 }
/**
 * Enfold uses ID CSS selectors which override the core Chosen CSS selectors.
 * This will load an alternative CSS file where all the core Chosen CSS selectors are prefixed with #cn-list.
 * This in theory should override the Enfold CSS selectors.
 *
 * @link https://connections-pro.com/support/topic/enfold-theme-issues/
 */
function cn_enqueue_enfold_css_override()
{
    // If SCRIPT_DEBUG is set and TRUE load the non-minified CSS files, otherwise, load the minified files.
    $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    $url = cnURL::makeProtocolRelative(CN_URL);
    $theme = wp_get_theme();
    $parent = $theme->parent();
    if (FALSE === $parent || NULL === $parent) {
        $enqueue = in_array($theme->get('Name'), array('Enfold'), TRUE);
    } elseif ($parent instanceof WP_Theme) {
        $enqueue = in_array($parent->get('Name'), array('Enfold'), TRUE);
    } else {
        $enqueue = FALSE;
    }
    if ($enqueue) {
        wp_deregister_style('cn-chosen');
        wp_register_style('cn-chosen', $url . "vendor/chosen/chosen-cn-list{$min}.css", array(), CN_CURRENT_VERSION);
    }
}
 /**
  * Registers the CSS libraries that may be enqueued in the admin or frontend.
  *
  * @access private
  * @since  0.7.3.2
  * @static
  *
  * @uses   add_filter()
  * @uses   is_admin()
  * @uses   wp_register_style()
  * @uses   get_user_option()
  * @uses   is_rtl()
  * @uses   cnSettingsAPI::get()
  * @uses   cnLocate::file()
  * @uses   cnLocate::fileNames()
  * @uses   wp_style_is()
  * @uses   remove_filter()
  *
  * @return void
  */
 public static function registerCSS()
 {
     // Add a filter so cnLocate will search the plugins CSS folder.
     add_filter('cn_locate_file_paths', array(__CLASS__, 'coreCSSPath'));
     // If SCRIPT_DEBUG is set and TRUE load the non-minified CSS files, otherwise, load the minified files.
     $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     $url = cnURL::makeProtocolRelative(CN_URL);
     if (is_admin()) {
         wp_register_style('cn-admin', $url . "assets/css/cn-admin{$min}.css", array(), CN_CURRENT_VERSION);
         wp_register_style('cn-admin-jquery-ui', $url . 'assets/css/jquery-ui-' . ('classic' == get_user_option('admin_color') ? 'classic' : 'fresh') . "{$min}.css", array(), CN_CURRENT_VERSION);
         wp_register_style('cn-admin-jquery-datepicker', $url . "assets/css/datepicker{$min}.css", array('cn-admin-jquery-ui'), CN_CURRENT_VERSION);
         if (is_rtl()) {
             wp_register_style('cn-admin-rtl', $url . "assets/css/cn-admin-rtl{$min}.css", array('cn-admin'), CN_CURRENT_VERSION);
         }
     } else {
         if (cnSettingsAPI::get('connections', 'compatibility', 'css')) {
             // This will locate the CSS file to be enqueued.
             $coreCSS = cnLocate::file(cnLocate::fileNames('cn-user', NULL, NULL, 'css'), 'url');
             // var_dump($coreCSS);
             // Registering the CSS with 'connections-user' for legacy support. Remove this at some point. 04/01/2014
             wp_register_style('connections-user', $coreCSS, array(), CN_CURRENT_VERSION);
             wp_register_style('cn-public', $coreCSS, array(), CN_CURRENT_VERSION);
         }
         // This will locate the custom CSS file to be enqueued.
         $customCSS = cnLocate::file(cnLocate::fileNames('cn-custom', NULL, NULL, 'css'), 'url');
         // var_dump($customCSS);
         // If a custom CSS file was found, lets register it.
         if ($customCSS) {
             // Check to see if the core CSS file was registered since it can be disabled.
             // Add it to the $required array to be used when registering the custom CSS file.
             $required = wp_style_is('cn-public', 'registered') ? array('cn-public') : array();
             wp_register_style('cn-public-custom', $customCSS, $required, CN_CURRENT_VERSION);
         }
     }
     wp_register_style('cn-qtip', $url . "vendor/jquery-qtip/jquery.qtip{$min}.css", array(), '2.2.1');
     wp_register_style('cn-chosen', $url . "vendor/chosen/chosen{$min}.css", array(), '1.6.1');
     wp_register_style('cn-font-awesome', $url . "vendor/font-awesome/css/font-awesome{$min}.css", array(), '4.4.0');
     // Remove the filter that adds the core CSS path to cnLocate.
     remove_filter('cn_locate_file_paths', array(__CLASS__, 'coreCSSPath'));
 }
 /**
  * Render the back link.
  *
  * @access private
  * @since  8.4
  *
  * @uses   cnURL::permalink()
  *
  * @param array    $atts
  * @param cnOutput $entry Instance of the cnEntry class.
  */
 public function singleActions($atts = array(), $entry)
 {
     echo '<ul><li>';
     cnURL::permalink(array('type' => 'home', 'text' => __('Go Back', 'connections'), 'return' => FALSE));
     echo '</li></ul>';
 }
 /**
  * The private recursive function to build the category link item.
  *
  * Accepted option for the $atts property are:
  * 	type (string)
  * 	show_empty (bool) Whether or not to display empty categories.
  * 	show_count (bool) Whether or not to display the category count.
  *
  * @param object $category A category object.
  * @param int $level The current category level.
  * @param int $depth The depth limit.
  * @param array $slug An array of the category slugs to be used to build the permalink.
  * @param array $atts
  * @return string
  */
 private static function categoryLinkDescendant($category, $level, $depth, $slug, $atts)
 {
     /**
      * @var WP_Rewrite $wp_rewrite
      * @var connectionsLoad $connections
      */
     global $wp_rewrite;
     $out = '';
     $defaults = array('show_empty' => TRUE, 'show_count' => TRUE, 'exclude' => array(), 'force_home' => FALSE, 'home_id' => cnSettingsAPI::get('connections', 'connections_home_page', 'page_id'));
     $atts = wp_parse_args($atts, $defaults);
     // Do not show the excluded category as options.
     if (!empty($atts['exclude']) && in_array($category->term_id, $atts['exclude'])) {
         return $out;
     }
     if ($atts['show_empty'] || !empty($category->count) || !empty($category->children)) {
         $count = $atts['show_count'] ? ' (' . $category->count . ')' : '';
         /*
          * Determine of pretty permalink is enabled.
          * If it is, add the category slug to the array which will be imploded to be used to build the URL.
          * If it is not, set the $slug to the category term ID.
          */
         if ($wp_rewrite->using_permalinks()) {
             $slug[] = $category->slug;
         } else {
             $slug = array($category->slug);
         }
         /*
          * Get tge current category from the URL / query string.
          */
         if (cnQuery::getVar('cn-cat-slug')) {
             // Category slug
             $queryCategorySlug = cnQuery::getVar('cn-cat-slug');
             if (!empty($queryCategorySlug)) {
                 // If the category slug is a descendant, use the last slug from the URL for the query.
                 $queryCategorySlug = explode('/', $queryCategorySlug);
                 if (isset($queryCategorySlug[count($queryCategorySlug) - 1])) {
                     $currentCategory = $queryCategorySlug[count($queryCategorySlug) - 1];
                 }
             }
         } elseif (cnQuery::getVar('cn-cat')) {
             $currentCategory = cnQuery::getVar('cn-cat');
         } else {
             $currentCategory = '';
         }
         $out .= '<li class="cat-item cat-item-' . $category->term_id . ($currentCategory == $category->slug || $currentCategory == $category->term_id ? ' current-cat' : '') . ' cn-cat-parent">';
         // Create the permalink anchor.
         $out .= cnURL::permalink(array('type' => 'category', 'slug' => implode('/', $slug), 'title' => $category->name, 'text' => $category->name . $count, 'home_id' => $atts['home_id'], 'force_home' => $atts['force_home'], 'return' => TRUE));
         /*
          * Only show the descendants based on the following criteria:
          * 	- There are descendant categories.
          * 	- The descendant depth is < than the current $level
          *
          * When descendant depth is set to 0, show all descendants.
          * When descendant depth is set to < $level, call the recursive function.
          */
         if (!empty($category->children) && ($depth <= 0 ? -1 : $level) < $depth) {
             $out .= '<ul class="children cn-cat-children">';
             foreach ($category->children as $child) {
                 $out .= self::categoryLinkDescendant($child, $level + 1, $depth, $slug, $atts);
             }
             $out .= '</ul>';
         }
         $out .= '</li>';
     }
     return $out;
 }
Exemplo n.º 6
0
 /**
  * Enqueues the template's JS in the theme's footer.
  *
  * @access private
  * @since  0.7.6
  * @return void
  */
 public function enqueueScript()
 {
     $required = apply_filters('cn_template_required_js-' . $this->slug, array(), $this);
     $url = cnURL::makeProtocolRelative($this->parts['js-url']);
     wp_enqueue_script("cnt-{$this->slug}", $url, $required, $this->version, TRUE);
 }
 /**
  * Set the URL to create a screenshot of.
  *
  * @access public
  * @since  8.2.5
  *
  * @param string $url
  */
 public function setURL($url)
 {
     // If the http protocol is not part of the url, add it.
     $this->url = cnURL::prefix($url);
 }
Exemplo n.º 8
0
 /**
  * Get the template base URL.
  *
  * @access public
  * @since  0.7.6
  * @uses   cnURL::fromPath()
  * @uses   getPath()
  *
  * @return string
  */
 public function getURL()
 {
     /*
      * The template URL is required when registering a template, but is not enforced.
      * So, there is a possibility that this value is empty.
      *
      * Let get the URL from the $this->getPath().
      */
     if (empty($this->url)) {
         $this->url = cnURL::fromPath($this->getPath());
     }
     return $this->url;
 }
 /**
  * Render an unordered list of categories.
  *
  * This is the Connections equivalent of @see wp_list_categories() in WordPress core ../wp-includes/category-template.php
  *
  * @access public
  * @since  8.1.6
  * @static
  *
  * @uses   wp_parse_args()
  * @uses   cnTerm::getTaxonomyTerms()
  * @uses   cnURL::permalink()
  * @uses   Walker::walk()
  *
  * @param array $atts {
  *     Optional. An array of arguments.
  *     NOTE: Additionally, all valid options as supported in @see cnTerm::getTaxonomyTerms().
  *
  * @type string $show_option_all  A non-blank value causes the display of a link to the directory home page.
  *                                Default: ''. The default is not to display a link.
  *                                Accepts: Any valid string.
  * @type string $show_option_none Set the text to show when no categories are listed.
  *                                Default: 'No Categories'
  *                                Accepts: Any valid string.
  * @type bool   $show_count       Whether or not to display the category count.
  *                                Default: FALSE
  * @type int    $depth            Controls how many levels in the hierarchy of categories are to be included in the list.
  *                                Default: 0
  *                                Accepts: 0  - All categories and child categories.
  *                                         -1 - All Categories displayed  flat, not showing the parent/child relationships.
  *                                         1  - Show only top level/root parent categories.
  *                                         n  - Value of n (int) specifies the depth (or level) to descend in displaying the categories.
  * @type string $taxonomy         The taxonomy tree to display.
  *                                Default: 'category'
  *                                Accepts: Any registered taxonomy.
  * @type bool   $return           Whether or not to return or echo the resulting HTML.
  *                                Default: FALSE
  * }
  *
  * @return string
  */
 public static function render($atts = array())
 {
     $out = '';
     $defaults = array('show_option_all' => '', 'show_option_none' => __('No categories', 'connections'), 'orderby' => 'name', 'order' => 'ASC', 'show_count' => FALSE, 'hide_empty' => FALSE, 'child_of' => 0, 'exclude' => array(), 'hierarchical' => TRUE, 'depth' => 0, 'parent_id' => array(), 'taxonomy' => 'category', 'force_home' => FALSE, 'home_id' => cnSettingsAPI::get('connections', 'connections_home_page', 'page_id'), 'return' => FALSE);
     $atts = wp_parse_args($atts, $defaults);
     $atts['parent_id'] = wp_parse_id_list($atts['parent_id']);
     $walker = new self();
     if (empty($atts['parent_id'])) {
         $terms = cnTerm::getTaxonomyTerms($atts['taxonomy'], array_merge($atts, array('name' => '')));
     } else {
         $terms = cnTerm::getTaxonomyTerms($atts['taxonomy'], array_merge($atts, array('include' => $atts['parent_id'], 'child_of' => 0, 'name' => '')));
         // If any of the `parent_id` is not a root parent (where $term->parent = 0) set it parent ID to `0`
         // so the term tree will be properly constructed.
         foreach ($terms as $term) {
             if (0 !== $term->parent) {
                 $term->parent = 0;
             }
         }
         foreach ($atts['parent_id'] as $termID) {
             $children = cnTerm::getTaxonomyTerms($atts['taxonomy'], array_merge($atts, array('child_of' => $termID, 'name' => '')));
             if (!is_wp_error($children)) {
                 $terms = array_merge($terms, $children);
             }
         }
     }
     /**
      * Allows extensions to add/remove class names to the term tree list.
      *
      * @since 8.5.18
      *
      * @param array $class The array of class names.
      * @param array $terms The array of terms.
      * @param array $atts  The method attributes.
      */
     $class = apply_filters('cn_term_list_class', array('cn-cat-tree'), $terms, $atts);
     $class = cnSanitize::htmlClass($class);
     $out .= '<ul class="' . cnFunction::escAttributeDeep($class) . '">' . PHP_EOL;
     if (empty($terms)) {
         $out .= '<li class="cat-item-none">' . $atts['show_option_none'] . '</li>';
     } else {
         if (cnQuery::getVar('cn-cat-slug')) {
             $slug = explode('/', cnQuery::getVar('cn-cat-slug'));
             // If the category slug is a descendant, use the last slug from the URL for the query.
             $atts['current_category'] = end($slug);
         } elseif ($catIDs = cnQuery::getVar('cn-cat')) {
             if (is_array($catIDs)) {
                 // If value is a string, strip the white space and covert to an array.
                 $catIDs = wp_parse_id_list($catIDs);
                 // Use the first element
                 $atts['current_category'] = reset($catIDs);
             } else {
                 $atts['current_category'] = $catIDs;
             }
         } else {
             $atts['current_category'] = 0;
         }
         if (!empty($atts['show_option_all'])) {
             $out .= '<li class="cat-item-all"><a href="' . cnURL::permalink(array('type' => 'home', 'data' => 'url', 'return' => TRUE)) . '">' . $atts['show_option_all'] . '</a></li>';
         }
         $out .= $walker->walk($terms, $atts['depth'], $atts);
     }
     $out .= '</ul>' . PHP_EOL;
     if ($atts['return']) {
         return $out;
     }
     echo $out;
 }
Exemplo n.º 10
0
 /**
  * Creates the initial character filter control.
  *
  * Accepted option for the $atts property are:
  *    return (bool) Whether or not to return or echo the result.
  *
  * @access public
  * @since  0.7.4
  * @static
  *
  * @uses   add_query_arg()
  * @uses   get_query_var()
  * @uses   wp_parse_args()
  * @uses   is_admin()
  *
  * @param  array  $atts [description]
  *
  * @return string
  */
 public static function index($atts = array())
 {
     $links = array(PHP_EOL);
     $current = '';
     $styles = '';
     $defaults = array('status' => array('approved'), 'tag' => 'div', 'style' => array(), 'return' => FALSE);
     $atts = wp_parse_args($atts, $defaults);
     $characters = cnRetrieve::getCharacters($atts);
     // $currentPageURL = add_query_arg( array( 'page' => FALSE , 'cn-action' => 'cn_filter' )  );
     // If in the admin init an instance of the cnFormObjects class to be used to create the URL nonce.
     if (is_admin()) {
         $form = new cnFormObjects();
     }
     // Current character
     if (is_admin()) {
         if (isset($_GET['cn-char']) && 0 < strlen($_GET['cn-char'])) {
             $current = urldecode($_GET['cn-char']);
         }
     } else {
         if (get_query_var('cn-char')) {
             $current = urldecode(get_query_var('cn-char'));
         }
     }
     if (is_array($atts['style']) && !empty($atts['style'])) {
         array_walk($atts['style'], create_function('&$i, $property', '$i = "$property: $i";'));
         $styles = implode($atts['style'], '; ');
     }
     foreach ($characters as $key => $char) {
         $char = strtoupper($char);
         // If we're in the admin, add the nonce to the URL to be verified when settings the current user filter.
         if (is_admin()) {
             $links[] = '<a' . ($current == $char ? ' class="cn-char-current"' : ' class="cn-char"') . ' href="' . esc_url($form->tokenURL(add_query_arg(array('cn-char' => urlencode($char))), 'filter')) . '">' . $char . '</a> ' . PHP_EOL;
         } else {
             $url = cnURL::permalink(array('type' => 'character', 'slug' => $char, 'title' => $char, 'class' => $current == $char ? 'cn-char-current' : 'cn-char', 'text' => $char, 'home_id' => in_the_loop() && is_page() ? get_the_id() : cnSettingsAPI::get('connections', 'connections_home_page', 'page_id'), 'force_home' => FALSE, 'return' => TRUE));
             $links[] = $url . PHP_EOL;
         }
     }
     $out = '<' . $atts['tag'] . ' class="cn-alphaindex"' . ($styles ? ' style="' . $styles . '"' : '') . '>' . implode(' ', $links) . '</' . $atts['tag'] . '>' . PHP_EOL;
     return self::echoOrReturn($atts['return'], $out);
 }
Exemplo n.º 11
0
 /**
  * Generates a permalink for a taxonomy term.
  *
  * Filters:
  *    cn_term_link
  *        Passes: (string) $link, (object) $term, (string) $taxonomy
  *        Return: $link
  *
  * NOTE: This is the Connections equivalent of get_term_link() in WordPress core ../wp-includes/taxonomy.php
  *
  * @access public
  * @since  8.1.6
  * @static
  *
  * @uses   cnTerm::get()
  * @uses   cnTerm::getBy()
  * @uses   is_wp_error()
  * @uses   cnTerm::getAncestors()
  * @uses   cnURL::permalink()
  * @uses   apply_filters()
  *
  * @param object|int|string $term
  * @param string            $taxonomy (optional if $term is object)
  *
  * @return string|WP_Error URL  to taxonomy term on success, WP_Error if term does not exist.
  */
 public static function permalink($term, $taxonomy = '')
 {
     /** @var $wp_rewrite WP_Rewrite */
     //global $wp_rewrite;
     if (!is_object($term)) {
         if (is_int($term)) {
             $term = self::get($term, $taxonomy);
         } else {
             $term = self::getBy('slug', $term, $taxonomy);
         }
     }
     if (!is_object($term)) {
         $term = new WP_Error('invalid_term', __('Empty Term', 'connections'));
     }
     if (is_wp_error($term)) {
         return $term;
     }
     $taxonomy = $term->taxonomy;
     //$link = $wp_rewrite->get_extra_permastruct( $taxonomy );
     //$slug = $term->slug;
     //$t    = get_taxonomy( $taxonomy );
     //if ( empty( $link ) ) {
     //if ( 'category' == $taxonomy ) {
     //$link = '?cat=' . $term->term_id;
     //} elseif ( $t->query_var ) {
     //
     //	$term_link = "?$t->query_var=$slug";
     //} else {
     //	$link = "?taxonomy=$taxonomy&term=$slug";
     //}
     //$link = home_url( $link );
     //} else {
     //if ( $t->rewrite['hierarchical'] ) {
     $slugs = array();
     $ancestors = self::getAncestors($term->term_id, $taxonomy);
     foreach ((array) $ancestors as $ancestor) {
         $ancestor_term = self::get($ancestor, $taxonomy);
         $slugs[] = $ancestor_term->slug;
     }
     $slugs = array_reverse($slugs);
     $slugs[] = $term->slug;
     $link = cnURL::permalink(array('type' => 'category', 'slug' => implode('/', $slugs), 'title' => $term->name, 'text' => $term->name, 'data' => 'url', 'return' => TRUE));
     //} else {
     //
     //	$term_link = str_replace( "%$taxonomy%", $slug, $term_link );
     //}
     //$link = home_url( user_trailingslashit( $link, 'category' ) );
     //}
     /**
      * Filter the term link.
      *
      * @since 8.1.6
      *
      * @param string $link Term link URL.
      * @param object $term     Term object.
      * @param string $taxonomy Taxonomy slug.
      */
     return apply_filters('cn_term_link', $link, $term, $taxonomy);
 }
 /**
  * A filter to change the WP core upload path for files.
  *
  * @access private
  * @static
  * @since  8.1
  * @param  array $file The WP core upload path values.
  *
  * @return array
  */
 public function subDirectory($file)
 {
     // If this is a multi site AND Connections is in multi site mode then the the paths passed by WP can be used.
     if (is_multisite() && CN_MULTISITE_ENABLED) {
         $file['subdir'] = empty($this->subDirectory) ? cnURL::preslashit($file['subdir']) : cnURL::preslashit($this->subDirectory);
         $file['path'] = untrailingslashit($file['basedir']) . $file['subdir'];
         $file['url'] = untrailingslashit($file['baseurl']) . $file['subdir'];
         // If Connections is on single site or in single site mode on a multi site setup use cnUpload::info() to get the path info.
     } else {
         // NOTE: Important! cnUpload::info() can not be used within this class when `if ( is_multisite() && CN_MULTISITE_ENABLED )`
         // because it will cause a infinite loop due to the filter added in $this->file() which add this method as a callback
         // to the `upload_dir` hook.
         $info = cnUpload::info();
         $file['subdir'] = empty($this->subDirectory) ? cnURL::preslashit($file['subdir']) : cnURL::preslashit($this->subDirectory);
         $file['path'] = untrailingslashit($info['base_path']) . $file['subdir'];
         $file['url'] = untrailingslashit($info['base_url']) . $file['subdir'];
     }
     return $file;
 }
Exemplo n.º 13
0
 /**
  * Echo or return the entry's addresses in a HTML hCard compliant string.
  *
  * Accepted options for the $atts property are:
  *  preferred (bool) Retrieve the preferred entry address.
  *  type (array) || (string) Retrieve specific address types.
  *   Permitted Types:
  *    home
  *    work
  *    school
  *    other
  *  city (array) || (string) Retrieve addresses in a specific city.
  *  state (array) || (string) Retrieve addresses in a specific state..
  *  zipcode (array) || (string) Retrieve addresses in a specific zipcode.
  *  country (array) || (string) Retrieve addresses in a specific country.
  *  coordinates (array) Retrieve addresses in with specific coordinates. Both latitude and longitude must be supplied.
  *  format (string) The tokens to use to display the address block parts.
  *   Permitted Tokens:
  *    %label%
  *    %line1%
  *    %line2%
  *    %line3%
  *    %city%
  *    %state%
  *    %zipcode%
  *    %country%
  *    %geo%
  *    %separator%
  *  separator (string) The separator to use.
  *  before (string) HTML to output before the addresses.
  *  after (string) HTML to after before the addresses.
  *  return (bool) Return string if set to TRUE instead of echo string.
  *
  * Filters:
  *  cn_output_default_atts_address => (array) Register the methods default attributes.
  *
  * @access public
  * @since unknown
  *
  * @param array $atts Accepted values as noted above.
  * @param bool  $cached Returns the cached address rather than querying the db.
  *
  * @return string
  */
 public function getAddressBlock($atts = array(), $cached = TRUE)
 {
     /*
      * // START -- Set the default attributes array. \\
      */
     $defaults = array('preferred' => NULL, 'type' => NULL, 'limit' => NULL, 'city' => NULL, 'state' => NULL, 'zipcode' => NULL, 'country' => NULL, 'coordinates' => array(), 'format' => '', 'link' => array('locality' => cnSettingsAPI::get('connections', 'link', 'locality'), 'region' => cnSettingsAPI::get('connections', 'link', 'region'), 'postal_code' => cnSettingsAPI::get('connections', 'link', 'postal_code'), 'country' => cnSettingsAPI::get('connections', 'link', 'country')), 'separator' => ':', 'before' => '', 'after' => '', 'return' => FALSE);
     $defaults = apply_filters('cn_output_default_atts_address', $defaults);
     $atts = cnSanitize::args($atts, $defaults);
     $atts['link'] = cnSanitize::args($atts['link'], $defaults['link']);
     $atts['id'] = $this->getId();
     /*
      * // END -- Set the default attributes array if not supplied. \\
      */
     $out = '';
     $addresses = $this->getAddresses($atts, $cached);
     $search = array('%label%', '%line1%', '%line2%', '%line3%', '%city%', '%state%', '%zipcode%', '%country%', '%geo%', '%separator%');
     if (empty($addresses)) {
         return '';
     }
     $out .= '<span class="address-block">' . PHP_EOL;
     foreach ($addresses as $address) {
         $replace = array();
         $out .= '<span class="adr">' . PHP_EOL;
         // The `notranslate` class is added to prevent Google Translate from translating the text.
         $replace[] = empty($address->name) ? '' : '<span class="address-name">' . $address->name . '</span>' . PHP_EOL;
         $replace[] = empty($address->line_1) ? '' : '<span class="street-address notranslate">' . $address->line_1 . '</span>' . PHP_EOL;
         $replace[] = empty($address->line_2) ? '' : '<span class="street-address notranslate">' . $address->line_2 . '</span>' . PHP_EOL;
         $replace[] = empty($address->line_3) ? '' : '<span class="street-address notranslate">' . $address->line_3 . '</span>' . PHP_EOL;
         if (empty($address->city)) {
             $replace[] = '';
         } else {
             if ($atts['link']['locality']) {
                 $locality = cnURL::permalink(array('type' => 'locality', 'slug' => $address->city, 'title' => $address->city, 'text' => $address->city, 'home_id' => $this->directoryHome['page_id'], 'force_home' => $this->directoryHome['force_home'], 'return' => TRUE));
             } else {
                 $locality = $address->city;
             }
             $replace[] = '<span class="locality">' . $locality . '</span>' . PHP_EOL;
         }
         if (empty($address->state)) {
             $replace[] = '';
         } else {
             if ($atts['link']['region']) {
                 $region = cnURL::permalink(array('type' => 'region', 'slug' => $address->state, 'title' => $address->state, 'text' => $address->state, 'home_id' => $this->directoryHome['page_id'], 'force_home' => $this->directoryHome['force_home'], 'return' => TRUE));
             } else {
                 $region = $address->state;
             }
             $replace[] = '<span class="region">' . $region . '</span>' . PHP_EOL;
         }
         if (empty($address->zipcode)) {
             $replace[] = '';
         } else {
             if ($atts['link']['postal_code']) {
                 $postal = cnURL::permalink(array('type' => 'postal_code', 'slug' => $address->zipcode, 'title' => $address->zipcode, 'text' => $address->zipcode, 'home_id' => $this->directoryHome['page_id'], 'force_home' => $this->directoryHome['force_home'], 'return' => TRUE));
             } else {
                 $postal = $address->zipcode;
             }
             $replace[] = '<span class="postal-code">' . $postal . '</span>' . PHP_EOL;
         }
         if (empty($address->country)) {
             $replace[] = '';
         } else {
             if ($atts['link']['country']) {
                 $country = cnURL::permalink(array('type' => 'country', 'slug' => $address->country, 'title' => $address->country, 'text' => $address->country, 'home_id' => $this->directoryHome['page_id'], 'force_home' => $this->directoryHome['force_home'], 'return' => TRUE));
             } else {
                 $country = $address->country;
             }
             $replace[] = '<span class="country-name">' . $country . '</span>' . PHP_EOL;
         }
         if (!empty($address->latitude) || !empty($address->longitude)) {
             $replace[] = '<span class="geo">' . (empty($address->latitude) ? '' : '<span class="latitude" title="' . $address->latitude . '"><span class="cn-label">' . __('Latitude', 'connections') . ': </span>' . $address->latitude . '</span>') . (empty($address->longitude) ? '' : '<span class="longitude" title="' . $address->longitude . '"><span class="cn-label">' . __('Longitude', 'connections') . ': </span>' . $address->longitude . '</span>') . '</span>' . PHP_EOL;
         }
         $replace[] = '<span class="cn-separator">' . $atts['separator'] . '</span>' . PHP_EOL;
         $out .= str_ireplace($search, $replace, empty($atts['format']) ? empty($defaults['format']) ? '%label% %line1% %line2% %line3% %city% %state%  %zipcode% %country%' : $defaults['format'] : $atts['format']);
         // Set the hCard Address Type.
         $out .= $this->gethCardAdrType($address->type);
         $out .= '</span>' . PHP_EOL;
     }
     $out .= '</span>' . PHP_EOL;
     $out = cnString::replaceWhatWith($out, ' ');
     $out = $atts['before'] . $out . $atts['after'] . PHP_EOL;
     return $this->echoOrReturn($atts['return'], $out);
 }
 /**
  * Render an unordered list of categories.
  *
  * This is the Connections equivalent of @see wp_list_categories() in WordPress core ../wp-includes/category-template.php
  *
  * @access public
  * @since  8.1.6
  * @static
  *
  * @uses   wp_parse_args()
  * @uses   cnTerm::getTaxonomyTerms()
  * @uses   cnURL::permalink()
  * @uses   Walker::walk()
  *
  * @param array $atts {
  *     Optional. An array of arguments.
  *     NOTE: Additionally, all valid options as supported in @see cnTerm::getTaxonomyTerms().
  *
  * @type string $show_option_all  A non-blank value causes the display of a link to the directory home page.
  *                                Default: ''. The default is not to display a link.
  *                                Accepts: Any valid string.
  * @type string $show_option_none Set the text to show when no categories are listed.
  *                                Default: 'No Categories'
  *                                Accepts: Any valid string.
  * @type bool   $show_count       Whether or not to display the category count.
  *                                Default: FALSE
  * @type int    $depth            Controls how many levels in the hierarchy of categories are to be included in the list.
  *                                Default: 0
  *                                Accepts: 0  - All categories and child categories.
  *                                         -1 - All Categories displayed  flat, not showing the parent/child relationships.
  *                                         1  - Show only top level/root parent categories.
  *                                         n  - Value of n (int) specifies the depth (or level) to descend in displaying the categories.
  * @type string $taxonomy         The taxonomy tree to display.
  *                                Default: 'category'
  *                                Accepts: Any registered taxonomy.
  * @type bool   $return           Whether or not to return or echo the resulting HTML.
  *                                Default: FALSE
  * }
  *
  * @return string
  */
 public static function render($atts = array())
 {
     $out = '';
     $defaults = array('show_option_all' => '', 'show_option_none' => __('No categories', 'connections'), 'orderby' => 'name', 'order' => 'ASC', 'show_count' => FALSE, 'hide_empty' => FALSE, 'child_of' => 0, 'exclude' => array(), 'hierarchical' => TRUE, 'depth' => 0, 'parent_id' => array(), 'taxonomy' => 'category', 'return' => FALSE);
     $atts = wp_parse_args($atts, $defaults);
     $atts['parent_id'] = wp_parse_id_list($atts['parent_id']);
     $walker = new self();
     if (empty($atts['parent_id'])) {
         $terms = cnTerm::getTaxonomyTerms($atts['taxonomy'], $atts);
     } else {
         $terms = cnTerm::getTaxonomyTerms($atts['taxonomy'], array_merge($atts, array('include' => $atts['parent_id'], 'child_of' => 0)));
         // If any of the `parent_id` is not a root parent (where $term->parent = 0) set it parent ID to `0`
         // so the term tree will be properly constructed.
         foreach ($terms as $term) {
             if (0 !== $term->parent) {
                 $term->parent = 0;
             }
         }
         foreach ($atts['parent_id'] as $termID) {
             $children = cnTerm::getTaxonomyTerms($atts['taxonomy'], array_merge($atts, array('child_of' => $termID)));
             if (!is_wp_error($children)) {
                 $terms = array_merge($terms, $children);
             }
         }
     }
     $out .= '<ul class="cn-cat-tree">' . PHP_EOL;
     if (empty($terms)) {
         $out .= '<li class="cat-item-none">' . $atts['show_option_none'] . '</li>';
     } else {
         if (get_query_var('cn-cat-slug')) {
             $slug = explode('/', get_query_var('cn-cat-slug'));
             // If the category slug is a descendant, use the last slug from the URL for the query.
             $atts['current_category'] = end($slug);
         } elseif ($catIDs = get_query_var('cn-cat')) {
             if (is_array($catIDs)) {
                 // If value is a string, strip the white space and covert to an array.
                 $catIDs = wp_parse_id_list($catIDs);
                 // Use the first element
                 $atts['current_category'] = reset($catIDs);
             } else {
                 $atts['current_category'] = $catIDs;
             }
         } else {
             $atts['current_category'] = 0;
         }
         if (!empty($atts['show_option_all'])) {
             $out .= '<li class="cat-item-all"><a href="' . cnURL::permalink(array('type' => 'home', 'data' => 'url', 'return' => TRUE)) . '">' . $atts['show_option_all'] . '</a></li>';
         }
         $out .= $walker->walk($terms, $atts['depth'], $atts);
     }
     $out .= '</ul>' . PHP_EOL;
     if ($atts['return']) {
         return $out;
     }
     echo $out;
 }
 /**
  * Caches the links for use and preps for saving and updating.
  *
  * @todo Validate as valid web addresses.
  *
  * @access  public
  * @since   0.7.3
  *
  * @param   array $links {
  *     Optional. An array of arguments.
  *
  *     @type int    $id         The unique link ID as queried from the DB.
  *     @type mixed  $preferred  The array key of the link to be set as the preferred link.
  *                              Default: ''
  *     @type string $type       The link type.
  *                              Default: @todo Should have a default if one is not supplied.
  *                              Accepts: The array keys returned from @see cnOptions::getDefaultLinkValues()
  *     @type string $title      The link text (also used for the link title attribute).
  *                              Default: ''
  *     @type string $url        The link URL.
  *     @type string $target     The link target attribute.
  *                              Default: same
  *                              Accepts: new|same
  *     @type bool   $follow     Whether or not the link should be followed.
  *                              Default: nofollow
  *                              Accepts: dofollow | nofollow
  *     @type string $visibility The visibility status of the link.
  *                              Default: public
  *                              Accepts: public|private|unlisted
  *     @type mixed  $image      The array key of the link to be assigned to the entry image.
  *                              Default: ''
  *     @type mixed  $logo       The array key of the link to be assigned to the entry logo.
  *                              Default: ''
  * }
  *
  * @return void
  */
 public function setLinks($links)
 {
     $userPreferred = NULL;
     $validFields = array('id' => NULL, 'preferred' => NULL, 'type' => NULL, 'title' => NULL, 'url' => NULL, 'target' => NULL, 'follow' => NULL, 'visibility' => NULL);
     if (!empty($links)) {
         $order = 0;
         $preferred = '';
         $image = '';
         $logo = '';
         if (isset($links['preferred'])) {
             $preferred = $links['preferred'];
             unset($links['preferred']);
         }
         if (isset($links['image'])) {
             $image = $links['image'];
             unset($links['image']);
         }
         if (isset($links['logo'])) {
             $logo = $links['logo'];
             unset($links['logo']);
         }
         foreach ($links as $key => $link) {
             // First validate the supplied data.
             $link = cnSanitize::args($link, $validFields);
             // If the URL is empty, no need to save it.
             if (0 == strlen($link['url'])) {
                 unset($links[$key]);
                 continue;
             }
             // If the http protocol is not part of the url, add it.
             $links[$key]['url'] = cnURL::prefix($link['url']);
             // Sanitize the URL.
             $links[$key]['url'] = cnSanitize::field('url', $links[$key]['url'], 'db');
             // Store the order attribute as supplied in the addresses array.
             $links[$key]['order'] = $order;
             // Convert the do/nofollow string to an (int) so it is saved properly in the db
             $links[$key]['follow'] = 'dofollow' == $link['follow'] ? 1 : 0;
             $links[$key]['preferred'] = !empty($preferred) && $preferred == $key ? TRUE : FALSE;
             $links[$key]['image'] = !empty($image) && $image == $key ? TRUE : FALSE;
             $links[$key]['logo'] = !empty($logo) && $logo == $key ? TRUE : FALSE;
             /*
              * If the user set a preferred link, save the $key value.
              * This is going to be needed because if a link that the user
              * does not have permission to edit is set to preferred, that link
              * will have preference.
              */
             if ($links[$key]['preferred']) {
                 $userPreferred = $key;
             }
             if ($links[$key]['image']) {
                 $userImage = $key;
             }
             if ($links[$key]['logo']) {
                 $userLogo = $key;
             }
             $order++;
         }
     }
     /*
      * Before storing the data, add back into the array from the cache the networks
      * the user may not have had permission to edit so the cache stays current.
      */
     $cached = unserialize($this->links);
     if (!empty($cached)) {
         foreach ($cached as $link) {
             /*
              * // START -- Compatibility for previous versions.
              */
             if (!isset($link['visibility']) || empty($link['visibility'])) {
                 $link['visibility'] = 'public';
             }
             /*
              * // END -- Compatibility for previous versions.
              */
             /** This filter is documented in ../includes/entry/class.entry-data.php */
             $link = apply_filters('cn_link-pre_setup', $link);
             // Add back to the data array the networks that user does not have permission to view and edit.
             if (!cnValidate::userPermitted($link['visibility'])) {
                 $links[] = $link;
                 // If the network is preferred, it takes precedence, so the user's choice is overridden.
                 if (isset($userPreferred) && !empty($preferred) && $link['preferred']) {
                     $links[$userPreferred]['preferred'] = FALSE;
                     // Throw the user a message so they know why their choice was overridden.
                     cnMessage::set('error', 'entry_preferred_overridden_link');
                 }
                 // If the link is already assigned to an image, it takes precedence, so the user's choice is overridden.
                 if (isset($userImage) && !empty($image) && $link['image']) {
                     $links[$userImage]['image'] = FALSE;
                     // @todo Create error message for the user.
                 }
                 // If the link is already assigned to an image, it takes precedence, so the user's choice is overridden.
                 if (isset($userLogo) && !empty($logo) && $link['logo']) {
                     $links[$userLogo]['logo'] = FALSE;
                     // @todo Create error message for the user.
                 }
             }
         }
     }
     $this->links = !empty($links) ? serialize($links) : '';
     //print_r($links); die;
 }
Exemplo n.º 16
0
function connectionsShowViewPage($action = NULL)
{
    // Grab an instance of the Connections object.
    $instance = Connections_Directory();
    $queryVars = array();
    echo '<div class="wrap">';
    switch ($action) {
        case 'add_entry':
            echo '<h2>Connections : ', __('Add Entry', 'connections'), '</h2>';
            /*
             * Check whether current user can add an entry.
             */
            if (current_user_can('connections_add_entry') || current_user_can('connections_add_entry_moderated')) {
                $form = new cnFormObjects();
                $entry = new cnOutput();
                $attr = array('id' => 'cn-form', 'method' => 'post', 'enctype' => 'multipart/form-data');
                $form->open($attr);
                $field = array('id' => 'metabox-name', 'title' => __('Name', 'connections'), 'context' => 'normal', 'priority' => 'high', 'callback' => array('cnEntryMetabox', 'name'));
                cnMetabox_Render::add($instance->pageHook->add, $field);
                echo '<div id="poststuff">';
                echo '<div id="post-body" class="metabox-holder columns-' . (1 == get_current_screen()->get_columns() ? '1' : '2') . '">';
                wp_nonce_field('cn-manage-metaboxes');
                wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', FALSE);
                wp_nonce_field('meta-box-order', 'meta-box-order-nonce', FALSE);
                $form->tokenField('add_entry', FALSE, '_cn_wpnonce', FALSE);
                do_action('cn_admin_form_add_entry_before', $entry, $form);
                echo '<div id="postbox-container-1" class="postbox-container">';
                echo '<div id="side-sortables" class="meta-box-sortables ui-sortable">';
                do_meta_boxes($instance->pageHook->add, 'side', $entry);
                echo '</div> <!-- #side-sortables -->';
                echo '</div> <!-- #postbox-container-1 -->';
                echo '<div id="postbox-container-2" class="postbox-container">';
                echo '<div id="normal-sortables" class="meta-box-sortables ui-sortable">';
                do_meta_boxes($instance->pageHook->add, 'normal', $entry);
                echo '</div> <!-- #normal-sortables -->';
                echo '</div> <!-- #postbox-container-2 -->';
                do_action('cn_admin_form_add_entry_after', $entry, $form);
                echo '</div> <!-- #post-body -->';
                echo '<br class="clear">';
                echo '</div> <!-- #poststuff -->';
                $form->close();
                unset($entry);
            } else {
                cnMessage::render('error', __('You are not authorized to add entries. Please contact the admin if you received this message in error.', 'connections'));
            }
            break;
        case 'copy_entry':
            echo '<div class="wrap">';
            echo '<h2>Connections : ', __('Copy Entry', 'connections'), '</h2>';
            /*
             * Check whether current user can add an entry.
             */
            if (current_user_can('connections_add_entry') || current_user_can('connections_add_entry_moderated')) {
                $id = esc_attr($_GET['id']);
                check_admin_referer('entry_copy_' . $id);
                $form = new cnFormObjects();
                $entry = new cnOutput($instance->retrieve->entry($id));
                $attr = array('id' => 'cn-form', 'method' => 'post', 'enctype' => 'multipart/form-data');
                $form->open($attr);
                $field = array('id' => 'metabox-name', 'title' => __('Name', 'connections'), 'context' => 'normal', 'priority' => 'high', 'callback' => array('cnEntryMetabox', 'name'));
                cnMetabox_Render::add($instance->pageHook->manage, $field);
                echo '<div id="poststuff">';
                echo '<div id="post-body" class="metabox-holder columns-' . (1 == get_current_screen()->get_columns() ? '1' : '2') . '">';
                wp_nonce_field('cn-manage-metaboxes');
                wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', FALSE);
                wp_nonce_field('meta-box-order', 'meta-box-order-nonce', FALSE);
                $form->tokenField('add_entry', FALSE, '_cn_wpnonce', FALSE);
                do_action('cn_admin_form_copy_entry_before', $entry, $form);
                echo '<div id="postbox-container-1" class="postbox-container">';
                echo '<div id="side-sortables" class="meta-box-sortables ui-sortable">';
                do_meta_boxes($instance->pageHook->manage, 'side', $entry);
                echo '</div> <!-- #side-sortables -->';
                echo '</div> <!-- #postbox-container-1 -->';
                echo '<div id="postbox-container-2" class="postbox-container">';
                echo '<div id="normal-sortables" class="meta-box-sortables ui-sortable">';
                do_meta_boxes($instance->pageHook->manage, 'normal', $entry);
                echo '</div> <!-- #normal-sortables -->';
                echo '</div> <!-- #postbox-container-2 -->';
                do_action('cn_admin_form_copy_entry_after', $entry, $form);
                echo '</div> <!-- #post-body -->';
                echo '<br class="clear">';
                echo '</div> <!-- #poststuff -->';
                $form->close();
                unset($entry);
            } else {
                cnMessage::render('error', __('You are not authorized to add entries. Please contact the admin if you received this message in error.', 'connections'));
            }
            break;
        case 'edit_entry':
            echo '<h2>Connections : ', __('Edit Entry', 'connections'), '</h2>';
            /*
             * Check whether the current user can edit entries.
             */
            if (current_user_can('connections_edit_entry') || current_user_can('connections_edit_entry_moderated')) {
                $id = esc_attr($_GET['id']);
                check_admin_referer('entry_edit_' . $id);
                $form = new cnFormObjects();
                $entry = new cnOutput($instance->retrieve->entry($id));
                $attr = array('id' => 'cn-form', 'action' => 'admin.php?connections_process=true&process=manage&action=update&id=' . $id, 'method' => 'post', 'enctype' => 'multipart/form-data');
                $form->open($attr);
                $field = array('id' => 'metabox-name', 'title' => __('Name', 'connections'), 'context' => 'normal', 'priority' => 'high', 'callback' => array('cnEntryMetabox', 'name'));
                cnMetabox_Render::add($instance->pageHook->manage, $field);
                echo '<div id="poststuff">';
                echo '<div id="post-body" class="metabox-holder columns-' . (1 == get_current_screen()->get_columns() ? '1' : '2') . '">';
                wp_nonce_field('cn-manage-metaboxes');
                wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', FALSE);
                wp_nonce_field('meta-box-order', 'meta-box-order-nonce', FALSE);
                $form->tokenField('update_entry', FALSE, '_cn_wpnonce', FALSE);
                do_action('cn_admin_form_edit_entry_before', $entry, $form);
                echo '<div id="postbox-container-1" class="postbox-container">';
                echo '<div id="side-sortables" class="meta-box-sortables ui-sortable">';
                do_meta_boxes($instance->pageHook->manage, 'side', $entry);
                echo '</div> <!-- #side-sortables -->';
                echo '</div> <!-- #postbox-container-1 -->';
                echo '<div id="postbox-container-2" class="postbox-container">';
                echo '<div id="normal-sortables" class="meta-box-sortables ui-sortable">';
                do_meta_boxes($instance->pageHook->manage, 'normal', $entry);
                echo '</div> <!-- #normal-sortables -->';
                echo '</div> <!-- #postbox-container-2 -->';
                do_action('cn_admin_form_edit_entry_after', $entry, $form);
                echo '</div> <!-- #post-body -->';
                echo '<br class="clear">';
                echo '</div> <!-- #poststuff -->';
                $form->close();
                unset($entry);
            } else {
                cnMessage::render('error', __('You are not authorized to edit entries. Please contact the admin if you received this message in error.', 'connections'));
            }
            break;
        default:
            $form = new cnFormObjects();
            $page = $instance->currentUser->getFilterPage('manage');
            $offset = ($page->current - 1) * $page->limit;
            echo '<div class="wrap">';
            echo get_screen_icon('connections');
            echo '<h2>Connections : ', __('Manage', 'connections'), ' <a class="button add-new-h2" href="admin.php?page=connections_add">', __('Add New', 'connections'), '</a></h2>';
            /*
             * Check whether user can view the entry list
             */
            if (current_user_can('connections_manage')) {
                $retrieveAttr['list_type'] = $instance->currentUser->getFilterEntryType();
                $retrieveAttr['category'] = $instance->currentUser->getFilterCategory();
                $retrieveAttr['char'] = isset($_GET['cn-char']) && 0 < strlen($_GET['cn-char']) ? $_GET['cn-char'] : '';
                $retrieveAttr['visibility'] = $instance->currentUser->getFilterVisibility();
                $retrieveAttr['status'] = $instance->currentUser->getFilterStatus();
                $retrieveAttr['limit'] = $page->limit;
                $retrieveAttr['offset'] = $offset;
                if (isset($_GET['s']) && !empty($_GET['s'])) {
                    $retrieveAttr['search_terms'] = $_GET['s'];
                }
                $results = $instance->retrieve->entries($retrieveAttr);
                // print_r($instance->lastQuery);
                ?>

				<?php 
                if (current_user_can('connections_edit_entry')) {
                    ?>

				<ul class="subsubsub">

					<?php 
                    $statuses = array('all' => __('All', 'connections'), 'approved' => __('Approved', 'connections'), 'pending' => __('Moderate', 'connections'));
                    foreach ($statuses as $key => $status) {
                        $subsubsub[] = sprintf('<li><a%1$shref="%2$s">%3$s</a> <span class="count">(%4$d)</span></li>', $instance->currentUser->getFilterStatus() == $key ? ' class="current" ' : ' ', esc_url($form->tokenURL(add_query_arg(array('page' => 'connections_manage', 'cn-action' => 'filter', 'status' => $key)), 'filter')), $status, cnRetrieve::recordCount(array('status' => $key)));
                    }
                    echo implode(' | ', $subsubsub);
                    ?>

				</ul>

				<?php 
                }
                ?>

				<form method="post">

					<p class="search-box">
						<label class="screen-reader-text" for="post-search-input"><?php 
                _e('Search Entries', 'connections');
                ?>
:</label>
						<input type="search" id="entry-search-input" name="s" value="<?php 
                if (isset($_GET['s']) && !empty($_GET['s'])) {
                    echo $_GET['s'];
                }
                ?>
" />
						<input type="submit" name="" id="search-submit" class="button" value="<?php 
                _e('Search Entries', 'connections');
                ?>
"  />
					</p>

					<?php 
                $form->tokenField('cn_manage_actions');
                ?>

					<input type="hidden" name="cn-action" value="manage_actions"/>

					<div class="tablenav">

						<div class="alignleft actions">
							<?php 
                cnTemplatePart::walker('term-select', array('name' => 'category', 'show_option_all' => __('Show All Categories', 'connections'), 'hide_empty' => FALSE, 'hierarchical' => TRUE, 'show_count' => FALSE, 'orderby' => 'name', 'selected' => $instance->currentUser->getFilterCategory()));
                echo $form->buildSelect('entry_type', array('all' => __('Show All Entries', 'connections'), 'individual' => __('Show Individuals', 'connections'), 'organization' => __('Show Organizations', 'connections'), 'family' => __('Show Families', 'connections')), $instance->currentUser->getFilterEntryType());
                /*
                 * Builds the visibilty select list base on current user capabilities.
                 */
                if (current_user_can('connections_view_public') || $instance->options->getAllowPublic()) {
                    $visibilitySelect['public'] = __('Show Public', 'connections');
                }
                if (current_user_can('connections_view_private')) {
                    $visibilitySelect['private'] = __('Show Private', 'connections');
                }
                if (current_user_can('connections_view_unlisted')) {
                    $visibilitySelect['unlisted'] = __('Show Unlisted', 'connections');
                }
                if (isset($visibilitySelect)) {
                    /*
                     * Add the 'Show All' option and echo the list.
                     */
                    $showAll['all'] = __('Show All', 'connections');
                    $visibilitySelect = $showAll + $visibilitySelect;
                    echo $form->buildSelect('visibility_type', $visibilitySelect, $instance->currentUser->getFilterVisibility());
                }
                ?>

							<input class="button-secondary action" type="submit" name="filter" value="Filter"/>

						</div>

						<div class="tablenav-pages">
							<?php 
                echo '<span class="displaying-num">' . sprintf(__('Displaying %1$d of %2$d entries.', 'connections'), $instance->resultCount, $instance->resultCountNoLimit) . '</span>';
                /*
                 * // START --> Pagination
                 *
                 * Grab the pagination data again incase a filter reset the values
                 * or the user input an invalid number which the retrieve query would have reset.
                 */
                $page = $instance->currentUser->getFilterPage('manage');
                $pageCount = ceil($instance->resultCountNoLimit / $page->limit);
                if ($pageCount > 1) {
                    $pageDisabled = array();
                    $pageFilterURL = array();
                    $pageValue = array();
                    $currentPageURL = add_query_arg(array('page' => FALSE, 'cn-action' => 'filter'));
                    $pageValue['first_page'] = 1;
                    $pageValue['previous_page'] = $page->current - 1 >= 1 ? $page->current - 1 : 1;
                    $pageValue['next_page'] = $page->current + 1 <= $pageCount ? $page->current + 1 : $pageCount;
                    $pageValue['last_page'] = $pageCount;
                    $page->current > 1 ? $pageDisabled['first_page'] = '' : ($pageDisabled['first_page'] = ' disabled');
                    $page->current - 1 >= 1 ? $pageDisabled['previous_page'] = '' : ($pageDisabled['previous_page'] = ' disabled');
                    $page->current + 1 <= $pageCount ? $pageDisabled['next_page'] = '' : ($pageDisabled['next_page'] = ' disabled');
                    $page->current < $pageCount ? $pageDisabled['last_page'] = '' : ($pageDisabled['last_page'] = ' disabled');
                    /*
                     * Genreate the page link token URL.
                     */
                    $pageFilterURL['first_page'] = esc_url($form->tokenURL(add_query_arg(array('pg' => $pageValue['first_page']), $currentPageURL), 'filter'));
                    $pageFilterURL['previous_page'] = esc_url($form->tokenURL(add_query_arg(array('pg' => $pageValue['previous_page']), $currentPageURL), 'filter'));
                    $pageFilterURL['next_page'] = esc_url($form->tokenURL(add_query_arg(array('pg' => $pageValue['next_page']), $currentPageURL), 'filter'));
                    $pageFilterURL['last_page'] = esc_url($form->tokenURL(add_query_arg(array('pg' => $pageValue['last_page']), $currentPageURL), 'filter'));
                    echo '<span class="page-navigation" id="page-input">';
                    echo '<a href="' . $pageFilterURL['first_page'] . '" title="' . __('Go to the first page.', 'connections') . '" class="first-page', $pageDisabled['first_page'], '">&laquo;</a> ';
                    echo '<a href="' . $pageFilterURL['previous_page'] . '" title="' . __('Go to the previous page.', 'connections') . '" class="prev-page', $pageDisabled['previous_page'], '">&lsaquo;</a> ';
                    echo '<span class="paging-input"><input type="text" size="2" value="' . $page->current . '" name="pg" title="' . __('Current page', 'connections') . '" class="current-page"> ' . __('of', 'connections') . ' <span class="total-pages">' . $pageCount . '</span></span> ';
                    echo '<a href="' . $pageFilterURL['next_page'] . '" title="' . __('Go to the next page.', 'connections') . '" class="next-page', $pageDisabled['next_page'], '">&rsaquo;</a> ';
                    echo '<a href="' . $pageFilterURL['last_page'] . '" title="' . __('Go to the last page.', 'connections') . '" class="last-page', $pageDisabled['last_page'], '">&raquo;</a>';
                    echo '</span>';
                }
                /*
                 * // END --> Pagination
                 */
                ?>
						</div>

					</div>
					<div class="clear"></div>
					<div class="tablenav">

						<?php 
                if (current_user_can('connections_edit_entry') || current_user_can('connections_delete_entry')) {
                    echo '<div class="alignleft actions">';
                    echo '<select name="action">';
                    echo '<option value="" SELECTED>', __('Bulk Actions', 'connections'), '</option>';
                    $bulkActions = array();
                    if (current_user_can('connections_edit_entry') || current_user_can('connections_edit_entry_moderated')) {
                        $bulkActions['unapprove'] = __('Unapprove', 'connections');
                        $bulkActions['approve'] = __('Approve', 'connections');
                        $bulkActions['public'] = __('Set Public', 'connections');
                        $bulkActions['private'] = __('Set Private', 'connections');
                        $bulkActions['unlisted'] = __('Set Unlisted', 'connections');
                    }
                    if (current_user_can('connections_delete_entry')) {
                        $bulkActions['delete'] = __('Delete', 'connections');
                    }
                    $bulkActions = apply_filters('cn_manage_bulk_actions', $bulkActions);
                    foreach ($bulkActions as $action => $string) {
                        echo '<option value="', $action, '">', $string, '</option>';
                    }
                    echo '</select>';
                    echo '<input class="button-secondary action" type="submit" name="bulk_action" value="', __('Apply', 'connections'), '" />';
                    echo '</div>';
                }
                ?>

						<div class="tablenav-pages">
							<?php 
                /*
                 * Display the character filter control.
                 */
                echo '<span class="displaying-num">', __('Filter by character:', 'connections'), '</span>';
                cnTemplatePart::index(array('status' => $instance->currentUser->getFilterStatus(), 'tag' => 'span'));
                cnTemplatePart::currentCharacter();
                ?>
						</div>
					</div>
					<div class="clear"></div>

			       	<table cellspacing="0" class="widefat connections">
						<thead>
				            <tr>
				                <th class="manage-column column-cb check-column" id="cb" scope="col"><input type="checkbox"/></th>
								<th class="col" style="width:10%;"></th>
								<th scope="col" colspan="2" style="width:40%;"><?php 
                _e('Name', 'connections');
                ?>
</th>
								<th scope="col" style="width:30%;"><?php 
                _e('Categories', 'connections');
                ?>
</th>
								<th scope="col" style="width:20%;"><?php 
                _e('Last Modified', 'connections');
                ?>
</th>
				            </tr>
						</thead>
						<tfoot>
				            <tr>
				                <th class="manage-column column-cb check-column" scope="col"><input type="checkbox"/></th>
								<th class="col" style="width:10%;"></th>
								<th scope="col" colspan="2" style="width:40%;"><?php 
                _e('Name', 'connections');
                ?>
</th>
								<th scope="col" style="width:30%;"><?php 
                _e('Categories', 'connections');
                ?>
</th>
								<th scope="col" style="width:20%;"><?php 
                _e('Last Modified', 'connections');
                ?>
</th>
				            </tr>
						</tfoot>
						<tbody>

				<?php 
                $previousLetter = '';
                foreach ($results as $row) {
                    /**
                     *
                     *
                     * @TODO: Use the Output class to show entry details.
                     */
                    $entry = new cnvCard($row);
                    $vCard =& $entry;
                    $currentLetter = strtoupper(mb_substr($entry->getSortColumn(), 0, 1));
                    if ($currentLetter != $previousLetter) {
                        $setAnchor = "<a name='{$currentLetter}'></a>";
                        $previousLetter = $currentLetter;
                    } else {
                        $setAnchor = null;
                    }
                    /*
                     * Generate the edit, copy and delete URLs with nonce tokens.
                     */
                    $editTokenURL = esc_url($form->tokenURL('admin.php?page=connections_manage&cn-action=edit_entry&id=' . $entry->getId(), 'entry_edit_' . $entry->getId()));
                    $copyTokenURL = esc_url($form->tokenURL('admin.php?page=connections_manage&cn-action=copy_entry&id=' . $entry->getId(), 'entry_copy_' . $entry->getId()));
                    $deleteTokenURL = esc_url($form->tokenURL('admin.php?cn-action=delete_entry&id=' . $entry->getId(), 'entry_delete_' . $entry->getId()));
                    $approvedTokenURL = esc_url($form->tokenURL('admin.php?cn-action=set_status&status=approved&id=' . $entry->getId(), 'entry_status_' . $entry->getId()));
                    $unapproveTokenURL = esc_url($form->tokenURL('admin.php?cn-action=set_status&status=pending&id=' . $entry->getId(), 'entry_status_' . $entry->getId()));
                    switch ($entry->getStatus()) {
                        case 'pending':
                            $statusClass = ' unapproved';
                            break;
                        case 'approved':
                            $statusClass = ' approved';
                            break;
                        default:
                            $statusClass = '';
                            break;
                    }
                    echo '<tr id="row-', $entry->getId(), '" class="parent-row' . $statusClass . '">';
                    echo "<th class='check-column' scope='row'><input type='checkbox' value='" . $entry->getId() . "' name='id[]'/></th> \n";
                    echo '<td>';
                    $entry->getImage(array('image' => 'photo', 'height' => 54, 'width' => 80, 'zc' => 2, 'fallback' => array('type' => 'block', 'string' => __('No Photo Available', 'connections'))));
                    echo '</td>';
                    echo '<td  colspan="2">';
                    if ($setAnchor) {
                        echo $setAnchor;
                    }
                    echo '<div style="float:right"><a href="#wphead" title="Return to top."><img src="' . CN_URL . 'assets/images/uparrow.gif" /></a></div>';
                    if (current_user_can('connections_edit_entry') || current_user_can('connections_edit_entry_moderated')) {
                        echo '<a class="row-title" title="Edit ' . $entry->getName(array('format' => '%last%, %first%')) . '" href="' . $editTokenURL . '"> ' . $entry->getName(array('format' => '%last%, %first%')) . '</a><br />';
                    } else {
                        echo '<strong>' . $entry->getName(array('format' => '%last%, %first%')) . '</strong>';
                    }
                    echo '<div class="row-actions">';
                    $rowActions = array();
                    $rowEditActions = array();
                    $rowActions[] = '<a class="detailsbutton" id="row-' . $entry->getId() . '" title="' . __('Click to show details.', 'connections') . '" >' . __('Show Details', 'connections') . '</a>';
                    $rowActions[] = $vCard->download(array('anchorText' => __('vCard', 'connections'), 'return' => TRUE));
                    $rowActions[] = cnURL::permalink(array('slug' => $entry->getSlug(), 'title' => sprintf(__('View %s', 'connections'), $entry->getName(array('format' => '%first% %last%'))), 'text' => __('View', 'connections'), 'return' => TRUE));
                    if ($entry->getStatus() == 'approved' && current_user_can('connections_edit_entry')) {
                        $rowEditActions[] = '<a class="action unapprove" href="' . $unapproveTokenURL . '" title="' . __('Unapprove', 'connections') . ' ' . $entry->getFullFirstLastName() . '">' . __('Unapprove', 'connections') . '</a>';
                    }
                    if ($entry->getStatus() == 'pending' && current_user_can('connections_edit_entry')) {
                        $rowEditActions[] = '<a class="action approve" href="' . $approvedTokenURL . '" title="' . __('Approve', 'connections') . ' ' . $entry->getFullFirstLastName() . '">' . __('Approve', 'connections') . '</a>';
                    }
                    if (current_user_can('connections_edit_entry') || current_user_can('connections_edit_entry_moderated')) {
                        $rowEditActions[] = '<a class="editbutton" href="' . $editTokenURL . '" title="' . __('Edit', 'connections') . ' ' . $entry->getFullFirstLastName() . '">' . __('Edit', 'connections') . '</a>';
                    }
                    if (current_user_can('connections_add_entry') || current_user_can('connections_add_entry_moderated')) {
                        $rowEditActions[] = '<a class="copybutton" href="' . $copyTokenURL . '" title="' . __('Copy', 'connections') . ' ' . $entry->getFullFirstLastName() . '">' . __('Copy', 'connections') . '</a>';
                    }
                    if (current_user_can('connections_delete_entry')) {
                        $rowEditActions[] = '<a class="submitdelete" onclick="return confirm(\'You are about to delete this entry. \\\'Cancel\\\' to stop, \\\'OK\\\' to delete\');" href="' . $deleteTokenURL . '" title="' . __('Delete', 'connections') . ' ' . $entry->getFullFirstLastName() . '">' . __('Delete', 'connections') . '</a>';
                    }
                    if (!empty($rowEditActions)) {
                        echo implode(' | ', $rowEditActions), '<br/>';
                    }
                    if (!empty($rowActions)) {
                        echo implode(' | ', $rowActions);
                    }
                    echo '</div>';
                    echo "</td> \n";
                    echo "<td > \n";
                    $categories = $entry->getCategory();
                    if (!empty($categories)) {
                        $i = 0;
                        foreach ($categories as $category) {
                            /*
                             * Genreate the category link token URL.
                             */
                            $categoryFilterURL = $form->tokenURL('admin.php?cn-action=filter&category=' . $category->term_id, 'filter');
                            echo '<a href="' . $categoryFilterURL . '">' . $category->name . '</a>';
                            $i++;
                            if (count($categories) > $i) {
                                echo ', ';
                            }
                        }
                        unset($i);
                    }
                    echo "</td> \n";
                    echo '<td >';
                    echo '<strong>' . __('On', 'connections') . ':</strong> ' . $entry->getFormattedTimeStamp('m/d/Y g:ia') . '<br />';
                    echo '<strong>' . __('By', 'connections') . ':</strong> ' . $entry->getEditedBy() . '<br />';
                    echo '<strong>' . __('Visibility', 'connections') . ':</strong> ' . $entry->displayVisibilityType() . '<br />';
                    $user = $entry->getUser() ? get_userdata($entry->getUser()) : FALSE;
                    /**
                     * NOTE: WP 3.5 introduced get_edit_user_link()
                     * REF:  http://codex.wordpress.org/Function_Reference/get_edit_user_link
                     *
                     * @TODO Use get_edit_user_link() to simplify this code when WP hits >= 3.9.
                     */
                    if ($user) {
                        if (get_current_user_id() == $user->ID) {
                            $editUserLink = get_edit_profile_url($user->ID);
                        } else {
                            $editUserLink = add_query_arg('user_id', $user->ID, self_admin_url('user-edit.php'));
                        }
                        echo '<strong>' . __('Linked to:', 'connections') . '</strong> ' . '<a href="' . esc_url($editUserLink) . '">' . esc_attr($user->display_name) . '</a>';
                    }
                    echo "</td> \n";
                    echo "</tr> \n";
                    echo "<tr class='child-row-" . $entry->getId() . " cn-entry-details' id='contact-" . $entry->getId() . "-detail' style='display:none;'>";
                    echo '<td colspan="2">&nbsp;</td>', "\n";
                    //echo "<td >&nbsp;</td> \n";
                    echo '<td colspan="2">';
                    /*
                     * Check if the entry has relations. Count the relations and then cycle thru each relation.
                     * Before the out check that the related entry still exists. If it does and the current user
                     * has edit capabilites the edit link will be displayed. If the user does not have edit capabilities
                     * the only the relation will be shown. After all relations have been output insert a <br>
                     * for spacing [@TODO: NOTE: this should be done with styles].
                     */
                    if ($entry->getFamilyMembers()) {
                        $count = count($entry->getFamilyMembers());
                        $i = 0;
                        foreach ($entry->getFamilyMembers() as $key => $value) {
                            $relation = new cnEntry();
                            $relation->set($key);
                            $editRelationTokenURL = $form->tokenURL('admin.php?page=connections&action=edit&id=' . $relation->getId(), 'entry_edit_' . $relation->getId());
                            if ($relation->getId()) {
                                if (current_user_can('connections_edit_entry')) {
                                    echo '<strong>' . $instance->options->getFamilyRelation($value) . ':</strong> ' . '<a href="' . $editRelationTokenURL . '" title="' . __('Edit', 'connections') . ' ' . $relation->getFullFirstLastName() . '">' . $relation->getFullFirstLastName() . '</a><br />' . "\n";
                                } else {
                                    echo '<strong>' . $instance->options->getFamilyRelation($value) . ':</strong> ' . $relation->getFullFirstLastName() . '<br />' . "\n";
                                }
                            }
                            if ($count - 1 == $i) {
                                echo '<br />';
                            }
                            // Insert a break after all connections are listed.
                            $i++;
                            unset($relation);
                        }
                        unset($i);
                        unset($count);
                    }
                    if ($entry->getContactFirstName() || $entry->getContactLastName()) {
                        echo '<strong>' . __('Contact', 'connections') . ':</strong> ' . $entry->getContactFirstName() . ' ' . $entry->getContactLastName() . '<br />';
                    }
                    if ($entry->getTitle()) {
                        echo '<strong>' . __('Title', 'connections') . ':</strong> ' . $entry->getTitle() . '<br />';
                    }
                    if ($entry->getOrganization() && $entry->getEntryType() !== 'organization') {
                        echo '<strong>' . __('Organization', 'connections') . ':</strong> ' . $entry->getOrganization() . '<br />';
                    }
                    if ($entry->getDepartment()) {
                        echo '<strong>' . __('Department', 'connections') . ':</strong> ' . $entry->getDepartment() . '<br />';
                    }
                    $addresses = $entry->getAddresses();
                    //print_r($addresses);
                    if (!empty($addresses)) {
                        foreach ($addresses as $address) {
                            $outCache = array();
                            echo '<div style="margin: 10px 0;">';
                            $address->preferred ? $preferred = '*' : ($preferred = '');
                            if (!empty($address->name)) {
                                echo '<span style="display: block"><strong>', $address->name, $preferred, '</strong></span>';
                            }
                            if (!empty($address->line_1)) {
                                echo '<span style="display: block">', $address->line_1, '</span>';
                            }
                            if (!empty($address->line_2)) {
                                echo '<span style="display: block">', $address->line_2, '</span>';
                            }
                            if (!empty($address->line_3)) {
                                echo '<span style="display: block">', $address->line_3, '</span>';
                            }
                            if (!empty($address->city)) {
                                $outCache[] = '<span>' . $address->city . '</span>';
                            }
                            if (!empty($address->state)) {
                                $outCache[] = '<span>' . $address->state . '</span>';
                            }
                            if (!empty($address->zipcode)) {
                                $outCache[] = '<span>' . $address->zipcode . '</span>';
                            }
                            if (!empty($outCache)) {
                                echo '<span style="display: block">', implode('&nbsp;', $outCache), '</span>';
                            }
                            if (!empty($address->country)) {
                                echo '<span style="display: block">', $address->country, '</span>';
                            }
                            if (!empty($address->latitude) && !empty($address->longitude)) {
                                echo '<span style="display: block">', '<strong>', __('Latitude', 'connections'), ':</strong>', ' ', $address->latitude, ' ', '<strong>', __('Longitude', 'connections'), ':</strong>', ' ', $address->longitude, '</span>';
                            }
                            echo '</div>';
                        }
                        unset($outCache);
                    }
                    echo '</td>', "\n";
                    echo '<td>';
                    $phoneNumbers = $entry->getPhoneNumbers();
                    if (!empty($phoneNumbers)) {
                        echo '<div class="phone-numbers">';
                        foreach ($phoneNumbers as $phone) {
                            $phone->preferred ? $preferred = '*' : ($preferred = '');
                            echo '<span class="phone"><strong>', $phone->name, '</strong>: ', $phone->number, $preferred, '</span>';
                        }
                        echo '</div>';
                    }
                    $emailAddresses = $entry->getEmailAddresses();
                    if (!empty($emailAddresses)) {
                        echo '<div class="email-addresses">';
                        foreach ($emailAddresses as $email) {
                            $email->preferred ? $preferred = '*' : ($preferred = '');
                            echo '<span class="email"><strong>', $email->name, ':</strong> <a href="mailto:', $email->address, '">', $email->address, '</a>', $preferred, '</span>';
                        }
                        echo '</div>';
                    }
                    $imIDs = $entry->getIm();
                    if (!empty($imIDs)) {
                        echo '<div class="im-ids">';
                        foreach ($imIDs as $im) {
                            $im->preferred ? $preferred = '*' : ($preferred = '');
                            echo '<span class="im"><strong>', $im->name, ':</strong> ', $im->id, $preferred, '</span>';
                        }
                        echo '</div>';
                    }
                    $socialNetworks = $entry->getSocialMedia();
                    if (!empty($socialNetworks)) {
                        echo '<div class="social-networks">';
                        foreach ($entry->getSocialMedia() as $network) {
                            $network->preferred ? $preferred = '*' : ($preferred = '');
                            echo '<span class="social-network"><strong>', $network->name, ':</strong> <a target="_blank" href="', $network->url, '">', $network->url . '</a>', $preferred, '</span>';
                        }
                        echo '</div>';
                    }
                    $links = $entry->getLinks();
                    if (!empty($links)) {
                        echo '<div class="links">';
                        foreach ($links as $link) {
                            $link->preferred ? $preferred = '*' : ($preferred = '');
                            echo '<span class="link"><strong>', $link->name, ':</strong> <a target="_blank" href="', $link->url, '">', $link->url, '</a>', $preferred, '</span>';
                        }
                        echo '</div>';
                    }
                    echo "</td> \n";
                    echo "<td>";
                    $entry->getDateBlock();
                    echo "</td> \n";
                    echo "</tr> \n";
                    echo "<tr class='child-row-" . $entry->getId() . " entrynotes' id='contact-" . $entry->getId() . "-detail-notes' style='display:none;'>";
                    echo "<td colspan='2'>&nbsp;</td> \n";
                    //echo "<td >&nbsp;</td> \n";
                    echo "<td colspan='3'>";
                    echo $entry->getBio() ? '<strong>' . __('Bio', 'connections') . ':</strong> ' . $entry->getBio() . '<br />' : '&nbsp;';
                    echo $entry->getNotes() ? '<strong>' . __('Notes', 'connections') . ':</strong> ' . $entry->getNotes() : '&nbsp;';
                    echo "</td> \n";
                    echo '<td>
												<span style="display: block;"><strong>' . __('Entry ID', 'connections') . ':</strong> ' . $entry->getId() . '</span>' . '
												<span style="display: block;"><strong>' . __('Entry Slug', 'connections') . ':</strong> ' . $entry->getSlug() . '</span>' . '
												<span style="display: block;"><strong>' . __('Date Added', 'connections') . ':</strong> ' . $entry->getDateAdded('m/d/Y g:ia') . '</span>
												<span style="display: block;"><strong>' . __('Added By', 'connections') . ':</strong> ' . $entry->getAddedBy() . '</span>';
                    echo '<span style="display: block;"><strong>' . __('Image Linked', 'connections') . ':</strong> ' . (!$entry->getImageLinked() ? __('No', 'connections') : __('Yes', 'connections')) . '</span>';
                    echo '<span style="display: block;"><strong>' . __('Display', 'connections') . ':</strong> ' . ($entry->getImageLinked() && $entry->getImageDisplay() ? __('Yes', 'connections') : __('No', 'connections')) . '</span>';
                    echo "</td> \n";
                    echo "</tr> \n";
                }
                ?>
								</tbody>
							</table>
							</form>


					<script type="text/javascript">
						/* <![CDATA[ */
						(function($){
							$(document).ready(function(){
								$('#doaction, #doaction2').click(function(){
									if ( $('select[name^="action"]').val() == 'delete' ) {
										var m = 'You are about to delete the selected entry(ies).\n  \'Cancel\' to stop, \'OK\' to delete.';
										return showNotice.warn(m);
									}
								});
							});
						})(jQuery);
						/* ]]> */
					</script>
				<?php 
            } else {
                cnMessage::set('error', 'capability_view_entry_list');
            }
            break;
    }
    echo '</div> <!-- .wrap -->';
}