PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.17.0
GiveWP – Donation Plugin and Fundraising Platform v2.17.0
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 2.31.0 2.31.1 All 253 releases
give / src / DonorDashboards / Shortcode.php
Shortcode.php
52 lines 991 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\DonorDashboards;
4
5 use Give\DonorDashboards\App as DonorDashboard;
6
7 class Shortcode {
8
9 protected $donorDashboard;
10
11 public function __construct() {
12 $this->donorDashboard = give( DonorDashboard::class );
13 }
14
15 /**
16 * Registers Donor Profile Shortcode
17 *
18 * @since 2.10.0
19 **/
20 public function addShortcode() {
21 add_shortcode( 'give_donor_dashboard', [ $this, 'renderCallback' ] );
22 }
23
24 /**
25 * Load Donor Profile frontend assets
26 *
27 * @since 2.9.0
28 **/
29 public function loadFrontendAssets() {
30 global $post;
31 if ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'give_donor_dashboard' ) ) {
32 return $this->donorDashboard->loadAssets();
33 }
34 }
35
36 /**
37 * Returns Shortcode markup
38 *
39 * @since 2.10.0
40 **/
41 public function renderCallback( $attributes ) {
42 $attributes = shortcode_atts(
43 [
44 'accent_color' => '#68bb6c',
45 ],
46 $attributes,
47 'give_donor_dashboard'
48 );
49 return $this->donorDashboard->getOutput( $attributes );
50 }
51 }
52