• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP gravityview_get_link函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: extract

<?php

/**
 * Display the website field type
 *
 * @package GravityView
 * @subpackage GravityView/templates/fields
 */
$gravityview_view = GravityView_View::getInstance();
extract($gravityview_view->getCurrentField());
if (!empty($value) && function_exists('gravityview_format_link')) {
    /** @since 1.8 */
    $anchor_text = !empty($field_settings['anchor_text']) ? trim(rtrim($field_settings['anchor_text'])) : false;
    // Check empty again, just in case trim removed whitespace didn't work
    if (!empty($anchor_text)) {
        // Replace the variables
        $anchor_text = GravityView_API::replace_variables($anchor_text, $form, $entry);
    } else {
        $anchor_text = empty($field_settings['truncatelink']) ? $value : gravityview_format_link($value);
    }
    $attributes = empty($field_settings['open_same_window']) ? 'target=_blank' : '';
    echo gravityview_get_link($value, $anchor_text, $attributes);
} else {
    echo $display_value;
}
开发者ID:mgratch,项目名称:GravityView,代码行数:25,代码来源:website.php


示例2: shortcode

 /**
  * @param array $atts {
  *   @type string $view_id Define the ID for the View where the entry will
  *   @type string $entry_id ID of the entry to edit. If undefined, uses the current entry ID
  *   @type string $post_id ID of the base post or page to use for an embedded View
  *   @type string $link_atts Whether to open Edit Entry link in a new window or the same window
  *   @type string $return What should the shortcode return: link HTML (`html`) or the URL (`url`). Default: `html`
  *   @type string $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
  * }
  * @param string $content
  * @param string $context
  *
  * @return string|void
  */
 public function shortcode($atts = array(), $content = '', $context = 'gv_edit_entry')
 {
     // Make sure GV is loaded
     if (!class_exists('GravityView_frontend') || !class_exists('GravityView_View')) {
         return null;
     }
     $defaults = array('view_id' => 0, 'entry_id' => 0, 'post_id' => 0, 'link_atts' => '', 'return' => 'html', 'field_values' => '');
     $settings = shortcode_atts($defaults, $atts, $context);
     if (empty($settings['view_id'])) {
         $view_id = GravityView_View::getInstance()->getViewId();
     } else {
         $view_id = absint($settings['view_id']);
     }
     if (empty($view_id)) {
         do_action('gravityview_log_debug', __METHOD__ . ' A View ID was not defined');
         return null;
     }
     $post_id = empty($settings['post_id']) ? $view_id : absint($settings['post_id']);
     $form_id = gravityview_get_form_id($view_id);
     $backup_entry_id = GravityView_frontend::getInstance()->getSingleEntry() ? GravityView_frontend::getInstance()->getSingleEntry() : GravityView_View::getInstance()->getCurrentEntry();
     $entry_id = empty($settings['entry_id']) ? $backup_entry_id : absint($settings['entry_id']);
     if (empty($entry_id)) {
         do_action('gravityview_log_debug', __METHOD__ . ' No entry defined');
         return null;
     }
     // By default, show only current user
     $user = wp_get_current_user();
     if (!$user) {
         do_action('gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user');
         return null;
     }
     $entry = $this->get_entry($entry_id, $form_id);
     // No search results
     if (false === $entry) {
         do_action('gravityview_log_debug', __METHOD__ . ' No entries match the entry ID defined', $entry_id);
         return null;
     }
     // Check permissions
     if (false === GravityView_Edit_Entry::check_user_cap_edit_entry($entry, $view_id)) {
         do_action('gravityview_log_debug', __METHOD__ . ' User does not have the capability to edit this entry: ' . $entry_id);
         return null;
     }
     $href = GravityView_Delete_Entry::get_delete_link($entry, $view_id, $post_id, $settings);
     // Get just the URL, not the tag
     if ('url' === $settings['return']) {
         return $href;
     }
     $link_text = empty($content) ? __('Delete Entry', 'gravityview') : $content;
     return gravityview_get_link($href, $link_text, $settings['link_atts']);
 }
开发者ID:roarmoser,项目名称:gv1,代码行数:64,代码来源:class-delete-entry-shortcode.php


示例3: get_files_array


//.........这里部分代码省略.........
                      * @filter `gravityview_audio_settings` Modify the settings passed to the `wp_video_shortcode()` function
                      * @since  1.2
                      * @param array $audio_settings Array with `src` and `class` keys
                      */
                     $audio_settings = apply_filters('gravityview_audio_settings', array('src' => $file_path, 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings['id']));
                     /**
                      * Generate the audio shortcode
                      * @see http://codex.wordpress.org/Audio_Shortcode
                      * @see https://developer.wordpress.org/reference/functions/wp_audio_shortcode/
                      */
                     $content = wp_audio_shortcode($audio_settings);
                 }
                 break;
                 // Video file
             // Video file
             case in_array($extension, wp_get_video_extensions()):
                 $disable_lightbox = true;
                 if (shortcode_exists('video')) {
                     $disable_wrapped_link = true;
                     /**
                      * @filter `gravityview_video_settings` Modify the settings passed to the `wp_video_shortcode()` function
                      * @since  1.2
                      * @param array $video_settings Array with `src` and `class` keys
                      */
                     $video_settings = apply_filters('gravityview_video_settings', array('src' => $file_path, 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings['id']));
                     /**
                      * Generate the video shortcode
                      * @see http://codex.wordpress.org/Video_Shortcode
                      * @see https://developer.wordpress.org/reference/functions/wp_video_shortcode/
                      */
                     $content = wp_video_shortcode($video_settings);
                 }
                 break;
                 // PDF
             // PDF
             case $extension === 'pdf':
                 // PDF needs to be displayed in an IFRAME
                 $link = add_query_arg(array('TB_iframe' => 'true'), $link);
                 break;
                 // if not image, do not set the lightbox (@since 1.5.3)
             // if not image, do not set the lightbox (@since 1.5.3)
             case !in_array($extension, array('jpg', 'jpeg', 'jpe', 'gif', 'png')):
                 $disable_lightbox = true;
                 break;
         }
         // If using Link to File, override the content.
         // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.)
         if (!empty($field_settings['link_to_file'])) {
             // Force the content to be the file name
             $content = $file_path_info["basename"];
             // Restore the wrapped link
             $disable_wrapped_link = false;
         }
         // Whether to use lightbox or not
         if ($disable_lightbox || empty($gravityview_view->atts['lightbox']) || !empty($field_settings['show_as_link'])) {
             $link_atts = empty($field_settings['show_as_link']) ? array('target' => '_blank') : array();
         } else {
             $link_atts = array('rel' => sprintf("%s-%s", $gv_class, $entry['id']), 'target' => '_blank', 'class' => 'thickbox');
         }
         /**
          * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field
          * @param array|string $link_atts Array or attributes string
          * @param array $field Current GravityView field array
          */
         $link_atts = apply_filters('gravityview/fields/fileupload/link_atts', $link_atts, $gravityview_view->getCurrentField());
         /**
          * @filter `gravityview/fields/fileupload/disable_link` Filter to alter the default behaviour of wrapping images (or image names) with a link to the content object
          * @since 1.5.1
          * @param bool $disable_wrapped_link whether to wrap the content with a link to the content object.
          * @param array $gravityview_view->field_data
          * @see GravityView_API:field_value() for info about $gravityview_view->field_data
          */
         $disable_wrapped_link = apply_filters('gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField());
         // If the HTML output hasn't been overridden by the switch statement above, use the default format
         if (!empty($content) && empty($disable_wrapped_link)) {
             /**
              * Modify the link text (defaults to the file name)
              *
              * @since 1.7
              *
              * @param string $content The existing anchor content. Could be `<img>` tag, audio/video embed or the file name
              * @param array $field GravityView array of the current field being processed
              */
             $content = apply_filters('gravityview/fields/fileupload/link_content', $content, $gravityview_view->getCurrentField());
             $content = gravityview_get_link($link, $content, $link_atts);
         }
         $output_arr[] = array('file_path' => $file_path, 'content' => $content);
     }
     // End foreach loop
     /**
      * @filter `gravityview/fields/fileupload/files_array` Modify the files array
      * @since 1.7
      * @param array $output_arr Associative array of files \n
      *  @type string $file_path The path to the file as stored in Gravity Forms \n
      *  @type string $content The generated output for the file \n
      * @param array $field GravityView array of the current field being processed
      */
     $output_arr = apply_filters('gravityview/fields/fileupload/files_array', $output_arr, $gravityview_view->getCurrentField());
     return $output_arr;
 }
开发者ID:kidaak,项目名称:GravityView,代码行数:101,代码来源:fileupload.php


示例4: extract

<?php

/**
 * Display the post_title field type
 *
 * @package GravityView
 * @subpackage GravityView/templates/fields
 */
$gravityview_view = GravityView_View::getInstance();
extract($gravityview_view->getCurrentField());
if (!empty($field_settings['dynamic_data']) && !empty($entry['post_id'])) {
    $output = get_the_title($entry['post_id']);
    if (empty($output)) {
        do_action('gravityview_log_debug', 'Dynamic data for post #' . $entry['post_id'] . ' doesnt exist.');
    }
} else {
    $output = $display_value;
}
// Link to the post URL?
if (!empty($field_settings['link_to_post']) && !empty($entry['post_id'])) {
    echo gravityview_get_link(get_permalink($entry['post_id']), esc_attr($output));
} else {
    echo $output;
}
开发者ID:mgratch,项目名称:GravityView,代码行数:24,代码来源:post_title.php


示例5: the_clear_search_button

 /**
  * Output the Clear Search Results button
  * @since 1.5.4
  */
 public static function the_clear_search_button()
 {
     $gravityview_view = GravityView_View::getInstance();
     if ($gravityview_view->search_clear) {
         $url = strtok(add_query_arg(array()), '?');
         echo gravityview_get_link($url, esc_html__('Clear', 'gravityview'), 'class=button gv-search-clear');
     }
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:12,代码来源:class-search-widget.php


示例6: get_connected_form_links

 /**
  * Get HTML links relating to a connected form, like Edit, Entries, Settings, Preview
  * @param  array|int $form Gravity Forms forms array, or the form ID
  * @param  boolean $include_form_link Whether to include the bold name of the form in the output
  * @return string          HTML links
  */
 public static function get_connected_form_links($form, $include_form_link = true)
 {
     // Either the form is empty or the form ID is 0, not yet set.
     if (empty($form)) {
         return '';
     }
     // The $form is passed as the form ID
     if (!is_array($form)) {
         $form = gravityview_get_form($form);
     }
     $form_id = $form['id'];
     $links = array();
     if (GVCommon::has_cap('gravityforms_edit_forms')) {
         $form_url = admin_url(sprintf('admin.php?page=gf_edit_forms&amp;id=%d', $form_id));
         $form_link = '<strong class="gv-form-title">' . gravityview_get_link($form_url, $form['title'], 'class=row-title') . '</strong>';
         $links[] = '<span>' . gravityview_get_link($form_url, __('Edit Form', 'gravityview')) . '</span>';
     } else {
         $form_link = '<strong class="gv-form-title">' . esc_html($form['title']) . '</strong>';
     }
     if (GVCommon::has_cap('gravityforms_view_entries')) {
         $entries_url = admin_url(sprintf('admin.php?page=gf_entries&amp;id=%d', $form_id));
         $links[] = '<span>' . gravityview_get_link($entries_url, __('Entries', 'gravityview')) . '</span>';
     }
     if (GVCommon::has_cap(array('gravityforms_edit_settings', 'gravityview_view_settings'))) {
         $settings_url = admin_url(sprintf('admin.php?page=gf_edit_forms&amp;view=settings&amp;id=%d', $form_id));
         $links[] = '<span>' . gravityview_get_link($settings_url, __('Settings', 'gravityview'), 'title=' . __('Edit settings for this form', 'gravityview')) . '</span>';
     }
     if (GVCommon::has_cap(array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms"))) {
         $preview_url = site_url(sprintf('?gf_page=preview&amp;id=%d', $form_id));
         $links[] = '<span>' . gravityview_get_link($preview_url, __('Preview Form', 'gravityview'), 'title=' . __('Preview this form', 'gravityview')) . '</span>';
     }
     $output = '';
     if (!empty($include_form_link)) {
         $output .= $form_link;
     }
     /**
      * @filter `gravityview_connected_form_links` Modify the links shown in the Connected Form links
      * @since 1.6
      * @param array $links Links to show
      * @param array $form Gravity Forms form array
      */
     $links = apply_filters('gravityview_connected_form_links', $links, $form);
     $output .= '<div class="row-actions">' . implode(' | ', $links) . '</div>';
     return $output;
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:51,代码来源:class-admin-views.php


示例7: entry_link_html

 /**
  * Generate an anchor tag that links to an entry.
  *
  * @since 1.6
  *
  * @param string $anchor_text The text or HTML inside the link
  * @param array $entry Gravity Forms entry array
  * @param array $field_settings Array of field settings. Optional, but passed to the `gravityview_field_entry_link` filter
  */
 public static function entry_link_html($entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array())
 {
     if (empty($entry) || !is_array($entry) || !isset($entry['id'])) {
         do_action('gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry);
         return NULL;
     }
     $href = self::entry_link($entry);
     $link = gravityview_get_link($href, $anchor_text, $passed_tag_atts);
     /**
      * @filter `gravityview_field_entry_link` Modify the link HTML
      * @param string $link HTML output of the link
      * @param string $href URL of the link
      * @param array  $entry The GF entry array
      * @param  array $field_settings Settings for the particular GV field
      */
     $output = apply_filters('gravityview_field_entry_link', $link, $href, $entry, $field_settings);
     return $output;
 }
开发者ID:roarmoser,项目名称:gv1,代码行数:27,代码来源:class-api.php


示例8: extract

<?php

/**
 * Generate output for the Source URL field
 * @package GravityView
 * @subpackage GravityView/templates/fields
 * @since 1.1.6
 */
$gravityview_view = GravityView_View::getInstance();
extract($gravityview_view->getCurrentField());
// If linking to the source URL
if (!empty($field_settings['link_to_source'])) {
    // If customizing the anchor text
    if (!empty($field_settings['source_link_text'])) {
        $link_text = GravityView_API::replace_variables($field_settings['source_link_text'], $form, $entry);
    } else {
        // Otherwise, it's just the URL
        $link_text = $value;
    }
    $output = gravityview_get_link($value, esc_html($link_text));
} else {
    // Otherwise, it's just the URL
    $output = $value;
}
echo $output;
开发者ID:roarmoser,项目名称:gv1,代码行数:25,代码来源:source_url.php


示例9: make_duplicate_link_row

 /**
  * Add the link to action list for post_row_actions
  *
  * @since 1.6
  * @param array $actions Row action links. Defaults are 'Edit', 'Quick Edit', 'Restore, 'Trash', 'Delete Permanently', 'Preview', and 'View'
  * @param WP_Post $post
  */
 public function make_duplicate_link_row($actions, $post)
 {
     // Only process on GravityView Views
     if (get_post_type($post) === 'gravityview' && $this->current_user_can_copy($post)) {
         $clone_link = $this->get_clone_view_link($post->ID, 'display', false);
         $clone_text = __('Clone', 'gravityview');
         $clone_title = __('Clone this View', 'gravityview');
         $actions['clone'] = gravityview_get_link($clone_link, $clone_text, 'title=' . $clone_title);
         $clone_draft_link = $this->get_clone_view_link($post->ID);
         $clone_draft_text = $this->is_all_views_page() ? __('New Draft', 'gravityview') : __('Clone View', 'gravityview');
         $clone_draft_title = __('Copy as a new draft View', 'gravityview');
         $actions['edit_as_new_draft'] = gravityview_get_link($clone_draft_link, esc_html($clone_draft_text), 'title=' . $clone_draft_title);
     }
     return $actions;
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:22,代码来源:class-gravityview-admin-duplicate-view.php


示例10: shortcode

 /**
  * Generate a link to an entry. The link can be an edit, delete, or standard link.
  *
  * @since 1.15
  *
  * @param array $atts {
  *    @type string $action What type of link to generate. Options: `read`, `edit`, and `delete`. Default: `read`
  *    @type string $view_id Define the ID for the View. If not set, use current View ID, if exists.
  *    @type string $entry_id ID of the entry to edit. If undefined, uses the current entry ID, if exists.
  *    @type string $post_id ID of the base post or page to use for an embedded View
  *    @type string $link_atts Pass anchor tag attributes (`target=_blank` to open Edit Entry link in a new window, for example)
  *    @type string $return What should the shortcode return: link HTML (`html`) or the URL (`url`). Default: `html`
  *    @type string $field_values Only used for `action="edit"`. Parameters to pass in to the prefill data in Edit Entry form. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
  * }
  *
  * @param string|null $content Used as link anchor text, if specified.
  * @param string $context Current shortcode being called. Not used.
  *
  * @return null|string If admin or an error occurred, returns null. Otherwise, returns entry link output. If `$atts['return']` is 'url', the entry link URL. Otherwise, entry link `<a>` HTML tag.
  */
 private function shortcode($atts, $content = null, $context = 'gv_entry_link')
 {
     // Don't process when saving post. Keep processing if it's admin-ajax.php
     if (!class_exists('GravityView_Plugin') || GravityView_Plugin::is_admin()) {
         return null;
     }
     // Make sure GV is loaded
     if (!class_exists('GravityView_frontend') || !class_exists('GravityView_View')) {
         do_action('gravityview_log_error', __METHOD__ . ' GravityView_frontend or GravityView_View do not exist.');
         return null;
     }
     $this->settings = shortcode_atts(self::$defaults, $atts, $context);
     $this->view_id = empty($this->settings['view_id']) ? GravityView_View::getInstance()->getViewId() : absint($this->settings['view_id']);
     if (empty($this->view_id)) {
         do_action('gravityview_log_error', __METHOD__ . ' A View ID was not defined and we are not inside a View');
         return null;
     }
     $this->entry = $this->get_entry($this->settings['entry_id']);
     do_action('gravityview_log_debug', __METHOD__ . ' ' . $context . ' $atts: ', $atts);
     if (!$this->has_cap()) {
         do_action('gravityview_log_error', __METHOD__ . ' User does not have the capability to ' . esc_attr($this->settings['action']) . ' this entry: ' . $this->entry['id']);
         return null;
     }
     $url = $this->get_url();
     if (!$url) {
         do_action('gravityview_log_error', __METHOD__ . ' Link returned false; View or Post may not exist.');
         return false;
     }
     // Get just the URL, not the tag
     if ('url' === $this->settings['return']) {
         return $url;
     }
     $link_atts = $this->get_link_atts();
     $link_text = $this->get_anchor_text($content);
     return gravityview_get_link($url, $link_text, $link_atts);
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:56,代码来源:class-gravityview-entry-link-shortcode.php


示例11: is_valid_embed_id

 /**
  * Checks if the passed post id has the passed View id embedded.
  *
  * Returns
  *
  * @since 1.6.1
  *
  * @param string $post_id Post ID where the View is embedded
  * @param string $view_id View ID
  *
  * @return bool|WP_Error If valid, returns true. If invalid, returns WP_Error containing error message.
  */
 public static function is_valid_embed_id($post_id = '', $view_id = '', $empty_is_valid = true)
 {
     $message = NULL;
     // Not invalid if not set!
     if (empty($post_id) || empty($view_id)) {
         if ($empty_is_valid) {
             return true;
         }
         $message = esc_html__('The ID is required.', 'gravityview');
     }
     if (!$message) {
         $status = get_post_status($post_id);
         // Nothing exists with that post ID.
         if (!is_numeric($post_id)) {
             $message = esc_html__('You did not enter a number. The value entered should be a number, representing the ID of the post or page the View is embedded on.', 'gravityview');
             // @todo Convert to generic article about Embed IDs
             $message .= ' ' . gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more&hellip;', 'gravityview'), 'target=_blank');
         }
     }
     if (!$message) {
         // Nothing exists with that post ID.
         if (empty($status) || in_array($status, array('revision', 'attachment'))) {
             $message = esc_html__('There is no post or page with that ID.', 'gravityview');
         }
     }
     if (!$message) {
         $view_ids_in_post = GravityView_View_Data::getInstance()->maybe_get_view_id($post_id);
         // The post or page specified does not contain the shortcode.
         if (false === in_array($view_id, (array) $view_ids_in_post)) {
             $message = sprintf(esc_html__('The Post ID entered is not valid. You may have entered a post or page that does not contain the selected View. Make sure the post contains the following shortcode: %s', 'gravityview'), '<br /><code>[gravityview id="' . intval($view_id) . '"]</code>');
         }
     }
     if (!$message) {
         // It's a View
         if ('gravityview' === get_post_type($post_id)) {
             $message = esc_html__('The ID is already a View.', 'gravityview');
         }
     }
     if ($message) {
         return new WP_Error('invalid_embed_id', $message);
     }
     return true;
 }
开发者ID:roarmoser,项目名称:gv1,代码行数:55,代码来源:class-data.php


示例12: extract

<?php

$gravityview_view = GravityView_View::getInstance();
$view_id = $gravityview_view->getViewId();
extract($gravityview_view->getCurrentField());
// Only show the link to logged-in users with the rigth caps.
if (!GravityView_Delete_Entry::check_user_cap_delete_entry($entry, $field_settings)) {
    return;
}
$link_text = empty($field_settings['delete_link']) ? __('Delete Entry', 'gravityview') : $field_settings['delete_link'];
$link_text = apply_filters('gravityview_entry_link', GravityView_API::replace_variables($link_text, $form, $entry));
$href = GravityView_Delete_Entry::get_delete_link($entry, $view_id);
$attributes = array('onclick' => GravityView_Delete_Entry::get_confirm_dialog());
echo gravityview_get_link($href, $link_text, $attributes);
开发者ID:mgratch,项目名称:GravityView,代码行数:14,代码来源:delete_link.php


示例13: extract

<?php

/**
 * Display the post_id field type
 *
 * @package GravityView
 * @subpackage GravityView/templates/fields
 */
$gravityview_view = GravityView_View::getInstance();
extract($gravityview_view->getCurrentField());
// Link to the post URL?
if ($gravityview_view->getCurrentFieldSetting('link_to_post') && !empty($entry['post_id'])) {
    echo gravityview_get_link(get_permalink($entry['post_id']), esc_attr($display_value));
} else {
    echo $display_value;
}
开发者ID:mgratch,项目名称:GravityView,代码行数:16,代码来源:post_id.php


示例14: extract

<?php

$gravityview_view = GravityView_View::getInstance();
$view_id = $gravityview_view->getViewId();
extract($gravityview_view->getCurrentField());
// Only show the link to logged-in users.
if (!GravityView_Edit_Entry::check_user_cap_edit_entry($entry)) {
    return;
}
$link_text = empty($field_settings['edit_link']) ? __('Edit Entry', 'gravityview') : $field_settings['edit_link'];
$link_atts = empty($field_settings['new_window']) ? '' : 'target="_blank"';
$output = apply_filters('gravityview_entry_link', GravityView_API::replace_variables($link_text, $form, $entry));
$href = GravityView_Edit_Entry::get_edit_link($entry, $view_id);
echo gravityview_get_link($href, $output, $link_atts);
开发者ID:mgratch,项目名称:GravityView,代码行数:14,代码来源:edit_link.php


示例15: form


//.........这里部分代码省略.........
        if (!empty($instance['error_post_id'])) {
            ?>
			<div class="error inline">
				<p><?php 
            echo $instance['error_post_id'];
            ?>
</p>
			</div>
			<?php 
            unset($error);
        }
        ?>

		<p>
			<label for="<?php 
        echo $this->get_field_id('post_id');
        ?>
"><?php 
        esc_html_e('If Embedded, Page ID:', 'gravityview');
        ?>
</label>
			<input class="code" size="3" id="<?php 
        echo $this->get_field_id('post_id');
        ?>
" name="<?php 
        echo $this->get_field_name('post_id');
        ?>
" type="text" value="<?php 
        echo esc_attr($instance['post_id']);
        ?>
" />
			<span class="howto"><?php 
        esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview');
        echo ' ' . gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more&hellip;', 'gravityview'), 'target=_blank');
        ?>
</span>
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('limit');
        ?>
">
				<span><?php 
        _e('Number of entries to show:', 'gravityview');
        ?>
</span>
			</label>
			<input class="code" id="<?php 
        echo $this->get_field_id('limit');
        ?>
" name="<?php 
        echo $this->get_field_name('limit');
        ?>
" type="number" value="<?php 
        echo intval($instance['limit']);
        ?>
" size="3" />
		</p>

		<p>
			<label for="<?php 
        echo $this->get_field_id('link_format');
        ?>
">
				<span><?php 
开发者ID:mgratch,项目名称:GravityView,代码行数:67,代码来源:class-gravityview-recent-entries-widget.php


示例16: add_delete_button

 /**
  * Add a Delete button to the #publishing-action section of the Delete Entry form
  *
  * @since 1.5.1
  * @param array $form    Gravity Forms form array
  * @param array $entry   Gravity Forms entry array
  * @param int $view_id GravityView View ID
  */
 function add_delete_button($form = array(), $entry = array(), $view_id = NULL)
 {
     // Only show the link to those who are allowed to see it.
     if (!self::check_user_cap_delete_entry($entry)) {
         return;
     }
     /**
      * @filter `gravityview/delete-entry/show-delete-button` Should the Delete button be shown in the Edit Entry screen?
      * @param boolean $show_entry Default: true
      */
     $show_delete_button = apply_filters('gravityview/delete-entry/show-delete-button', true);
     // If the button is hidden by the filter, don't show.
     if (!$show_delete_button) {
         return;
     }
     $attributes = array('class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete', 'tabindex' => '5', 'onclick' => self::get_confirm_dialog());
     echo gravityview_get_link(self::get_delete_link($entry, $view_id), esc_attr__('Delete', 'gravityview'), $attributes);
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:26,代码来源:class-delete-entry.php


示例17: user_can_edit_entry

 /**
  * Check if the user can edit the entry
  *
  * - Is the nonce valid?
  * - Does the user have the right caps for the entry
  * - Is the entry in the trash?
  *
  * @todo Move to GVCommon
  *
  * @param  boolean $echo Show error messages in the form?
  * @return boolean        True: can edit form. False: nope.
  */
 function user_can_edit_entry($echo = false)
 {
     $error = NULL;
     /**
      *  1. Permalinks are turned off
      *  2. There are two entries embedded using oEmbed
      *  3. One of the entries has just been saved
      */
     if (!empty($_POST['lid']) && !empty($_GET['entry']) && $_POST['lid'] !== $_GET['entry']) {
         $error = true;
     }
     if (!empty($_GET['entry']) && (string) $this->entry['id'] !== $_GET['entry']) {
         $error = true;
     } elseif (!$this->verify_nonce()) {
         /**
          * If the Entry is embedded, there may be two entries on the same page.
          * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
          */
         if (GravityView_oEmbed::getInstance()->get_entry_id()) {
             $error = true;
         } else {
             $error = __('The link to edit this entry is not valid; it may have expired.', 'gravityview');
         }
     }
     if (!GravityView_Edit_Entry::check_user_cap_edit_entry($this->entry)) {
         $error = __('You do not have permission to edit this entry.', 'gravityview');
     }
     if ($this->entry['status'] === 'trash') {
         $error = __('You cannot edit the entry; it is in the trash.', 'gravityview');
     }
     // No errors; everything's fine here!
     if (empty($error)) {
         return true;
     }
     if ($echo && $error !== true) {
         $error = esc_html($error);
         /**
          * @since 1.9
          */
         if (!empty($this->entry)) {
             $error .= ' ' . gravityview_get_link('#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview'), array('onclick' => "window.history.go(-1); return false;"));
         }
         echo GVCommon::generate_notice(wpautop($error), 'gv-error error');
     }
     do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error);
     return false;
 }
开发者ID:hansstam,项目名称:makerfaire,代码行数:59,代码来源:class-edit-entry-render.php


示例18: get_item_output

 /**
  * Get the output for a specific entry
  *
  * @param array $entry GF Entry array
  *
  * @since 1.7.2
  *
  * @uses gravityview_get_link
  * @uses GravityView_API::entry_link
  * @uses GravityView_API::replace_variables
  *
  * @return string HTML output for the entry
  */
 private function get_item_output($entry)
 {
     $link = GravityView_API::entry_link($entry, $this->post_id);
     $item_output = gravityview_get_link($link, $this->link_format);
     if (!empty($this->after_link)) {
         /**
          * Modify the item output HTML
          *
          * @since 1.7.2
          *
          * @param string $item_output The HTML output for the after_link content
          * @param array $entry Gravity Forms entry array
          * @param GravityView_Entry_List $this The current class instance
          */
         $after_link = apply_filters('gravityview/entry-list/after-link', '<div>' . $this->after_link . '</div>', $entry, $this);
         $item_output .= $after_link;
     }
     $item_output = GravityView_API::replace_variables($item_output, $this->form, $entry);
     $item_output = '<' . $this->item_tag . '>' . $item_output . '</' . $this->item_tag . '>';
     /**
      * Modify the item output HTML
      *
      * @since 1.7.2
      *
      * @param string $item_output The HTML output for the item
      * @param array $entry Gravity Forms entry array
      * @param GravityView_Entry_List $this The current class instance
      */
     $item_output = apply_filters('gravityview/entry-list/item', $item_output, $entry, $this);
     return $item_output;
 }
开发者ID:psdes,项目名称:GravityView,代码行数:44,代码来源:class-gravityview-entry-list.php


示例19: extract

<?php

/**
 * Generate output for the Source URL field
 * @package GravityView
 * @subpackage GravityView/templates/fields
 * @since 1.1.6
 */
$gravityview_view = GravityView_View::getInstance();
extract($gravityview_view->getCurrentField());
// If linking to the source URL
if (!empty($field_settings['link_to_source'])) {
    // If customizing the anchor text
    if (!empty($field_settings['source_link_text'])) {
        $link_text = GravityView_API::replace_variables($field_settings['source_link_text'], $form, $entry);
    } else {
        // Otherwise, it's just the URL
        $link_text = esc_html($value);
    }
    $output = gravityview_get_link($value, $link_text);
} else {
    // Otherwise, it's just the URL
    $output = $value;
}
echo $output;
开发者ID:mgratch,项目名称:GravityView,代码行数:25,代码来源:source_url.php


示例20: array

    $params = array();
    // The default link is a mailto link
    $link = 'mailto:' . $value;
    // Is the subject set?
    if (!empty($field_settings['emailsubject'])) {
        $subject = GravityView_API::replace_variables($field_settings['emailsubject'], $form, $entry);
        $params[] = 'subject=' . str_replace('+', '%20', urlencode($subject));
    }
    // Is the body set?
    if (!empty($field_settings['emailbody'])) {
        $body = GravityView_API::replace_variables($field_settings['emailbody'], $form, $entry);
        $params[] = 'body=' . str_replace('+', '%20', urlencode($body));
    }
    // If the subject and body have been set, use them
    if (!empty($params)) {
        $link .= '?' . implode('&', $params);
    }
    // Generate the link HTML
    $output = gravityview_get_link($link, $value);
}
/**
 * Prevent encrypting emails no matter what - this is handy for DataTables exports, for example
 * @since 1.1.6
 * @var boolean
 */
$prevent_encrypt = apply_filters('gravityview_email_prevent_encrypt', false);
// If encrypting the link
if (!empty($field_settings['emailencrypt']) && !$prevent_encrypt) {
    $output = GVCommon::js_encrypt($output);
}
echo $output;
开发者ID:mgratch,项目名称:GravityView,代码行数:31,代码来源:email.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP gravityview_sanitize_html_class函数代码示例发布时间:2022-05-15
下一篇:
PHP gravityview_get_form_id函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap