24 private static $search_parameters = array(
'gv_search',
'gv_start',
'gv_end',
'gv_id',
'gv_by',
'filter_*' );
96 add_action(
'wp', array( $this,
'parse_content' ), 11 );
97 add_filter(
'render_block', array( $this,
'detect_views_in_block_content' ) );
98 add_filter(
'parse_query', array( $this,
'parse_query_fix_frontpage' ), 10 );
99 add_action(
'template_redirect', array( $this,
'set_entry_data' ), 1 );
102 add_action(
'wp_enqueue_scripts', array( $this,
'add_scripts_and_styles' ), 20 );
105 add_action(
'wp_print_footer_scripts', array( $this,
'add_scripts_and_styles' ), 1 );
107 add_filter(
'the_title', array( $this,
'single_entry_title' ), 1, 2 );
108 add_filter(
'comments_open', array( $this,
'comments_open' ), 10, 2 );
110 add_action(
'gravityview_after', array( $this,
'context_not_configured_warning' ) );
111 add_filter(
'gravityview/template/text/no_entries', array( $this,
'filter_no_entries_output' ), 10, 3 );
121 if ( empty( self::$instance ) ) {
122 self::$instance =
new self();
123 self::$instance->initialize();
126 return self::$instance;
189 if ( ! is_array( $entry ) ) {
248 $this->context_view_id = (int)
$view_id;
250 } elseif ( isset( $_GET[
'gvid'] ) && $multiple_views ) {
256 $this->context_view_id = (int) $_GET[
'gvid'];
258 } elseif ( ! $multiple_views ) {
260 $this->context_view_id = (int) array_pop( $array_keys );
261 unset( $array_keys );
292 $is_front_page = ( $query->is_home || $query->is_page );
293 $show_on_front = (
'page' === get_option(
'show_on_front' ) );
294 $front_page_id = get_option(
'page_on_front' );
296 if ( $is_front_page && $show_on_front && $front_page_id ) {
299 $_query = wp_parse_args( $query->query );
302 if ( isset( $_query[
'pagename'] ) &&
'' === $_query[
'pagename'] ) {
303 unset( $_query[
'pagename'] );
308 $ignore = apply_filters(
'gravityview/internal/ignored_endpoints', array(
'preview',
'page',
'paged',
'cpage' ), $query );
310 foreach ( (array) $endpoints as $endpoint ) {
311 $ignore[] = $endpoint[1];
319 if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) {
321 $qv =& $query->query_vars;
324 if ( self::is_single_entry() ) {
325 add_filter(
'redirect_canonical',
'__return_false' );
328 $query->is_page =
true;
329 $query->is_home =
false;
330 $qv[
'page_id'] = $front_page_id;
333 if ( ! empty( $qv[
'paged'] ) ) {
334 $qv[
'page'] = $qv[
'paged'];
335 unset( $qv[
'paged'] );
340 $query->is_singular = $query->is_single || $query->is_page || $query->is_attachment;
358 if ( ! class_exists(
'GV\View_Collection' ) || ! class_exists(
'GV\View' ) ) {
359 return $block_content;
366 foreach ( $views->all() as $view ) {
367 if ( ! $gv_view_data->views->contains( $view->ID ) ) {
368 $gv_view_data->views->add( $view );
372 return $block_content;
389 $is_GV_post_type =
'gravityview' === get_post_type( $post );
392 $post_content = ! empty( $post->post_content ) ? $post->post_content : null;
394 if ( ! $is_GV_post_type && function_exists(
'parse_blocks' ) && preg_match_all(
'/"ref":\d+/', $post_content ) ) {
395 $blocks = parse_blocks( $post_content );
397 foreach ( $blocks as $block ) {
398 if ( empty( $block[
'attrs'][
'ref'] ) ) {
402 $block_post = get_post( $block[
'attrs'][
'ref'] );
405 $post_content .= $block_post->post_content;
419 $post_id = $this->
getPostId() ? $this->
getPostId() : ( isset( $post ) ? $post->ID : null );
427 unset( $entry, $post_id, $post_has_shortcode );
434 $entry_id = self::is_single_entry();
462 if ( empty( $get ) || ! is_array( $get ) ) {
467 $get = array_filter( $get );
470 if ( empty( $get ) ) {
474 $search_keys = array_keys( $get );
476 $search_match = implode(
'|', self::$search_parameters );
478 foreach ( $search_keys as $search_key ) {
481 if ( preg_match(
'/(' . $search_match .
')/i', $search_key ) ) {
500 if ( ! class_exists(
'\GV\Entry' ) ) {
501 return $passed_title;
508 return $passed_title;
511 $entry = $gventry->as_entry();
518 $apply_outside_loop = apply_filters(
'gravityview/single/title/out_loop', in_the_loop(), $entry );
520 if ( ! $apply_outside_loop ) {
521 return $passed_title;
525 if ( empty( $passed_post_id ) ) {
526 return $passed_title;
531 if ( is_object( $post ) && (
int) $post->ID !== (
int) $passed_post_id ) {
532 return $passed_title;
554 return $passed_title;
560 if ( 1 < $view_collection->count() ) {
561 return $passed_title;
581 return $passed_title;
592 $check_entry_display = apply_filters(
'gravityview/single/title/check_entry_display',
true, $entry, $view );
594 if ( $check_entry_display ) {
598 if ( is_wp_error( $check_display ) ) {
599 return $passed_title;
603 $title = $view->settings->get(
'single_title', $passed_title );
626 gravityview()->log->notice(
'\GravityView_frontend::insert_view_in_content is deprecated. Use \GV\View::content()' );
627 return \GV\View::content(
$content );
649 $open = apply_filters(
'gravityview/comments_open', $open, $post_id );
667 if ( ! class_exists(
'GravityView_View' ) ) {
673 if ( ! empty( $fields ) ) {
679 switch ( $context ) {
681 $tab = esc_html__(
'Multiple Entries',
'gk-gravityview' );
684 $tab = esc_html__(
'Edit Entry',
'gk-gravityview' );
688 $tab = esc_html__(
'Single Entry',
'gk-gravityview' );
692 $title = sprintf( esc_html_x(
'The %s layout has not been configured.',
'Displayed when a View is not configured. %s is replaced by the tab label',
'gk-gravityview' ), $tab );
693 $edit_link = admin_url( sprintf(
'post.php?post=%d&action=edit#%s-view',
$view_id, $context ) );
694 $action_text = sprintf( esc_html__(
'Add fields to %s',
'gk-gravityview' ), $tab );
695 $message = esc_html__(
'You can only see this message because you are able to edit this View.',
'gk-gravityview' );
697 $image = sprintf(
'<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf(
'assets/images/tab-%s.png', $context ),
GRAVITYVIEW_FILE ) ) );
698 $output = sprintf(
'<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>',
$title, esc_url( $edit_link ), $action_text, $message );
717 if ( $is_search || ! $context instanceof \
GV\Template_Context ) {
718 return $no_entries_text;
721 $no_entries_option = (int) $context->view->settings->get(
'no_entries_options', 0 );
724 if ( empty( $no_entries_option ) ) {
725 return $no_entries_text;
728 if ( 1 === $no_entries_option ) {
729 $form_id = (int) $context->view->settings->get(
'no_entries_form' );
735 .gv-table-multiple-container:has( .gv-no-results-form ) th, 736 .gv-table-multiple-container:has( .gv-no-results-form ) td { 739 .gv-table-multiple-container:has( .gv-no-results-form ) thead, 740 .gv-table-multiple-container:has( .gv-no-results-form ) tfoot, 741 .gv-table-multiple-container:has( .gv-no-results-form ) + .gv-powered-by { 746 $form_title = $context->view->settings->get(
'no_entries_form_title',
true );
747 $form_desc = $context->view->settings->get(
'no_entries_form_description',
true );
755 if ( 2 === $no_entries_option ) {
757 $no_entries_redirect = $context->view->settings->get(
'no_entries_redirect' );
759 if ( $no_entries_redirect ) {
760 $redirect_url = GFCommon::replace_variables( $no_entries_redirect, $context->form, $context->entry,
false,
false,
false,
'text' );
762 $redirected = wp_redirect( $redirect_url );
764 if ( defined(
'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) {
772 return $no_entries_text;
799 gravityview()->log->notice(
'\GravityView_frontend::render_view is deprecated. Use \GV\View_Renderer etc.' );
807 if ( ! $view =
gravityview()->views->get( $passed_args ) ) {
811 $view->settings->update( $passed_args );
813 $direct_access = apply_filters(
'gravityview_direct_access',
true, $view->ID );
814 $embed_only = $view->settings->get(
'embed_only' );
816 if ( ! $direct_access || ( $embed_only && !
GVCommon::has_cap(
'read_private_gravityviews' ) ) ) {
817 return __(
'You are not allowed to view this content.',
'gk-gravityview' );
821 return $shortcode->callback( $passed_args );
841 $return_search_criteria = $search_criteria;
843 foreach ( array(
'start_date',
'end_date' ) as $key ) {
847 if ( ! empty(
$args[ $key ] ) ) {
850 $date = strtotime(
$args[ $key ], GFCommon::get_local_timestamp() );
853 if ( empty( $date ) ) {
855 ' Invalid {key} date format: {format}',
858 'format' =>
$args[ $key ],
865 $datetime_format =
'Y-m-d H:i:s';
866 $search_is_outside_view_bounds =
false;
868 if ( ! empty( $search_criteria[ $key ] ) ) {
870 $search_date = strtotime( $search_criteria[ $key ], GFCommon::get_local_timestamp() );
883 $datetime_format = gravityview_is_valid_datetime(
$args[ $key ] ) ?
'Y-m-d' : $datetime_format;
884 $search_is_outside_view_bounds = ( $search_date > $date );
887 $search_is_outside_view_bounds = ( $search_date < $date );
893 if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
896 $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date,
true );
901 if ( isset( $return_search_criteria[
'start_date'] ) && isset( $return_search_criteria[
'end_date'] ) ) {
903 if ( strtotime( $return_search_criteria[
'start_date'] ) > strtotime( $return_search_criteria[
'end_date'] ) ) {
904 gravityview()->log->error(
'Invalid search: the start date is after the end date.', array(
'data' => $return_search_criteria ) );
908 return $return_search_criteria;
922 if ( ! empty(
$args[
'admin_show_all_statuses'] ) &&
GVCommon::has_cap(
'gravityview_moderate_entries' ) ) {
923 gravityview()->log->debug(
'User can moderate entries; showing all approval statuses' );
924 return $search_criteria;
927 if ( ! empty(
$args[
'show_only_approved'] ) ) {
929 $search_criteria[
'field_filters'][] = array(
934 $search_criteria[
'field_filters'][
'mode'] =
'all';
936 gravityview()->log->debug(
'[process_search_only_approved] Search Criteria if show only approved: ', array(
'data' => $search_criteria ) );
939 return $search_criteria;
961 if ( empty( $entry[
'id'] ) || ( array_key_exists(
'show_only_approved',
$args ) && !
$args[
'show_only_approved'] ) ) {
967 if ( ! empty(
$args[
'admin_show_all_statuses'] ) &&
GVCommon::has_cap(
'gravityview_moderate_entries' ) ) {
968 gravityview()->log->debug(
'User can moderate entries, so entry is approved for viewing' );
995 $criteria = apply_filters(
'gravityview_search_criteria', array(), array(
$form_id ), \
GV\Utils::get(
$args,
'id' ) );
996 $search_criteria = isset(
$criteria[
'search_criteria'] ) ?
$criteria[
'search_criteria'] : array(
'field_filters' => array() );
1005 $search_criteria = apply_filters(
'gravityview_fe_search_criteria', $search_criteria,
$form_id,
$args );
1007 if ( ! is_array( $search_criteria ) ) {
1011 $original_search_criteria = $search_criteria;
1013 gravityview()->log->debug(
'[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array(
'data' => $search_criteria ) );
1016 if ( ! empty(
$args[
'search_value'] ) ) {
1019 $operator = ! empty(
$args[
'search_operator'] ) && in_array(
$args[
'search_operator'], array(
'is',
'isnot',
'>',
'<',
'contains' ) ) ?
$args[
'search_operator'] :
'contains';
1021 $search_criteria[
'field_filters'][] = array(
1022 'key' => \
GV\Utils::_GET(
'search_field', \
GV\Utils::get(
$args,
'search_field' ) ),
1023 'value' => _wp_specialchars(
$args[
'search_value'] ),
1024 'operator' => $operator,
1028 $search_criteria[
'field_filters'][
'mode'] =
'all';
1031 if ( $search_criteria !== $original_search_criteria ) {
1032 gravityview()->log->debug(
'[get_search_criteria] Search Criteria after implicity search: ', array(
'data' => $search_criteria ) );
1036 $search_criteria = self::process_search_dates(
$args, $search_criteria );
1038 if ( $search_criteria !== $original_search_criteria ) {
1039 gravityview()->log->debug(
'[get_search_criteria] Search Criteria after date params: ', array(
'data' => $search_criteria ) );
1043 $search_criteria = self::process_search_only_approved(
$args, $search_criteria );
1049 $search_criteria[
'status'] = apply_filters(
'gravityview_status',
'active',
$args );
1051 return $search_criteria;
1080 public static function get_view_entries(
$args,
$form_id ) {
1082 gravityview()->log->debug(
'[get_view_entries] init' );
1085 $parameters = self::get_view_entries_parameters(
$args,
$form_id );
1090 list(
$entries, $paging, $count ) =
1094 'Get Entries. Found: {count} entries',
1112 'paging' => $paging,
1121 return apply_filters(
'gravityview/view/entries', $return,
$args );
1141 public static function get_view_entries_parameters(
$args = array(),
$form_id = 0 ) {
1145 gravityview()->log->error(
'Passed args are not an array or the form ID is not numeric' );
1157 $search_criteria = self::get_search_criteria(
$args,
$form_id );
1159 $paging = self::get_search_criteria_paging(
$args );
1161 $parameters = array(
1162 'search_criteria' => $search_criteria,
1164 'paging' => $paging,
1165 'cache' => isset(
$args[
'cache'] ) ?
$args[
'cache'] :
true,
1183 $parameters = apply_filters(
'gravityview_get_entries', $parameters, $args,
$form_id );
1190 $parameters = apply_filters(
'gravityview_get_entries_' . \
GV\Utils::get( $args,
'id' ), $parameters, $args,
$form_id );
1192 gravityview()->log->debug(
'$parameters passed to gravityview_get_entries(): ', array(
'data' => $parameters ) );
1212 $default_page_size = apply_filters(
'gravityview_default_page_size', 25 );
1215 $page_size = ! empty(
$args[
'page_size'] ) ? intval(
$args[
'page_size'] ) : $default_page_size;
1217 if ( -1 === $page_size ) {
1218 $page_size = PHP_INT_MAX;
1221 $curr_page = empty( $_GET[
'pagenum'] ) ? 1 : intval( $_GET[
'pagenum'] );
1222 $offset = ( $curr_page - 1 ) * $page_size;
1224 if ( ! empty(
$args[
'offset'] ) ) {
1225 $offset += intval(
$args[
'offset'] );
1229 'offset' => $offset,
1230 'page_size' => $page_size,
1233 gravityview()->log->debug(
'Paging: ', array(
'data' => $paging ) );
1247 public static function updateViewSorting(
$args,
$form_id ) {
1250 $has_values = isset( $_GET[
'sort'] );
1252 if ( $has_values && is_array( $_GET[
'sort'] ) ) {
1253 $sorts = array_keys( $_GET[
'sort'] );
1254 $dirs = array_values( $_GET[
'sort'] );
1256 if ( $has_values = array_filter( $dirs ) ) {
1257 $sort_field_id = end( $sorts );
1258 $sort_direction = end( $dirs );
1262 if ( ! isset( $sort_field_id ) ) {
1263 $sort_field_id = isset( $_GET[
'sort'] ) ? $_GET[
'sort'] :
\GV\Utils::get(
$args,
'sort_field' );
1266 if ( ! isset( $sort_direction ) ) {
1267 $sort_direction = isset( $_GET[
'dir'] ) ? $_GET[
'dir'] :
\GV\Utils::get(
$args,
'sort_direction' );
1270 if ( is_array( $sort_field_id ) ) {
1271 $sort_field_id = array_pop( $sort_field_id );
1274 if ( is_array( $sort_direction ) ) {
1275 $sort_direction = array_pop( $sort_direction );
1278 if ( ! empty( $sort_field_id ) ) {
1279 if ( is_array( $sort_field_id ) ) {
1280 $sort_direction = array_values( $sort_field_id );
1281 $sort_field_id = array_keys( $sort_field_id );
1283 $sort_field_id = reset( $sort_field_id );
1284 $sort_direction = reset( $sort_direction );
1287 $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id,
$form_id );
1289 'key' => $sort_field_id,
1290 'direction' => strtolower( $sort_direction ),
1294 if (
'RAND' === $sort_direction ) {
1299 if ( ! empty(
$form[
'fields'] ) ) {
1303 if ( ! is_a( $field,
'GF_Field' ) ) {
1308 'key' => $field->id,
1309 'is_numeric' =>
false,
1310 'direction' =>
'RAND',
1319 if ( ! class_exists(
'GravityView_View' ) ) {
1320 gravityview()->plugin->include_legacy_frontend(
true );
1325 gravityview()->log->debug(
'[updateViewSorting] Sort Criteria : ', array(
'data' => $sorting ) );
1348 if ( is_array( $sort_field_id ) ) {
1349 $modified_ids = array();
1350 foreach ( $sort_field_id as $_sort_field_id ) {
1351 $modified_ids [] = self::_override_sorting_id_by_field_type( $_sort_field_id,
$form_id );
1353 return $modified_ids;
1358 $sort_field = GFFormsModel::get_field(
$form, $sort_field_id );
1360 if ( ! $sort_field ) {
1361 return $sort_field_id;
1364 switch ( $sort_field[
'type'] ) {
1368 if ( floatval( $sort_field_id ) === floor( $sort_field_id ) ) {
1379 $address_part = apply_filters(
'gravityview/sorting/address',
'city', $sort_field_id,
$form_id );
1381 switch ( strtolower( $address_part ) ) {
1383 $sort_field_id .=
'.1';
1386 $sort_field_id .=
'.2';
1390 $sort_field_id .=
'.3';
1393 $sort_field_id .=
'.4';
1396 $sort_field_id .=
'.5';
1399 $sort_field_id .=
'.6';
1406 if ( floatval( $sort_field_id ) === floor( $sort_field_id ) ) {
1414 $name_part = apply_filters(
'gravityview/sorting/full-name',
'first', $sort_field_id,
$form_id );
1416 if (
'last' === strtolower( $name_part ) ) {
1417 $sort_field_id .=
'.6';
1419 $sort_field_id .=
'.3';
1424 $sort_field_id =
false;
1434 $sort_field_id = apply_filters(
'gravityview/sorting/time', $sort_field_id,
$form_id );
1438 return $sort_field_id;
1450 if ( ! class_exists(
'\GV\Entry' ) ) {
1453 do_action(
'gravityview_log_error',
'\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary() );
1460 $single_entry = get_query_var( $var_name );
1468 $single_entry = apply_filters(
'gravityview/is_single_entry', $single_entry );
1470 if ( empty( $single_entry ) ) {
1484 global
$post, $posts;
1490 foreach ( $views as
$view_id => $data ) {
1494 $data = $view->as_data();
1497 $js_dependencies = array(
'jquery',
'gravityview-jquery-cookie' );
1498 $css_dependencies = array();
1500 $lightbox = $view->settings->get(
'lightbox' );
1512 $js_dependency = apply_filters_deprecated(
'gravity_view_lightbox_script', array(
'thickbox' ),
'2.5.1',
'gravityview_lightbox_script' );
1520 $js_dependency = apply_filters(
'gravityview_lightbox_script', $js_dependency, $view );
1521 $js_dependencies[] = $js_dependency;
1528 $css_dependency = apply_filters_deprecated(
'gravity_view_lightbox_style', array(
'thickbox' ),
'2.5.1',
'gravityview_lightbox_style' );
1536 $css_dependency = apply_filters(
'gravityview_lightbox_style', $css_dependency, $view );
1537 $css_dependencies[] = $css_dependency;
1546 if ( gravityview_view_has_single_checkbox_or_radio( $data[
'form'], $data[
'fields'] ) ) {
1547 $css_dependencies[] =
'dashicons';
1550 wp_register_script(
'gravityview-jquery-cookie', plugins_url(
'assets/lib/jquery.cookie/jquery.cookie.min.js',
GRAVITYVIEW_FILE ), array(
'jquery' ),
GV_PLUGIN_VERSION,
true );
1552 $script_debug = ( defined(
'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ?
'' :
'.min';
1554 wp_register_script(
'gravityview-fe-view', plugins_url(
'assets/js/fe-views' . $script_debug .
'.js',
GRAVITYVIEW_FILE ), apply_filters(
'gravityview_js_dependencies', $js_dependencies ),
GV_PLUGIN_VERSION,
true );
1556 wp_enqueue_script(
'gravityview-fe-view' );
1558 if ( ! empty( $data[
'atts'][
'sort_columns'] ) ) {
1564 self::add_style( $template_id );
1567 if (
'wp_print_footer_scripts' === current_filter() ) {
1569 $js_localization = array(
1570 'cookiepath' => COOKIEPATH,
1571 'clear' => _x(
'Clear',
'Clear all data from the form',
'gk-gravityview' ),
1572 'reset' => _x(
'Reset',
'Reset the search form to the state that existed on page load',
'gk-gravityview' ),
1580 $js_localization = apply_filters(
'gravityview_js_localization', $js_localization, $views );
1582 wp_localize_script(
'gravityview-fe-view',
'gvGlobals', $js_localization );
1603 $use_legacy_search_style = apply_filters(
'gravityview_use_legacy_search_style',
false );
1605 $rtl = is_rtl() ?
'-rtl' :
'';
1607 $css_file_base = $use_legacy_search_style ?
'gv-legacy-search' :
'gv-default-styles';
1611 wp_enqueue_style(
'gravityview_default_style', $path, $css_dependencies,
GV_PLUGIN_VERSION,
'all' );
1621 if ( ! empty( $template_id ) && wp_style_is(
'gravityview_style_' . $template_id,
'registered' ) ) {
1622 gravityview()->log->debug(
'Adding extra template style for {template_id}', array(
'template_id' => $template_id ) );
1623 wp_enqueue_style(
'gravityview_style_' . $template_id );
1624 } elseif ( empty( $template_id ) ) {
1625 gravityview()->log->error(
'Cannot add template style; template_id is empty' );
1627 gravityview()->log->error(
'Cannot add template style; {template_id} is not registered', array(
'template_id' =>
'gravityview_style_' . $template_id ) );
1667 $sort_field_id = self::_override_sorting_id_by_field_type(
$field[
'id'],
$form[
'id'] );
1674 if ( ! empty( $sorting[
'key'] ) && (
string) $sort_field_id === (
string) $sorting[
'key'] ) {
1676 if (
'asc' === $sorting[
'direction'] ) {
1677 $sort_args[
'dir'] =
'desc';
1678 $class .=
' gv-icon-sort-desc';
1680 $sort_args[
'dir'] =
'asc';
1681 $class .=
' gv-icon-sort-asc';
1684 $class .=
' gv-icon-caret-up-down';
1687 $url = add_query_arg( $sort_args, remove_query_arg( array(
'pagenum' ) ) );
1689 return '<a href="' . esc_url_raw(
$url ) .
'" class="' .
$class .
'" ></a> ' .
$label;
1712 $not_sortable = array(
1721 $not_sortable = apply_filters_deprecated(
'gravityview/sortable/field_blacklist', array( $not_sortable, $field_type,
$form ),
'2.14',
'gravityview/sortable/field_blocklist' );
1730 $not_sortable = apply_filters(
'gravityview/sortable/field_blocklist', $not_sortable, $field_type,
$form );
1732 if ( in_array( $field_type, $not_sortable ) ) {
1736 return apply_filters(
"gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters(
"gravityview/sortable/field_{$field_id}",
true,
$form ) );
const GV_PLUGIN_VERSION(! GravityKit\GravityView\Foundation\meets_min_php_version_requirement(__FILE__, '7.2.0'))
Constants.
static $search_parameters
static _GET( $name, $default=null)
Grab a value from the _GET superglobal or default.
context_not_configured_warning( $view_id=0)
Display a warning when a View has not been configured.
single_entry_title( $passed_title, $passed_post_id=null)
Filter the title for the single entry view.
static getInstance( $passed_post=NULL)
static from_content( $content)
Get a list of detected objects inside the supplied content.
static _override_sorting_id_by_field_type( $sort_field_id, $form_id)
Override sorting per field.
static getInstance( $passed_post=NULL)
setIsGravityviewPostType( $is_gravityview_post_type)
$is_gravityview_post_type
__construct()
Class constructor, enforce Singleton pattern.
set_context_view_id( $view_id=null)
Set the context view ID used when page contains multiple embedded views or displaying the single entr...
static process_search_only_approved( $args, $search_criteria)
Process the approved only search criteria according to the View settings.
gravityview_get_form( $form_id)
Returns the form object for a given Form ID.
static generate_notice( $notice, $class='', $cap='', $object_id=null)
Display updated/error notice.
render_view( $passed_args)
Core function to render a View based on a set of arguments.
add_columns_sort_links( $label='', $field=array(), $form=array())
Inject the sorting links on the table columns.
static from_post(\WP_Post $post)
Get a list of objects inside the supplied .
static is_entry_approved( $entry, $args=array())
Check if a certain entry is approved.
gravityview_css_url( $css_file='', $dir_path='')
Functions that don't require GravityView or Gravity Forms API access but are used in the plugin to ex...
if(gravityview() ->plugin->is_GF_25()) $form
setSingleEntry( $single_entry)
Sets the single entry ID and also the entry.
GravityView_frontend_get_view_entries( $args, $form_id, $parameters, $count)
$criteria['paging']
Modify the search parameters before the entries are fetched.
comments_open( $open, $post_id)
Disable comments on GravityView post types.
if(empty( $field_settings['content'])) $content
is_field_sortable( $field_id='', $form=array())
Checks if field (column) is sortable.
static get_search_criteria( $args, $form_id)
Parse search criteria for a entries search.
detect_views_in_block_content( $block_content)
Detect GV Views in parsed Gutenberg block content.
static check_entry_display( $entry, $view=null)
Checks if a certain entry is valid according to the View search filters (specially the Adv Filters) ...
static get_endpoint_name()
Return the endpoint name for a single Entry.
static get_search_criteria_paging( $args)
Get the paging array for the View.
static is_field_numeric( $form=null, $field='')
Checks if the field type is a 'numeric' field type (e.g.
setEntry( $entry)
Set the current entry.
static by_id( $post_id)
Construct a instance from a post ID.
enqueue_default_style( $css_dependencies=array())
Handle enqueuing the gravityview_default_style stylesheet.
gravityview_has_shortcode_r( $content, $tag='gravityview')
Placeholder until the recursive has_shortcode() patch is merged.
setPostHasShortcode( $post_has_shortcode)
insert_view_in_content( $content)
In case View post is called directly, insert the view in the post content.
filter_no_entries_output( $no_entries_text, $is_search, $context=null)
Modify what happens when there are no entries in the View based on View settings. ...
setGvOutputData( $gv_output_data)
const GRAVITYVIEW_FILE
Full path to the GravityView file "GRAVITYVIEW_FILE" "./gravityview.php".
static is_single_entry()
Verify if user requested a single entry view.
static process_search_dates( $args, $search_criteria=array())
Process the start and end dates for a view - overrides values defined in shortcode (if needed) ...
static replace_variables( $text, $form=array(), $entry=array(), $url_encode=false, $esc_html=true, $nl2br=true, $format='html', $aux_data=array())
Alias for GravityView_Merge_Tags::replace_variables()
if(empty( $created_by)) $form_id
is_searching()
Checks if the current View is presenting search results.
add_scripts_and_styles()
Register styles and scripts.
static get( $array, $key, $default=null)
Grab a value from an array or an object or default.
gravityview()
The main GravityView wrapper function.
parse_query_fix_frontpage(&$query)
Allow GravityView entry endpoints on the front page of a site.
gravityview_get_template_id( $post_id)
Get the template ID (list, table, datatables, map) for a View.
static is_approved( $status)
static add_style( $template_id)
Add template extra style if exists.
static get_entry( $entry_slug, $force_allow_ids=false, $check_entry_display=true, $view=null)
Return a single entry object.
static has_cap( $caps='', $object_id=null, $user_id=null)
Alias of GravityView_Roles_Capabilities::has_cap()
if(false !==strpos( $value, '00:00')) $field_id
string $field_id ID of the field being displayed
_get_single_entry_title( $view, $entry=array(), $passed_title='')
Returns the single entry title for a View with variables replaced and shortcodes parsed.
parse_content( $wp=array())
Read the $post and process the View data inside.
static get_form( $form_id)
Returns the form object for a given Form ID.
get_context_view_id()
Returns the the view_id context when page contains multiple embedded views or displaying single entry...
set_entry_data()
Set the entry.
static getInstance()
Get the one true instantiated self.