PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
← All changes | includes/template-functions.php +21 -12 2.3.24.16.9 View file →
@@ -43,9 +43,9 @@
43 43 * @param array $args Passed arguments. Default is empty array().
44 44 * @param string $template_path Template file path. Default is empty.
45 45 * @param string $default_path Default path. Default is empty.
46 46 */
47 -function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
47 +function give_get_template( $template_name, $args = [], $template_path = '', $default_path = '' ) {
48 48 if ( ! empty( $args ) && is_array( $args ) ) {
49 49 extract( $args );
50 50 }
51 51
@@ -54,9 +54,9 @@
54 54 $located = give_get_locate_template( $template_names, $template_path, $default_path );
55 55
56 56 if ( ! file_exists( $located ) ) {
57 57 /* translators: %s: the template */
58 - Give()->notices->print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true );
58 + Give_Notices::print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true );
59 59
60 60 return;
61 61 }
62 62
@@ -76,9 +76,9 @@
76 76 * @param array $args Passed arguments.
77 77 */
78 78 do_action( 'give_before_template_part', $template_name, $template_path, $located, $args );
79 79
80 - include( $located );
80 + include $located;
81 81
82 82 /**
83 83 * Fires in give template, after the file is included.
84 84 *
@@ -121,9 +121,9 @@
121 121 */
122 122 do_action( "get_template_part_{$slug}", $slug, $name );
123 123
124 124 // Setup possible parts
125 - $templates = array();
125 + $templates = [];
126 126 if ( isset( $name ) ) {
127 127 $templates[] = $slug . '-' . $name . '.php';
128 128 }
129 129 $templates[] = $slug . '.php';
@@ -156,8 +156,10 @@
156 156 function give_locate_template( $template_names, $load = false, $require_once = true ) {
157 157 // No file found yet
158 158 $located = false;
159 159
160 + $theme_template_paths = give_get_theme_template_paths();
161 +
160 162 // Try to find a template file
161 163 foreach ( (array) $template_names as $template_name ) {
162 164
163 165 // Continue if template is empty
@@ -168,9 +170,9 @@
168 170 // Trim off any slashes from the template name
169 171 $template_name = ltrim( $template_name, '/' );
170 172
171 173 // try locating this template file by looping through the template paths
172 - foreach ( give_get_theme_template_paths() as $template_path ) {
174 + foreach ( $theme_template_paths as $template_path ) {
173 175
174 176 if ( file_exists( $template_path . $template_name ) ) {
175 177 $located = $template_path . $template_name;
176 178 break;
@@ -217,12 +219,12 @@
217 219 }
218 220
219 221 // Look within passed path within the theme - this is priority.
220 222 $template = locate_template(
221 - array(
223 + [
222 224 trailingslashit( $template_path ) . $template_name,
223 225 $template_name,
224 - )
226 + ]
225 227 );
226 228
227 229 // Get default template/
228 230 if ( ! $template ) {
@@ -246,13 +248,13 @@
246 248 function give_get_theme_template_paths() {
247 249
248 250 $template_dir = give_get_theme_template_dir_name();
249 251
250 - $file_paths = array(
252 + $file_paths = [
251 253 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir,
252 254 10 => trailingslashit( get_template_directory() ) . $template_dir,
253 255 100 => give_get_templates_dir(),
254 - );
256 + ];
255 257
256 258 $file_paths = apply_filters( 'give_template_paths', $file_paths );
257 259
258 260 // sort the file paths based on priority
@@ -300,8 +302,9 @@
300 302
301 303 /**
302 304 * Adds body classes for Give pages
303 305 *
306 + * @since 4.0.0 updated with give-campaign-page
304 307 * @since 1.0
305 308 *
306 309 * @param array $class current classes
307 310 *
@@ -329,8 +332,13 @@
329 332 $classes[] = 'give-test-mode';
330 333 $classes[] = 'give-page';
331 334 }
332 335
336 + if ( give_is_campaign_page() ) {
337 + $classes[] = 'give-campaign-page';
338 + $classes[] = 'give-page';
339 + }
340 +
333 341 // Theme-specific Classes used to prevent conflicts via CSS
334 342 /* @var WP_Theme $current_theme */
335 343 $current_theme = wp_get_theme();
336 344
@@ -377,9 +385,9 @@
377 385 if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) {
378 386 return $classes;
379 387 }
380 388
381 - //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc).
389 + // @TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc).
382 390
383 391 if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) {
384 392 unset( $classes[ $key ] );
385 393 }
@@ -397,9 +405,9 @@
397 405 * @return string
398 406 */
399 407 function give_get_placeholder_img_src() {
400 408
401 - $placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) );
409 + $placeholder_url = esc_url( GIVE_PLUGIN_URL . 'build/assets/dist/images/give-placeholder.jpg');
402 410
403 411 return apply_filters( 'give_placeholder_img_src', $placeholder_url );
404 412 }
405 413
@@ -480,13 +488,14 @@
480 488 *
481 489 * Returns true when viewing a single form.
482 490 *
483 491 * @since 1.6
492 + * @since 2.10.4 Updated post type slug to match registration.
484 493 *
485 494 * @return bool
486 495 */
487 496 function is_give_form() {
488 - return is_singular( array( 'give_form' ) );
497 + return is_singular( [ 'give_forms' ] );
489 498 }
490 499 }
491 500
492 501 if ( ! function_exists( 'is_give_category' ) ) {