@@ -795,6 +795,7 @@ |
||
795 | 795 | * Retrieve the entries for the current view and request. |
796 | 796 | * |
797 | 797 | * @param \GV\Request The request. Unused for now. |
798 | + * @param Request $request |
|
798 | 799 | * |
799 | 800 | * @return \GV\Entry_Collection The entries. |
800 | 801 | */ |
@@ -20,16 +20,16 @@ |
||
20 | 20 | */ |
21 | 21 | function gravityview_register_gravityview_widgets() { |
22 | 22 | |
23 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
23 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
24 | 24 | |
25 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
26 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
27 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
28 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
29 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/search-widget/class-search-widget.php' ); |
|
25 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
26 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
27 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
28 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
29 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/search-widget/class-search-widget.php' ); |
|
30 | 30 | |
31 | - if( class_exists('GFPolls') ) { |
|
32 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
31 | + if ( class_exists( 'GFPolls' ) ) { |
|
32 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | } |
@@ -74,7 +74,7 @@ |
||
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Render the page size widget |
77 | - * |
|
77 | + * |
|
78 | 78 | * @param array $widget_args The Widget shortcode args. |
79 | 79 | * @param string $content The content. |
80 | 80 | * @param string|\GV\Template_Context $context The context, if available. |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $default_size = 25; |
46 | 46 | |
47 | 47 | if ( $context instanceof \GV\Template_Context ) { |
48 | - $default_size = (int) $context->view->settings->get( 'page_size' ); |
|
48 | + $default_size = (int)$context->view->settings->get( 'page_size' ); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | $sizes = array( 10, 25, $default_size, 50, 100 ); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $page_sizes = array(); |
58 | 58 | foreach ( $sizes as $size ) { |
59 | - $page_sizes [] = array( |
|
59 | + $page_sizes [ ] = array( |
|
60 | 60 | 'value' => $size, |
61 | 61 | 'text' => $size |
62 | 62 | ); |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function render_frontend( $widget_args, $content = '', $context = null ) { |
83 | 83 | |
84 | - if( ! $this->pre_render_frontend() ) { |
|
84 | + if ( ! $this->pre_render_frontend() ) { |
|
85 | 85 | return; |
86 | 86 | } |
87 | 87 | |
88 | - $page_size = (int) \GV\Utils::_GET( 'page_size', $context->view->settings->get( 'page_size' ) ); |
|
88 | + $page_size = (int)\GV\Utils::_GET( 'page_size', $context->view->settings->get( 'page_size' ) ); |
|
89 | 89 | |
90 | 90 | $settings = shortcode_atts( array( |
91 | 91 | 'label' => __( 'Page Size', 'gravityview' ), |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | |
103 | 103 | ?> |
104 | 104 | <div class="gv-widget-page-size"> |
105 | - <?php if( ! empty( $settings['label'] ) ) { ?><label for="gv-page_size"><?php echo esc_html( $settings['label'] ); ?></label><?php } ?> |
|
105 | + <?php if ( ! empty( $settings[ 'label' ] ) ) { ?><label for="gv-page_size"><?php echo esc_html( $settings[ 'label' ] ); ?></label><?php } ?> |
|
106 | 106 | <form method="get" action="" onchange="this.submit();"> |
107 | 107 | <div> |
108 | 108 | <select name="page_size" id="gv-page_size"> |
109 | - <option value=""><?php echo esc_html( $settings['default_choice_text'] ); ?></option> |
|
109 | + <option value=""><?php echo esc_html( $settings[ 'default_choice_text' ] ); ?></option> |
|
110 | 110 | <?php |
111 | - foreach ( $settings['choices'] as $choice ) { ?> |
|
112 | - <option value='<?php echo esc_attr( $choice['value'] ); ?>'<?php gv_selected( esc_attr( $choice['value'] ), esc_attr( $page_size ), true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
111 | + foreach ( $settings[ 'choices' ] as $choice ) { ?> |
|
112 | + <option value='<?php echo esc_attr( $choice[ 'value' ] ); ?>'<?php gv_selected( esc_attr( $choice[ 'value' ] ), esc_attr( $page_size ), true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option> |
|
113 | 113 | <?php } ?> |
114 | 114 | </select> |
115 | 115 | <input type="submit" value="Submit" style="display: none"/> |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | // Already overridden |
143 | - if ( (int) $page_size === (int) $view->settings->get( 'page_size' ) ) { |
|
143 | + if ( (int)$page_size === (int)$view->settings->get( 'page_size' ) ) { |
|
144 | 144 | return; |
145 | 145 | } |
146 | 146 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | 'view' => $view, |
149 | 149 | ) ); |
150 | 150 | |
151 | - if ( ! in_array( (int) $page_size, wp_list_pluck( self::get_page_sizes( $context ), 'value' ), true ) ) { |
|
151 | + if ( ! in_array( (int)$page_size, wp_list_pluck( self::get_page_sizes( $context ), 'value' ), true ) ) { |
|
152 | 152 | gravityview()->log->warning( 'The passed page size is not allowed: {page_size}. Not modifying result.', array( 'page_size' => $page_size ) ); |
153 | 153 | return; |
154 | 154 | } |