当前位置: 首页>>代码示例>>PHP>>正文


PHP Connections_Directory函数代码示例

本文整理汇总了PHP中Connections_Directory函数的典型用法代码示例。如果您正苦于以下问题:PHP Connections_Directory函数的具体用法?PHP Connections_Directory怎么用?PHP Connections_Directory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Connections_Directory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_entries

 /**
  * @param WP_REST_Request $request Full details about the request.
  *
  * @return array
  */
 protected function get_entries($request)
 {
     // Grab an instance of the Connections object.
     $instance = Connections_Directory();
     $atts = array('limit' => $request['per_page'], 'offset' => $request['offset']);
     $results = $instance->retrieve->entries($atts);
     return $results;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:13,代码来源:class.cn-rest-entry-controller.php

示例2: get

 /**
  * Get the system info.
  *
  * @access private
  * @since  8.3
  * @static
  *
  * @global wpdb $wpdb
  *
  * @uses   Browser()
  * @uses   Connections_Directory()
  * @uses   wp_get_theme()
  * @uses   cnSystem_Info::getHost()
  *
  * @return string
  */
 public static function get()
 {
     /** @var wpdb $wpdb */
     global $wpdb;
     if (!class_exists('Browser')) {
         require_once CN_PATH . 'vendor/browser/Browser.php';
     }
     $browser = new Browser();
     // Grab an instance of the Connections object.
     $instance = Connections_Directory();
     // Get theme info
     $theme_data = wp_get_theme();
     $theme = $theme_data->Name . ' ' . $theme_data->Version;
     // Try to identify the hosting provider
     $host = self::getHost();
     ob_start();
     require_once CN_PATH . 'includes/system-info/inc.system-info.php';
     return ob_get_clean();
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:35,代码来源:class.system-info.php

示例3: widget

 /**
  * Function for displaying the widget on the page.
  *
  * @access  private
  * @since   1.0
  *
  * @param  array $args
  * @param  array $option
  *
  * @return string
  */
 public function widget($args, $option)
 {
     // Only process and display the widget if displaying a single entry.
     if (get_query_var('cn-entry-slug')) {
         // Grab an instance of the Connections object.
         $instance = Connections_Directory();
         // Query the entry.
         $result = $instance->retrieve->entries(array('slug' => urldecode(get_query_var('cn-entry-slug'))));
         // Setup the entry object
         $entry = new cnEntry($result[0]);
         // Query the entry meta.
         $metadata = $entry->getMeta(array('key' => 'hobbies', 'single' => TRUE));
         // If there is no meta; bail.
         if (empty($metadata)) {
             return;
         }
         /**
          * Extract $before_widget, $after_widget, $before_title and $after_title.
          *
          * @var $before_widget
          * @var $after_widget
          * @var $before_title
          * @var $after_title
          */
         extract($args);
         // Setup the default widget options if they were not set when they were added to the sidebar;
         // ie. the user did not click the "Save" button on the widget.
         $title = strlen($option['title']) > 0 ? $option['title'] : __('Hobbies', 'connections_hobbies');
         // Setup the atts to be passed to the method that displays the data.
         $atts = array();
         echo $before_widget;
         echo $before_title . $title . $after_title;
         // Display the income level.
         Connections_Hobbies::block('hobbies', $metadata, NULL, $atts);
         echo $after_widget;
     }
 }
开发者ID:Connections-Business-Directory,项目名称:Connections-Hobbies,代码行数:48,代码来源:class.widgets.php

示例4: shortcode

 public static function shortcode($atts, $content = '', $tag = 'cn_thumbr')
 {
     // Grab an instance of the Connections object.
     $instance = Connections_Directory();
     $log = array();
     $srcset = array();
     $permitted = array('attachment', 'featured', 'path', 'url', 'logo', 'photo');
     $defaults = array('type' => 'url', 'source' => NULL, 'negate' => FALSE, 'grayscale' => FALSE, 'brightness' => 0, 'colorize' => NULL, 'contrast' => 0, 'detect_edges' => FALSE, 'emboss' => FALSE, 'gaussian_blur' => FALSE, 'blur' => FALSE, 'sketchy' => FALSE, 'sharpen' => FALSE, 'smooth' => NULL, 'opacity' => 100, 'crop_mode' => 1, 'crop_focus' => array(0.5, 0.5), 'crop_only' => FALSE, 'canvas_color' => '#FFFFFF', 'quality' => 90, 'sizes' => '1024|640|320');
     $defaults = apply_filters('cn_thumbr_shortcode_atts', $defaults);
     $atts = shortcode_atts($defaults, $atts, $tag);
     if (!in_array($atts['type'], $permitted)) {
         return __('Valid image source type not supplied.', 'connections');
     }
     /*
      * Convert some of the $atts values in the array to boolean because the Shortcode API passes all values as strings.
      */
     cnFormatting::toBoolean($atts['negate']);
     cnFormatting::toBoolean($atts['grayscale']);
     cnFormatting::toBoolean($atts['detect_edges']);
     cnFormatting::toBoolean($atts['emboss']);
     cnFormatting::toBoolean($atts['gaussian_blur']);
     cnFormatting::toBoolean($atts['blur']);
     cnFormatting::toBoolean($atts['sketchy']);
     cnFormatting::toBoolean($atts['sharpen']);
     // cnFormatting::toBoolean( $atts['crop'] );
     cnFormatting::toBoolean($atts['crop_only']);
     $atts['sizes'] = explode('|', $atts['sizes']);
     array_map('trim', $atts['sizes']);
     array_map('absint', $atts['sizes']);
     if (empty($atts['sizes'])) {
         return __('No image sizes were supplied or supplied values were invalid.', 'connections');
     }
     switch ($atts['type']) {
         case 'attachment':
             $source = wp_get_attachment_url(absint($atts['source']));
             break;
         case 'featured':
             $source = wp_get_attachment_url(get_post_thumbnail_id());
             break;
         case 'path':
             $source = $atts['source'];
             break;
         case 'url':
             $source = esc_url($atts['source']);
             break;
         case 'logo':
             $result = $instance->retrieve->entry(absint($atts['source']));
             $entry = new cnEntry($result);
             $meta = $entry->getImageMeta(array('type' => 'logo'));
             if (is_wp_error($meta)) {
                 // Display the error messages.
                 return implode(PHP_EOL, $meta->get_error_messages());
             }
             $source = $meta['url'];
             break;
         case 'photo':
             $result = $instance->retrieve->entry(absint($atts['source']));
             $entry = new cnEntry($result);
             $meta = $entry->getImageMeta(array('type' => 'photo'));
             if (is_wp_error($meta)) {
                 // Display the error messages.
                 return implode(PHP_EOL, $meta->get_error_messages());
             }
             $source = $meta['url'];
             break;
     }
     // Unset $atts['source'] because passing that $atts to cnImage::get() extracts and overwrite the $source var.
     unset($atts['source']);
     foreach ($atts['sizes'] as $width) {
         $atts['width'] = $width;
         $image = cnImage::get($source, $atts, 'data');
         if (is_wp_error($image)) {
             // Display the error messages.
             return implode(PHP_EOL, $image->get_error_messages());
         } elseif ($image === FALSE) {
             return __('An error has occured while creating the thumbnail.', 'connections');
         }
         if (defined('WP_DEBUG') && WP_DEBUG === TRUE) {
             $log[] = '<pre>' . $image['log'] . '</pre>';
         }
         $srcset[] = $image['url'] . ' ' . $width . 'w';
     }
     $out = sprintf('<img class="cn-image" srcset="%1$s" sizes="100vw"%2$s />', implode(',', $srcset), empty($content) ? '' : ' alt="' . esc_attr($content) . '"');
     if (defined('WP_DEBUG') && WP_DEBUG === TRUE) {
         $out .= implode('', $log);
     }
     return $out;
 }
开发者ID:VacantFuture,项目名称:Connections,代码行数:88,代码来源:class.shortcode-thumbnail-responsive.php

示例5: userPermitted

 /**
  * Will return TRUE?FALSE based on current user capability or privacy setting if the user is not logged in to
  * WordPress.
  *
  * @access public
  * @since  0.7.2.0
  * @static
  *
  * @uses   is_user_logged_in()
  * @uses   current_user_can()
  * @uses   is_admin()
  * @uses   cnOptions::loginRequired()
  * @uses   cnOptions::getAllowPublicOverride()
  * @uses   cnOptions::getAllowPrivateOverride()
  *
  * @param string $visibility
  *
  * @return bool
  */
 public static function userPermitted($visibility)
 {
     // Ensure a valid option for $visibility.
     if (!in_array($visibility, array('public', 'private', 'unlisted'))) {
         return FALSE;
     }
     if (is_user_logged_in()) {
         switch ($visibility) {
             case 'public':
                 return current_user_can('connections_view_public');
             case 'private':
                 return current_user_can('connections_view_private');
             case 'unlisted':
                 return is_admin() && current_user_can('connections_view_unlisted');
             default:
                 return FALSE;
         }
     } else {
         // Unlisted entries are not shown on the frontend.
         if ('unlisted' == $visibility) {
             return FALSE;
         }
         // Grab an instance of the Connections object.
         $instance = Connections_Directory();
         if (cnOptions::loginRequired()) {
             switch ($visibility) {
                 case 'public':
                     return $instance->options->getAllowPublicOverride();
                 case 'private':
                     return $instance->options->getAllowPrivateOverride();
                 default:
                     return FALSE;
             }
         } else {
             if ('public' == $visibility) {
                 return TRUE;
             }
         }
         // If we get here, return FALSE
         return FALSE;
     }
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:61,代码来源:class.utility.php

示例6: frontendActions

 /**
  * This action will handle frontend process requests, currently only creating the vCard for download.
  *
  * @TODO If no vcard is found should redirect to an error message.
  * @access private
  * @since 0.7.3
  * @return void
  */
 public static function frontendActions()
 {
     // Grab an instance of the Connections object.
     $instance = Connections_Directory();
     $process = get_query_var('cn-process');
     $token = get_query_var('cn-token');
     $id = (int) get_query_var('cn-id');
     if ('vcard' === $process) {
         $slug = get_query_var('cn-entry-slug');
         //var_dump($slug);
         /*
          * If the token and id values were set, the link was likely from the admin.
          * Check for those values and validate the token. The primary reason for this
          * to be able to download vCards of entries that are set to "Unlisted".
          */
         if (!empty($id) && !empty($token)) {
             if (!wp_verify_nonce($token, 'download_vcard_' . $id)) {
                 wp_die('Invalid vCard Token');
             }
             $entry = $instance->retrieve->entry($id);
             // Die if no entry was found.
             if (empty($entry)) {
                 wp_die(__('vCard not available for download.', 'connections'));
             }
             $vCard = new cnvCard($entry);
             //var_dump($vCard);die;
         } else {
             $entry = $instance->retrieve->entries(array('slug' => $slug));
             //var_dump($entry);die;
             // Die if no entry was found.
             if (empty($entry)) {
                 wp_die(__('vCard not available for download.', 'connections'));
             }
             $vCard = new cnvCard($entry[0]);
             //var_dump($vCard);die;
         }
         $filename = sanitize_file_name($vCard->getName());
         //var_dump($filename);
         $data = $vCard->getvCard();
         //var_dump($data);die;
         header('Content-Description: File Transfer');
         header('Content-Type: application/octet-stream');
         header('Content-Disposition: attachment; filename=' . $filename . '.vcf');
         header('Content-Length: ' . strlen($data));
         header('Pragma: public');
         header("Pragma: no-cache");
         //header( "Expires: 0" );
         header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
         header('Cache-Control: private');
         // header( 'Connection: close' );
         ob_clean();
         flush();
         echo $data;
         exit;
     }
 }
开发者ID:kurainetto,项目名称:Connections,代码行数:64,代码来源:connections.php

示例7: view

 /**
  * 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'))) {
//.........这里部分代码省略.........
开发者ID:VacantFuture,项目名称:Connections,代码行数:101,代码来源:class.shortcode.php

示例8: metaDesc

 /**
  * Add the the current Connections category description or entry bio excerpt as the page meta description.
  *
  * @access private
  * @since  0.7.8
  * @static
  *
  * @uses   cnQuery::getVar()
  * @uses   esc_attr()
  * @uses   strip_shortcodes()
  */
 public static function metaDesc()
 {
     // Whether or not to filter the page title with the current directory location.
     if (!cnSettingsAPI::get('connections', 'seo_meta', 'page_desc')) {
         return;
     }
     $description = '';
     if (cnQuery::getVar('cn-cat-slug')) {
         // If the category slug is a descendant, use the last slug from the URL for the query.
         $categorySlug = explode('/', cnQuery::getVar('cn-cat-slug'));
         if (isset($categorySlug[count($categorySlug) - 1])) {
             $categorySlug = $categorySlug[count($categorySlug) - 1];
         }
         $term = cnTerm::getBy('slug', $categorySlug, 'category');
         $category = new cnCategory($term);
         $description = $category->getExcerpt(array('length' => 160));
     }
     if (cnQuery::getVar('cn-cat')) {
         if (is_array(cnQuery::getVar('cn-cat'))) {
             return;
         }
         $categoryID = cnQuery::getVar('cn-cat');
         $term = cnTerm::getBy('id', $categoryID, 'category');
         $category = new cnCategory($term);
         $description = $category->getExcerpt(array('length' => 160));
     }
     if (cnQuery::getVar('cn-entry-slug')) {
         // Grab an instance of the Connections object.
         $instance = Connections_Directory();
         $result = $instance->retrieve->entries(array('slug' => urldecode(cnQuery::getVar('cn-entry-slug'))));
         // Make sure an entry is returned and then echo the meta desc.
         if (!empty($result)) {
             $entry = new cnEntry($result[0]);
             $description = $entry->getExcerpt(array('length' => 160));
         }
     }
     if (0 == strlen($description)) {
         return;
     }
     echo '<meta name="description" content="' . esc_attr(trim(strip_shortcodes(strip_tags(stripslashes($description))))) . '"/>' . "\n";
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:52,代码来源:class.seo.php

示例9: controlStrings

 /**
  * The core template Customizer control string.
  *
  * @access private
  * @since  8.4
  *
  * @uses   Connections_Directory()
  * @uses   apply_filters()
  *
  * @return array
  */
 private function controlStrings()
 {
     // Grab an instance of the Connections object.
     $instance = Connections_Directory();
     $addressTypes = array_keys($instance->options->getDefaultAddressValues());
     $phoneTypes = array_keys($instance->options->getDefaultPhoneNumberValues());
     $emailTypes = array_keys($instance->options->getDefaultEmailValues());
     $dateTypes = array_keys($instance->options->getDateOptions());
     $linkTypes = array_keys($instance->options->getDefaultLinkValues());
     $strings = array('title' => array('label' => __('Show the entry title.', 'connections'), 'desc' => __('Whether or not to display the Title field.', 'connections')), 'org' => array('label' => __('Show the entry organization.', 'connections'), 'desc' => __('Whether or not to display the Organization field.', 'connections')), 'dept' => array('label' => __('Show the entry department.', 'connections'), 'desc' => __('Whether or not to display the Department field.', 'connections')), 'contact_name' => array('label' => __('Show the entry contact name.', 'connections'), 'desc' => __('Whether or not to display the Contact First and Last Name fields.', 'connections')), 'family' => array('label' => __('Show the entry family members.', 'connections'), 'desc' => __('Whether or not to display the family members.', 'connections')), 'addresses' => array('label' => __('Show the addresses.', 'connections'), 'desc' => __('Whether or not to display the addresses.', 'connections')), 'phone_numbers' => array('label' => __('Show the phone numbers.', 'connections'), 'desc' => __('Whether or not to display the phone numbers.', 'connections')), 'email' => array('label' => __('Show the email addresses.', 'connections'), 'desc' => __('Whether or not to display the email addresses.', 'connections')), 'im' => array('label' => __('Show the IM addresses.', 'connections'), 'desc' => __('Whether or not to display the IM addresses.', 'connections')), 'social_media' => array('label' => __('Show the social networks.', 'connections'), 'desc' => __('Whether or not to display the social networks.', 'connections')), 'links' => array('label' => __('Show the links.', 'connections'), 'desc' => __('Whether or not to display the links.', 'connections')), 'dates' => array('label' => __('Show the dates.', 'connections'), 'desc' => __('Whether or not to display the dates.', 'connections')), 'bio' => array('label' => __('Show the bio.', 'connections'), 'desc' => __('Whether or not to display the bio field.', 'connections')), 'notes' => array('label' => __('Show the notes.', 'connections'), 'desc' => __('Whether or not to display the notes field.', 'connections')), 'categories' => array('label' => __('Show the categories assigned to the entry.', 'connections'), 'desc' => __('Whether or not to display the categories.', 'connections')), 'last_updated' => array('label' => __('Show the last updated message.', 'connections'), 'desc' => __('Whether or not to display the last updated message.', 'connections')), 'return_to_top' => array('label' => __('Show display to top.', 'connections'), 'desc' => __('Whether or not to display the return to top arrow.', 'connections')), 'name_format' => array('label' => __('Name Format', 'connections'), 'desc' => __(sprintf('Default: %s', '<code>%prefix% %first% %middle% %last% %suffix%</code>'), 'connections')), 'contact_name_format' => array('label' => __('Contact Name Format', 'connections'), 'desc' => __(sprintf('Default: %s', '<code>%label%%separator% %first% %last%</code>'), 'connections')), 'address_format' => array('label' => __('Address Format', 'connections'), 'desc' => __(sprintf('Default: %s', '<code>%label% %line1% %line2% %line3% %city% %state%  %zipcode% %country%</code>'), 'connections')), 'email_format' => array('label' => __('Email Format', 'connections'), 'desc' => __(sprintf('Default: %s', '<code>%label%%separator% %address%</code>'), 'connections')), 'phone_format' => array('label' => __('Phone Format', 'connections'), 'desc' => __(sprintf('Default: %s', '<code>%label%%separator% %number%</code>'), 'connections')), 'link_format' => array('label' => __('Link Format', 'connections'), 'desc' => __(sprintf('Default: %s', '<code>%label%%separator% %title%</code>'), 'connections')), 'date_format' => array('label' => __('Date Format', 'connections'), 'desc' => __(sprintf('Default: %s', '<code>%label%%separator% %date%</code>'), 'connections')), 'address_types' => array('label' => __('Display Address Types', 'connections'), 'desc' => __(sprintf('Valid: %s', '<code>' . implode('</code>, <code>', $addressTypes)) . '</code>', 'connections')), 'phone_types' => array('label' => __('Display Phone Types', 'connections'), 'desc' => __(sprintf('Valid: %s', '<code>' . implode('</code>, <code>', $phoneTypes)) . '</code>', 'connections')), 'email_types' => array('label' => __('Display Email Types', 'connections'), 'desc' => __(sprintf('Valid: %s', '<code>' . implode('</code>, <code>', $emailTypes)) . '</code>', 'connections')), 'date_types' => array('label' => __('Display Date Types', 'connections'), 'desc' => __(sprintf('Valid: %s', '<code>' . implode('</code>, <code>', $dateTypes)) . '</code>', 'connections')), 'link_types' => array('label' => __('Display Link Types', 'connections'), 'desc' => __(sprintf('Valid: %s', '<code>' . implode('</code>, <code>', $linkTypes)) . '</code>', 'connections')));
     /**
      * An associative array of core strings used by the Template Customizer.
      *
      * The array key is the string ID. The value is an associative array with two keys.
      * The `label` key is the Customizer control label.
      * The `desc` key is the Customizer control description.
      *
      * @since 8.4
      *
      * @param array $strings
      */
     return apply_filters('cn_template_customizer_strings', $strings);
 }
开发者ID:VacantFuture,项目名称:Connections,代码行数:34,代码来源:class.template-customizer.php

示例10: remove_filter

            remove_filter('page_rewrite_rules', array('cnRewrite', 'addPageRewriteRules'));
            // Flush so they are rebuilt.
            flush_rewrite_rules();
        }
    }
    /**
     * The main function responsible for returning the Connections instance
     * to functions everywhere.
     *
     * Use this function like you would a global variable, except without needing
     * to declare the global.
     *
     * NOTE: Declaring an instance in the global @var $connections connectionsLoad to provide backward
     * compatibility with many internal methods, template and extensions that expect it.
     *
     * Example: <?php $instance = Connections_Directory(); ?>
     *
     * @access public
     * @since  0.7.9
     * @global $connections
     * @return connectionsLoad
     */
    function Connections_Directory()
    {
        global $connections;
        $connections = connectionsLoad::instance();
        return $connections;
    }
    // Start Connections.
    Connections_Directory();
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:31,代码来源:connections.php

示例11: update

 /**
  * Update the entry in the db.
  *
  * @access public
  * @since  unknown
  *
  * @return false|int
  */
 public function update()
 {
     /** @var wpdb $wpdb */
     global $wpdb;
     // Grab an instance of the Connections object.
     $instance = Connections_Directory();
     $this->serializeOptions();
     $this->setPropertyDefaultsByEntryType();
     do_action('cn_update-entry', $this);
     $result = $wpdb->update(CN_ENTRY_TABLE, array('ts' => current_time('mysql'), 'ordo' => $this->getOrder(), 'entry_type' => $this->entryType, 'visibility' => $this->getVisibility(), 'slug' => $this->getSlug(), 'honorific_prefix' => $this->honorificPrefix, 'first_name' => $this->firstName, 'middle_name' => $this->middleName, 'last_name' => $this->lastName, 'honorific_suffix' => $this->honorificSuffix, 'title' => $this->title, 'organization' => $this->organization, 'department' => $this->department, 'contact_first_name' => $this->contactFirstName, 'contact_last_name' => $this->contactLastName, 'family_name' => $this->familyName, 'birthday' => $this->birthday, 'anniversary' => $this->anniversary, 'addresses' => $this->addresses, 'phone_numbers' => $this->phoneNumbers, 'email' => $this->emailAddresses, 'im' => $this->im, 'social' => $this->socialMedia, 'links' => $this->links, 'dates' => $this->dates, 'options' => $this->options, 'bio' => $this->bio, 'notes' => $this->notes, 'edited_by' => $instance->currentUser->getID(), 'user' => $this->getUser(), 'status' => $this->status), array('id' => $this->id), array('%s', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s'), array('%d'));
     //print_r($wpdb->last_query);
     /*
      * Only update the rest of the entry's data if the update to the ENTRY TABLE was successful.
      */
     if (FALSE !== $result) {
         require_once CN_PATH . 'includes/entry/class.entry-db.php';
         $cnDb = new cnEntry_DB($this->getId());
         $cnDb->upsert(CN_ENTRY_ADDRESS_TABLE, array('order' => array('key' => 'order', 'format' => '%d'), 'preferred' => array('key' => 'preferred', 'format' => '%d'), 'type' => array('key' => 'type', 'format' => '%s'), 'line_1' => array('key' => 'line_1', 'format' => '%s'), 'line_2' => array('key' => 'line_2', 'format' => '%s'), 'line_3' => array('key' => 'line_3', 'format' => '%s'), 'line_4' => array('key' => 'line_4', 'format' => '%s'), 'district' => array('key' => 'district', 'format' => '%s'), 'county' => array('key' => 'county', 'format' => '%s'), 'city' => array('key' => 'city', 'format' => '%s'), 'state' => array('key' => 'state', 'format' => '%s'), 'zipcode' => array('key' => 'zipcode', 'format' => '%s'), 'country' => array('key' => 'country', 'format' => '%s'), 'latitude' => array('key' => 'latitude', 'format' => '%s'), 'longitude' => array('key' => 'longitude', 'format' => '%s'), 'visibility' => array('key' => 'visibility', 'format' => '%s')), $this->getAddresses(array(), TRUE, TRUE, 'db'), array('id' => array('key' => 'id', 'format' => '%d')));
         $cnDb->upsert(CN_ENTRY_PHONE_TABLE, array('order' => array('key' => 'order', 'format' => '%d'), 'preferred' => array('key' => 'preferred', 'format' => '%d'), 'type' => array('key' => 'type', 'format' => '%s'), 'number' => array('key' => 'number', 'format' => '%s'), 'visibility' => array('key' => 'visibility', 'format' => '%s')), $this->getPhoneNumbers(array(), TRUE, TRUE), array('id' => array('key' => 'id', 'format' => '%d')));
         $cnDb->upsert(CN_ENTRY_EMAIL_TABLE, array('order' => array('key' => 'order', 'format' => '%d'), 'preferred' => array('key' => 'preferred', 'format' => '%d'), 'type' => array('key' => 'type', 'format' => '%s'), 'address' => array('key' => 'address', 'format' => '%s'), 'visibility' => array('key' => 'visibility', 'format' => '%s')), $this->getEmailAddresses(array(), TRUE, TRUE), array('id' => array('key' => 'id', 'format' => '%d')));
         $cnDb->upsert(CN_ENTRY_MESSENGER_TABLE, array('order' => array('key' => 'order', 'format' => '%d'), 'preferred' => array('key' => 'preferred', 'format' => '%d'), 'type' => array('key' => 'type', 'format' => '%s'), 'uid' => array('key' => 'id', 'format' => '%s'), 'visibility' => array('key' => 'visibility', 'format' => '%s')), $this->getIm(array(), TRUE, TRUE), array('id' => array('key' => 'uid', 'format' => '%d')));
         $cnDb->upsert(CN_ENTRY_SOCIAL_TABLE, array('order' => array('key' => 'order', 'format' => '%d'), 'preferred' => array('key' => 'preferred', 'format' => '%d'), 'type' => array('key' => 'type', 'format' => '%s'), 'url' => array('key' => 'url', 'format' => '%s'), 'visibility' => array('key' => 'visibility', 'format' => '%s')), $this->getSocialMedia(array(), TRUE, TRUE), array('id' => array('key' => 'id', 'format' => '%d')));
         $cnDb->upsert(CN_ENTRY_LINK_TABLE, array('order' => array('key' => 'order', 'format' => '%d'), 'preferred' => array('key' => 'preferred', 'format' => '%d'), 'type' => array('key' => 'type', 'format' => '%s'), 'title' => array('key' => 'title', 'format' => '%s'), 'url' => array('key' => 'url', 'format' => '%s'), 'target' => array('key' => 'target', 'format' => '%s'), 'follow' => array('key' => 'follow', 'format' => '%d'), 'image' => array('key' => 'image', 'format' => '%d'), 'logo' => array('key' => 'logo', 'format' => '%d'), 'visibility' => array('key' => 'visibility', 'format' => '%s')), $this->getLinks(array(), TRUE, TRUE), array('id' => array('key' => 'id', 'format' => '%d')));
         $cnDb->upsert(CN_ENTRY_DATE_TABLE, array('order' => array('key' => 'order', 'format' => '%d'), 'preferred' => array('key' => 'preferred', 'format' => '%d'), 'type' => array('key' => 'type', 'format' => '%s'), 'date' => array('key' => 'date', 'format' => '%s'), 'visibility' => array('key' => 'visibility', 'format' => '%s')), $this->getDates(array(), TRUE, TRUE), array('id' => array('key' => 'id', 'format' => '%d')));
         $this->updateObjectCaches();
     }
     do_action('cn_updated-entry', $this);
     return $result;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:37,代码来源:class.entry-data.php

示例12: adminBarMenuItems

 /**
  * Add the entry actions to the admin bar
  *
  * @access private
  * @static
  * @since  8.2
  * @uses   cnURL::permalink()
  * @uses   current_user_can()
  * @param  $admin_bar object
  *
  * @return void
  */
 public static function adminBarMenuItems($admin_bar)
 {
     if (get_query_var('cn-entry-slug')) {
         // Grab an instance of the Connections object.
         $instance = Connections_Directory();
         $entry = $instance->retrieve->entries(array('slug' => rawurldecode(get_query_var('cn-entry-slug')), 'status' => 'approved,pending'));
         // preg_match( '/href="(.*?)"/', cnURL::permalink( array( 'slug' => $entry->slug, 'return' => TRUE ) ), $matches );
         // $permalink = $matches[1];
         if (current_user_can('connections_manage') && current_user_can('connections_view_menu') && (current_user_can('connections_edit_entry_moderated') || current_user_can('connections_edit_entry'))) {
             $admin_bar->add_node(array('parent' => FALSE, 'id' => 'cn-edit-entry', 'title' => __('Edit Entry', 'connections'), 'href' => admin_url(wp_nonce_url('admin.php?page=connections_manage&cn-action=edit_entry&id=' . $entry[0]->id, 'entry_edit_' . $entry[0]->id)), 'meta' => array('title' => __('Edit Entry', 'connections'))));
         }
     }
 }
开发者ID:kurainetto,项目名称:Connections,代码行数:25,代码来源:class.entry-actions.php

示例13: date

 /**
  * Renders the dates metabox.
  *
  * @access public
  * @since  0.8
  * @param  object $entry   An instance of the cnEntry object.
  * @param  array  $metabox The metabox options array from self::register().
  * @return string          The dates metabox.
  */
 public static function date($entry, $metabox)
 {
     // Grab an instance of the Connections object.
     $instance = Connections_Directory();
     // Grab the email types.
     $dateTypes = $instance->options->getDateOptions();
     echo '<div class="widgets-sortables ui-sortable" id="dates">', PHP_EOL;
     // --> Start template <-- \\
     echo '<textarea id="date-template" style="display: none;">', PHP_EOL;
     echo '<div class="widget-top">', PHP_EOL;
     echo '<div class="widget-title-action"><a class="widget-action"></a></div>', PHP_EOL;
     echo '<div class="widget-title"><h4>', PHP_EOL;
     cnHTML::field(array('type' => 'select', 'class' => '', 'id' => 'date[::FIELD::][type]', 'options' => $dateTypes, 'required' => FALSE, 'label' => __('Type', 'connections'), 'return' => FALSE));
     cnHTML::field(array('type' => 'radio', 'format' => 'inline', 'class' => '', 'id' => 'date[preferred]', 'options' => array('::FIELD::' => __('Preferred', 'connections')), 'required' => FALSE, 'before' => '<span class="preferred">', 'after' => '</span>', 'return' => FALSE));
     // Only show this if there are visibility options that the user is permitted to see.
     if (!empty(self::$visibility)) {
         cnHTML::field(array('type' => 'radio', 'format' => 'inline', 'class' => '', 'id' => 'date[::FIELD::][visibility]', 'options' => self::$visibility, 'required' => FALSE, 'before' => '<span class="visibility">' . __('Visibility', 'connections') . ' ', 'after' => '</span>', 'return' => FALSE), 'public');
     }
     echo '</h4></div>', PHP_EOL;
     echo '</div>', PHP_EOL;
     echo '<div class="widget-inside">';
     cnHTML::field(array('type' => 'text', 'class' => 'datepicker', 'id' => 'date[::FIELD::][date]', 'required' => FALSE, 'label' => __('Date', 'connections'), 'before' => '', 'after' => '', 'return' => FALSE));
     echo '<p class="cn-remove-button"><a href="#" class="cn-remove cn-button button cn-button-warning" data-type="date" data-token="::FIELD::">', __('Remove', 'connections'), '</a></p>';
     echo '</div>', PHP_EOL;
     echo '</textarea>', PHP_EOL;
     // --> End template <-- \\
     $dates = $entry->getDates(array(), FALSE);
     //print_r($dates);
     if (!empty($dates)) {
         foreach ($dates as $date) {
             $token = str_replace('-', '', cnUtility::getUUID());
             $selectName = 'date[' . $token . '][type]';
             $preferred = $date->preferred ? $token : '';
             echo '<div class="widget date" id="date-row-' . $token . '">', PHP_EOL;
             echo '<div class="widget-top">', PHP_EOL;
             echo '<div class="widget-title-action"><a class="widget-action"></a></div>', PHP_EOL;
             echo '<div class="widget-title"><h4>', PHP_EOL;
             cnHTML::field(array('type' => 'select', 'class' => '', 'id' => 'date[' . $token . '][type]', 'options' => $dateTypes, 'required' => FALSE, 'label' => __('Type', 'connections'), 'return' => FALSE), $date->type);
             cnHTML::field(array('type' => 'radio', 'format' => 'inline', 'class' => '', 'id' => 'date[preferred]', 'options' => array($token => __('Preferred', 'connections')), 'required' => FALSE, 'before' => '<span class="preferred">', 'after' => '</span>', 'return' => FALSE), $preferred);
             // Only show this if there are visibility options that the user is permitted to see.
             if (!empty(self::$visibility)) {
                 cnHTML::field(array('type' => 'radio', 'format' => 'inline', 'class' => '', 'id' => 'date[' . $token . '][visibility]', 'options' => self::$visibility, 'required' => FALSE, 'before' => '<span class="visibility">' . __('Visibility', 'connections') . ' ', 'after' => '</span>', 'return' => FALSE), $date->visibility);
             }
             echo '</h4></div>', PHP_EOL;
             echo '</div>', PHP_EOL;
             echo '<div class="widget-inside">', PHP_EOL;
             cnHTML::field(array('type' => 'text', 'class' => 'datepicker', 'id' => 'date[' . $token . '][date]', 'required' => FALSE, 'label' => __('Date', 'connections'), 'before' => '', 'after' => '', 'return' => FALSE), date('m/d/Y', strtotime($date->date)));
             echo '<input type="hidden" name="date[', $token, '][id]" value="', $date->id, '">', PHP_EOL;
             echo '<p class="cn-remove-button"><a href="#" class="cn-remove cn-button button cn-button-warning" data-type="date" data-token="' . $token . '">', __('Remove', 'connections'), '</a></p>', PHP_EOL;
             echo '</div>', PHP_EOL;
             echo '</div>', PHP_EOL;
         }
     }
     echo '</div>', PHP_EOL;
     echo '<p class="add"><a href="#" class="cn-add cn-button button" data-type="date" data-container="dates">', __('Add Date', 'connections'), '</a></p>', PHP_EOL;
 }
开发者ID:kurainetto,项目名称:Connections,代码行数:65,代码来源:class.metabox-entry.php

示例14: padCounts

 /**
  * Add count of children to parent count.
  *
  * Recalculates term counts by including items from child terms. Assumes all
  * relevant children are already in the $terms argument.
  *
  * NOTE: This is the Connections equivalent of @see _pad_term_counts() in WordPress core ../wp-includes/taxonomy.php
  *
  * @access private
  * @since  8.1
  * @static
  *
  * @global $wpdb
  *
  * @uses   childrenIDs()
  * @uses   is_user_logged_in()
  * @uses   current_user_can()
  * @uses   wpdb::get_results()
  *
  * @param  array $terms List of Term IDs
  * @param  string $taxonomy Term Context
  *
  * @return null Will break from function if conditions are not met.
  */
 private static function padCounts(&$terms, $taxonomy)
 {
     /** @var wpdb $wpdb */
     global $wpdb;
     $term_ids = array();
     $visibility = array();
     // Grab an instance of the Connections object.
     /** @var connectionsLoad $instance */
     $instance = Connections_Directory();
     // This function only works for hierarchical taxonomies like post categories.
     // if ( !is_taxonomy_hierarchical( $taxonomy ) )
     // 	return;
     $term_hier = self::childrenIDs($taxonomy);
     if (empty($term_hier)) {
         return;
     }
     $term_items = array();
     foreach ((array) $terms as $key => $term) {
         $terms_by_id[$term->term_id] =& $terms[$key];
         $term_ids[$term->term_taxonomy_id] = $term->term_id;
     }
     /*
      * // START --> Set up the query to only return the entries based on user permissions.
      */
     if (is_user_logged_in()) {
         if (current_user_can('connections_view_public')) {
             $visibility[] = 'public';
         }
         if (current_user_can('connections_view_private')) {
             $visibility[] = 'private';
         }
         if (current_user_can('connections_view_unlisted') && is_admin()) {
             $visibility[] = 'unlisted';
         }
     } else {
         // Display the 'public' entries if the user is not required to be logged in.
         $visibility[] = $instance->options->getAllowPublic() ? 'public' : '';
     }
     /*
      * // END --> Set up the query to only return the entries based on user permissions.
      */
     // Get the object and term ids and stick them in a lookup table
     // $tax_obj      = get_taxonomy( $taxonomy );
     $entry_types = array('individual', 'organization', 'family');
     $results = $wpdb->get_results("SELECT entry_id, term_taxonomy_id FROM " . CN_TERM_RELATIONSHIP_TABLE . " INNER JOIN " . CN_ENTRY_TABLE . " ON entry_id = id WHERE term_taxonomy_id IN (" . implode(',', array_keys($term_ids)) . ") AND entry_type IN ('" . implode("', '", $entry_types) . "') AND visibility IN ('" . implode("', '", (array) $visibility) . "')");
     foreach ($results as $row) {
         $id = $term_ids[$row->term_taxonomy_id];
         $term_items[$id][$row->entry_id] = isset($term_items[$id][$row->entry_id]) ? ++$term_items[$id][$row->entry_id] : 1;
     }
     // Touch every ancestor's lookup row for each post in each term
     foreach ($term_ids as $term_id) {
         $child = $term_id;
         while (!empty($terms_by_id[$child]) && ($parent = $terms_by_id[$child]->parent)) {
             if (!empty($term_items[$term_id])) {
                 foreach ($term_items[$term_id] as $item_id => $touches) {
                     $term_items[$parent][$item_id] = isset($term_items[$parent][$item_id]) ? ++$term_items[$parent][$item_id] : 1;
                 }
             }
             $child = $parent;
         }
     }
     // Transfer the touched cells
     foreach ((array) $term_items as $id => $items) {
         if (isset($terms_by_id[$id])) {
             $terms_by_id[$id]->count = count($items);
         }
     }
 }
开发者ID:VacantFuture,项目名称:Connections,代码行数:92,代码来源:class.terms.php

示例15: getPhoneNumberBlock

 /**
  * Echo or return the entry's phone numbers in a HTML hCard compliant string.
  *
  * Accepted options for the $atts property are:
  *  preferred (bool) Retrieve the preferred entry phone number.
  *  type (array) || (string) Retrieve specific phone number types.
  *   Permitted Types:
  *    homephone
  *    homefax
  *    cellphone
  *    workphone
  *    workfax
  *  format (string) The tokens to use to display the phone number block parts.
  *   Permitted Tokens:
  *    %label%
  *    %number%
  *    %separator%
  *  separator (string) The separator to use.
  *  before (string) HTML to output before the phone numbers.
  *  after (string) HTML to after before the phone numbers.
  *  return (bool) Return string if set to TRUE instead of echo string.
  *
  * Filters:
  *  cn_output_default_atts_phone => (array) Register the methods default attributes.
  *
  * @access public
  * @since unknown
  *
  * @param array $atts   Accepted values as noted above.
  * @param bool  $cached Returns the cached data rather than querying the db.
  *
  * @return string
  */
 public function getPhoneNumberBlock($atts = array(), $cached = TRUE)
 {
     // Grab an instance of the Connections object.
     $instance = Connections_Directory();
     /*
      * // START -- Set the default attributes array. \\
      */
     $defaults = array('preferred' => NULL, 'type' => NULL, 'limit' => NULL, 'format' => '', 'separator' => ':', 'before' => '', 'after' => '', 'return' => FALSE);
     $defaults = apply_filters('cn_output_default_atts_phone', $defaults);
     $atts = cnSanitize::args($atts, $defaults);
     $atts['id'] = $this->getId();
     /*
      * // END -- Set the default attributes array if not supplied. \\
      */
     $rows = array();
     $phoneNumbers = $this->getPhoneNumbers($atts, $cached);
     $search = array('%label%', '%number%', '%separator%');
     if (empty($phoneNumbers)) {
         return '';
     }
     foreach ($phoneNumbers as $phone) {
         $replace = array();
         $row = "\t" . '<span class="tel">';
         $replace[] = empty($phone->name) ? '' : '<span class="phone-name">' . $phone->name . '</span>';
         if (empty($phone->number)) {
             $replace[] = '';
         } else {
             if ($instance->settings->get('connections', 'link', 'phone')) {
                 $replace[] = '<a class="value" href="tel:' . $phone->number . '" value="' . preg_replace('/[^0-9]/', '', $phone->number) . '">' . $phone->number . '</a>';
             } else {
                 $replace[] = '<span class="value">' . $phone->number . '</span>';
             }
         }
         $replace[] = '<span class="cn-separator">' . $atts['separator'] . '</span>';
         $row .= str_ireplace($search, $replace, empty($atts['format']) ? empty($defaults['format']) ? '%label%%separator% %number%' : $defaults['format'] : $atts['format']);
         // Set the hCard Phone Number Type.
         $row .= $this->gethCardTelType($phone->type);
         $row .= '</span>' . PHP_EOL;
         $rows[] = apply_filters('cn_output_phone_number', cnString::replaceWhatWith($row, ' '), $phone, $this, $atts);
     }
     $block = '<span class="phone-number-block">' . PHP_EOL . implode(PHP_EOL, $rows) . PHP_EOL . '</span>';
     $block = apply_filters('cn_output_phone_numbers', $block, $phoneNumbers, $this, $atts);
     $html = $atts['before'] . $block . $atts['after'] . PHP_EOL;
     return $this->echoOrReturn($atts['return'], $html);
 }
开发者ID:VacantFuture,项目名称:Connections,代码行数:78,代码来源:class.entry-output.php


注:本文中的Connections_Directory函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。