5 if ( ! defined(
'GRAVITYVIEW_DIR' ) ) {
27 $is_renderable = in_array( get_class( $this ), array(
28 'GV\Frontend_Request',
39 return apply_filters(
'gravityview/request/is_renderable', $is_renderable, $this );
48 $doing_ajax = defined(
'DOING_AJAX' ) ? DOING_AJAX :
false;
49 $load_scripts_styles = preg_match(
'#^/wp-admin/load-(scripts|styles).php$#', Utils::_SERVER(
'SCRIPT_NAME' ) );
51 return is_admin() && ! ( $doing_ajax || $load_scripts_styles );
72 return ( self::is_ajax() && ! empty( $_POST[
'action'] ) && $_POST[
'action'] ==
'parse-embed' && ! isset( $_POST[
'type'] ) );
81 return defined(
'DOING_AJAX' ) && DOING_AJAX;
90 return ! empty( $GLOBALS[
'wp']->query_vars[
'rest_route'] );
104 public function is_view( $return_view =
true ) {
106 if ( $post &&
'gravityview' === get_post_type( $post ) ) {
130 $id = get_query_var( Entry::get_endpoint_name() );
138 if ( isset(
$entries[
"$form_id:$id" ] ) ) {
142 $view = $this->is_view();
154 if ( $view && ( $joins = $view->joins ) ) {
155 $forms = array_merge( wp_list_pluck( $joins,
'join' ), wp_list_pluck( $joins,
'join_on' ) );
156 $valid_forms = array_unique( wp_list_pluck(
$forms,
'ID' ) );
158 $multientry = array();
159 foreach ( $ids = explode(
',', $id ) as
$i => $id ) {
163 if ( ! $e = GF_Entry::by_id( $id, $valid_form ) ) {
167 if ( ! in_array( $e[
'form_id'], $valid_forms ) ) {
171 array_push( $multientry, $e );
175 $is_edit_entry = apply_filters(
'gravityview_is_edit_entry',
false );
178 if ( $is_edit_entry && 1 !== count( $multientry ) ) {
182 $entry = Multi_Entry::from_entries( array_filter( $multientry ) );
212 if ( (
$entry = $this->is_entry(
$form_id ) ) && apply_filters(
'gravityview_is_edit_entry',
false ) ) {
213 if (
$entry->is_multi() ) {
214 return array_pop(
$entry->entries );
233 $search_method = apply_filters(
'gravityview/search/method',
'get' );
241 unset( $get[
'mode'] );
243 $get = array_filter( $get,
'gravityview_is_not_empty_string' );
245 if( $this->_has_field_key( $get ) ) {
249 return isset( $get[
'gv_search'] ) || isset( $get[
'gv_start'] ) || isset( $get[
'gv_end'] ) || isset( $get[
'gv_by'] ) || isset( $get[
'gv_id'] );
266 $has_field_key =
false;
271 foreach ( $fields as
$field ) {
272 if( empty( $field->_gf_field_class_name ) ) {
273 $meta[] = preg_quote( $field->name );
277 foreach ( $get as $key =>
$value ) {
278 if ( preg_match(
'/^(filter|input)_(([0-9_]+)|'. implode(
'|', $meta ) .
')$/sm', $key ) ) {
279 $has_field_key =
true;
284 return $has_field_key;
289 require
gravityview()->plugin->dir(
'future/includes/class-gv-request-frontend.php' );
290 require
gravityview()->plugin->dir(
'future/includes/class-gv-request-admin.php' );
291 require
gravityview()->plugin->dir(
'future/includes/rest/class-gv-request-rest.php' );
292 require
gravityview()->plugin->dir(
'future/includes/class-gv-request-mock.php' );
If this file is called directly, abort.
static is_rest()
Is this a REST request? Call after parse_request.
is_search()
Checks whether this an entry search request.
static is_add_oembed_preview()
Is this the Add Media / From URL preview request?
static is_admin()
Check if WordPress is_admin(), and make sure not DOING_AJAX.
is_entry( $form_id=0)
Checks whether this is a single entry request.
is_renderable()
Whether this request is something that is renderable.
static is_ajax()
Is this an AJAX call in progress?
if(empty( $created_by)) $form_id
is_view( $return_view=true)
The current $post is a View, no?
_has_field_key( $get)
Calculate whether the $_REQUEST has a GravityView field.
static is_frontend()
This is the frontend.
static get( $array, $key, $default=null)
Grab a value from an array or an object or default.
gravityview()
The main GravityView wrapper function.
static get_all( $groups='')
Get all fields.
is_edit_entry( $form_id=0)
Checks whether this an edit entry request.
static from_post( $post)
Construct a instance from a .