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


PHP GVCommon::get_entry方法代码示例

本文整理汇总了PHP中GVCommon::get_entry方法的典型用法代码示例。如果您正苦于以下问题:PHP GVCommon::get_entry方法的具体用法?PHP GVCommon::get_entry怎么用?PHP GVCommon::get_entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GVCommon的用法示例。


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

示例1: entry_link

 /**
  * return href for single entry
  * @param  array|int $entry   Entry array or entry ID
  * @param  int|null $post_id If wanting to define the parent post, pass a post ID
  * @param boolean $add_directory_args True: Add args to help return to directory; False: only include args required to get to entry {@since 1.7.3}
  * @return string          Link to the entry with the directory parent slug
  */
 public static function entry_link($entry, $post_id = NULL, $add_directory_args = true)
 {
     if (!empty($entry) && !is_array($entry)) {
         $entry = GVCommon::get_entry($entry);
     } else {
         if (empty($entry)) {
             $entry = GravityView_frontend::getInstance()->getEntry();
         }
     }
     // Second parameter used to be passed as $field; this makes sure it's not an array
     if (!is_numeric($post_id)) {
         $post_id = NULL;
     }
     // Get the permalink to the View
     $directory_link = self::directory_link($post_id, false);
     // No post ID? Get outta here.
     if (empty($directory_link)) {
         return '';
     }
     $query_arg_name = GravityView_Post_Types::get_entry_var_name();
     $entry_slug = self::get_entry_slug($entry['id'], $entry);
     if (get_option('permalink_structure') && !is_preview()) {
         $args = array();
         $directory_link = trailingslashit($directory_link) . $query_arg_name . '/' . $entry_slug . '/';
     } else {
         $args = array($query_arg_name => $entry_slug);
     }
     /**
      * @since 1.7.3
      */
     if ($add_directory_args) {
         if (!empty($_GET['pagenum'])) {
             $args['pagenum'] = intval($_GET['pagenum']);
         }
         /**
          * @since 1.7
          */
         if ($sort = rgget('sort')) {
             $args['sort'] = $sort;
             $args['dir'] = rgget('dir');
         }
     }
     /**
      * Check if we have multiple views embedded in the same page and in that case make sure the single entry link
      * has the view id so that Advanced Filters can be applied correctly when rendering the single view
      * @see GravityView_frontend::get_context_view_id()
      */
     if (class_exists('GravityView_View_Data') && GravityView_View_Data::getInstance()->has_multiple_views()) {
         $args['gvid'] = gravityview_get_view_id();
     }
     return add_query_arg($args, $directory_link);
 }
开发者ID:roarmoser,项目名称:gv1,代码行数:59,代码来源:class-api.php

示例2: setEntry

 /**
  * Set the current entry
  * @param array|int $entry Entry array or entry ID
  */
 public function setEntry($entry)
 {
     if (!is_array($entry)) {
         $entry = GVCommon::get_entry($entry);
     }
     $this->entry = $entry;
 }
开发者ID:kidaak,项目名称:GravityView,代码行数:11,代码来源:class-frontend-views.php

示例3: gravityview_get_entry

 /**
  * Return a single entry object
  *
  * Since 1.4, supports custom entry slugs. The way that GravityView fetches an entry based on the custom slug is by searching `gravityview_unique_id` meta. The `$entry_slug` is fetched by getting the current query var set by `is_single_entry()`
  *
  * @access public
  * @param mixed $entry_id
  * @param boolean $force_allow_ids Force the get_entry() method to allow passed entry IDs, even if the `gravityview_custom_entry_slug_allow_id` filter returns false.
  * @return object or false
  */
 function gravityview_get_entry($entry_slug, $force_allow_ids = false)
 {
     return GVCommon::get_entry($entry_slug, $force_allow_ids);
 }
开发者ID:psdes,项目名称:GravityView,代码行数:14,代码来源:connector-functions.php

示例4: gravityview_get_entry

/**
 * Return a single entry object
 *
 * Since 1.4, supports custom entry slugs. The way that GravityView fetches an entry based on the custom slug is by searching `gravityview_unique_id` meta. The `$entry_slug` is fetched by getting the current query var set by `is_single_entry()`
 *
 * @access public
 * @param mixed $entry_id
 * @param boolean $force_allow_ids Force the get_entry() method to allow passed entry IDs, even if the `gravityview_custom_entry_slug_allow_id` filter returns false.
 * @param boolean $check_entry_display Check whether the entry is visible for the current View configuration. Default: true {@since 1.14}
 * @return array|boolean
 */
function gravityview_get_entry($entry_slug, $force_allow_ids = false, $check_entry_display = true)
{
    return GVCommon::get_entry($entry_slug, $force_allow_ids, $check_entry_display);
}
开发者ID:mgratch,项目名称:GravityView,代码行数:15,代码来源:connector-functions.php

示例5: get_entry

 /**
  * Get entry array from `entry_id` parameter. If no $entry_id
  *
  * @since 1.15
  * @uses GVCommon::get_entry
  * @uses GravityView_frontend::getSingleEntry
  *
  * @param int $entry_id Gravity Forms Entry ID. If not passed, current View's current entry ID will be used, if found.
  *
  * @return array|bool Gravity Forms array, if found. Otherwise, false.
  */
 private function get_entry($entry_id = 0)
 {
     $backup_entry = GravityView_frontend::getInstance()->getSingleEntry() ? GravityView_frontend::getInstance()->getEntry() : GravityView_View::getInstance()->getCurrentEntry();
     if (empty($entry_id)) {
         if (!$backup_entry) {
             do_action('gravityview_log_error', __METHOD__ . ' No entry defined (or entry id not valid number)', $this->settings);
             return false;
         }
         $entry = $backup_entry;
     } else {
         $entry = wp_cache_get('gv_entry_link_entry_' . $entry_id, 'gravityview_entry_link_shortcode');
         if (false === $entry) {
             $entry = GVCommon::get_entry($entry_id, true, false);
             wp_cache_add('gv_entry_link_entry_' . $entry_id, $entry, 'gravityview_entry_link_shortcode');
         }
     }
     // No search results
     if (false === $entry) {
         do_action('gravityview_log_error', __METHOD__ . ' No entries match the entry ID defined', $entry_id);
         return false;
     }
     return $entry;
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:34,代码来源:class-gravityview-entry-link-shortcode.php


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