@@ -11,11 +11,11 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML |
| 13 | 13 | { |
| 14 | - public function __construct($template_file, $args = array(), $options_array = array()) |
|
| 15 | - { |
|
| 16 | - $html = EEH_Template::locate_template($template_file, $args); |
|
| 14 | + public function __construct($template_file, $args = array(), $options_array = array()) |
|
| 15 | + { |
|
| 16 | + $html = EEH_Template::locate_template($template_file, $args); |
|
| 17 | 17 | |
| 18 | 18 | // echo " filepath:$template_file html $html"; |
| 19 | - parent::__construct($html, $options_array); |
|
| 20 | - } |
|
| 19 | + parent::__construct($html, $options_array); |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -2,47 +2,47 @@ |
||
| 2 | 2 | |
| 3 | 3 | class EE_Validation_Error extends Exception |
| 4 | 4 | { |
| 5 | - /** |
|
| 6 | - * Form Section from which this error originated. |
|
| 7 | - * @var EE_Form_Section |
|
| 8 | - */ |
|
| 9 | - protected $_form_section; |
|
| 10 | - /** |
|
| 11 | - * a short string for uniquely identifying the error, which isn't internationalized and |
|
| 12 | - * machines can use to identify the error |
|
| 13 | - * @var string |
|
| 14 | - */ |
|
| 15 | - protected $_string_code; |
|
| 5 | + /** |
|
| 6 | + * Form Section from which this error originated. |
|
| 7 | + * @var EE_Form_Section |
|
| 8 | + */ |
|
| 9 | + protected $_form_section; |
|
| 10 | + /** |
|
| 11 | + * a short string for uniquely identifying the error, which isn't internationalized and |
|
| 12 | + * machines can use to identify the error |
|
| 13 | + * @var string |
|
| 14 | + */ |
|
| 15 | + protected $_string_code; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * When creating a validation error, we need to know which field the error relates to. |
|
| 19 | - * @param string $message message you want to display about this error |
|
| 20 | - * @param string $string_code a code for uniquely identifying the exception |
|
| 21 | - * @param EE_Form_Section_Validatable $form_section |
|
| 22 | - * @param Exception $previous if there was an exception that caused this exception |
|
| 23 | - */ |
|
| 24 | - public function __construct($message = null, $string_code = null, $form_section = null, $previous = null) |
|
| 25 | - { |
|
| 26 | - $this->_form_section = $form_section; |
|
| 27 | - $this->_string_code = $string_code; |
|
| 28 | - parent::__construct($message, 500, $previous); |
|
| 29 | - } |
|
| 17 | + /** |
|
| 18 | + * When creating a validation error, we need to know which field the error relates to. |
|
| 19 | + * @param string $message message you want to display about this error |
|
| 20 | + * @param string $string_code a code for uniquely identifying the exception |
|
| 21 | + * @param EE_Form_Section_Validatable $form_section |
|
| 22 | + * @param Exception $previous if there was an exception that caused this exception |
|
| 23 | + */ |
|
| 24 | + public function __construct($message = null, $string_code = null, $form_section = null, $previous = null) |
|
| 25 | + { |
|
| 26 | + $this->_form_section = $form_section; |
|
| 27 | + $this->_string_code = $string_code; |
|
| 28 | + parent::__construct($message, 500, $previous); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * returns teh form section which caused the error. |
|
| 33 | - * @return EE_Form_Section_Validatable |
|
| 34 | - */ |
|
| 35 | - public function get_form_section() |
|
| 36 | - { |
|
| 37 | - return $this->_form_section; |
|
| 38 | - } |
|
| 39 | - /** |
|
| 40 | - * Sets teh form seciton of the error, in case it wasnt set previously |
|
| 41 | - * @param EE_Form_Section_Validatable $form_section |
|
| 42 | - * @return void |
|
| 43 | - */ |
|
| 44 | - public function set_form_section($form_section) |
|
| 45 | - { |
|
| 46 | - $this->_form_section = $form_section; |
|
| 47 | - } |
|
| 31 | + /** |
|
| 32 | + * returns teh form section which caused the error. |
|
| 33 | + * @return EE_Form_Section_Validatable |
|
| 34 | + */ |
|
| 35 | + public function get_form_section() |
|
| 36 | + { |
|
| 37 | + return $this->_form_section; |
|
| 38 | + } |
|
| 39 | + /** |
|
| 40 | + * Sets teh form seciton of the error, in case it wasnt set previously |
|
| 41 | + * @param EE_Form_Section_Validatable $form_section |
|
| 42 | + * @return void |
|
| 43 | + */ |
|
| 44 | + public function set_form_section($form_section) |
|
| 45 | + { |
|
| 46 | + $this->_form_section = $form_section; |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | // price td |
| 109 | 109 | $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
| 110 | 110 | // total td |
| 111 | - $total = $line_item->is_taxable() ? $line_item->total_no_code() . '*' : $line_item->total_no_code(); |
|
| 111 | + $total = $line_item->is_taxable() ? $line_item->total_no_code().'*' : $line_item->total_no_code(); |
|
| 112 | 112 | $html .= EEH_HTML::td($total, '', 'item_r'); |
| 113 | 113 | // end of row |
| 114 | 114 | $html .= EEH_HTML::trx(); |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
| 133 | 133 | // desc td |
| 134 | 134 | $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
| 135 | - $html .= EEH_HTML::td() . EEH_HTML::tdx(); |
|
| 135 | + $html .= EEH_HTML::td().EEH_HTML::tdx(); |
|
| 136 | 136 | // discount/surcharge td |
| 137 | 137 | if ($line_item->is_percent()) { |
| 138 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
| 138 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
| 139 | 139 | } else { |
| 140 | 140 | $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
| 141 | 141 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | // desc td |
| 165 | 165 | $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
| 166 | 166 | // percent td |
| 167 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c', '', ' colspan="2"'); |
|
| 167 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c', '', ' colspan="2"'); |
|
| 168 | 168 | // total td |
| 169 | 169 | $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
| 170 | 170 | // end of row |
@@ -1,223 +1,223 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * |
|
| 5 | - * Class EE_Invoice_Line_Item_Display_Strategy |
|
| 6 | - * |
|
| 7 | - * Description |
|
| 8 | - * |
|
| 9 | - * @package Event Espresso |
|
| 10 | - * @subpackage core |
|
| 11 | - * @author Brent Christensen |
|
| 12 | - * |
|
| 13 | - * |
|
| 14 | - */ |
|
| 4 | + * |
|
| 5 | + * Class EE_Invoice_Line_Item_Display_Strategy |
|
| 6 | + * |
|
| 7 | + * Description |
|
| 8 | + * |
|
| 9 | + * @package Event Espresso |
|
| 10 | + * @subpackage core |
|
| 11 | + * @author Brent Christensen |
|
| 12 | + * |
|
| 13 | + * |
|
| 14 | + */ |
|
| 15 | 15 | class EE_Invoice_Line_Item_Display_Strategy implements EEI_Line_Item_Display |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @param EE_Line_Item $line_item |
|
| 20 | - * @param array $options |
|
| 21 | - * @return mixed |
|
| 22 | - */ |
|
| 23 | - public function display_line_item(EE_Line_Item $line_item, $options = array()) |
|
| 24 | - { |
|
| 25 | - |
|
| 26 | - $html = ''; |
|
| 27 | - // set some default options and merge with incoming |
|
| 28 | - $default_options = array( |
|
| 29 | - 'show_desc' => true, |
|
| 30 | - 'odd' => false |
|
| 31 | - ); |
|
| 32 | - $options = array_merge($default_options, (array) $options); |
|
| 33 | - |
|
| 34 | - switch ($line_item->type()) { |
|
| 35 | - case EEM_Line_Item::type_total: |
|
| 36 | - // loop thru children |
|
| 37 | - foreach ($line_item->children() as $child_line_item) { |
|
| 38 | - // recursively feed children back into this method |
|
| 39 | - $html .= $this->display_line_item($child_line_item, $options); |
|
| 40 | - } |
|
| 41 | - $html .= $this->_separator_row($options); |
|
| 42 | - $html .= $this->_total_row($line_item, esc_html__('Total', 'event_espresso'), $options); |
|
| 43 | - break; |
|
| 44 | - |
|
| 45 | - |
|
| 46 | - case EEM_Line_Item::type_sub_total: |
|
| 47 | - // loop thru children |
|
| 48 | - foreach ($line_item->children() as $child_line_item) { |
|
| 49 | - // recursively feed children back into this method |
|
| 50 | - $html .= $this->display_line_item($child_line_item, $options); |
|
| 51 | - } |
|
| 52 | - $html .= $this->_total_row($line_item, esc_html__('Sub-Total', 'event_espresso'), $options); |
|
| 53 | - break; |
|
| 54 | - |
|
| 55 | - |
|
| 56 | - case EEM_Line_Item::type_tax_sub_total: |
|
| 57 | - // loop thru children |
|
| 58 | - foreach ($line_item->children() as $child_line_item) { |
|
| 59 | - // recursively feed children back into this method |
|
| 60 | - $html .= $this->display_line_item($child_line_item, $options); |
|
| 61 | - } |
|
| 62 | - $html .= $this->_total_row($line_item, esc_html__('Tax Total', 'event_espresso'), $options); |
|
| 63 | - break; |
|
| 64 | - |
|
| 65 | - |
|
| 66 | - case EEM_Line_Item::type_line_item: |
|
| 67 | - // item row |
|
| 68 | - $html .= $this->_item_row($line_item, $options); |
|
| 69 | - // got any kids? |
|
| 70 | - foreach ($line_item->children() as $child_line_item) { |
|
| 71 | - $this->display_line_item($child_line_item, $options); |
|
| 72 | - } |
|
| 73 | - break; |
|
| 74 | - |
|
| 75 | - |
|
| 76 | - case EEM_Line_Item::type_sub_line_item: |
|
| 77 | - $html .= $this->_sub_item_row($line_item, $options); |
|
| 78 | - break; |
|
| 79 | - |
|
| 80 | - |
|
| 81 | - case EEM_Line_Item::type_tax: |
|
| 82 | - $html .= $this->_tax_row($line_item, $options); |
|
| 83 | - break; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - return $html; |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * _total_row |
|
| 93 | - * |
|
| 94 | - * @param EE_Line_Item $line_item |
|
| 95 | - * @param array $options |
|
| 96 | - * @return mixed |
|
| 97 | - */ |
|
| 98 | - private function _item_row(EE_Line_Item $line_item, $options = array()) |
|
| 99 | - { |
|
| 100 | - // start of row |
|
| 101 | - $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
| 102 | - $html = EEH_HTML::tr('', $row_class); |
|
| 103 | - // name td |
|
| 104 | - $html .= EEH_HTML::td($line_item->name(), '', 'item_l'); |
|
| 105 | - // desc td |
|
| 106 | - $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
| 107 | - // quantity td |
|
| 108 | - $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l'); |
|
| 109 | - // price td |
|
| 110 | - $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
| 111 | - // total td |
|
| 112 | - $total = $line_item->is_taxable() ? $line_item->total_no_code() . '*' : $line_item->total_no_code(); |
|
| 113 | - $html .= EEH_HTML::td($total, '', 'item_r'); |
|
| 114 | - // end of row |
|
| 115 | - $html .= EEH_HTML::trx(); |
|
| 116 | - return $html; |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * _sub_item_row |
|
| 123 | - * |
|
| 124 | - * @param EE_Line_Item $line_item |
|
| 125 | - * @param array $options |
|
| 126 | - * @return mixed |
|
| 127 | - */ |
|
| 128 | - private function _sub_item_row(EE_Line_Item $line_item, $options = array()) |
|
| 129 | - { |
|
| 130 | - // start of row |
|
| 131 | - $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
| 132 | - // name td |
|
| 133 | - $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
| 134 | - // desc td |
|
| 135 | - $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
| 136 | - $html .= EEH_HTML::td() . EEH_HTML::tdx(); |
|
| 137 | - // discount/surcharge td |
|
| 138 | - if ($line_item->is_percent()) { |
|
| 139 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
| 140 | - } else { |
|
| 141 | - $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
| 142 | - } |
|
| 143 | - // total td |
|
| 144 | - $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
| 145 | - // end of row |
|
| 146 | - $html .= EEH_HTML::trx(); |
|
| 147 | - return $html; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * _tax_row |
|
| 154 | - * |
|
| 155 | - * @param EE_Line_Item $line_item |
|
| 156 | - * @param array $options |
|
| 157 | - * @return mixed |
|
| 158 | - */ |
|
| 159 | - private function _tax_row(EE_Line_Item $line_item, $options = array()) |
|
| 160 | - { |
|
| 161 | - // start of row |
|
| 162 | - $html = EEH_HTML::tr('', 'item sub-item tax-total'); |
|
| 163 | - // name td |
|
| 164 | - $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
| 165 | - // desc td |
|
| 166 | - $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
| 167 | - // percent td |
|
| 168 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c', '', ' colspan="2"'); |
|
| 169 | - // total td |
|
| 170 | - $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
| 171 | - // end of row |
|
| 172 | - $html .= EEH_HTML::trx(); |
|
| 173 | - return $html; |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * _total_row |
|
| 180 | - * |
|
| 181 | - * @param EE_Line_Item $line_item |
|
| 182 | - * @param string $text |
|
| 183 | - * @param array $options |
|
| 184 | - * @return mixed |
|
| 185 | - */ |
|
| 186 | - private function _total_row(EE_Line_Item $line_item, $text = '', $options = array()) |
|
| 187 | - { |
|
| 188 | - // colspan |
|
| 189 | - $colspan = $options['show_desc'] ? ' colspan="2"' : ''; |
|
| 190 | - // start of row |
|
| 191 | - $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
| 192 | - // empty td |
|
| 193 | - $html .= EEH_HTML::td(EEH_HTML::nbsp(), '', '', '', $colspan); |
|
| 194 | - // total td |
|
| 195 | - $html .= EEH_HTML::td($text, '', 'total_currency total', '', $colspan); |
|
| 196 | - // total td |
|
| 197 | - $html .= EEH_HTML::td($line_item->total_no_code(), '', 'total'); |
|
| 198 | - // end of row |
|
| 199 | - $html .= EEH_HTML::trx(); |
|
| 200 | - return $html; |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * _separator_row |
|
| 207 | - * |
|
| 208 | - * @param array $options |
|
| 209 | - * @return mixed |
|
| 210 | - */ |
|
| 211 | - private function _separator_row($options = array()) |
|
| 212 | - { |
|
| 213 | - // colspan |
|
| 214 | - $colspan = $options['show_desc'] ? ' colspan="5"' : ' colspan="4"'; |
|
| 215 | - // start of row |
|
| 216 | - $html = EEH_HTML::tr(EEH_HTML::td('<hr>', '', '', '', $colspan)); |
|
| 18 | + /** |
|
| 19 | + * @param EE_Line_Item $line_item |
|
| 20 | + * @param array $options |
|
| 21 | + * @return mixed |
|
| 22 | + */ |
|
| 23 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) |
|
| 24 | + { |
|
| 25 | + |
|
| 26 | + $html = ''; |
|
| 27 | + // set some default options and merge with incoming |
|
| 28 | + $default_options = array( |
|
| 29 | + 'show_desc' => true, |
|
| 30 | + 'odd' => false |
|
| 31 | + ); |
|
| 32 | + $options = array_merge($default_options, (array) $options); |
|
| 33 | + |
|
| 34 | + switch ($line_item->type()) { |
|
| 35 | + case EEM_Line_Item::type_total: |
|
| 36 | + // loop thru children |
|
| 37 | + foreach ($line_item->children() as $child_line_item) { |
|
| 38 | + // recursively feed children back into this method |
|
| 39 | + $html .= $this->display_line_item($child_line_item, $options); |
|
| 40 | + } |
|
| 41 | + $html .= $this->_separator_row($options); |
|
| 42 | + $html .= $this->_total_row($line_item, esc_html__('Total', 'event_espresso'), $options); |
|
| 43 | + break; |
|
| 44 | + |
|
| 45 | + |
|
| 46 | + case EEM_Line_Item::type_sub_total: |
|
| 47 | + // loop thru children |
|
| 48 | + foreach ($line_item->children() as $child_line_item) { |
|
| 49 | + // recursively feed children back into this method |
|
| 50 | + $html .= $this->display_line_item($child_line_item, $options); |
|
| 51 | + } |
|
| 52 | + $html .= $this->_total_row($line_item, esc_html__('Sub-Total', 'event_espresso'), $options); |
|
| 53 | + break; |
|
| 54 | + |
|
| 55 | + |
|
| 56 | + case EEM_Line_Item::type_tax_sub_total: |
|
| 57 | + // loop thru children |
|
| 58 | + foreach ($line_item->children() as $child_line_item) { |
|
| 59 | + // recursively feed children back into this method |
|
| 60 | + $html .= $this->display_line_item($child_line_item, $options); |
|
| 61 | + } |
|
| 62 | + $html .= $this->_total_row($line_item, esc_html__('Tax Total', 'event_espresso'), $options); |
|
| 63 | + break; |
|
| 64 | + |
|
| 65 | + |
|
| 66 | + case EEM_Line_Item::type_line_item: |
|
| 67 | + // item row |
|
| 68 | + $html .= $this->_item_row($line_item, $options); |
|
| 69 | + // got any kids? |
|
| 70 | + foreach ($line_item->children() as $child_line_item) { |
|
| 71 | + $this->display_line_item($child_line_item, $options); |
|
| 72 | + } |
|
| 73 | + break; |
|
| 74 | + |
|
| 75 | + |
|
| 76 | + case EEM_Line_Item::type_sub_line_item: |
|
| 77 | + $html .= $this->_sub_item_row($line_item, $options); |
|
| 78 | + break; |
|
| 79 | + |
|
| 80 | + |
|
| 81 | + case EEM_Line_Item::type_tax: |
|
| 82 | + $html .= $this->_tax_row($line_item, $options); |
|
| 83 | + break; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + return $html; |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * _total_row |
|
| 93 | + * |
|
| 94 | + * @param EE_Line_Item $line_item |
|
| 95 | + * @param array $options |
|
| 96 | + * @return mixed |
|
| 97 | + */ |
|
| 98 | + private function _item_row(EE_Line_Item $line_item, $options = array()) |
|
| 99 | + { |
|
| 100 | + // start of row |
|
| 101 | + $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
| 102 | + $html = EEH_HTML::tr('', $row_class); |
|
| 103 | + // name td |
|
| 104 | + $html .= EEH_HTML::td($line_item->name(), '', 'item_l'); |
|
| 105 | + // desc td |
|
| 106 | + $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
| 107 | + // quantity td |
|
| 108 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l'); |
|
| 109 | + // price td |
|
| 110 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
| 111 | + // total td |
|
| 112 | + $total = $line_item->is_taxable() ? $line_item->total_no_code() . '*' : $line_item->total_no_code(); |
|
| 113 | + $html .= EEH_HTML::td($total, '', 'item_r'); |
|
| 114 | + // end of row |
|
| 115 | + $html .= EEH_HTML::trx(); |
|
| 116 | + return $html; |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * _sub_item_row |
|
| 123 | + * |
|
| 124 | + * @param EE_Line_Item $line_item |
|
| 125 | + * @param array $options |
|
| 126 | + * @return mixed |
|
| 127 | + */ |
|
| 128 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) |
|
| 129 | + { |
|
| 130 | + // start of row |
|
| 131 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
| 132 | + // name td |
|
| 133 | + $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
| 134 | + // desc td |
|
| 135 | + $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
| 136 | + $html .= EEH_HTML::td() . EEH_HTML::tdx(); |
|
| 137 | + // discount/surcharge td |
|
| 138 | + if ($line_item->is_percent()) { |
|
| 139 | + $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
| 140 | + } else { |
|
| 141 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
| 142 | + } |
|
| 143 | + // total td |
|
| 144 | + $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
| 145 | + // end of row |
|
| 146 | + $html .= EEH_HTML::trx(); |
|
| 147 | + return $html; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * _tax_row |
|
| 154 | + * |
|
| 155 | + * @param EE_Line_Item $line_item |
|
| 156 | + * @param array $options |
|
| 157 | + * @return mixed |
|
| 158 | + */ |
|
| 159 | + private function _tax_row(EE_Line_Item $line_item, $options = array()) |
|
| 160 | + { |
|
| 161 | + // start of row |
|
| 162 | + $html = EEH_HTML::tr('', 'item sub-item tax-total'); |
|
| 163 | + // name td |
|
| 164 | + $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
| 165 | + // desc td |
|
| 166 | + $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
| 167 | + // percent td |
|
| 168 | + $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c', '', ' colspan="2"'); |
|
| 169 | + // total td |
|
| 170 | + $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
| 171 | + // end of row |
|
| 172 | + $html .= EEH_HTML::trx(); |
|
| 173 | + return $html; |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * _total_row |
|
| 180 | + * |
|
| 181 | + * @param EE_Line_Item $line_item |
|
| 182 | + * @param string $text |
|
| 183 | + * @param array $options |
|
| 184 | + * @return mixed |
|
| 185 | + */ |
|
| 186 | + private function _total_row(EE_Line_Item $line_item, $text = '', $options = array()) |
|
| 187 | + { |
|
| 188 | + // colspan |
|
| 189 | + $colspan = $options['show_desc'] ? ' colspan="2"' : ''; |
|
| 190 | + // start of row |
|
| 191 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
| 192 | + // empty td |
|
| 193 | + $html .= EEH_HTML::td(EEH_HTML::nbsp(), '', '', '', $colspan); |
|
| 194 | + // total td |
|
| 195 | + $html .= EEH_HTML::td($text, '', 'total_currency total', '', $colspan); |
|
| 196 | + // total td |
|
| 197 | + $html .= EEH_HTML::td($line_item->total_no_code(), '', 'total'); |
|
| 198 | + // end of row |
|
| 199 | + $html .= EEH_HTML::trx(); |
|
| 200 | + return $html; |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * _separator_row |
|
| 207 | + * |
|
| 208 | + * @param array $options |
|
| 209 | + * @return mixed |
|
| 210 | + */ |
|
| 211 | + private function _separator_row($options = array()) |
|
| 212 | + { |
|
| 213 | + // colspan |
|
| 214 | + $colspan = $options['show_desc'] ? ' colspan="5"' : ' colspan="4"'; |
|
| 215 | + // start of row |
|
| 216 | + $html = EEH_HTML::tr(EEH_HTML::td('<hr>', '', '', '', $colspan)); |
|
| 217 | 217 | // // separator td |
| 218 | 218 | // $html .= EEH_HTML::td( '<hr>', '', '', '', $colspan ); |
| 219 | 219 | // // end of row |
| 220 | 220 | // $html .= EEH_HTML::trx(); |
| 221 | - return $html; |
|
| 222 | - } |
|
| 221 | + return $html; |
|
| 222 | + } |
|
| 223 | 223 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function set_notice($key, $value) |
| 73 | 73 | { |
| 74 | - $this->_notice[ $key ] = $value; |
|
| 74 | + $this->_notice[$key] = $value; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function get_notice($key) |
| 84 | 84 | { |
| 85 | - return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null; |
|
| 85 | + return isset($this->_notice[$key]) ? $this->_notice[$key] : null; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function add_output($string, $append = true) |
| 105 | 105 | { |
| 106 | - $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
| 106 | + $this->_output = $append ? $this->_output.$string : $string.$this->_output; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
@@ -12,146 +12,146 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class EE_Response |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * @access protected |
|
| 17 | - * @type array $_notice |
|
| 18 | - */ |
|
| 19 | - protected $_notice = array(); |
|
| 20 | - |
|
| 21 | - /** |
|
| 22 | - * rendered output to be returned to WP |
|
| 23 | - * |
|
| 24 | - * @access protected |
|
| 25 | - * @type string |
|
| 26 | - */ |
|
| 27 | - protected $_output = ''; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @access protected |
|
| 31 | - * @type bool |
|
| 32 | - */ |
|
| 33 | - protected $request_terminated = false; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @access protected |
|
| 37 | - * @type bool |
|
| 38 | - */ |
|
| 39 | - protected $deactivate_plugin = false; |
|
| 40 | - |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @deprecated 4.9.53 |
|
| 44 | - * @return \EE_Response |
|
| 45 | - */ |
|
| 46 | - public function __construct() |
|
| 47 | - { |
|
| 48 | - $this->terminate_request(false); |
|
| 49 | - EE_Error::doing_it_wrong( |
|
| 50 | - __METHOD__, |
|
| 51 | - sprintf( |
|
| 52 | - esc_html__( |
|
| 53 | - 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
| 54 | - 'event_espresso' |
|
| 55 | - ), |
|
| 56 | - 'EventEspresso\core\services\request\Response', |
|
| 57 | - '\core\services\request', |
|
| 58 | - 'EventEspresso\core\services\request' |
|
| 59 | - ), |
|
| 60 | - '4.9.53' |
|
| 61 | - ); |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * @deprecated 4.9.53 |
|
| 67 | - * @param $key |
|
| 68 | - * @param $value |
|
| 69 | - * @return void |
|
| 70 | - */ |
|
| 71 | - public function set_notice($key, $value) |
|
| 72 | - { |
|
| 73 | - $this->_notice[ $key ] = $value; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * @deprecated 4.9.53 |
|
| 79 | - * @param $key |
|
| 80 | - * @return mixed |
|
| 81 | - */ |
|
| 82 | - public function get_notice($key) |
|
| 83 | - { |
|
| 84 | - return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * @deprecated 4.9.53 |
|
| 90 | - * @return array |
|
| 91 | - */ |
|
| 92 | - public function get_notices() |
|
| 93 | - { |
|
| 94 | - return $this->_notice; |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * @deprecated 4.9.53 |
|
| 100 | - * @param $string |
|
| 101 | - * @param bool $append |
|
| 102 | - */ |
|
| 103 | - public function add_output($string, $append = true) |
|
| 104 | - { |
|
| 105 | - $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * @deprecated 4.9.53 |
|
| 111 | - * @return string |
|
| 112 | - */ |
|
| 113 | - public function get_output() |
|
| 114 | - { |
|
| 115 | - return $this->_output; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * @deprecated 4.9.53 |
|
| 121 | - * @return boolean |
|
| 122 | - */ |
|
| 123 | - public function request_terminated() |
|
| 124 | - { |
|
| 125 | - return $this->request_terminated; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * @deprecated 4.9.53 |
|
| 131 | - * @param boolean $request_terminated |
|
| 132 | - */ |
|
| 133 | - public function terminate_request($request_terminated = true) |
|
| 134 | - { |
|
| 135 | - $this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * @deprecated 4.9.53 |
|
| 141 | - * @return boolean |
|
| 142 | - */ |
|
| 143 | - public function plugin_deactivated() |
|
| 144 | - { |
|
| 145 | - return $this->deactivate_plugin; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * @deprecated 4.9.53 |
|
| 151 | - * sets $deactivate_plugin to true |
|
| 152 | - */ |
|
| 153 | - public function deactivate_plugin() |
|
| 154 | - { |
|
| 155 | - $this->deactivate_plugin = true; |
|
| 156 | - } |
|
| 15 | + /** |
|
| 16 | + * @access protected |
|
| 17 | + * @type array $_notice |
|
| 18 | + */ |
|
| 19 | + protected $_notice = array(); |
|
| 20 | + |
|
| 21 | + /** |
|
| 22 | + * rendered output to be returned to WP |
|
| 23 | + * |
|
| 24 | + * @access protected |
|
| 25 | + * @type string |
|
| 26 | + */ |
|
| 27 | + protected $_output = ''; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @access protected |
|
| 31 | + * @type bool |
|
| 32 | + */ |
|
| 33 | + protected $request_terminated = false; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @access protected |
|
| 37 | + * @type bool |
|
| 38 | + */ |
|
| 39 | + protected $deactivate_plugin = false; |
|
| 40 | + |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @deprecated 4.9.53 |
|
| 44 | + * @return \EE_Response |
|
| 45 | + */ |
|
| 46 | + public function __construct() |
|
| 47 | + { |
|
| 48 | + $this->terminate_request(false); |
|
| 49 | + EE_Error::doing_it_wrong( |
|
| 50 | + __METHOD__, |
|
| 51 | + sprintf( |
|
| 52 | + esc_html__( |
|
| 53 | + 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
| 54 | + 'event_espresso' |
|
| 55 | + ), |
|
| 56 | + 'EventEspresso\core\services\request\Response', |
|
| 57 | + '\core\services\request', |
|
| 58 | + 'EventEspresso\core\services\request' |
|
| 59 | + ), |
|
| 60 | + '4.9.53' |
|
| 61 | + ); |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * @deprecated 4.9.53 |
|
| 67 | + * @param $key |
|
| 68 | + * @param $value |
|
| 69 | + * @return void |
|
| 70 | + */ |
|
| 71 | + public function set_notice($key, $value) |
|
| 72 | + { |
|
| 73 | + $this->_notice[ $key ] = $value; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * @deprecated 4.9.53 |
|
| 79 | + * @param $key |
|
| 80 | + * @return mixed |
|
| 81 | + */ |
|
| 82 | + public function get_notice($key) |
|
| 83 | + { |
|
| 84 | + return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * @deprecated 4.9.53 |
|
| 90 | + * @return array |
|
| 91 | + */ |
|
| 92 | + public function get_notices() |
|
| 93 | + { |
|
| 94 | + return $this->_notice; |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * @deprecated 4.9.53 |
|
| 100 | + * @param $string |
|
| 101 | + * @param bool $append |
|
| 102 | + */ |
|
| 103 | + public function add_output($string, $append = true) |
|
| 104 | + { |
|
| 105 | + $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * @deprecated 4.9.53 |
|
| 111 | + * @return string |
|
| 112 | + */ |
|
| 113 | + public function get_output() |
|
| 114 | + { |
|
| 115 | + return $this->_output; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * @deprecated 4.9.53 |
|
| 121 | + * @return boolean |
|
| 122 | + */ |
|
| 123 | + public function request_terminated() |
|
| 124 | + { |
|
| 125 | + return $this->request_terminated; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * @deprecated 4.9.53 |
|
| 131 | + * @param boolean $request_terminated |
|
| 132 | + */ |
|
| 133 | + public function terminate_request($request_terminated = true) |
|
| 134 | + { |
|
| 135 | + $this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * @deprecated 4.9.53 |
|
| 141 | + * @return boolean |
|
| 142 | + */ |
|
| 143 | + public function plugin_deactivated() |
|
| 144 | + { |
|
| 145 | + return $this->deactivate_plugin; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * @deprecated 4.9.53 |
|
| 151 | + * sets $deactivate_plugin to true |
|
| 152 | + */ |
|
| 153 | + public function deactivate_plugin() |
|
| 154 | + { |
|
| 155 | + $this->deactivate_plugin = true; |
|
| 156 | + } |
|
| 157 | 157 | } |
@@ -6,14 +6,14 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | class EE_All_Caps_Text_Field extends EE_Text_Field_Base |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * makes it all upper case, and key-like |
|
| 11 | - * |
|
| 12 | - * @param string $value_inputted_for_field_on_model_object |
|
| 13 | - * @return string |
|
| 14 | - */ |
|
| 15 | - public function prepare_for_set($value_inputted_for_field_on_model_object) |
|
| 16 | - { |
|
| 17 | - return strtoupper(sanitize_key($value_inputted_for_field_on_model_object)); |
|
| 18 | - } |
|
| 9 | + /** |
|
| 10 | + * makes it all upper case, and key-like |
|
| 11 | + * |
|
| 12 | + * @param string $value_inputted_for_field_on_model_object |
|
| 13 | + * @return string |
|
| 14 | + */ |
|
| 15 | + public function prepare_for_set($value_inputted_for_field_on_model_object) |
|
| 16 | + { |
|
| 17 | + return strtoupper(sanitize_key($value_inputted_for_field_on_model_object)); |
|
| 18 | + } |
|
| 19 | 19 | } |
@@ -3,27 +3,27 @@ |
||
| 3 | 3 | class EE_Primary_Key_Int_Field extends EE_Primary_Key_Field_Base |
| 4 | 4 | { |
| 5 | 5 | |
| 6 | - public function __construct($table_column, $nicename) |
|
| 7 | - { |
|
| 8 | - parent::__construct($table_column, $nicename, 0); |
|
| 9 | - $this->setSchemaType('integer'); |
|
| 10 | - } |
|
| 6 | + public function __construct($table_column, $nicename) |
|
| 7 | + { |
|
| 8 | + parent::__construct($table_column, $nicename, 0); |
|
| 9 | + $this->setSchemaType('integer'); |
|
| 10 | + } |
|
| 11 | 11 | |
| 12 | - public function prepare_for_set($value_inputted_for_field_on_model_object) |
|
| 13 | - { |
|
| 14 | - if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) { |
|
| 15 | - $value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID(); |
|
| 16 | - } |
|
| 17 | - return absint($value_inputted_for_field_on_model_object); |
|
| 18 | - } |
|
| 12 | + public function prepare_for_set($value_inputted_for_field_on_model_object) |
|
| 13 | + { |
|
| 14 | + if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) { |
|
| 15 | + $value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID(); |
|
| 16 | + } |
|
| 17 | + return absint($value_inputted_for_field_on_model_object); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - public function prepare_for_set_from_db($value_found_in_db_for_model_object) |
|
| 21 | - { |
|
| 22 | - return intval($value_found_in_db_for_model_object); |
|
| 23 | - } |
|
| 20 | + public function prepare_for_set_from_db($value_found_in_db_for_model_object) |
|
| 21 | + { |
|
| 22 | + return intval($value_found_in_db_for_model_object); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function is_auto_increment() |
|
| 26 | - { |
|
| 27 | - return true; |
|
| 28 | - } |
|
| 25 | + public function is_auto_increment() |
|
| 26 | + { |
|
| 27 | + return true; |
|
| 28 | + } |
|
| 29 | 29 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $this->_wp_post_stati = $wp_post_statuses; |
| 81 | 81 | |
| 82 | 82 | foreach ($this->_wp_post_stati as $post_status => $args_object) { |
| 83 | - $this->_allowed_enum_values[ $post_status ] = $args_object->label; |
|
| 83 | + $this->_allowed_enum_values[$post_status] = $args_object->label; |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
@@ -111,6 +111,6 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function get_status_object($status) |
| 113 | 113 | { |
| 114 | - return isset($this->_wp_post_stati[ $status ]) ? $this->_wp_post_stati[ $status ] : false; |
|
| 114 | + return isset($this->_wp_post_stati[$status]) ? $this->_wp_post_stati[$status] : false; |
|
| 115 | 115 | } |
| 116 | 116 | } |
@@ -3,114 +3,114 @@ |
||
| 3 | 3 | class EE_WP_Post_Status_Field extends EE_Enum_Text_Field |
| 4 | 4 | { |
| 5 | 5 | |
| 6 | - protected $_wp_post_stati; |
|
| 6 | + protected $_wp_post_stati; |
|
| 7 | 7 | |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * constructor |
|
| 11 | - * |
|
| 12 | - * @param string $table_column column on table |
|
| 13 | - * @param string $nicename nice name for column(field) |
|
| 14 | - * @param bool $nullable is this field nullable |
|
| 15 | - * @param string $default_value default status |
|
| 16 | - * @param array $new_stati If additional stati are to be used other than the default WP statuses then |
|
| 17 | - * they can be registered via this property. The format of the array should be |
|
| 18 | - * as follows: array( |
|
| 19 | - * 'status_reference' => array( |
|
| 20 | - * 'label' => esc_html__('Status Reference Label', 'event_espresso') |
|
| 21 | - * 'public' => true, //'Whether posts of this status should be shown on the |
|
| 22 | - * frontend of the site' |
|
| 23 | - * 'exclude_from_search' => false, //'Whether posts of this status should be |
|
| 24 | - * excluded from wp searches' |
|
| 25 | - * 'show_in_admin_all_list' => true, //whether posts of this status are included |
|
| 26 | - * in queries for the admin "all" view in list table views. |
|
| 27 | - * 'show_in_admin_status_list' => true, //Show in the list of statuses with post |
|
| 28 | - * counts at the top of the admin list tables (i.e. Status Reference(2) ) |
|
| 29 | - * 'label_count' => _n_noop( 'Status Reference <span class="count">(%s)</span>', |
|
| 30 | - * 'Status References <span class="count">(%s)</span>' ), //the text to display |
|
| 31 | - * on the admin screen( or you won't see your status count ). |
|
| 32 | - * ) |
|
| 33 | - * ) |
|
| 34 | - * @link http://codex.wordpress.org/Function_Reference/register_post_status for more info |
|
| 35 | - * @param boolean $store_in_db_as_int By default, enums are stored as STRINGS in the DB. However, if this var is |
|
| 36 | - * set to true, it will be stored as an INT |
|
| 37 | - */ |
|
| 38 | - public function __construct($table_column, $nicename, $nullable, $default_value, $new_stati = array()) |
|
| 39 | - { |
|
| 40 | - $this->_register_new_stati($new_stati); |
|
| 41 | - $this->_set_allowed_enum_values(); |
|
| 42 | - parent::__construct($table_column, $nicename, $nullable, $default_value, $this->_allowed_enum_values); |
|
| 43 | - } |
|
| 9 | + /** |
|
| 10 | + * constructor |
|
| 11 | + * |
|
| 12 | + * @param string $table_column column on table |
|
| 13 | + * @param string $nicename nice name for column(field) |
|
| 14 | + * @param bool $nullable is this field nullable |
|
| 15 | + * @param string $default_value default status |
|
| 16 | + * @param array $new_stati If additional stati are to be used other than the default WP statuses then |
|
| 17 | + * they can be registered via this property. The format of the array should be |
|
| 18 | + * as follows: array( |
|
| 19 | + * 'status_reference' => array( |
|
| 20 | + * 'label' => esc_html__('Status Reference Label', 'event_espresso') |
|
| 21 | + * 'public' => true, //'Whether posts of this status should be shown on the |
|
| 22 | + * frontend of the site' |
|
| 23 | + * 'exclude_from_search' => false, //'Whether posts of this status should be |
|
| 24 | + * excluded from wp searches' |
|
| 25 | + * 'show_in_admin_all_list' => true, //whether posts of this status are included |
|
| 26 | + * in queries for the admin "all" view in list table views. |
|
| 27 | + * 'show_in_admin_status_list' => true, //Show in the list of statuses with post |
|
| 28 | + * counts at the top of the admin list tables (i.e. Status Reference(2) ) |
|
| 29 | + * 'label_count' => _n_noop( 'Status Reference <span class="count">(%s)</span>', |
|
| 30 | + * 'Status References <span class="count">(%s)</span>' ), //the text to display |
|
| 31 | + * on the admin screen( or you won't see your status count ). |
|
| 32 | + * ) |
|
| 33 | + * ) |
|
| 34 | + * @link http://codex.wordpress.org/Function_Reference/register_post_status for more info |
|
| 35 | + * @param boolean $store_in_db_as_int By default, enums are stored as STRINGS in the DB. However, if this var is |
|
| 36 | + * set to true, it will be stored as an INT |
|
| 37 | + */ |
|
| 38 | + public function __construct($table_column, $nicename, $nullable, $default_value, $new_stati = array()) |
|
| 39 | + { |
|
| 40 | + $this->_register_new_stati($new_stati); |
|
| 41 | + $this->_set_allowed_enum_values(); |
|
| 42 | + parent::__construct($table_column, $nicename, $nullable, $default_value, $this->_allowed_enum_values); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * This registers any new statuses sent via the $new_stati array on construct |
|
| 48 | - * |
|
| 49 | - * @access protected |
|
| 50 | - * @param array $new_stati statuses |
|
| 51 | - * @return void |
|
| 52 | - */ |
|
| 53 | - protected function _register_new_stati($new_stati) |
|
| 54 | - { |
|
| 46 | + /** |
|
| 47 | + * This registers any new statuses sent via the $new_stati array on construct |
|
| 48 | + * |
|
| 49 | + * @access protected |
|
| 50 | + * @param array $new_stati statuses |
|
| 51 | + * @return void |
|
| 52 | + */ |
|
| 53 | + protected function _register_new_stati($new_stati) |
|
| 54 | + { |
|
| 55 | 55 | |
| 56 | - foreach ((array) $new_stati as $status_key => $status_args) { |
|
| 57 | - $args = array( |
|
| 58 | - 'label' => isset($status_args['label']) ? $status_args['label'] : $status_key, |
|
| 59 | - 'public' => isset($status_args['public']) && is_bool($status_args['public']) ? $status_args['public'] : true, |
|
| 60 | - 'exclude_from_search' => isset($status_args['exclude_from_search']) && is_bool($status_args['exclude_from_search']) ? $status_args['exclude_from_search'] : false, |
|
| 61 | - 'show_in_admin_all_list' => isset($status_args['show_in_admin_all_list']) && is_bool($status_args['show_in_admin_all_list']) ? $status_args['show_in_admin_all_list'] : false, |
|
| 62 | - 'show_in_admin_status_list' => isset($status_args['show_in_admin_status_list']) && is_bool($status_args['show_in_admin_status_list']) ? $status_args['show_in_admin_status_list'] : true, |
|
| 63 | - 'label_count' => isset($status_args['label_count']) ? $status_args['label_count'] : '', |
|
| 64 | - ); |
|
| 65 | - register_post_status($status_key, $status_args); |
|
| 66 | - } |
|
| 67 | - } |
|
| 56 | + foreach ((array) $new_stati as $status_key => $status_args) { |
|
| 57 | + $args = array( |
|
| 58 | + 'label' => isset($status_args['label']) ? $status_args['label'] : $status_key, |
|
| 59 | + 'public' => isset($status_args['public']) && is_bool($status_args['public']) ? $status_args['public'] : true, |
|
| 60 | + 'exclude_from_search' => isset($status_args['exclude_from_search']) && is_bool($status_args['exclude_from_search']) ? $status_args['exclude_from_search'] : false, |
|
| 61 | + 'show_in_admin_all_list' => isset($status_args['show_in_admin_all_list']) && is_bool($status_args['show_in_admin_all_list']) ? $status_args['show_in_admin_all_list'] : false, |
|
| 62 | + 'show_in_admin_status_list' => isset($status_args['show_in_admin_status_list']) && is_bool($status_args['show_in_admin_status_list']) ? $status_args['show_in_admin_status_list'] : true, |
|
| 63 | + 'label_count' => isset($status_args['label_count']) ? $status_args['label_count'] : '', |
|
| 64 | + ); |
|
| 65 | + register_post_status($status_key, $status_args); |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * This sets the _allowed_enum_values property using the $wp_post_stati array |
|
| 72 | - * |
|
| 73 | - * @access protected |
|
| 74 | - * @regurn void |
|
| 75 | - */ |
|
| 76 | - protected function _set_allowed_enum_values() |
|
| 77 | - { |
|
| 78 | - // first let's get the post_statuses |
|
| 79 | - global $wp_post_statuses; |
|
| 80 | - $this->_wp_post_stati = $wp_post_statuses; |
|
| 70 | + /** |
|
| 71 | + * This sets the _allowed_enum_values property using the $wp_post_stati array |
|
| 72 | + * |
|
| 73 | + * @access protected |
|
| 74 | + * @regurn void |
|
| 75 | + */ |
|
| 76 | + protected function _set_allowed_enum_values() |
|
| 77 | + { |
|
| 78 | + // first let's get the post_statuses |
|
| 79 | + global $wp_post_statuses; |
|
| 80 | + $this->_wp_post_stati = $wp_post_statuses; |
|
| 81 | 81 | |
| 82 | - foreach ($this->_wp_post_stati as $post_status => $args_object) { |
|
| 83 | - $this->_allowed_enum_values[ $post_status ] = $args_object->label; |
|
| 84 | - } |
|
| 85 | - } |
|
| 82 | + foreach ($this->_wp_post_stati as $post_status => $args_object) { |
|
| 83 | + $this->_allowed_enum_values[ $post_status ] = $args_object->label; |
|
| 84 | + } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Before calling parent, first double-checks our list of acceptable post |
|
| 89 | - * types is up-to-date |
|
| 90 | - * |
|
| 91 | - * @param string $value_inputted_for_field_on_model_object |
|
| 92 | - * @return string |
|
| 93 | - */ |
|
| 94 | - public function prepare_for_set($value_inputted_for_field_on_model_object) |
|
| 95 | - { |
|
| 96 | - $this->_set_allowed_enum_values(); |
|
| 97 | - return parent::prepare_for_set($value_inputted_for_field_on_model_object); |
|
| 98 | - } |
|
| 87 | + /** |
|
| 88 | + * Before calling parent, first double-checks our list of acceptable post |
|
| 89 | + * types is up-to-date |
|
| 90 | + * |
|
| 91 | + * @param string $value_inputted_for_field_on_model_object |
|
| 92 | + * @return string |
|
| 93 | + */ |
|
| 94 | + public function prepare_for_set($value_inputted_for_field_on_model_object) |
|
| 95 | + { |
|
| 96 | + $this->_set_allowed_enum_values(); |
|
| 97 | + return parent::prepare_for_set($value_inputted_for_field_on_model_object); |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | |
| 102 | - // helper methods for getting various $wp_post_statuses stuff. |
|
| 102 | + // helper methods for getting various $wp_post_statuses stuff. |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * This just returns the status object for the given status |
|
| 106 | - * |
|
| 107 | - * @access public |
|
| 108 | - * @see wp_register_post_status in wp-includes/post.php for a list of properties of the status object |
|
| 109 | - * @param string $status What status object you want |
|
| 110 | - * @return std_object the status object or FALSE if it doesn't exist. |
|
| 111 | - */ |
|
| 112 | - public function get_status_object($status) |
|
| 113 | - { |
|
| 114 | - return isset($this->_wp_post_stati[ $status ]) ? $this->_wp_post_stati[ $status ] : false; |
|
| 115 | - } |
|
| 104 | + /** |
|
| 105 | + * This just returns the status object for the given status |
|
| 106 | + * |
|
| 107 | + * @access public |
|
| 108 | + * @see wp_register_post_status in wp-includes/post.php for a list of properties of the status object |
|
| 109 | + * @param string $status What status object you want |
|
| 110 | + * @return std_object the status object or FALSE if it doesn't exist. |
|
| 111 | + */ |
|
| 112 | + public function get_status_object($status) |
|
| 113 | + { |
|
| 114 | + return isset($this->_wp_post_stati[ $status ]) ? $this->_wp_post_stati[ $status ] : false; |
|
| 115 | + } |
|
| 116 | 116 | } |
@@ -2,6 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | class EE_Trashed_Flag_Field extends EE_Boolean_Field |
| 4 | 4 | { |
| 5 | - // note: some client code simply checks if a field IS an EE_Trashed_Flag_Field |
|
| 6 | - // ...otherwise, these fields are mostly the same as boolean fields |
|
| 5 | + // note: some client code simply checks if a field IS an EE_Trashed_Flag_Field |
|
| 6 | + // ...otherwise, these fields are mostly the same as boolean fields |
|
| 7 | 7 | } |
@@ -6,26 +6,26 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | class EE_Integer_Field extends EE_Model_Field_Base |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @param string $table_column |
|
| 11 | - * @param string $nicename |
|
| 12 | - * @param bool $nullable |
|
| 13 | - * @param null $default_value |
|
| 14 | - */ |
|
| 15 | - public function __construct($table_column, $nicename, $nullable, $default_value = null) |
|
| 16 | - { |
|
| 17 | - parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
| 18 | - $this->setSchemaType('integer'); |
|
| 19 | - } |
|
| 9 | + /** |
|
| 10 | + * @param string $table_column |
|
| 11 | + * @param string $nicename |
|
| 12 | + * @param bool $nullable |
|
| 13 | + * @param null $default_value |
|
| 14 | + */ |
|
| 15 | + public function __construct($table_column, $nicename, $nullable, $default_value = null) |
|
| 16 | + { |
|
| 17 | + parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
| 18 | + $this->setSchemaType('integer'); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | 21 | |
| 22 | - public function prepare_for_set($value_inputted_for_field_on_model_object) |
|
| 23 | - { |
|
| 24 | - return intval($value_inputted_for_field_on_model_object); |
|
| 25 | - } |
|
| 22 | + public function prepare_for_set($value_inputted_for_field_on_model_object) |
|
| 23 | + { |
|
| 24 | + return intval($value_inputted_for_field_on_model_object); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function prepare_for_set_from_db($value_inputted_for_field_on_model_object) |
|
| 28 | - { |
|
| 29 | - return intval($value_inputted_for_field_on_model_object); |
|
| 30 | - } |
|
| 27 | + public function prepare_for_set_from_db($value_inputted_for_field_on_model_object) |
|
| 28 | + { |
|
| 29 | + return intval($value_inputted_for_field_on_model_object); |
|
| 30 | + } |
|
| 31 | 31 | } |