7 if( ! is_admin() ) {
return; }
10 if(
false ===
gravityview()->plugin->is_compatible() ) {
23 require_once(
GRAVITYVIEW_DIR .
'includes/class-gravityview-migrate.php' );
24 require_once(
GRAVITYVIEW_DIR .
'includes/admin/metaboxes/class-gravityview-admin-metaboxes.php' );
26 require_once(
GRAVITYVIEW_DIR .
'includes/class-gravityview-change-entry-creator.php' );
27 require_once(
GRAVITYVIEW_DIR .
'includes/admin/class-gravityview-support-port.php' );
28 require_once(
GRAVITYVIEW_DIR .
'includes/class-gravityview-admin-duplicate-view.php' );
29 require_once(
GRAVITYVIEW_DIR .
'includes/admin/class-gravityview-admin-no-conflict.php' );
40 add_filter(
'post_updated_messages', array( $this,
'post_updated_messages' ) );
41 add_filter(
'bulk_post_updated_messages', array( $this,
'post_updated_messages' ) );
43 add_action(
'plugins_loaded', array( $this,
'backend_actions' ), 100 );
45 add_action(
'gravityview/metaboxes/data-source/before', array(
'GravityView_Admin',
'connected_form_warning' ) );
57 if ( isset( $_REQUEST[
'post_status'] ) &&
'trash' === $_REQUEST[
'post_status'] ) {
58 return esc_html__(
'No Views found in Trash',
'gk-gravityview' );
59 } elseif( ! empty( $_GET[
's'] ) ) {
60 return esc_html__(
'No Views found.',
'gk-gravityview' );
64 $image = self::get_floaty();
67 $output = sprintf( esc_attr__(
"%sYou don't have any active views. Let’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.",
'gk-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>' );
69 $output = esc_attr__(
'There are no active Views',
'gk-gravityview' );
87 if ( empty(
$form_id ) || $pagenow ===
'post-new.php' ) {
91 $form_info = GFFormsModel::get_form(
$form_id,
true );
94 if ( empty( $form_info ) ) {
95 $error = esc_html__(
'The form connected to this View no longer exists.',
'gk-gravityview' );
96 $error .=
' ' . esc_html__(
'Select another form as the data source for this View.',
'gk-gravityview' );
97 } elseif ( $form_info->is_trash ) {
98 $error = esc_html__(
'The connected form is in the trash.',
'gk-gravityview' );
99 $error .=
' ' .
gravityview_get_link( admin_url(
'admin.php?page=gf_edit_forms&filter=trash&s=' . $form_info->title ), esc_html__(
'Restore the form from the trash',
'gk-gravityview' ) );
100 $error .=
' ' . esc_html__(
'or select another form.',
'gk-gravityview' );
105 <div
class=
"wp-dialog notice-warning inline error wp-clearfix">
107 <h3><?php echo $error; ?></h3>
112 remove_action(
'gravityview/metaboxes/data-source/before', array(
'GravityView_Admin',
'connected_form_warning' ) );
123 include_once(
GRAVITYVIEW_DIR .
'includes/admin/class.field.type.php' );
124 include_once(
GRAVITYVIEW_DIR .
'includes/admin/class.render.settings.php' );
125 include_once(
GRAVITYVIEW_DIR .
'includes/admin/class-gravityview-admin-view-item.php' );
126 include_once(
GRAVITYVIEW_DIR .
'includes/admin/class-gravityview-admin-view-field.php' );
127 include_once(
GRAVITYVIEW_DIR .
'includes/admin/class-gravityview-admin-view-widget.php' );
130 include_once(
GRAVITYVIEW_DIR .
'includes/class-admin-add-shortcode.php' );
131 include_once(
GRAVITYVIEW_DIR .
'includes/class-admin-approve-entries.php' );
132 include_once(
GRAVITYVIEW_DIR .
'includes/class-gravityview-bulk-actions.php' );
139 do_action(
'gravityview_include_backend_actions');
156 function post_updated_messages( $messages, $bulk_counts = NULL ) {
159 $post_id = get_the_ID();
164 $bulk_counts = is_null( $bulk_counts ) ? array(
'updated' => 1 ,
'locked' => 1 ,
'deleted' => 1 ,
'trashed' => 1,
'untrashed' => 1 ) : $bulk_counts;
168 $start_fresh = get_post_meta( $post_id,
'_gravityview_start_fresh',
true );
172 if( !empty( $start_fresh ) ) {
177 if( !empty( $connected_form ) ) {
179 $form_name = esc_attr(
$form[
'title'] );
180 $image = self::get_floaty();
181 $new_form_text .=
'<h3>'.$image.sprintf( __(
'A new form was created for this View: "%s"',
'gk-gravityview' ), $form_name ).
'</h3>';
182 $new_form_text .= sprintf( __(
'%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s 184 You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. 185 ',
'gk-gravityview' ),
'<strong>',
'</strong>',
'<a href="'.site_url(
'?gf_page=preview&id='.$connected_form ).
'">',
'</a>',
'<code>[gravityform id="'.$connected_form.
'" name="'.$form_name.
'"]</code>',
'<a href="'.admin_url(
'admin.php?page=gf_edit_forms&id='.$connected_form ).
'">',
'</a>',
'<a href="'.admin_url(
'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).
'">',
'</a>');
186 $new_form_text = wpautop( $new_form_text );
188 delete_post_meta( $post_id,
'_gravityview_start_fresh' );
192 $messages[
'gravityview'] = array(
195 1 => sprintf(__(
'View updated. %sView on website.%s',
'gk-gravityview' ),
'<a href="'.get_permalink( $post_id ).
'">',
'</a>'),
197 2 => sprintf(__(
'View updated. %sView on website.%s',
'gk-gravityview' ),
'<a href="'.get_permalink( $post_id ).
'">',
'</a>'),
198 3 => __(
'View deleted.',
'gk-gravityview' ),
200 4 => sprintf(__(
'View updated. %sView on website.%s',
'gk-gravityview' ),
'<a href="'.get_permalink( $post_id ).
'">',
'</a>'),
202 5 => isset( $_GET[
'revision'] ) ? sprintf( __(
'View restored to revision from %s',
'gk-gravityview' ), wp_post_revision_title( (
int) $_GET[
'revision'],
false ) ) :
false,
204 6 => sprintf(__(
'View published. %sView on website.%s',
'gk-gravityview' ),
'<a href="'.get_permalink( $post_id ).
'">',
'</a>') . $new_form_text,
206 7 => sprintf(__(
'View saved. %sView on website.%s',
'gk-gravityview' ),
'<a href="'.get_permalink( $post_id ).
'">',
'</a>') . $new_form_text,
207 8 => __(
'View submitted.',
'gk-gravityview' ),
210 __(
'View scheduled for: %1$s.',
'gk-gravityview' ),
212 date_i18n( __(
'M j, Y @ G:i',
'gk-gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) )
215 10 => sprintf(__(
'View draft updated. %sView on website.%s',
'gk-gravityview' ),
'<a href="'.get_permalink( $post_id ).
'">',
'</a>') . $new_form_text,
221 'updated' => _n(
'%s View updated.',
'%s Views updated.', $bulk_counts[
'updated'],
'gk-gravityview' ),
222 'locked' => _n(
'%s View not updated, somebody is editing it.',
'%s Views not updated, somebody is editing them.', $bulk_counts[
'locked'],
'gk-gravityview' ),
223 'deleted' => _n(
'%s View permanently deleted.',
'%s Views permanently deleted.', $bulk_counts[
'deleted'],
'gk-gravityview' ),
224 'trashed' => _n(
'%s View moved to the Trash.',
'%s Views moved to the Trash.', $bulk_counts[
'trashed'],
'gk-gravityview' ),
225 'untrashed' => _n(
'%s View restored from the Trash.',
'%s Views restored from the Trash.', $bulk_counts[
'untrashed'],
'gk-gravityview' ),
283 gravityview()->log->warning(
'The \GravityView_Admin::is_admin_page() method is deprecated. Use gravityview()->request->is_admin' );
284 return gravityview()->request->is_admin( $hook, $page );
301 gravityview()->log->warning(
'The gravityview_is_admin_page() function is deprecated. Use gravityview()->request->is_admin' );
302 return gravityview()->request->is_admin( $hook, $page );
const GRAVITYVIEW_DIR
"GRAVITYVIEW_DIR" "./" The absolute path to the plugin directory, with trailing slash ...
gravityview_get_floaty( $height=87, $css_class=null)
Get an image of our intrepid explorer friend.
static get_notices()
Get admin notices.
gravityview_get_form( $form_id)
Returns the form object for a given Form ID.
gravityview_is_admin_page( $hook='', $page=NULL)
Former alias for GravityView_Admin::is_admin_page()
gravityview_get_link( $href='', $anchor_text='', $atts=array())
Generate an HTML anchor tag with a list of supported attributes.
static check_gravityforms()
Check if Gravity Forms plugin is active and show notice if not.
backend_actions()
Function to launch admin objects.
if(gravityview() ->plugin->is_GF_25()) $form
static get_plugin_status( $location='')
Check if specified plugin is active, inactive or not installed.
static no_views_text()
Get text for no views found.
static is_admin_page( $hook='', $page=NULL)
Is the current admin page a GravityView-related page?
gravityview_get_form_id( $view_id)
Get the connected form ID from a View ID.
static get_plugin_status( $location='')
Check if specified plugin is active, inactive or not installed.
static check_gravityforms()
Check if Gravity Forms plugin is active and show notice if not.
static connected_form_warning( $form_id=0)
Display error HTML in Edit View when the form is in the trash or no longer exists in Gravity Forms...
static add_notice( $notice=array())
Add a notice to be displayed in the admin.
if(empty( $created_by)) $form_id
static add_notice( $notice=array())
Add a notice to be displayed in the admin.
static get_floaty()
Get an image of our intrepid explorer friend.
gravityview()
The main GravityView wrapper function.
static has_cap( $caps='', $object_id=null, $user_id=null)
Alias of GravityView_Roles_Capabilities::has_cap()
static get_notices()
Get admin notices.