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

PHP GVCommon类代码示例

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

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



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

示例1: get_content

 /**
  * Filter the value of the field
  *
  * @todo Consider how to add to parent class
  *
  * @since 1.16
  *
  * @param string $output HTML value output
  * @param array  $entry The GF entry array
  * @param array  $field_settings Settings for the particular GV field
  * @param array  $field Current field being displayed
  *
  * @return String values for this field based on the numeric values used by Gravity Forms
  */
 public function get_content($output = '', $entry = array(), $field_settings = array(), $field = array())
 {
     /** Overridden by a template. */
     if (!empty($field['field_path'])) {
         return $output;
     }
     return GVCommon::format_date($field['value'], 'format=' . rgar($field_settings, 'date_display'));
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:22,代码来源:class-gravityview-field-date-created.php


示例2: add_edit_view_link

 /**
  * Add Edit View link when in embedded View
  *
  * @since 1.13
  * @return void
  */
 function add_edit_view_link()
 {
     /** @var WP_Admin_Bar $wp_admin_bar */
     global $wp_admin_bar;
     if (GVCommon::has_cap('edit_gravityviews')) {
         $view_data = GravityView_View_Data::getInstance();
         $views = $view_data->get_views();
         // If there is a View embed, shor Edit View link.
         // todo: Support multiple View embeds with a drop-down menu
         if (!$this->gravityview_view->isGravityviewPostType() && !empty($views) && !$view_data->has_multiple_views()) {
             $view = reset($views);
             if (GVCommon::has_cap('edit_gravityview', $view['id'])) {
                 $wp_admin_bar->add_menu(array('id' => 'edit-view', 'title' => __('Edit View', 'gravityview'), 'href' => esc_url_raw(admin_url(sprintf('post.php?post=%d&action=edit', $view['id'])))));
             }
         }
     }
 }
开发者ID:kidaak,项目名称:GravityView,代码行数:23,代码来源:class-gravityview-admin-bar.php


示例3: add_shortcode_button

    /**
     * Add shortcode button to the Add Media right
     *
     * @access public
     * @return void
     */
    function add_shortcode_button()
    {
        /**
         * @since 1.15.3
         */
        if (!GVCommon::has_cap(array('publish_gravityviews'))) {
            return;
        }
        if (!$this->is_post_editor_screen()) {
            return;
        }
        ?>
		<a href="#TB_inline?width=600&amp;height=800&amp;inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php 
        esc_attr_e("Insert View", 'gravityview');
        ?>
"><span class="icon gv-icon-astronaut-head"></span><?php 
        esc_html_e('Add View', 'gravityview');
        ?>
</a>
		<?php 
    }
开发者ID:mgratch,项目名称:GravityView,代码行数:27,代码来源:class-admin-add-shortcode.php


示例4: test_fire_everything

 /**
  * @since 1.15
  * @covers GravityView_Uninstall::fire_everything()
  */
 function test_fire_everything()
 {
     $create_count = 10;
     $form = $this->factory->form->create_and_get();
     $all_forms = GFAPI::get_forms();
     $views = $this->factory->view->create_many($create_count, array('form_id' => $form['id']));
     $entry_ids = $this->factory->entry->create_many($create_count, array('form_id' => $form['id']));
     $connected = gravityview_get_connected_views($form['id']);
     $entry_count = GFAPI::count_entries($form['id']);
     // Make sure the objects were created and connected
     $this->assertEquals($create_count, count(array_filter($views)));
     $this->assertEquals($create_count, count(array_filter($connected)));
     $this->assertEquals($create_count, count(array_filter($entry_ids)));
     $this->_set_up_expected_options();
     ### DO NOT DELETE WHEN THE USER DOESN'T HAVE THE CAPABILITY
     $user = $this->factory->user->create_and_set(array('user_login' => 'administrator', 'user_pass' => 'administrator', 'role' => 'administrator'));
     $this->assertTrue(GVCommon::has_cap('gravityview_uninstall'));
     ### DO NOT DELETE WHEN IT IS NOT SET OR SET TO FALSE
     // TRY deleting when the settings aren't configured.
     $this->_set_up_gravityview_settings(NULL);
     $this->uninstall();
     $this->_check_deleted_options(false);
     // TRY deleting when the Delete setting is set to No
     $this->_set_up_gravityview_settings('0');
     $this->uninstall();
     $this->_check_deleted_options(false);
     ### REALLY DELETE NOW
     // Create the items
     $this->_set_up_gravityview_settings('delete');
     $this->_set_up_notes($entry_ids);
     $this->_set_up_entry_meta($entry_ids, $form);
     $this->uninstall();
     // No Forms should be deleted
     $this->assertEquals($all_forms, GFAPI::get_forms());
     $this->_check_posts();
     $this->_check_entries($form, $entry_count);
     $this->_check_deleted_options();
     $this->_check_deleted_entry_notes($entry_ids);
     $this->_check_deleted_entry_meta($entry_ids);
 }
开发者ID:hansstam,项目名称:makerfaire,代码行数:44,代码来源:GravityView_Uninstall_Test.php


示例5: gravityview_get_link

/**
 * Generate an HTML anchor tag with a list of supported attributes
 *
 * @see GVCommon::get_link_html()
 *
 * @since 1.6
 *
 * @param string $href URL of the link.
 * @param string $anchor_text The text or HTML inside the anchor. This is not sanitized in the function.
 * @param array $atts Attributes to be added to the anchor tag
 *
 * @return string HTML output of anchor link. If empty $href, returns NULL
 */
function gravityview_get_link($href = '', $anchor_text = '', $atts = array())
{
    return GVCommon::get_link_html($href, $anchor_text, $atts);
}
开发者ID:roarmoser,项目名称:gv1,代码行数:17,代码来源:class-common.php


示例6: array

$criteria['paging'] = array('offset' => 0, 'page_size' => $view_settings['page_size']);
// Prepare Search Criteria
$criteria['search_criteria'] = array('field_filters' => array(array('key' => 'created_by', 'value' => $created_by, 'operator' => 'is')));
$criteria['search_criteria'] = GravityView_frontend::process_search_only_approved($view_settings, $criteria['search_criteria']);
$criteria['search_criteria']['status'] = apply_filters('gravityview_status', 'active', $view_settings);
/**
 * Modify the search parameters before the entries are fetched
 *
 * @since 1.11
 *
 * @param array $criteria Gravity Forms search criteria array, as used by GVCommon::get_entries()
 * @param array $view_settings Associative array of settings with plugin defaults used if not set by the View
 * @param int $form_id The Gravity Forms ID
 */
$criteria = apply_filters('gravityview/field/other_entries/criteria', $criteria, $view_settings, $form_id);
$entries = GVCommon::get_entries($form_id, $criteria);
// Don't show if no entries and the setting says so
if (empty($entries) && $gravityview_view->getCurrentFieldSetting('no_entries_hide')) {
    return;
}
// If there are search results, get the entry list object
$list = new GravityView_Entry_List($entries, $gravityview_view->getPostId(), $field['form'], $gravityview_view->getCurrentFieldSetting('link_format'), $gravityview_view->getCurrentFieldSetting('after_link'), 'other_entries');
// Generate and echo the output
$list->output();
/**
 * @since 1.7.6
 * @deprecated since 1.11
 */
$deprecated = apply_filters('gravityview/field/other_entries/args', array(), $field);
if (!empty($deprecated)) {
    _deprecated_function('The "gravityview/field/other_entries/args" filter', 'GravityView 1.11', 'gravityview/field/other_entries/criteria');
开发者ID:hansstam,项目名称:makerfaire,代码行数:31,代码来源:other_entries.php


示例7: show_approve_entry_column

 /**
  * Should the Approve/Reject Entry column be shown in the GF Entries page?
  *
  * @since 1.7.2
  *
  * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
  *
  * @return bool True: Show column; False: hide column
  */
 private function show_approve_entry_column($form_id)
 {
     $show_approve_column = GVCommon::has_cap('gravityview_moderate_entries');
     /**
      * @filter `gravityview/approve_entries/hide-if-no-connections` Return true to hide reject/approve if there are no connected Views
      * @since 1.7.2
      * @param boolean $hide_if_no_connections
      */
     $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false);
     if ($hide_if_no_connections) {
         $connected_views = gravityview_get_connected_views($form_id);
         if (empty($connected_views)) {
             $show_approve_column = false;
         }
     }
     /**
      * @filter `gravityview/approve_entries/show-column` Override whether the column is shown
      * @param boolean $show_approve_column Whether the column will be shown
      * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
      */
     $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id);
     return $show_approve_column;
 }
开发者ID:qqz,项目名称:GravityView,代码行数:32,代码来源:class-admin-approve-entries.php


示例8: check_user_cap_edit_field

 /**
  * checks if user has permissions to edit a specific field
  *
  * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_field for maximum security!!
  *
  * @param  [type] $field [description]
  * @return bool
  */
 private function check_user_cap_edit_field($field)
 {
     // If they can edit any entries (as defined in Gravity Forms), we're good.
     if (GVCommon::has_cap(array('gravityforms_edit_entries', 'gravityview_edit_others_entries'))) {
         return true;
     }
     $field_cap = isset($field['allow_edit_cap']) ? $field['allow_edit_cap'] : false;
     // If the field has custom editing capaibilities set, check those
     if ($field_cap) {
         return GVCommon::has_cap($field['allow_edit_cap']);
     }
     return false;
 }
开发者ID:hansstam,项目名称:makerfaire,代码行数:21,代码来源:class-edit-entry-render.php


示例9: get_entries

 /**
  * Get the entries that will be shown in the current widget
  *
  * @param  array $instance Settings for the current widget
  *
  * @return array $entries Multidimensional array of Gravity Forms entries
  */
 private function get_entries($instance, $form_id)
 {
     // Get the settings for the View ID
     $view_settings = gravityview_get_template_settings($instance['view_id']);
     // Set the context view ID to avoid conflicts with the Advanced Filter extension.
     $criteria['context_view_id'] = $instance['view_id'];
     $instance['limit'] = isset($instance['limit']) ? $instance['limit'] : 10;
     $view_settings['id'] = $instance['view_id'];
     $view_settings['page_size'] = $instance['limit'];
     // Prepare paging criteria
     $criteria['paging'] = array('offset' => 0, 'page_size' => $instance['limit']);
     // Prepare Search Criteria
     $criteria['search_criteria'] = array('field_filters' => array());
     $criteria['search_criteria'] = GravityView_frontend::process_search_only_approved($view_settings, $criteria['search_criteria']);
     $criteria['search_criteria']['status'] = apply_filters('gravityview_status', 'active', $view_settings);
     /**
      * Modify the search parameters before the entries are fetched
      */
     $criteria = apply_filters('gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id);
     $results = GVCommon::get_entries($form_id, $criteria);
     return $results;
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:29,代码来源:class-gravityview-recent-entries-widget.php


示例10: show_for_user

 /**
  * Check whether to show Support for a user
  *
  * If the user doesn't have the `gravityview_support_port` capability, returns false.
  * If there is no preference set for the user, use the global plugin setting.
  *
  * @since 1.15
  *
  * @param int $user Optional. ID of the user to check, defaults to 0 for current user.
  *
  * @return bool Whether to show GravityView support
  */
 public static function show_for_user($user = 0)
 {
     if (!GVCommon::has_cap('gravityview_support_port')) {
         return false;
     }
     $pref = get_user_option(self::user_pref_name, $user);
     // Not set; default to plugin setting
     if (false === $pref) {
         return GravityView_Settings::getSetting('support_port');
     }
     return !empty($pref);
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:24,代码来源:class-gravityview-support-port.php


示例11: check_user_cap_delete_entry

 /**
  * checks if user has permissions to view the link or delete a specific entry
  *
  * @since 1.5.1
  * @since 1.15 Added `$view_id` param
  *
  * @param  array $entry Gravity Forms entry array
  * @param array $field Field settings (optional)
  * @param int $view_id Pass a View ID to check caps against. If not set, check against current View (optional)
  * @return bool
  */
 public static function check_user_cap_delete_entry($entry, $field = array(), $view_id = 0)
 {
     $gravityview_view = GravityView_View::getInstance();
     $current_user = wp_get_current_user();
     $entry_id = isset($entry['id']) ? $entry['id'] : NULL;
     // Or if they can delete any entries (as defined in Gravity Forms), we're good.
     if (GVCommon::has_cap(array('gravityforms_delete_entries', 'gravityview_delete_others_entries'), $entry_id)) {
         do_action('gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Current user has `gravityforms_delete_entries` or `gravityview_delete_others_entries` capability.');
         return true;
     }
     // If field options are passed, check if current user can view the link
     if (!empty($field)) {
         // If capability is not defined, something is not right!
         if (empty($field['allow_edit_cap'])) {
             do_action('gravityview_log_error', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Cannot read delete entry field caps', $field);
             return false;
         }
         if (GVCommon::has_cap($field['allow_edit_cap'])) {
             // Do not return true if cap is read, as we need to check if the current user created the entry
             if ($field['allow_edit_cap'] !== 'read') {
                 return true;
             }
         } else {
             do_action('gravityview_log_debug', sprintf('GravityView_Delete_Entry[check_user_cap_delete_entry] User %s is not authorized to view delete entry link ', $current_user->ID));
             return false;
         }
     }
     if (!isset($entry['created_by'])) {
         do_action('gravityview_log_error', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Entry `created_by` doesn\'t exist.');
         return false;
     }
     $view_id = empty($view_id) ? $gravityview_view->getViewId() : $view_id;
     // Only checks user_delete view option if view is already set
     if ($view_id) {
         $current_view = gravityview_get_current_view_data($view_id);
         $user_delete = isset($current_view['atts']['user_delete']) ? $current_view['atts']['user_delete'] : false;
         if (empty($user_delete)) {
             do_action('gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] User Delete is disabled. Returning false.');
             return false;
         }
     }
     // If the logged-in user is the same as the user who created the entry, we're good.
     if (is_user_logged_in() && intval($current_user->ID) === intval($entry['created_by'])) {
         do_action('gravityview_log_debug', sprintf('GravityView_Delete_Entry[check_user_cap_delete_entry] User %s created the entry.', $current_user->ID));
         return true;
     }
     return false;
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:59,代码来源:class-delete-entry.php


示例12: gravityview_get_field_type

/**
 * Returns the GF Form field type for a certain field(id) of a form
 * @param  object $form     Gravity Forms form
 * @param  mixed $field_id Field ID or Field array
 * @return string field type
 */
function gravityview_get_field_type($form = null, $field_id = '')
{
    return GVCommon::get_field_type($form, $field_id);
}
开发者ID:mgratch,项目名称:GravityView,代码行数:10,代码来源:connector-functions.php


示例13: app_settings_fields

 /**
  * Specify the settings fields to be rendered on the plugin settings page
  * @return array
  */
 public function app_settings_fields()
 {
     $default_settings = $this->get_default_settings();
     $disabled_attribute = GVCommon::has_cap('gravityview_edit_settings') ? false : 'disabled';
     $fields = apply_filters('gravityview_settings_fields', array(array('name' => 'license_key', 'required' => true, 'label' => __('License Key', 'gravityview'), 'description' => __('Enter the license key that was sent to you on purchase. This enables plugin updates &amp; support.', 'gravityview') . $this->get_license_handler()->license_details($this->get_app_setting('license_key_response')), 'type' => 'edd_license', 'data-pending-text' => __('Verifying license&hellip;', 'gravityview'), 'default_value' => $default_settings['license_key'], 'class' => '' == $this->get_app_setting('license_key') ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key'), array('name' => 'license_key_response', 'default_value' => $default_settings['license_key_response'], 'type' => 'hidden'), array('name' => 'license_key_status', 'default_value' => $default_settings['license_key_status'], 'type' => 'hidden'), array('name' => 'support-email', 'type' => 'text', 'validate' => 'email', 'default_value' => $default_settings['support-email'], 'label' => __('Support Email', 'gravityview'), 'description' => __('In order to provide responses to your support requests, please provide your email address.', 'gravityview'), 'class' => 'code regular-text'), array('name' => 'support_port', 'type' => 'radio', 'label' => __('Show Support Port?', 'gravityview'), 'default_value' => $default_settings['support_port'], 'horizontal' => 1, 'choices' => array(array('label' => _x('Show', 'Setting: Show or Hide', 'gravityview'), 'value' => '1'), array('label' => _x('Hide', 'Setting: Show or Hide', 'gravityview'), 'value' => '0')), 'tooltip' => '<p><img src="' . esc_url_raw(plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE)) . '" alt="' . esc_attr__('The Support Port looks like this.', 'gravityview') . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview') . '</p>', 'description' => __('Show the Support Port on GravityView pages?', 'gravityview')), array('name' => 'no-conflict-mode', 'type' => 'radio', 'label' => __('No-Conflict Mode', 'gravityview'), 'default_value' => $default_settings['no-conflict-mode'], 'horizontal' => 1, 'choices' => array(array('label' => _x('On', 'Setting: On or off', 'gravityview'), 'value' => '1'), array('label' => _x('Off', 'Setting: On or off', 'gravityview'), 'value' => '0')), 'description' => __('Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview') . ' ' . __('If your Edit View tabs are ugly, enable this setting.', 'gravityview')), array('name' => 'delete-on-uninstall', 'type' => 'radio', 'label' => __('Remove Data on Delete?', 'gravityview'), 'default_value' => $default_settings['delete-on-uninstall'], 'horizontal' => 1, 'choices' => array(array('label' => _x('Keep GravityView Data', 'Setting: what to do when uninstalling plugin', 'gravityview'), 'value' => '0', 'tooltip' => sprintf('<h6>%s</h6><p>%s</p>', __('Keep GravityView content and settings', 'gravityview'), __('If you delete then re-install the plugin, all GravityView data will be kept. Views, settings, etc. will be untouched.', 'gravityview'))), array('label' => _x('Permanently Delete', 'Setting: what to do when uninstalling plugin', 'gravityview'), 'value' => 'delete', 'tooltip' => sprintf('<h6>%s</h6><p><span class="howto">%s</span></p><p>%s</p>', __('Delete all GravityView content and settings', 'gravityview'), __('If you delete then re-install GravityView, it will be like installing GravityView for the first time.', 'gravityview'), __('When GravityView is uninstalled and deleted, delete all Views, GravityView entry approvals, GravityView-generated entry notes (including approval and entry creator changes), and GravityView plugin settings. No Gravity Forms data will be touched.', 'gravityview')))), 'description' => sprintf(__('Should GravityView content and entry approval status be removed from the site when the GravityView plugin is deleted?', 'gravityview'), __('Permanently Delete', 'gravityview')))));
     /**
      * Redux backward compatibility
      * @since 1.7.4
      */
     foreach ($fields as &$field) {
         $field['name'] = isset($field['name']) ? $field['name'] : rgget('id', $field);
         $field['label'] = isset($field['label']) ? $field['label'] : rgget('title', $field);
         $field['default_value'] = isset($field['default_value']) ? $field['default_value'] : rgget('default', $field);
         $field['description'] = isset($field['description']) ? $field['description'] : rgget('subtitle', $field);
         if ($disabled_attribute) {
             $field['disabled'] = $disabled_attribute;
         }
     }
     $sections = array(array('description' => sprintf('<span class="version-info description">%s</span>', sprintf(__('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version)), 'fields' => $fields));
     // custom 'update settings' button
     $button = array('class' => 'button button-primary button-hero', 'type' => 'save');
     if ($disabled_attribute) {
         $button['disabled'] = $disabled_attribute;
     }
     /**
      * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page
      * Extensions can tap in here to insert their own section and settings.
      * <code>
      *   $sections[] = array(
      *      'title' => __( 'GravityView My Extension Settings', 'gravityview' ),
      *      'fields' => $settings,
      *   );
      * </code>
      * @param array $extension_settings Empty array, ready for extension settings!
      */
     $extension_sections = apply_filters('gravityview/settings/extension/sections', array());
     // If there are extensions, add a section for them
     if (!empty($extension_sections)) {
         if ($disabled_attribute) {
             foreach ($extension_sections as &$section) {
                 foreach ($section['fields'] as &$field) {
                     $field['disabled'] = $disabled_attribute;
                 }
             }
         }
         $k = count($extension_sections) - 1;
         $extension_sections[$k]['fields'][] = $button;
         $sections = array_merge($sections, $extension_sections);
     } else {
         // add the 'update settings' button to the general section
         $sections[0]['fields'][] = $button;
     }
     return $sections;
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:58,代码来源:class-gravityview-settings.php


示例14: current_user_can_copy

 /**
  * Test if the user is allowed to copy Views
  *
  * @since 1.6
  */
 private function current_user_can_copy($post)
 {
     $id = is_object($post) ? $post->ID : $post;
     // Can't edit this current View
     return GVCommon::has_cap('copy_gravityviews', $id);
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:11,代码来源:class-gravityview-admin-duplicate-view.php


示例15: license_call

 /**
  * Perform the call to EDD based on the AJAX call or passed data
  *
  * @since 1.7.4
  *
  * @param array $array {
  * @type string $license The license key
  * @type string $edd_action The EDD action to perform, like `check_license`
  * @type string $field_id The ID of the field to check
  * @type boolean $update Whether to update plugin settings. Prevent updating the data by setting an `update` key to false
  * @type string $format If `object`, return the object of the license data. Else, return the JSON-encoded object
  * }
  *
  * @return mixed|string|void
  */
 public function license_call($array = array())
 {
     $is_ajax = defined('DOING_AJAX') && DOING_AJAX;
     $data = empty($array) ? $_POST['data'] : $array;
     $has_cap = GVCommon::has_cap('gravityview_edit_settings');
     if ($is_ajax && empty($data['license'])) {
         die(-1);
     }
     // If the user isn't allowed to edit settings, show an error message
     if (!$has_cap) {
         $license_data = new stdClass();
         $license_data->error = 'capability';
         $license_data->message = $this->get_license_message($license_data);
         $json = json_encode($license_data);
     } else {
         $license = esc_attr(rgget('license', $data));
         $license_data = $this->_license_get_remote_response($data, $license);
         // Empty is returned when there's an error.
         if (empty($license_data)) {
             if ($is_ajax) {
                 exit(json_encode(array()));
             } else {
                 // Non-ajax call
                 return json_encode(array());
             }
         }
         $license_data->message = $this->get_license_message($license_data);
         $json = json_encode($license_data);
         $update_license = !isset($data['update']) || !empty($data['update']);
         $is_check_action_button = 'check_license' === $data['edd_action'] && defined('DOING_AJAX') && DOING_AJAX;
         // Failed is the response from trying to de-activate a license and it didn't work.
         // This likely happened because people entered in a different key and clicked "Deactivate",
         // meaning to deactivate the original key. We don't want to save this response, since it is
         // most likely a mistake.
         if ($license_data->license !== 'failed' && !$is_check_action_button && $update_license) {
             if (!empty($data['field_id'])) {
                 set_transient('gravityview_' . esc_attr($data['field_id']) . '_valid', $license_data, DAY_IN_SECONDS);
             }
             $this->license_call_update_settings($license_data, $data);
         }
     }
     // End $has_cap
     if ($is_ajax) {
         exit($json);
     } else {
         // Non-ajax call
         return rgget('format', $data) === 'object' ? $license_data : $json;
     }
 }
开发者ID:kidaak,项目名称:GravityView,代码行数:64,代码来源:class-gv-license-handler.php


示例16: no_views_text

 /**
  * Get text for no views found.
  * @todo Move somewhere appropriate.
  * @return string HTML message with no container tags.
  */
 static function no_views_text()
 {
     if (!class_exists('GravityView_Admin')) {
         require_once GRAVITYVIEW_DIR . 'includes/class-admin.php';
     }
     // Floaty the astronaut
     $image = GravityView_Admin::get_floaty();
     if (GVCommon::has_cap('edit_gravityviews')) {
         $output = sprintf(esc_attr__("%sYou don't have any active views. Let&rsquo;s go %screate one%s!%s\n\nIf you feel like you're lost in space and need help getting started, check out the %sGetting Started%s page.", 'gravityview'), '<h3>', '<a href="' . admin_url('post-new.php?post_type=gravityview') . '">', '</a>', '</h3>', '<a href="' . admin_url('edit.php?post_type=gravityview&page=gv-getting-started') . '">', '</a>');
     } else {
         $output = esc_attr__('There are no active Views', 'gravityview');
     }
     return $image . wpautop($output);
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:19,代码来源:class-post-types.php


示例17: extract

<?php

/**
 * Display the date_created field type
 *
 * @package GravityView
 * @subpackage GravityView/templates/fields
 */
$gravityview_view = GravityView_View::getInstance();
extract($gravityview_view->getCurrentField());
echo GVCommon::format_date($value, 'format=' . rgar($field_settings, 'date_display'));
开发者ID:mgratch,项目名称:GravityView,代码行数:11,代码来源:date_created.php


示例18: plugin_action_links

 /**
  * Modify plugin action links at plugins screen
  *
  * @since 1.15 Added check for `gravityview_view_settings` and `gravityview_support_port` capabilities
  * @access public
  * @static
  * @param array $links Array of action links under GravityView on the plugin page
  * @return array Action links with Settings and Support included, if the user has the appropriate caps
  */
 public static function plugin_action_links($links)
 {
     $actions = array();
     if (GVCommon::has_cap('gravityview_view_settings')) {
         $actions[] = sprintf('<a href="%s">%s</a>', admin_url('edit.php?post_type=gravityview&page=gravityview_settings'), esc_html__('Settings', 'gravityview'));
     }
     if (GVCommon::has_cap('gravityview_support_port')) {
         $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__('Support', 'gravityview') . '</a>';
     }
     return array_merge($actions, $links);
 }
开发者ID:qqz,项目名称:GravityView,代码行数:20,代码来源:class-admin.php


示例19: save_postdata

 /**
  * Save View configuration
  *
  * @access public
  * @param mixed $post_id
  * @return void
  */
 function save_postdata($post_id)
 {
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return;
     }
     // validate post_type
     if (!isset($_POST['post_type']) || 'gravityview' != $_POST['post_type']) {
         return;
     }
     // validate user can edit and save post/page
     if ('page' == $_POST['post_type']) {
         if (!current_user_can('edit_page', $post_id)) {
             return;
         }
     } else {
         if (!current_user_can('edit_post', $post_id)) {
             return;
         }
     }
     do_action('gravityview_log_debug', '[save_postdata] Saving View post type.', $_POST);
     $statii = array();
     // check if this is a start fresh View
     if (isset($_POST['gravityview_select_form_nonce']) && wp_verify_nonce($_POST['gravityview_select_form_nonce'], 'gravityview_select_form')) {
         $form_id = !empty($_POST['gravityview_form_id']) ? $_POST['gravityview_form_id'] : '';
         // save form id
         $statii['form_id'] = update_post_meta($post_id, '_gravityview_form_id', $form_id);
     }
     // Was this a start fresh?
     if (!empty($_POST['gravityview_form_id_start_fresh'])) {
         $statii['start_fresh'] = add_post_meta($post_id, '_gravityview_start_fresh', 1);
     } else {
         $statii['start_fresh'] = delete_post_meta($post_id, '_gravityview_start_fresh');
     }
     // Check if we have a template id
     if (isset($_POST['gravityview_select_template_nonce']) && wp_verify_nonce($_POST['gravityview_select_template_nonce'], 'gravityview_select_template')) {
         $template_id = !empty($_POST['gravityview_directory_template']) ? $_POST['gravityview_directory_template'] : '';
         // now save template id
         $statii['directory_template'] = update_post_meta($post_id, '_gravityview_directory_template', $template_id);
     }
     // save View Configuration metabox
     if (isset($_POST['gravityview_view_configuration_nonce']) && wp_verify_nonce($_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration')) {
         // template settings
         if (empty($_POST['template_settings'])) {
             $_POST['template_settings'] = array();
         }
         $statii['template_settings'] = update_post_meta($post_id, '_gravityview_template_settings', $_POST['template_settings']);
         $fields = array();
         // Directory&single Visible Fields
         if (!empty($preset_fields)) {
             $fields = $preset_fields;
         } elseif (!empty($_POST['fields'])) {
             if (!is_array($_POST['fields'])) {
                 // Fields are passed as a jQuery-serialized array, created in admin-views.js in the serializeForm method
                 // Not using parse_str due to max_input_vars limitation
                 $fields_holder = array();
                 GVCommon::gv_parse_str($_POST['fields'], $fields_holder);
                 if (isset($fields_holder['fields'])) {
                     // When parsed, there's a m
                     $fields = $fields_holder['fields'];
                 } else {
                     do_action('gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder);
                 }
             } else {
                 $fields = $_POST['fields'];
             }
         }
         $statii['directory_fields'] = update_post_meta($post_id, '_gravityview_directory_fields', $fields);
         // Directory Visible Widgets
         if (empty($_POST['widgets'])) {
             $_POST['widgets'] = array();
         }
         $statii['directory_widgets'] = update_post_meta($post_id, '_gravityview_directory_widgets', $_POST['widgets']);
     }
     // end save view configuration
     do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map('intval', $statii));
 }
开发者ID:psdes,项目名称:GravityView,代码行数:83,代码来源:class-admin-views.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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP GWF_Box类代码示例发布时间:2022-05-23
下一篇:
PHP GV类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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