@@ -7,11 +7,11 @@ |
||
7 | 7 | <?php echo $nav_tabs; ?> |
8 | 8 | |
9 | 9 | <?php |
10 | - do_action('AHEE__admin_wrapper__template__before_admin_page_content'); |
|
11 | - echo $before_admin_page_content; |
|
12 | - echo $admin_page_content; |
|
13 | - echo $after_admin_page_content; |
|
14 | - do_action('AHEE__admin_wrapper__template__after_admin_page_content'); |
|
15 | - ?> |
|
10 | + do_action('AHEE__admin_wrapper__template__before_admin_page_content'); |
|
11 | + echo $before_admin_page_content; |
|
12 | + echo $admin_page_content; |
|
13 | + echo $after_admin_page_content; |
|
14 | + do_action('AHEE__admin_wrapper__template__after_admin_page_content'); |
|
15 | + ?> |
|
16 | 16 | |
17 | 17 | </div> |
@@ -9,11 +9,11 @@ |
||
9 | 9 | </div> <!-- post-body-content --> |
10 | 10 | |
11 | 11 | <?php |
12 | - // let's loop through the columns |
|
13 | - for ($i = 1; $i <= $num_columns; $i++) { |
|
14 | - $metaref = ($i === 1) ? 'normal' : 'side'; |
|
15 | - $metaref = ($i > 2) ? 'column' . $i : $metaref; |
|
16 | - ?> |
|
12 | + // let's loop through the columns |
|
13 | + for ($i = 1; $i <= $num_columns; $i++) { |
|
14 | + $metaref = ($i === 1) ? 'normal' : 'side'; |
|
15 | + $metaref = ($i > 2) ? 'column' . $i : $metaref; |
|
16 | + ?> |
|
17 | 17 | |
18 | 18 | <div id='postbox-container-<?php echo $i; ?>' class='postbox-container'> |
19 | 19 | <?php do_meta_boxes($current_page, $metaref, null); ?> |
@@ -12,7 +12,7 @@ |
||
12 | 12 | // let's loop through the columns |
13 | 13 | for ($i = 1; $i <= $num_columns; $i++) { |
14 | 14 | $metaref = ($i === 1) ? 'normal' : 'side'; |
15 | - $metaref = ($i > 2) ? 'column' . $i : $metaref; |
|
15 | + $metaref = ($i > 2) ? 'column'.$i : $metaref; |
|
16 | 16 | ?> |
17 | 17 | |
18 | 18 | <div id='postbox-container-<?php echo $i; ?>' class='postbox-container'> |
@@ -2,16 +2,16 @@ discard block |
||
2 | 2 | <ul class="infolinks"> |
3 | 3 | <li> |
4 | 4 | <?php |
5 | - echo '<a href="http://eventespresso.com/wiki/installation/" target="_blank">' |
|
6 | - . __( |
|
7 | - 'Installation', |
|
8 | - 'event_espresso' |
|
9 | - ) |
|
10 | - . '</a> & <a href="http://eventespresso.com/wiki/setting-up-event-espresso/" target="_blank">' |
|
11 | - . __( |
|
12 | - 'Usage Guide', |
|
13 | - 'event_espresso' |
|
14 | - ) . '</a>'; ?> |
|
5 | + echo '<a href="http://eventespresso.com/wiki/installation/" target="_blank">' |
|
6 | + . __( |
|
7 | + 'Installation', |
|
8 | + 'event_espresso' |
|
9 | + ) |
|
10 | + . '</a> & <a href="http://eventespresso.com/wiki/setting-up-event-espresso/" target="_blank">' |
|
11 | + . __( |
|
12 | + 'Usage Guide', |
|
13 | + 'event_espresso' |
|
14 | + ) . '</a>'; ?> |
|
15 | 15 | </li> |
16 | 16 | <li> |
17 | 17 | <a href="http://eventespresso.com/wiki/put-custom-templates/" target="_blank"> |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | </li> |
42 | 42 | <li> |
43 | 43 | <?php echo '<a href="http://eventespresso.com/pricing/" target="_blank">' |
44 | - . __( |
|
45 | - 'Plugins', |
|
46 | - 'event_espresso' |
|
47 | - ) |
|
48 | - . '</a> & <a href="http://eventespresso.com/add-ons/" target="_blank">' |
|
49 | - . __( |
|
50 | - 'Add-ons', |
|
51 | - 'event_espresso' |
|
52 | - ) . '</a>'; ?><br/> |
|
44 | + . __( |
|
45 | + 'Plugins', |
|
46 | + 'event_espresso' |
|
47 | + ) |
|
48 | + . '</a> & <a href="http://eventespresso.com/add-ons/" target="_blank">' |
|
49 | + . __( |
|
50 | + 'Add-ons', |
|
51 | + 'event_espresso' |
|
52 | + ) . '</a>'; ?><br/> |
|
53 | 53 | <br/> |
54 | 54 | <ol> |
55 | 55 | <li> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | . __( |
12 | 12 | 'Usage Guide', |
13 | 13 | 'event_espresso' |
14 | - ) . '</a>'; ?> |
|
14 | + ).'</a>'; ?> |
|
15 | 15 | </li> |
16 | 16 | <li> |
17 | 17 | <a href="http://eventespresso.com/wiki/put-custom-templates/" target="_blank"> |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | . __( |
50 | 50 | 'Add-ons', |
51 | 51 | 'event_espresso' |
52 | - ) . '</a>'; ?><br/> |
|
52 | + ).'</a>'; ?><br/> |
|
53 | 53 | <br/> |
54 | 54 | <ol> |
55 | 55 | <li> |
@@ -3,11 +3,11 @@ |
||
3 | 3 | |
4 | 4 | <div class="ee-notices"><?php echo isset($ajax_notices) ? $ajax_notices : ''; ?></div> |
5 | 5 | <?php |
6 | - do_action('AHEE__admin_wrapper__template__before_admin_page_content'); |
|
7 | - echo $before_admin_page_content; |
|
8 | - echo $admin_page_content; |
|
9 | - echo $after_admin_page_content; |
|
10 | - do_action('AHEE__admin_wrapper__template__after_admin_page_content'); |
|
11 | - ?> |
|
6 | + do_action('AHEE__admin_wrapper__template__before_admin_page_content'); |
|
7 | + echo $before_admin_page_content; |
|
8 | + echo $admin_page_content; |
|
9 | + echo $after_admin_page_content; |
|
10 | + do_action('AHEE__admin_wrapper__template__after_admin_page_content'); |
|
11 | + ?> |
|
12 | 12 | </div> |
13 | 13 | <!-- espresso-admin --> |
14 | 14 | \ No newline at end of file |
@@ -7,7 +7,7 @@ |
||
7 | 7 | <div id="<?php echo $admin_page_wrapper_div_id; ?>"> |
8 | 8 | <div id="post-body" class="metabox-holder columns-1"> |
9 | 9 | |
10 | - <?php if (! empty($admin_page_header)) : ?> |
|
10 | + <?php if ( ! empty($admin_page_header)) : ?> |
|
11 | 11 | <div id="admin-page-header"> |
12 | 12 | <?php echo $admin_page_header; ?> |
13 | 13 | </div> |
@@ -15,235 +15,235 @@ discard block |
||
15 | 15 | abstract class EE_Qtip_Config extends EE_Base |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * This will hold the qtips setup array (setup by children) |
|
20 | - * |
|
21 | - * @access protected |
|
22 | - * @var array |
|
23 | - */ |
|
24 | - protected $_qtipsa; |
|
18 | + /** |
|
19 | + * This will hold the qtips setup array (setup by children) |
|
20 | + * |
|
21 | + * @access protected |
|
22 | + * @var array |
|
23 | + */ |
|
24 | + protected $_qtipsa; |
|
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * This holds the constructed EE_Qtip objects |
|
29 | - * |
|
30 | - * @access protected |
|
31 | - * @var EE_Qtip |
|
32 | - */ |
|
33 | - protected $_qtips; |
|
27 | + /** |
|
28 | + * This holds the constructed EE_Qtip objects |
|
29 | + * |
|
30 | + * @access protected |
|
31 | + * @var EE_Qtip |
|
32 | + */ |
|
33 | + protected $_qtips; |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * an array of default options for instantiated qtip js objects |
|
38 | - * |
|
39 | - * @access protected |
|
40 | - * @var array |
|
41 | - */ |
|
42 | - protected $_default_options; |
|
36 | + /** |
|
37 | + * an array of default options for instantiated qtip js objects |
|
38 | + * |
|
39 | + * @access protected |
|
40 | + * @var array |
|
41 | + */ |
|
42 | + protected $_default_options; |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * constructor |
|
47 | - * |
|
48 | - * @access public |
|
49 | - */ |
|
50 | - public function __construct() |
|
51 | - { |
|
52 | - $this->_qtipsa = $this->_qtips = array(); |
|
53 | - $this->_set_default_options(); |
|
54 | - $this->_set_tips_array(); |
|
55 | - $this->_construct_tips(); |
|
56 | - } |
|
45 | + /** |
|
46 | + * constructor |
|
47 | + * |
|
48 | + * @access public |
|
49 | + */ |
|
50 | + public function __construct() |
|
51 | + { |
|
52 | + $this->_qtipsa = $this->_qtips = array(); |
|
53 | + $this->_set_default_options(); |
|
54 | + $this->_set_tips_array(); |
|
55 | + $this->_construct_tips(); |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * Children define this method and its purpose is to setup the $_qtipsa property. The format of this property is: |
|
61 | - * |
|
62 | - * $qtipsa = array( |
|
63 | - * 0 => array( |
|
64 | - * 'content_id' => 'some_unique_id_for_referencing_content', //just the string |
|
65 | - * 'content' => 'html/text content for the qtip', |
|
66 | - * 'target' => '#target-element', //use the same schema as jQuery selectors. This will match what the |
|
67 | - * target is for the qTip in the dom (i.e. if class then '.some-class'). |
|
68 | - * 'options' => array() //use this to override any of the default options for this specific qtip. |
|
69 | - * ) |
|
70 | - * ); |
|
71 | - * |
|
72 | - * @abstract |
|
73 | - * @access protected |
|
74 | - * @return void |
|
75 | - */ |
|
76 | - abstract protected function _set_tips_array(); |
|
59 | + /** |
|
60 | + * Children define this method and its purpose is to setup the $_qtipsa property. The format of this property is: |
|
61 | + * |
|
62 | + * $qtipsa = array( |
|
63 | + * 0 => array( |
|
64 | + * 'content_id' => 'some_unique_id_for_referencing_content', //just the string |
|
65 | + * 'content' => 'html/text content for the qtip', |
|
66 | + * 'target' => '#target-element', //use the same schema as jQuery selectors. This will match what the |
|
67 | + * target is for the qTip in the dom (i.e. if class then '.some-class'). |
|
68 | + * 'options' => array() //use this to override any of the default options for this specific qtip. |
|
69 | + * ) |
|
70 | + * ); |
|
71 | + * |
|
72 | + * @abstract |
|
73 | + * @access protected |
|
74 | + * @return void |
|
75 | + */ |
|
76 | + abstract protected function _set_tips_array(); |
|
77 | 77 | |
78 | 78 | |
79 | - /** |
|
80 | - * all the default options for the qtip js are defined here. Children class can override the defaults for all the |
|
81 | - * qtips defined in their config OR just leave it and have the parent default options apply. |
|
82 | - * |
|
83 | - * commented out options are there for reference so you know which can be defined by the child. |
|
84 | - * |
|
85 | - * Note: children do NOT have to define all these options. Just define the ones to override. |
|
86 | - * |
|
87 | - * @link http://qtip2.com/options |
|
88 | - * |
|
89 | - * @access protected |
|
90 | - * @return void |
|
91 | - */ |
|
92 | - protected function _set_default_options() |
|
93 | - { |
|
94 | - $this->_default_options = array( |
|
95 | - // 'id' => 'unique_id_referncing_qtip_instance', |
|
96 | - 'prerender' => false, |
|
97 | - // increases page load if true, |
|
98 | - 'suppress' => true, |
|
99 | - // whether default browser tooltips are suppressed. |
|
100 | - 'content' => array( |
|
101 | - 'button' => false, |
|
102 | - // what you want for the close button text/link. |
|
103 | - 'title' => true, |
|
104 | - // Options: "string", true. If TRUE then the title attribute of the target will be used (if available). If "string" then we'll use that as the title. |
|
105 | - 'clone' => true, |
|
106 | - // Options: true|false. if true then the text will be cloned from the content instead of removed from the dom. |
|
107 | - ), |
|
108 | - 'show_only_once' => false, |
|
109 | - // this is NOT a qtip2 library option, but is something added for EE specific use. If set to true, this means that this particular tooltip will only show ONCE for the user and then a cookie will be saved so that it doesn't show again (after exit). |
|
110 | - 'position' => array( |
|
111 | - 'my' => 'top left', |
|
112 | - // top left || top center || top right || right top || right center || right bottom || bottom right || bottom center || bottom left || left bottom || left center || left top |
|
113 | - 'at' => 'bottom right', |
|
114 | - // same options as above. |
|
115 | - 'target' => 'event', |
|
116 | - // if u use jQuery::#selector, js will parse to a jQuery selector || 'mouse' (at mouse cursor position) || 'event' (position at target that triggered the tooltip), or an array containing an absolute x/y position on page. |
|
117 | - 'container' => false, |
|
118 | - // what HTML element the tooltip is appended to (it's containing element). jquery object. Use 'jQuery::#selector' and js will parse' |
|
119 | - 'viewport' => true, |
|
120 | - // @link http://qtip2.com/plugins#viewport |
|
121 | - 'adjust' => array( |
|
122 | - 'x' => 0, |
|
123 | - // adjust position on x axis by 0 pixels. |
|
124 | - 'y' => 0, |
|
125 | - // adjust position on y axis by 0 pixels. |
|
126 | - 'mouse' => true, |
|
127 | - // when position['target'] is set to 'mouse', tooltip will follow mouse when hovering over the target. False, stops following. |
|
128 | - 'resize' => true, |
|
129 | - // adjust tooltip position when window is resized. |
|
130 | - 'scroll' => true, |
|
131 | - // position of tooltip adjusted when window (or position.container) is scrolled. |
|
132 | - 'method' => 'flipinvert', |
|
133 | - // @link http://qtip2.com/plugins#viewport |
|
134 | - ), |
|
135 | - ), |
|
136 | - 'show' => array( |
|
137 | - 'event' => 'mouseenter', |
|
138 | - // what event triggers tooltip to be shown. Any jQuery standard event or custom events can be used. space separated events provide multiple triggers. |
|
139 | - 'target' => false, |
|
140 | - // options jQuery::#selector|false. Used to indicate which html element will trigger show event. When false, the element the qtip() method was called upon is used. |
|
141 | - 'delay' => 90, |
|
142 | - // time in millisecons by which to delay showing of tooltip. |
|
143 | - 'solo' => false, |
|
144 | - // determines whether tooltip will hid all others when triggered. Options: true (hide all) || false (ignore) || string (parent selector for which qtips get hidden) |
|
145 | - 'modal' => array( |
|
146 | - 'on' => false, // does tooltip trigger modal? |
|
147 | - 'blur' => true, // does clicking on the dimmed background hide the tooltip and remove the dim? |
|
148 | - 'escape' => true, // hitting escape key hide the tooltip and cancel modal |
|
149 | - 'stealfocus' => true, // can users focus on inputs and elelments outside of tooltip when modal on? |
|
150 | - ), |
|
151 | - ), |
|
152 | - 'hide' => array( |
|
153 | - 'event' => 'mouseleave', |
|
154 | - // similar as what you do for show.event. |
|
155 | - 'target' => false, |
|
156 | - // Options jQuery::#selector. which html element will trigger hide event. When false, the element the .qtip() method was called upon is used. |
|
157 | - 'delay' => 0, |
|
158 | - // set time in milliseconds for delaying the hide of the tooltip |
|
159 | - 'inactive' => false, |
|
160 | - // if integer, time in millisecons in which the tooltip should be hidden if remains inactive (not interacted with) |
|
161 | - 'fixed' => false, |
|
162 | - // when set to true, the tooltip will not hide if moused over. |
|
163 | - 'leave' => 'window', |
|
164 | - // specify whether the tooltip will hide when leaving the window it's conained within. |
|
165 | - 'distance' => false, |
|
166 | - // if integer, distance in pixels that the tooltip hides when the mouse is moved from the point it triggered the tooltip. |
|
167 | - ), |
|
168 | - 'style' => array( |
|
169 | - 'classes' => 'qtip-tipsy', |
|
170 | - // Options "string", false. A space separated string containing all class names which should be added ot the main qTip element. See options for styles in comment block at end of this class. |
|
171 | - 'def' => true, |
|
172 | - // set to false and the default qtip class does not get applied |
|
173 | - 'widget' => false, |
|
174 | - // whether ui-widget classes of the themeroller UI styles are applied to tooltip. |
|
175 | - 'width' => false, |
|
176 | - // Options: "string", integer, false. with this you can override all applied CSS width styles for tooltip. Can be any valid width CSS value. (does not override min/max width styles) |
|
177 | - 'height' => false, |
|
178 | - // same as above except applies to height. |
|
179 | - 'tip' => array( |
|
180 | - 'corner' => true, |
|
181 | - // where in relation to the tooltip the speech bubble tip is applied. Options: true, "corner string" (see position), false. true inherits |
|
182 | - 'mimic' => false, |
|
183 | - // see documentation @link http://qtip2.com/plugins#tips |
|
184 | - 'border' => true, |
|
185 | - // Options: true, integer. determines the width of the border that surrounds the tip element. True inherits from tooltip. |
|
186 | - 'width' => 6, |
|
187 | - // width of rendered tip in pixels in relation to the side of the tooltip the tip is on. |
|
188 | - 'height' => 6, |
|
189 | - // works the same as tip.width |
|
190 | - 'offset' => 0, |
|
191 | - // use to set the offset of the tip in relation to its corner position. |
|
192 | - ), |
|
193 | - ), |
|
79 | + /** |
|
80 | + * all the default options for the qtip js are defined here. Children class can override the defaults for all the |
|
81 | + * qtips defined in their config OR just leave it and have the parent default options apply. |
|
82 | + * |
|
83 | + * commented out options are there for reference so you know which can be defined by the child. |
|
84 | + * |
|
85 | + * Note: children do NOT have to define all these options. Just define the ones to override. |
|
86 | + * |
|
87 | + * @link http://qtip2.com/options |
|
88 | + * |
|
89 | + * @access protected |
|
90 | + * @return void |
|
91 | + */ |
|
92 | + protected function _set_default_options() |
|
93 | + { |
|
94 | + $this->_default_options = array( |
|
95 | + // 'id' => 'unique_id_referncing_qtip_instance', |
|
96 | + 'prerender' => false, |
|
97 | + // increases page load if true, |
|
98 | + 'suppress' => true, |
|
99 | + // whether default browser tooltips are suppressed. |
|
100 | + 'content' => array( |
|
101 | + 'button' => false, |
|
102 | + // what you want for the close button text/link. |
|
103 | + 'title' => true, |
|
104 | + // Options: "string", true. If TRUE then the title attribute of the target will be used (if available). If "string" then we'll use that as the title. |
|
105 | + 'clone' => true, |
|
106 | + // Options: true|false. if true then the text will be cloned from the content instead of removed from the dom. |
|
107 | + ), |
|
108 | + 'show_only_once' => false, |
|
109 | + // this is NOT a qtip2 library option, but is something added for EE specific use. If set to true, this means that this particular tooltip will only show ONCE for the user and then a cookie will be saved so that it doesn't show again (after exit). |
|
110 | + 'position' => array( |
|
111 | + 'my' => 'top left', |
|
112 | + // top left || top center || top right || right top || right center || right bottom || bottom right || bottom center || bottom left || left bottom || left center || left top |
|
113 | + 'at' => 'bottom right', |
|
114 | + // same options as above. |
|
115 | + 'target' => 'event', |
|
116 | + // if u use jQuery::#selector, js will parse to a jQuery selector || 'mouse' (at mouse cursor position) || 'event' (position at target that triggered the tooltip), or an array containing an absolute x/y position on page. |
|
117 | + 'container' => false, |
|
118 | + // what HTML element the tooltip is appended to (it's containing element). jquery object. Use 'jQuery::#selector' and js will parse' |
|
119 | + 'viewport' => true, |
|
120 | + // @link http://qtip2.com/plugins#viewport |
|
121 | + 'adjust' => array( |
|
122 | + 'x' => 0, |
|
123 | + // adjust position on x axis by 0 pixels. |
|
124 | + 'y' => 0, |
|
125 | + // adjust position on y axis by 0 pixels. |
|
126 | + 'mouse' => true, |
|
127 | + // when position['target'] is set to 'mouse', tooltip will follow mouse when hovering over the target. False, stops following. |
|
128 | + 'resize' => true, |
|
129 | + // adjust tooltip position when window is resized. |
|
130 | + 'scroll' => true, |
|
131 | + // position of tooltip adjusted when window (or position.container) is scrolled. |
|
132 | + 'method' => 'flipinvert', |
|
133 | + // @link http://qtip2.com/plugins#viewport |
|
134 | + ), |
|
135 | + ), |
|
136 | + 'show' => array( |
|
137 | + 'event' => 'mouseenter', |
|
138 | + // what event triggers tooltip to be shown. Any jQuery standard event or custom events can be used. space separated events provide multiple triggers. |
|
139 | + 'target' => false, |
|
140 | + // options jQuery::#selector|false. Used to indicate which html element will trigger show event. When false, the element the qtip() method was called upon is used. |
|
141 | + 'delay' => 90, |
|
142 | + // time in millisecons by which to delay showing of tooltip. |
|
143 | + 'solo' => false, |
|
144 | + // determines whether tooltip will hid all others when triggered. Options: true (hide all) || false (ignore) || string (parent selector for which qtips get hidden) |
|
145 | + 'modal' => array( |
|
146 | + 'on' => false, // does tooltip trigger modal? |
|
147 | + 'blur' => true, // does clicking on the dimmed background hide the tooltip and remove the dim? |
|
148 | + 'escape' => true, // hitting escape key hide the tooltip and cancel modal |
|
149 | + 'stealfocus' => true, // can users focus on inputs and elelments outside of tooltip when modal on? |
|
150 | + ), |
|
151 | + ), |
|
152 | + 'hide' => array( |
|
153 | + 'event' => 'mouseleave', |
|
154 | + // similar as what you do for show.event. |
|
155 | + 'target' => false, |
|
156 | + // Options jQuery::#selector. which html element will trigger hide event. When false, the element the .qtip() method was called upon is used. |
|
157 | + 'delay' => 0, |
|
158 | + // set time in milliseconds for delaying the hide of the tooltip |
|
159 | + 'inactive' => false, |
|
160 | + // if integer, time in millisecons in which the tooltip should be hidden if remains inactive (not interacted with) |
|
161 | + 'fixed' => false, |
|
162 | + // when set to true, the tooltip will not hide if moused over. |
|
163 | + 'leave' => 'window', |
|
164 | + // specify whether the tooltip will hide when leaving the window it's conained within. |
|
165 | + 'distance' => false, |
|
166 | + // if integer, distance in pixels that the tooltip hides when the mouse is moved from the point it triggered the tooltip. |
|
167 | + ), |
|
168 | + 'style' => array( |
|
169 | + 'classes' => 'qtip-tipsy', |
|
170 | + // Options "string", false. A space separated string containing all class names which should be added ot the main qTip element. See options for styles in comment block at end of this class. |
|
171 | + 'def' => true, |
|
172 | + // set to false and the default qtip class does not get applied |
|
173 | + 'widget' => false, |
|
174 | + // whether ui-widget classes of the themeroller UI styles are applied to tooltip. |
|
175 | + 'width' => false, |
|
176 | + // Options: "string", integer, false. with this you can override all applied CSS width styles for tooltip. Can be any valid width CSS value. (does not override min/max width styles) |
|
177 | + 'height' => false, |
|
178 | + // same as above except applies to height. |
|
179 | + 'tip' => array( |
|
180 | + 'corner' => true, |
|
181 | + // where in relation to the tooltip the speech bubble tip is applied. Options: true, "corner string" (see position), false. true inherits |
|
182 | + 'mimic' => false, |
|
183 | + // see documentation @link http://qtip2.com/plugins#tips |
|
184 | + 'border' => true, |
|
185 | + // Options: true, integer. determines the width of the border that surrounds the tip element. True inherits from tooltip. |
|
186 | + 'width' => 6, |
|
187 | + // width of rendered tip in pixels in relation to the side of the tooltip the tip is on. |
|
188 | + 'height' => 6, |
|
189 | + // works the same as tip.width |
|
190 | + 'offset' => 0, |
|
191 | + // use to set the offset of the tip in relation to its corner position. |
|
192 | + ), |
|
193 | + ), |
|
194 | 194 | |
195 | - ); |
|
196 | - } |
|
195 | + ); |
|
196 | + } |
|
197 | 197 | |
198 | 198 | |
199 | - /** |
|
200 | - * This takes the set $_qtipsa array property and loops through it to set the EE_Qtip objects and assign them to |
|
201 | - * the $_qtips property |
|
202 | - * |
|
203 | - * @access protected |
|
204 | - * @return void |
|
205 | - */ |
|
206 | - protected function _construct_tips() |
|
207 | - { |
|
208 | - foreach ($this->_qtipsa as $qt) { |
|
209 | - // make sure we have what we need. |
|
210 | - if (! isset($qt['content_id']) || ! isset($qt['target']) || ! isset($qt['content'])) { |
|
211 | - throw new EE_Error( |
|
212 | - sprintf( |
|
213 | - __( |
|
214 | - 'There is something wrong with the _qtipsa property setup for the %s qtip config class. The dump of the current array index is: %s.<br /><br />Please check that it is setup correctly.', |
|
215 | - 'event_espresso' |
|
216 | - ), |
|
217 | - get_class($this), |
|
218 | - var_export($qt, true) |
|
219 | - ) |
|
220 | - ); |
|
221 | - } |
|
199 | + /** |
|
200 | + * This takes the set $_qtipsa array property and loops through it to set the EE_Qtip objects and assign them to |
|
201 | + * the $_qtips property |
|
202 | + * |
|
203 | + * @access protected |
|
204 | + * @return void |
|
205 | + */ |
|
206 | + protected function _construct_tips() |
|
207 | + { |
|
208 | + foreach ($this->_qtipsa as $qt) { |
|
209 | + // make sure we have what we need. |
|
210 | + if (! isset($qt['content_id']) || ! isset($qt['target']) || ! isset($qt['content'])) { |
|
211 | + throw new EE_Error( |
|
212 | + sprintf( |
|
213 | + __( |
|
214 | + 'There is something wrong with the _qtipsa property setup for the %s qtip config class. The dump of the current array index is: %s.<br /><br />Please check that it is setup correctly.', |
|
215 | + 'event_espresso' |
|
216 | + ), |
|
217 | + get_class($this), |
|
218 | + var_export($qt, true) |
|
219 | + ) |
|
220 | + ); |
|
221 | + } |
|
222 | 222 | |
223 | - // make sure the options include defaults and just override via set config. |
|
224 | - $options_override = isset($qt['options']) ? (array) $qt['options'] : array(); |
|
225 | - $options = array_merge($this->_default_options, $options_override); |
|
226 | - $setup = array( |
|
227 | - 'content_id' => $qt['content_id'], |
|
228 | - 'options' => $options, |
|
229 | - 'target' => $qt['target'], |
|
230 | - 'content' => $qt['content'], |
|
231 | - ); |
|
232 | - $this->_qtips[] = new EE_Qtip($setup); |
|
233 | - } |
|
234 | - } |
|
223 | + // make sure the options include defaults and just override via set config. |
|
224 | + $options_override = isset($qt['options']) ? (array) $qt['options'] : array(); |
|
225 | + $options = array_merge($this->_default_options, $options_override); |
|
226 | + $setup = array( |
|
227 | + 'content_id' => $qt['content_id'], |
|
228 | + 'options' => $options, |
|
229 | + 'target' => $qt['target'], |
|
230 | + 'content' => $qt['content'], |
|
231 | + ); |
|
232 | + $this->_qtips[] = new EE_Qtip($setup); |
|
233 | + } |
|
234 | + } |
|
235 | 235 | |
236 | 236 | |
237 | - /** |
|
238 | - * return the _qtips property contents |
|
239 | - * |
|
240 | - * @access public |
|
241 | - * @return EE_Qtip[] |
|
242 | - */ |
|
243 | - public function get_tips() |
|
244 | - { |
|
245 | - return $this->_qtips; |
|
246 | - } |
|
237 | + /** |
|
238 | + * return the _qtips property contents |
|
239 | + * |
|
240 | + * @access public |
|
241 | + * @return EE_Qtip[] |
|
242 | + */ |
|
243 | + public function get_tips() |
|
244 | + { |
|
245 | + return $this->_qtips; |
|
246 | + } |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | // class names you can use for tooltip styles |
@@ -295,17 +295,17 @@ discard block |
||
295 | 295 | */ |
296 | 296 | class EE_Qtip extends EE_Base |
297 | 297 | { |
298 | - public $content_id; |
|
299 | - public $options; |
|
300 | - public $target; |
|
301 | - public $content; |
|
298 | + public $content_id; |
|
299 | + public $options; |
|
300 | + public $target; |
|
301 | + public $content; |
|
302 | 302 | |
303 | - public function __construct($setup_array) |
|
304 | - { |
|
305 | - foreach ($setup_array as $prop => $value) { |
|
306 | - if (EEH_Class_Tools::has_property($this, $prop)) { |
|
307 | - $this->{$prop} = $value; |
|
308 | - } |
|
309 | - } |
|
310 | - } |
|
303 | + public function __construct($setup_array) |
|
304 | + { |
|
305 | + foreach ($setup_array as $prop => $value) { |
|
306 | + if (EEH_Class_Tools::has_property($this, $prop)) { |
|
307 | + $this->{$prop} = $value; |
|
308 | + } |
|
309 | + } |
|
310 | + } |
|
311 | 311 | } |
@@ -207,7 +207,7 @@ |
||
207 | 207 | { |
208 | 208 | foreach ($this->_qtipsa as $qt) { |
209 | 209 | // make sure we have what we need. |
210 | - if (! isset($qt['content_id']) || ! isset($qt['target']) || ! isset($qt['content'])) { |
|
210 | + if ( ! isset($qt['content_id']) || ! isset($qt['target']) || ! isset($qt['content'])) { |
|
211 | 211 | throw new EE_Error( |
212 | 212 | sprintf( |
213 | 213 | __( |
@@ -32,126 +32,126 @@ |
||
32 | 32 | class EEE_Base_Class |
33 | 33 | { |
34 | 34 | |
35 | - const extending_method_prefix = 'ext_'; |
|
36 | - const dynamic_callback_method_prefix = 'dynamic_callback_method_'; |
|
37 | - /** |
|
38 | - * The model name that is extended (not classname) |
|
39 | - * |
|
40 | - * @var string |
|
41 | - */ |
|
42 | - protected $_model_name_extended = null; |
|
43 | - /** |
|
44 | - * The model this extends |
|
45 | - * |
|
46 | - * @var EE_Base_Class |
|
47 | - */ |
|
48 | - protected $_ = null; |
|
35 | + const extending_method_prefix = 'ext_'; |
|
36 | + const dynamic_callback_method_prefix = 'dynamic_callback_method_'; |
|
37 | + /** |
|
38 | + * The model name that is extended (not classname) |
|
39 | + * |
|
40 | + * @var string |
|
41 | + */ |
|
42 | + protected $_model_name_extended = null; |
|
43 | + /** |
|
44 | + * The model this extends |
|
45 | + * |
|
46 | + * @var EE_Base_Class |
|
47 | + */ |
|
48 | + protected $_ = null; |
|
49 | 49 | |
50 | - public function __construct() |
|
51 | - { |
|
52 | - if (! $this->_model_name_extended) { |
|
53 | - throw new EE_Error( |
|
54 | - sprintf( |
|
55 | - __( |
|
56 | - "When declaring a class extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
57 | - "event_espresso" |
|
58 | - ) |
|
59 | - ) |
|
60 | - ); |
|
61 | - } |
|
62 | - if (did_action('AHEE__EE_' . $this->_model_name_extended . '__construct__end')) { |
|
63 | - throw new EE_Error( |
|
64 | - sprintf( |
|
65 | - __( |
|
66 | - "Hooked in model object extension '%s' too late! The model object %s has already been used!", |
|
67 | - "event_espresso" |
|
68 | - ), |
|
69 | - get_class($this), |
|
70 | - $this->_model_name_extended |
|
71 | - ) |
|
72 | - ); |
|
73 | - } |
|
74 | - $this->_register_extending_methods(); |
|
75 | - } |
|
50 | + public function __construct() |
|
51 | + { |
|
52 | + if (! $this->_model_name_extended) { |
|
53 | + throw new EE_Error( |
|
54 | + sprintf( |
|
55 | + __( |
|
56 | + "When declaring a class extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
57 | + "event_espresso" |
|
58 | + ) |
|
59 | + ) |
|
60 | + ); |
|
61 | + } |
|
62 | + if (did_action('AHEE__EE_' . $this->_model_name_extended . '__construct__end')) { |
|
63 | + throw new EE_Error( |
|
64 | + sprintf( |
|
65 | + __( |
|
66 | + "Hooked in model object extension '%s' too late! The model object %s has already been used!", |
|
67 | + "event_espresso" |
|
68 | + ), |
|
69 | + get_class($this), |
|
70 | + $this->_model_name_extended |
|
71 | + ) |
|
72 | + ); |
|
73 | + } |
|
74 | + $this->_register_extending_methods(); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the |
|
79 | - * model extended. (Internally uses filters, and the __call magic method) |
|
80 | - */ |
|
81 | - protected function _register_extending_methods() |
|
82 | - { |
|
83 | - $all_methods = get_class_methods(get_class($this)); |
|
84 | - foreach ($all_methods as $method_name) { |
|
85 | - if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
86 | - $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
|
87 | - $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model"; |
|
88 | - add_filter( |
|
89 | - $callback_name, |
|
90 | - array($this, self::dynamic_callback_method_prefix . $method_name_on_model), |
|
91 | - 10, |
|
92 | - 10 |
|
93 | - ); |
|
94 | - } |
|
95 | - } |
|
96 | - } |
|
77 | + /** |
|
78 | + * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the |
|
79 | + * model extended. (Internally uses filters, and the __call magic method) |
|
80 | + */ |
|
81 | + protected function _register_extending_methods() |
|
82 | + { |
|
83 | + $all_methods = get_class_methods(get_class($this)); |
|
84 | + foreach ($all_methods as $method_name) { |
|
85 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
86 | + $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
|
87 | + $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model"; |
|
88 | + add_filter( |
|
89 | + $callback_name, |
|
90 | + array($this, self::dynamic_callback_method_prefix . $method_name_on_model), |
|
91 | + 10, |
|
92 | + 10 |
|
93 | + ); |
|
94 | + } |
|
95 | + } |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the |
|
100 | - * model extended. (Internally uses filters, and the __call magic method) |
|
101 | - */ |
|
102 | - public function deregister() |
|
103 | - { |
|
104 | - $all_methods = get_class_methods(get_class($this)); |
|
105 | - foreach ($all_methods as $method_name) { |
|
106 | - if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
107 | - $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
|
108 | - $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model"; |
|
109 | - remove_filter( |
|
110 | - $callback_name, |
|
111 | - array($this, self::dynamic_callback_method_prefix . $method_name_on_model), |
|
112 | - 10 |
|
113 | - ); |
|
114 | - } |
|
115 | - } |
|
116 | - } |
|
98 | + /** |
|
99 | + * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the |
|
100 | + * model extended. (Internally uses filters, and the __call magic method) |
|
101 | + */ |
|
102 | + public function deregister() |
|
103 | + { |
|
104 | + $all_methods = get_class_methods(get_class($this)); |
|
105 | + foreach ($all_methods as $method_name) { |
|
106 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
107 | + $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
|
108 | + $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model"; |
|
109 | + remove_filter( |
|
110 | + $callback_name, |
|
111 | + array($this, self::dynamic_callback_method_prefix . $method_name_on_model), |
|
112 | + 10 |
|
113 | + ); |
|
114 | + } |
|
115 | + } |
|
116 | + } |
|
117 | 117 | |
118 | 118 | |
119 | - public function __call($callback_method_name, $args) |
|
120 | - { |
|
121 | - if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) { |
|
122 | - // it's a dynamic callback for a method name |
|
123 | - $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name); |
|
124 | - $original_return_val = $args[0]; |
|
125 | - $model_called = $args[1]; |
|
126 | - // phpcs:disable WordPress.WP.I18n.SingleUnderscoreGetTextFunction |
|
127 | - $this->_ = $model_called; |
|
128 | - // phpcs:enable |
|
129 | - $args_provided_to_method_on_model = $args[2]; |
|
130 | - $extending_method = self::extending_method_prefix . $method_called_on_model; |
|
131 | - if (method_exists($this, $extending_method)) { |
|
132 | - return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model); |
|
133 | - } else { |
|
134 | - throw new EE_Error( |
|
135 | - sprintf( |
|
136 | - __( |
|
137 | - "An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", |
|
138 | - "event_espresso" |
|
139 | - ), |
|
140 | - $this->_model_name_extended, |
|
141 | - get_class($this), |
|
142 | - $extending_method, |
|
143 | - $extending_method |
|
144 | - ) |
|
145 | - ); |
|
146 | - } |
|
147 | - } else { |
|
148 | - throw new EE_Error( |
|
149 | - sprintf( |
|
150 | - __("There is no method named '%s' on '%s'", "event_espresso"), |
|
151 | - $callback_method_name, |
|
152 | - get_class($this) |
|
153 | - ) |
|
154 | - ); |
|
155 | - } |
|
156 | - } |
|
119 | + public function __call($callback_method_name, $args) |
|
120 | + { |
|
121 | + if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) { |
|
122 | + // it's a dynamic callback for a method name |
|
123 | + $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name); |
|
124 | + $original_return_val = $args[0]; |
|
125 | + $model_called = $args[1]; |
|
126 | + // phpcs:disable WordPress.WP.I18n.SingleUnderscoreGetTextFunction |
|
127 | + $this->_ = $model_called; |
|
128 | + // phpcs:enable |
|
129 | + $args_provided_to_method_on_model = $args[2]; |
|
130 | + $extending_method = self::extending_method_prefix . $method_called_on_model; |
|
131 | + if (method_exists($this, $extending_method)) { |
|
132 | + return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model); |
|
133 | + } else { |
|
134 | + throw new EE_Error( |
|
135 | + sprintf( |
|
136 | + __( |
|
137 | + "An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", |
|
138 | + "event_espresso" |
|
139 | + ), |
|
140 | + $this->_model_name_extended, |
|
141 | + get_class($this), |
|
142 | + $extending_method, |
|
143 | + $extending_method |
|
144 | + ) |
|
145 | + ); |
|
146 | + } |
|
147 | + } else { |
|
148 | + throw new EE_Error( |
|
149 | + sprintf( |
|
150 | + __("There is no method named '%s' on '%s'", "event_espresso"), |
|
151 | + $callback_method_name, |
|
152 | + get_class($this) |
|
153 | + ) |
|
154 | + ); |
|
155 | + } |
|
156 | + } |
|
157 | 157 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | public function __construct() |
51 | 51 | { |
52 | - if (! $this->_model_name_extended) { |
|
52 | + if ( ! $this->_model_name_extended) { |
|
53 | 53 | throw new EE_Error( |
54 | 54 | sprintf( |
55 | 55 | __( |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ) |
60 | 60 | ); |
61 | 61 | } |
62 | - if (did_action('AHEE__EE_' . $this->_model_name_extended . '__construct__end')) { |
|
62 | + if (did_action('AHEE__EE_'.$this->_model_name_extended.'__construct__end')) { |
|
63 | 63 | throw new EE_Error( |
64 | 64 | sprintf( |
65 | 65 | __( |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model"; |
88 | 88 | add_filter( |
89 | 89 | $callback_name, |
90 | - array($this, self::dynamic_callback_method_prefix . $method_name_on_model), |
|
90 | + array($this, self::dynamic_callback_method_prefix.$method_name_on_model), |
|
91 | 91 | 10, |
92 | 92 | 10 |
93 | 93 | ); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model"; |
109 | 109 | remove_filter( |
110 | 110 | $callback_name, |
111 | - array($this, self::dynamic_callback_method_prefix . $method_name_on_model), |
|
111 | + array($this, self::dynamic_callback_method_prefix.$method_name_on_model), |
|
112 | 112 | 10 |
113 | 113 | ); |
114 | 114 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $this->_ = $model_called; |
128 | 128 | // phpcs:enable |
129 | 129 | $args_provided_to_method_on_model = $args[2]; |
130 | - $extending_method = self::extending_method_prefix . $method_called_on_model; |
|
130 | + $extending_method = self::extending_method_prefix.$method_called_on_model; |
|
131 | 131 | if (method_exists($this, $extending_method)) { |
132 | 132 | return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model); |
133 | 133 | } else { |
@@ -44,211 +44,211 @@ |
||
44 | 44 | abstract class EEME_Base |
45 | 45 | { |
46 | 46 | |
47 | - const extending_method_prefix = 'ext_'; |
|
48 | - const dynamic_callback_method_prefix = 'dynamic_callback_method_'; |
|
49 | - |
|
50 | - protected $_extra_tables = array(); |
|
51 | - protected $_extra_fields = array(); |
|
52 | - protected $_extra_relations = array(); |
|
53 | - |
|
54 | - /** |
|
55 | - * The model name that is extended (not classname) |
|
56 | - * |
|
57 | - * @var string |
|
58 | - */ |
|
59 | - protected $_model_name_extended = null; |
|
60 | - |
|
61 | - /** |
|
62 | - * The model this extends |
|
63 | - * |
|
64 | - * @var EEM_Base |
|
65 | - */ |
|
66 | - protected $_ = null; |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * @throws \EE_Error |
|
71 | - */ |
|
72 | - public function __construct() |
|
73 | - { |
|
74 | - if (! $this->_model_name_extended) { |
|
75 | - throw new EE_Error( |
|
76 | - __( |
|
77 | - "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
78 | - "event_espresso" |
|
79 | - ) |
|
80 | - ); |
|
81 | - } |
|
82 | - $construct_end_action = 'AHEE__EEM_' . $this->_model_name_extended . '__construct__end'; |
|
83 | - if (did_action($construct_end_action)) { |
|
84 | - throw new EE_Error( |
|
85 | - sprintf( |
|
86 | - __( |
|
87 | - "Hooked in model extension '%s' too late! The model %s has already been used! We know because the action %s has been fired", |
|
88 | - "event_espresso" |
|
89 | - ), |
|
90 | - get_class($this), |
|
91 | - $this->_model_name_extended, |
|
92 | - $construct_end_action |
|
93 | - ) |
|
94 | - ); |
|
95 | - } |
|
96 | - add_filter( |
|
97 | - 'FHEE__EEM_' . $this->_model_name_extended . '__construct__tables', |
|
98 | - array($this, 'add_extra_tables_on_filter') |
|
99 | - ); |
|
100 | - add_filter( |
|
101 | - 'FHEE__EEM_' . $this->_model_name_extended . '__construct__fields', |
|
102 | - array($this, 'add_extra_fields_on_filter') |
|
103 | - ); |
|
104 | - add_filter( |
|
105 | - 'FHEE__EEM_' . $this->_model_name_extended . '__construct__model_relations', |
|
106 | - array($this, 'add_extra_relations_on_filter') |
|
107 | - ); |
|
108 | - $this->_register_extending_methods(); |
|
109 | - } |
|
110 | - |
|
111 | - |
|
112 | - /** |
|
113 | - * @param array $existing_tables |
|
114 | - * @return array |
|
115 | - */ |
|
116 | - public function add_extra_tables_on_filter($existing_tables) |
|
117 | - { |
|
118 | - return array_merge((array) $existing_tables, $this->_extra_tables); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @param array $existing_fields |
|
124 | - * @return array |
|
125 | - */ |
|
126 | - public function add_extra_fields_on_filter($existing_fields) |
|
127 | - { |
|
128 | - if ($this->_extra_fields) { |
|
129 | - foreach ($this->_extra_fields as $table_alias => $fields) { |
|
130 | - if (! isset($existing_fields[ $table_alias ])) { |
|
131 | - $existing_fields[ $table_alias ] = array(); |
|
132 | - } |
|
133 | - $existing_fields[ $table_alias ] = array_merge( |
|
134 | - (array) $existing_fields[ $table_alias ], |
|
135 | - $this->_extra_fields[ $table_alias ] |
|
136 | - ); |
|
137 | - } |
|
138 | - } |
|
139 | - return $existing_fields; |
|
140 | - } |
|
141 | - |
|
142 | - |
|
143 | - /** |
|
144 | - * @param array $existing_relations |
|
145 | - * @return array |
|
146 | - */ |
|
147 | - public function add_extra_relations_on_filter($existing_relations) |
|
148 | - { |
|
149 | - return array_merge((array) $existing_relations, $this->_extra_relations); |
|
150 | - } |
|
151 | - |
|
152 | - |
|
153 | - /** |
|
154 | - * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the |
|
155 | - * model extended. (Internally uses filters, and the __call magic method) |
|
156 | - */ |
|
157 | - protected function _register_extending_methods() |
|
158 | - { |
|
159 | - $all_methods = get_class_methods(get_class($this)); |
|
160 | - foreach ($all_methods as $method_name) { |
|
161 | - if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
162 | - $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
|
163 | - $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
|
164 | - add_filter( |
|
165 | - $callback_name, |
|
166 | - array($this, self::dynamic_callback_method_prefix . $method_name_on_model), |
|
167 | - 10, |
|
168 | - 10 |
|
169 | - ); |
|
170 | - } |
|
171 | - } |
|
172 | - } |
|
173 | - |
|
174 | - /** |
|
175 | - * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the |
|
176 | - * model extended. (Internally uses filters, and the __call magic method) |
|
177 | - */ |
|
178 | - public function deregister() |
|
179 | - { |
|
180 | - remove_filter( |
|
181 | - 'FHEE__EEM_' . $this->_model_name_extended . '__construct__tables', |
|
182 | - array($this, 'add_extra_tables_on_filter') |
|
183 | - ); |
|
184 | - remove_filter( |
|
185 | - 'FHEE__EEM_' . $this->_model_name_extended . '__construct__fields', |
|
186 | - array($this, 'add_extra_fields_on_filter') |
|
187 | - ); |
|
188 | - remove_filter( |
|
189 | - 'FHEE__EEM_' . $this->_model_name_extended . '__construct__model_relations', |
|
190 | - array($this, 'add_extra_relations_on_filter') |
|
191 | - ); |
|
192 | - $all_methods = get_class_methods(get_class($this)); |
|
193 | - foreach ($all_methods as $method_name) { |
|
194 | - if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
195 | - $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
|
196 | - $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
|
197 | - remove_filter( |
|
198 | - $callback_name, |
|
199 | - array($this, self::dynamic_callback_method_prefix . $method_name_on_model), |
|
200 | - 10 |
|
201 | - ); |
|
202 | - } |
|
203 | - } |
|
204 | - /** @var EEM_Base $model_to_reset */ |
|
205 | - $model_to_reset = 'EEM_' . $this->_model_name_extended; |
|
206 | - if (class_exists($model_to_reset)) { |
|
207 | - $model_to_reset::reset(); |
|
208 | - } |
|
209 | - } |
|
210 | - |
|
211 | - |
|
212 | - /** |
|
213 | - * @param string $callback_method_name |
|
214 | - * @param array $args |
|
215 | - * @return mixed |
|
216 | - * @throws EE_Error |
|
217 | - */ |
|
218 | - public function __call($callback_method_name, $args) |
|
219 | - { |
|
220 | - if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) { |
|
221 | - // it's a dynamic callback for a method name |
|
222 | - $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name); |
|
223 | - list($original_return_val, $model_called, $args_provided_to_method_on_model) = (array) $args; |
|
224 | - // phpcs:disable WordPress.WP.I18n.SingleUnderscoreGetTextFunction |
|
225 | - $this->_ = $model_called; |
|
226 | - // phpcs:enable |
|
227 | - $extending_method = self::extending_method_prefix . $method_called_on_model; |
|
228 | - if (method_exists($this, $extending_method)) { |
|
229 | - return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model); |
|
230 | - } else { |
|
231 | - throw new EE_Error( |
|
232 | - sprintf( |
|
233 | - __( |
|
234 | - "An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", |
|
235 | - "event_espresso" |
|
236 | - ), |
|
237 | - $this->_model_name_extended, |
|
238 | - get_class($this), |
|
239 | - $extending_method, |
|
240 | - $extending_method |
|
241 | - ) |
|
242 | - ); |
|
243 | - } |
|
244 | - } else { |
|
245 | - throw new EE_Error( |
|
246 | - sprintf( |
|
247 | - __("There is no method named '%s' on '%s'", "event_espresso"), |
|
248 | - $callback_method_name, |
|
249 | - get_class($this) |
|
250 | - ) |
|
251 | - ); |
|
252 | - } |
|
253 | - } |
|
47 | + const extending_method_prefix = 'ext_'; |
|
48 | + const dynamic_callback_method_prefix = 'dynamic_callback_method_'; |
|
49 | + |
|
50 | + protected $_extra_tables = array(); |
|
51 | + protected $_extra_fields = array(); |
|
52 | + protected $_extra_relations = array(); |
|
53 | + |
|
54 | + /** |
|
55 | + * The model name that is extended (not classname) |
|
56 | + * |
|
57 | + * @var string |
|
58 | + */ |
|
59 | + protected $_model_name_extended = null; |
|
60 | + |
|
61 | + /** |
|
62 | + * The model this extends |
|
63 | + * |
|
64 | + * @var EEM_Base |
|
65 | + */ |
|
66 | + protected $_ = null; |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * @throws \EE_Error |
|
71 | + */ |
|
72 | + public function __construct() |
|
73 | + { |
|
74 | + if (! $this->_model_name_extended) { |
|
75 | + throw new EE_Error( |
|
76 | + __( |
|
77 | + "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
78 | + "event_espresso" |
|
79 | + ) |
|
80 | + ); |
|
81 | + } |
|
82 | + $construct_end_action = 'AHEE__EEM_' . $this->_model_name_extended . '__construct__end'; |
|
83 | + if (did_action($construct_end_action)) { |
|
84 | + throw new EE_Error( |
|
85 | + sprintf( |
|
86 | + __( |
|
87 | + "Hooked in model extension '%s' too late! The model %s has already been used! We know because the action %s has been fired", |
|
88 | + "event_espresso" |
|
89 | + ), |
|
90 | + get_class($this), |
|
91 | + $this->_model_name_extended, |
|
92 | + $construct_end_action |
|
93 | + ) |
|
94 | + ); |
|
95 | + } |
|
96 | + add_filter( |
|
97 | + 'FHEE__EEM_' . $this->_model_name_extended . '__construct__tables', |
|
98 | + array($this, 'add_extra_tables_on_filter') |
|
99 | + ); |
|
100 | + add_filter( |
|
101 | + 'FHEE__EEM_' . $this->_model_name_extended . '__construct__fields', |
|
102 | + array($this, 'add_extra_fields_on_filter') |
|
103 | + ); |
|
104 | + add_filter( |
|
105 | + 'FHEE__EEM_' . $this->_model_name_extended . '__construct__model_relations', |
|
106 | + array($this, 'add_extra_relations_on_filter') |
|
107 | + ); |
|
108 | + $this->_register_extending_methods(); |
|
109 | + } |
|
110 | + |
|
111 | + |
|
112 | + /** |
|
113 | + * @param array $existing_tables |
|
114 | + * @return array |
|
115 | + */ |
|
116 | + public function add_extra_tables_on_filter($existing_tables) |
|
117 | + { |
|
118 | + return array_merge((array) $existing_tables, $this->_extra_tables); |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @param array $existing_fields |
|
124 | + * @return array |
|
125 | + */ |
|
126 | + public function add_extra_fields_on_filter($existing_fields) |
|
127 | + { |
|
128 | + if ($this->_extra_fields) { |
|
129 | + foreach ($this->_extra_fields as $table_alias => $fields) { |
|
130 | + if (! isset($existing_fields[ $table_alias ])) { |
|
131 | + $existing_fields[ $table_alias ] = array(); |
|
132 | + } |
|
133 | + $existing_fields[ $table_alias ] = array_merge( |
|
134 | + (array) $existing_fields[ $table_alias ], |
|
135 | + $this->_extra_fields[ $table_alias ] |
|
136 | + ); |
|
137 | + } |
|
138 | + } |
|
139 | + return $existing_fields; |
|
140 | + } |
|
141 | + |
|
142 | + |
|
143 | + /** |
|
144 | + * @param array $existing_relations |
|
145 | + * @return array |
|
146 | + */ |
|
147 | + public function add_extra_relations_on_filter($existing_relations) |
|
148 | + { |
|
149 | + return array_merge((array) $existing_relations, $this->_extra_relations); |
|
150 | + } |
|
151 | + |
|
152 | + |
|
153 | + /** |
|
154 | + * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the |
|
155 | + * model extended. (Internally uses filters, and the __call magic method) |
|
156 | + */ |
|
157 | + protected function _register_extending_methods() |
|
158 | + { |
|
159 | + $all_methods = get_class_methods(get_class($this)); |
|
160 | + foreach ($all_methods as $method_name) { |
|
161 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
162 | + $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
|
163 | + $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
|
164 | + add_filter( |
|
165 | + $callback_name, |
|
166 | + array($this, self::dynamic_callback_method_prefix . $method_name_on_model), |
|
167 | + 10, |
|
168 | + 10 |
|
169 | + ); |
|
170 | + } |
|
171 | + } |
|
172 | + } |
|
173 | + |
|
174 | + /** |
|
175 | + * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the |
|
176 | + * model extended. (Internally uses filters, and the __call magic method) |
|
177 | + */ |
|
178 | + public function deregister() |
|
179 | + { |
|
180 | + remove_filter( |
|
181 | + 'FHEE__EEM_' . $this->_model_name_extended . '__construct__tables', |
|
182 | + array($this, 'add_extra_tables_on_filter') |
|
183 | + ); |
|
184 | + remove_filter( |
|
185 | + 'FHEE__EEM_' . $this->_model_name_extended . '__construct__fields', |
|
186 | + array($this, 'add_extra_fields_on_filter') |
|
187 | + ); |
|
188 | + remove_filter( |
|
189 | + 'FHEE__EEM_' . $this->_model_name_extended . '__construct__model_relations', |
|
190 | + array($this, 'add_extra_relations_on_filter') |
|
191 | + ); |
|
192 | + $all_methods = get_class_methods(get_class($this)); |
|
193 | + foreach ($all_methods as $method_name) { |
|
194 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
195 | + $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
|
196 | + $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
|
197 | + remove_filter( |
|
198 | + $callback_name, |
|
199 | + array($this, self::dynamic_callback_method_prefix . $method_name_on_model), |
|
200 | + 10 |
|
201 | + ); |
|
202 | + } |
|
203 | + } |
|
204 | + /** @var EEM_Base $model_to_reset */ |
|
205 | + $model_to_reset = 'EEM_' . $this->_model_name_extended; |
|
206 | + if (class_exists($model_to_reset)) { |
|
207 | + $model_to_reset::reset(); |
|
208 | + } |
|
209 | + } |
|
210 | + |
|
211 | + |
|
212 | + /** |
|
213 | + * @param string $callback_method_name |
|
214 | + * @param array $args |
|
215 | + * @return mixed |
|
216 | + * @throws EE_Error |
|
217 | + */ |
|
218 | + public function __call($callback_method_name, $args) |
|
219 | + { |
|
220 | + if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) { |
|
221 | + // it's a dynamic callback for a method name |
|
222 | + $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name); |
|
223 | + list($original_return_val, $model_called, $args_provided_to_method_on_model) = (array) $args; |
|
224 | + // phpcs:disable WordPress.WP.I18n.SingleUnderscoreGetTextFunction |
|
225 | + $this->_ = $model_called; |
|
226 | + // phpcs:enable |
|
227 | + $extending_method = self::extending_method_prefix . $method_called_on_model; |
|
228 | + if (method_exists($this, $extending_method)) { |
|
229 | + return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model); |
|
230 | + } else { |
|
231 | + throw new EE_Error( |
|
232 | + sprintf( |
|
233 | + __( |
|
234 | + "An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", |
|
235 | + "event_espresso" |
|
236 | + ), |
|
237 | + $this->_model_name_extended, |
|
238 | + get_class($this), |
|
239 | + $extending_method, |
|
240 | + $extending_method |
|
241 | + ) |
|
242 | + ); |
|
243 | + } |
|
244 | + } else { |
|
245 | + throw new EE_Error( |
|
246 | + sprintf( |
|
247 | + __("There is no method named '%s' on '%s'", "event_espresso"), |
|
248 | + $callback_method_name, |
|
249 | + get_class($this) |
|
250 | + ) |
|
251 | + ); |
|
252 | + } |
|
253 | + } |
|
254 | 254 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function __construct() |
73 | 73 | { |
74 | - if (! $this->_model_name_extended) { |
|
74 | + if ( ! $this->_model_name_extended) { |
|
75 | 75 | throw new EE_Error( |
76 | 76 | __( |
77 | 77 | "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | ) |
80 | 80 | ); |
81 | 81 | } |
82 | - $construct_end_action = 'AHEE__EEM_' . $this->_model_name_extended . '__construct__end'; |
|
82 | + $construct_end_action = 'AHEE__EEM_'.$this->_model_name_extended.'__construct__end'; |
|
83 | 83 | if (did_action($construct_end_action)) { |
84 | 84 | throw new EE_Error( |
85 | 85 | sprintf( |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | ); |
95 | 95 | } |
96 | 96 | add_filter( |
97 | - 'FHEE__EEM_' . $this->_model_name_extended . '__construct__tables', |
|
97 | + 'FHEE__EEM_'.$this->_model_name_extended.'__construct__tables', |
|
98 | 98 | array($this, 'add_extra_tables_on_filter') |
99 | 99 | ); |
100 | 100 | add_filter( |
101 | - 'FHEE__EEM_' . $this->_model_name_extended . '__construct__fields', |
|
101 | + 'FHEE__EEM_'.$this->_model_name_extended.'__construct__fields', |
|
102 | 102 | array($this, 'add_extra_fields_on_filter') |
103 | 103 | ); |
104 | 104 | add_filter( |
105 | - 'FHEE__EEM_' . $this->_model_name_extended . '__construct__model_relations', |
|
105 | + 'FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations', |
|
106 | 106 | array($this, 'add_extra_relations_on_filter') |
107 | 107 | ); |
108 | 108 | $this->_register_extending_methods(); |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | { |
128 | 128 | if ($this->_extra_fields) { |
129 | 129 | foreach ($this->_extra_fields as $table_alias => $fields) { |
130 | - if (! isset($existing_fields[ $table_alias ])) { |
|
131 | - $existing_fields[ $table_alias ] = array(); |
|
130 | + if ( ! isset($existing_fields[$table_alias])) { |
|
131 | + $existing_fields[$table_alias] = array(); |
|
132 | 132 | } |
133 | - $existing_fields[ $table_alias ] = array_merge( |
|
134 | - (array) $existing_fields[ $table_alias ], |
|
135 | - $this->_extra_fields[ $table_alias ] |
|
133 | + $existing_fields[$table_alias] = array_merge( |
|
134 | + (array) $existing_fields[$table_alias], |
|
135 | + $this->_extra_fields[$table_alias] |
|
136 | 136 | ); |
137 | 137 | } |
138 | 138 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
164 | 164 | add_filter( |
165 | 165 | $callback_name, |
166 | - array($this, self::dynamic_callback_method_prefix . $method_name_on_model), |
|
166 | + array($this, self::dynamic_callback_method_prefix.$method_name_on_model), |
|
167 | 167 | 10, |
168 | 168 | 10 |
169 | 169 | ); |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | public function deregister() |
179 | 179 | { |
180 | 180 | remove_filter( |
181 | - 'FHEE__EEM_' . $this->_model_name_extended . '__construct__tables', |
|
181 | + 'FHEE__EEM_'.$this->_model_name_extended.'__construct__tables', |
|
182 | 182 | array($this, 'add_extra_tables_on_filter') |
183 | 183 | ); |
184 | 184 | remove_filter( |
185 | - 'FHEE__EEM_' . $this->_model_name_extended . '__construct__fields', |
|
185 | + 'FHEE__EEM_'.$this->_model_name_extended.'__construct__fields', |
|
186 | 186 | array($this, 'add_extra_fields_on_filter') |
187 | 187 | ); |
188 | 188 | remove_filter( |
189 | - 'FHEE__EEM_' . $this->_model_name_extended . '__construct__model_relations', |
|
189 | + 'FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations', |
|
190 | 190 | array($this, 'add_extra_relations_on_filter') |
191 | 191 | ); |
192 | 192 | $all_methods = get_class_methods(get_class($this)); |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
197 | 197 | remove_filter( |
198 | 198 | $callback_name, |
199 | - array($this, self::dynamic_callback_method_prefix . $method_name_on_model), |
|
199 | + array($this, self::dynamic_callback_method_prefix.$method_name_on_model), |
|
200 | 200 | 10 |
201 | 201 | ); |
202 | 202 | } |
203 | 203 | } |
204 | 204 | /** @var EEM_Base $model_to_reset */ |
205 | - $model_to_reset = 'EEM_' . $this->_model_name_extended; |
|
205 | + $model_to_reset = 'EEM_'.$this->_model_name_extended; |
|
206 | 206 | if (class_exists($model_to_reset)) { |
207 | 207 | $model_to_reset::reset(); |
208 | 208 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | // phpcs:disable WordPress.WP.I18n.SingleUnderscoreGetTextFunction |
225 | 225 | $this->_ = $model_called; |
226 | 226 | // phpcs:enable |
227 | - $extending_method = self::extending_method_prefix . $method_called_on_model; |
|
227 | + $extending_method = self::extending_method_prefix.$method_called_on_model; |
|
228 | 228 | if (method_exists($this, $extending_method)) { |
229 | 229 | return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model); |
230 | 230 | } else { |
@@ -12,111 +12,111 @@ |
||
12 | 12 | { |
13 | 13 | |
14 | 14 | |
15 | - /** |
|
16 | - * Sending messenger |
|
17 | - * |
|
18 | - * @type EE_messenger | string |
|
19 | - */ |
|
20 | - protected $_sending_messenger = ''; |
|
21 | - |
|
22 | - |
|
23 | - /** |
|
24 | - * Holds the incoming token; |
|
25 | - * @type string |
|
26 | - */ |
|
27 | - public $token = ''; |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * Constructor |
|
32 | - * |
|
33 | - * @param string $sending_messenger_slug This is used to set what messenger is used to "send" |
|
34 | - * the EE_Message retrieved from the DB via the given token. |
|
35 | - * @param string $token This is a token for a Message that should already exist int the db. |
|
36 | - * This is then used to populate the properties in here. |
|
37 | - * @param EE_Message_Resource_Manager $message_resource_manager |
|
38 | - */ |
|
39 | - public function __construct($token, $sending_messenger_slug = 'html', EE_Message_Resource_Manager $message_resource_manager) |
|
40 | - { |
|
41 | - $this->token = $token; |
|
42 | - $this->_sending_messenger = $this->_set_sending_messenger($sending_messenger_slug, $message_resource_manager); |
|
43 | - $this->_message = $this->_generate_message(); |
|
44 | - // set params for parent from the message object |
|
45 | - parent::__construct( |
|
46 | - $this->_message->messenger(), |
|
47 | - $this->_message->message_type(), |
|
48 | - array(), |
|
49 | - $this->_message->context(), |
|
50 | - false |
|
51 | - ); |
|
52 | - } |
|
53 | - |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * @param string $sending_messenger_slug |
|
58 | - * @param \EE_Message_Resource_Manager $message_resource_manager |
|
59 | - * @return \EE_messenger | string |
|
60 | - */ |
|
61 | - protected function _set_sending_messenger( |
|
62 | - $sending_messenger_slug, |
|
63 | - EE_Message_Resource_Manager $message_resource_manager |
|
64 | - ) { |
|
65 | - $sending_messenger = $message_resource_manager->get_active_messenger($sending_messenger_slug); |
|
66 | - return $sending_messenger instanceof EE_messenger ? $sending_messenger : $sending_messenger_slug; |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * @return EE_messenger |
|
73 | - */ |
|
74 | - public function sending_messenger() |
|
75 | - { |
|
76 | - return $this->_sending_messenger; |
|
77 | - } |
|
78 | - |
|
79 | - |
|
80 | - |
|
81 | - /** |
|
82 | - * generates an EE_Message using the supplied arguments and some defaults |
|
83 | - * |
|
84 | - * @param array $properties |
|
85 | - * @return EE_Message |
|
86 | - * @throws \EE_Error |
|
87 | - */ |
|
88 | - protected function _generate_message($properties = array()) |
|
89 | - { |
|
90 | - // a message was generated immediately but the parent class will call this again |
|
91 | - if ($this->_message instanceof EE_Message) { |
|
92 | - return $this->_message; |
|
93 | - } |
|
94 | - $message = EEM_Message::instance()->get_one_by_token($this->token); |
|
95 | - if (! $message instanceof EE_Message) { |
|
96 | - throw new EE_Error( |
|
97 | - sprintf( |
|
98 | - __('Unable to retrieve generated message from DB using given token: "%1$s"', 'event_espresso'), |
|
99 | - $this->token |
|
100 | - ) |
|
101 | - ); |
|
102 | - } |
|
103 | - $message->set_STS_ID(EEM_Message::status_idle); |
|
104 | - |
|
105 | - if (! $this->_sending_messenger instanceof EE_messenger) { |
|
106 | - $message->set_STS_ID(EEM_Message::status_failed); |
|
107 | - $message->set_error_message( |
|
108 | - sprintf( |
|
109 | - __('Unable to send message because the "%1$s" messenger is not active or not installed', 'event_espresso'), |
|
110 | - $this->_sending_messenger |
|
111 | - ) |
|
112 | - ); |
|
113 | - } |
|
114 | - |
|
115 | - // set properties |
|
116 | - $this->_valid = true; |
|
117 | - $this->_messenger = $message->messenger_object(); |
|
118 | - $this->_message_type = $message->message_type_object(); |
|
119 | - $this->_send_now = $message->send_now(); |
|
120 | - return $message; |
|
121 | - } |
|
15 | + /** |
|
16 | + * Sending messenger |
|
17 | + * |
|
18 | + * @type EE_messenger | string |
|
19 | + */ |
|
20 | + protected $_sending_messenger = ''; |
|
21 | + |
|
22 | + |
|
23 | + /** |
|
24 | + * Holds the incoming token; |
|
25 | + * @type string |
|
26 | + */ |
|
27 | + public $token = ''; |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * Constructor |
|
32 | + * |
|
33 | + * @param string $sending_messenger_slug This is used to set what messenger is used to "send" |
|
34 | + * the EE_Message retrieved from the DB via the given token. |
|
35 | + * @param string $token This is a token for a Message that should already exist int the db. |
|
36 | + * This is then used to populate the properties in here. |
|
37 | + * @param EE_Message_Resource_Manager $message_resource_manager |
|
38 | + */ |
|
39 | + public function __construct($token, $sending_messenger_slug = 'html', EE_Message_Resource_Manager $message_resource_manager) |
|
40 | + { |
|
41 | + $this->token = $token; |
|
42 | + $this->_sending_messenger = $this->_set_sending_messenger($sending_messenger_slug, $message_resource_manager); |
|
43 | + $this->_message = $this->_generate_message(); |
|
44 | + // set params for parent from the message object |
|
45 | + parent::__construct( |
|
46 | + $this->_message->messenger(), |
|
47 | + $this->_message->message_type(), |
|
48 | + array(), |
|
49 | + $this->_message->context(), |
|
50 | + false |
|
51 | + ); |
|
52 | + } |
|
53 | + |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * @param string $sending_messenger_slug |
|
58 | + * @param \EE_Message_Resource_Manager $message_resource_manager |
|
59 | + * @return \EE_messenger | string |
|
60 | + */ |
|
61 | + protected function _set_sending_messenger( |
|
62 | + $sending_messenger_slug, |
|
63 | + EE_Message_Resource_Manager $message_resource_manager |
|
64 | + ) { |
|
65 | + $sending_messenger = $message_resource_manager->get_active_messenger($sending_messenger_slug); |
|
66 | + return $sending_messenger instanceof EE_messenger ? $sending_messenger : $sending_messenger_slug; |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * @return EE_messenger |
|
73 | + */ |
|
74 | + public function sending_messenger() |
|
75 | + { |
|
76 | + return $this->_sending_messenger; |
|
77 | + } |
|
78 | + |
|
79 | + |
|
80 | + |
|
81 | + /** |
|
82 | + * generates an EE_Message using the supplied arguments and some defaults |
|
83 | + * |
|
84 | + * @param array $properties |
|
85 | + * @return EE_Message |
|
86 | + * @throws \EE_Error |
|
87 | + */ |
|
88 | + protected function _generate_message($properties = array()) |
|
89 | + { |
|
90 | + // a message was generated immediately but the parent class will call this again |
|
91 | + if ($this->_message instanceof EE_Message) { |
|
92 | + return $this->_message; |
|
93 | + } |
|
94 | + $message = EEM_Message::instance()->get_one_by_token($this->token); |
|
95 | + if (! $message instanceof EE_Message) { |
|
96 | + throw new EE_Error( |
|
97 | + sprintf( |
|
98 | + __('Unable to retrieve generated message from DB using given token: "%1$s"', 'event_espresso'), |
|
99 | + $this->token |
|
100 | + ) |
|
101 | + ); |
|
102 | + } |
|
103 | + $message->set_STS_ID(EEM_Message::status_idle); |
|
104 | + |
|
105 | + if (! $this->_sending_messenger instanceof EE_messenger) { |
|
106 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
107 | + $message->set_error_message( |
|
108 | + sprintf( |
|
109 | + __('Unable to send message because the "%1$s" messenger is not active or not installed', 'event_espresso'), |
|
110 | + $this->_sending_messenger |
|
111 | + ) |
|
112 | + ); |
|
113 | + } |
|
114 | + |
|
115 | + // set properties |
|
116 | + $this->_valid = true; |
|
117 | + $this->_messenger = $message->messenger_object(); |
|
118 | + $this->_message_type = $message->message_type_object(); |
|
119 | + $this->_send_now = $message->send_now(); |
|
120 | + return $message; |
|
121 | + } |
|
122 | 122 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | return $this->_message; |
93 | 93 | } |
94 | 94 | $message = EEM_Message::instance()->get_one_by_token($this->token); |
95 | - if (! $message instanceof EE_Message) { |
|
95 | + if ( ! $message instanceof EE_Message) { |
|
96 | 96 | throw new EE_Error( |
97 | 97 | sprintf( |
98 | 98 | __('Unable to retrieve generated message from DB using given token: "%1$s"', 'event_espresso'), |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | $message->set_STS_ID(EEM_Message::status_idle); |
104 | 104 | |
105 | - if (! $this->_sending_messenger instanceof EE_messenger) { |
|
105 | + if ( ! $this->_sending_messenger instanceof EE_messenger) { |
|
106 | 106 | $message->set_STS_ID(EEM_Message::status_failed); |
107 | 107 | $message->set_error_message( |
108 | 108 | sprintf( |