PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.3.0
GiveWP – Donation Plugin and Fundraising Platform v2.3.0
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
give / includes / admin / shortcodes / shortcode-give-goal.php

shortcode-give-goal.php in GiveWP – Donation Plugin and Fundraising Platform 2.3.0, at includes/admin/shortcodes/shortcode-give-goal.php

89 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The [give_goal] Shortcode Generator class
4 *
5 * @package Give/Admin/Shortcodes
6 * @copyright Copyright (c) 2016, WordImpress
7 * @license https://opensource.org/licenses/gpl-license GNU Public License
8 * @since 1.3.0
9 */
10
11 // Exit if accessed directly.
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15
16 /**
17 * Class Give_Shortcode_Donation_Form_Goal
18 */
19 class Give_Shortcode_Donation_Form_Goal extends Give_Shortcode_Generator {
20
21 /**
22 * Class constructor
23 */
24 public function __construct() {
25
26 $this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' );
27 $this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' );
28
29 parent::__construct( 'give_goal' );
30 }
31
32 /**
33 * Define the shortcode attribute fields
34 *
35 * @return array
36 */
37 public function define_fields() {
38
39 $create_form_link = sprintf(
40 /* translators: %s: create new form URL */
41 __( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
42 admin_url( 'post-new.php?post_type=give_forms' )
43 );
44
45 return array(
46 array(
47 'type' => 'post',
48 'query_args' => array(
49 'post_type' => 'give_forms',
50 'meta_key' => '_give_goal_option',
51 'meta_value' => 'enabled',
52 ),
53 'name' => 'id',
54 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ),
55 'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
56 'required' => array(
57 'alert' => esc_html__( 'You must first select a Form!', 'give' ),
58 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
59 ),
60 ),
61 array(
62 'type' => 'container',
63 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
64 ),
65 array(
66 'type' => 'listbox',
67 'name' => 'show_text',
68 'label' => esc_attr__( 'Show Text:', 'give' ),
69 'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ),
70 'options' => array(
71 'true' => esc_html__( 'Show', 'give' ),
72 'false' => esc_html__( 'Hide', 'give' ),
73 ),
74 ),
75 array(
76 'type' => 'listbox',
77 'name' => 'show_bar',
78 'label' => esc_attr__( 'Show Progress Bar:', 'give' ),
79 'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ),
80 'options' => array(
81 'true' => esc_html__( 'Show', 'give' ),
82 'false' => esc_html__( 'Hide', 'give' ),
83 ),
84 ),
85 );
86 }
87 }
88
89 new Give_Shortcode_Donation_Form_Goal;