@@ -1,7 +1,7 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | - exit; // Exit if accessed directly |
|
| 3 | + if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | + exit; // Exit if accessed directly |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -9,110 +9,110 @@ discard block |
||
| 9 | 9 | * |
| 10 | 10 | * @since 1.0.0 |
| 11 | 11 | */ |
| 12 | -class AUI { |
|
| 12 | + class AUI { |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | + /** |
|
| 15 | 15 | * Holds the class instance. |
| 16 | 16 | * |
| 17 | 17 | * @since 1.0.0 |
| 18 | 18 | * @var null |
| 19 | 19 | */ |
| 20 | - private static $instance = null; |
|
| 20 | + private static $instance = null; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 22 | + /** |
|
| 23 | 23 | * Holds the current AUI version number. |
| 24 | 24 | * |
| 25 | 25 | * @var string $ver The current version number. |
| 26 | 26 | */ |
| 27 | - public static $ver = '0.1.72'; |
|
| 27 | + public static $ver = '0.1.72'; |
|
| 28 | 28 | |
| 29 | - public static $options = null; |
|
| 29 | + public static $options = null; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | + /** |
|
| 32 | 32 | * There can be only one. |
| 33 | 33 | * |
| 34 | 34 | * @since 1.0.0 |
| 35 | 35 | * @return AUI|null |
| 36 | 36 | */ |
| 37 | - public static function instance() { |
|
| 38 | - if ( self::$instance == null ) { |
|
| 39 | - self::$instance = new AUI(); |
|
| 40 | - } |
|
| 37 | + public static function instance() { |
|
| 38 | + if ( self::$instance == null ) { |
|
| 39 | + self::$instance = new AUI(); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - return self::$instance; |
|
| 43 | - } |
|
| 42 | + return self::$instance; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | + /** |
|
| 46 | 46 | * AUI constructor. |
| 47 | 47 | * |
| 48 | 48 | * @since 1.0.0 |
| 49 | 49 | */ |
| 50 | - private function __construct() { |
|
| 51 | - if ( function_exists( "__autoload" ) ) { |
|
| 52 | - spl_autoload_register( "__autoload" ); |
|
| 53 | - } |
|
| 54 | - spl_autoload_register( array( $this, 'autoload' ) ); |
|
| 50 | + private function __construct() { |
|
| 51 | + if ( function_exists( "__autoload" ) ) { |
|
| 52 | + spl_autoload_register( "__autoload" ); |
|
| 53 | + } |
|
| 54 | + spl_autoload_register( array( $this, 'autoload' ) ); |
|
| 55 | 55 | |
| 56 | - // load options |
|
| 57 | - self::$options = get_option('aui_options'); |
|
| 58 | - } |
|
| 56 | + // load options |
|
| 57 | + self::$options = get_option('aui_options'); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 60 | + /** |
|
| 61 | 61 | * Autoload any components on the fly. |
| 62 | 62 | * |
| 63 | 63 | * @since 1.0.0 |
| 64 | 64 | * |
| 65 | 65 | * @param $classname |
| 66 | 66 | */ |
| 67 | - private function autoload( $classname ) { |
|
| 68 | - $class = str_replace( '_', '-', strtolower( $classname ) ); |
|
| 69 | - $file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php'; |
|
| 70 | - if ( $file_path && is_readable( $file_path ) ) { |
|
| 71 | - include_once( $file_path ); |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 67 | + private function autoload( $classname ) { |
|
| 68 | + $class = str_replace( '_', '-', strtolower( $classname ) ); |
|
| 69 | + $file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php'; |
|
| 70 | + if ( $file_path && is_readable( $file_path ) ) { |
|
| 71 | + include_once( $file_path ); |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | 76 | * Get the AUI options. |
| 77 | 77 | * |
| 78 | 78 | * @param $option |
| 79 | 79 | * |
| 80 | 80 | * @return string|void |
| 81 | 81 | */ |
| 82 | - public function get_option( $option ){ |
|
| 83 | - $result = isset(self::$options[$option]) ? esc_attr(self::$options[$option]) : ''; |
|
| 84 | - |
|
| 85 | - if ( ! $result && $option) { |
|
| 86 | - if( $option == 'color_primary' ){ |
|
| 87 | - $result = AUI_PRIMARY_COLOR; |
|
| 88 | - }elseif( $option == 'color_secondary' ){ |
|
| 89 | - $result = AUI_SECONDARY_COLOR; |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - return $result; |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - public function render( $items = array(), $echo = false ) { |
|
| 96 | - $output = ''; |
|
| 97 | - |
|
| 98 | - if ( ! empty( $items ) ) { |
|
| 99 | - foreach ( $items as $args ) { |
|
| 100 | - $render = isset( $args['render'] ) ? $args['render'] : ''; |
|
| 101 | - if ( $render && method_exists( __CLASS__, $render ) ) { |
|
| 102 | - $output .= $this->$render( $args ); |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - if ( $echo ) { |
|
| 108 | - echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 109 | - }else{ |
|
| 110 | - return $output; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - /** |
|
| 82 | + public function get_option( $option ){ |
|
| 83 | + $result = isset(self::$options[$option]) ? esc_attr(self::$options[$option]) : ''; |
|
| 84 | + |
|
| 85 | + if ( ! $result && $option) { |
|
| 86 | + if( $option == 'color_primary' ){ |
|
| 87 | + $result = AUI_PRIMARY_COLOR; |
|
| 88 | + }elseif( $option == 'color_secondary' ){ |
|
| 89 | + $result = AUI_SECONDARY_COLOR; |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + return $result; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + public function render( $items = array(), $echo = false ) { |
|
| 96 | + $output = ''; |
|
| 97 | + |
|
| 98 | + if ( ! empty( $items ) ) { |
|
| 99 | + foreach ( $items as $args ) { |
|
| 100 | + $render = isset( $args['render'] ) ? $args['render'] : ''; |
|
| 101 | + if ( $render && method_exists( __CLASS__, $render ) ) { |
|
| 102 | + $output .= $this->$render( $args ); |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + if ( $echo ) { |
|
| 108 | + echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 109 | + }else{ |
|
| 110 | + return $output; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | 116 | * Render and return a bootstrap alert component. |
| 117 | 117 | * |
| 118 | 118 | * @since 1.0.0 |
@@ -122,17 +122,17 @@ discard block |
||
| 122 | 122 | * |
| 123 | 123 | * @return string The rendered component. |
| 124 | 124 | */ |
| 125 | - public function alert( $args = array(), $echo = false ) { |
|
| 126 | - $output = AUI_Component_Alert::get( $args ); |
|
| 125 | + public function alert( $args = array(), $echo = false ) { |
|
| 126 | + $output = AUI_Component_Alert::get( $args ); |
|
| 127 | 127 | |
| 128 | - if ( $echo ) { |
|
| 129 | - echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 130 | - }else{ |
|
| 131 | - return $output; |
|
| 132 | - } |
|
| 133 | - } |
|
| 128 | + if ( $echo ) { |
|
| 129 | + echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 130 | + }else{ |
|
| 131 | + return $output; |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - /** |
|
| 135 | + /** |
|
| 136 | 136 | * Render and return a bootstrap input component. |
| 137 | 137 | * |
| 138 | 138 | * @since 1.0.0 |
@@ -142,17 +142,17 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @return string The rendered component. |
| 144 | 144 | */ |
| 145 | - public function input( $args = array(), $echo = false ) { |
|
| 146 | - $output = AUI_Component_Input::input( $args ); |
|
| 145 | + public function input( $args = array(), $echo = false ) { |
|
| 146 | + $output = AUI_Component_Input::input( $args ); |
|
| 147 | 147 | |
| 148 | - if ( $echo ) { |
|
| 149 | - echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 150 | - }else{ |
|
| 151 | - return $output; |
|
| 152 | - } |
|
| 153 | - } |
|
| 148 | + if ( $echo ) { |
|
| 149 | + echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 150 | + }else{ |
|
| 151 | + return $output; |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - /** |
|
| 155 | + /** |
|
| 156 | 156 | * Render and return a bootstrap textarea component. |
| 157 | 157 | * |
| 158 | 158 | * @since 1.0.0 |
@@ -162,17 +162,17 @@ discard block |
||
| 162 | 162 | * |
| 163 | 163 | * @return string The rendered component. |
| 164 | 164 | */ |
| 165 | - public function textarea( $args = array(), $echo = false ) { |
|
| 166 | - $output = AUI_Component_Input::textarea( $args ); |
|
| 165 | + public function textarea( $args = array(), $echo = false ) { |
|
| 166 | + $output = AUI_Component_Input::textarea( $args ); |
|
| 167 | 167 | |
| 168 | - if ( $echo ) { |
|
| 169 | - echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 170 | - }else{ |
|
| 171 | - return $output; |
|
| 172 | - } |
|
| 173 | - } |
|
| 168 | + if ( $echo ) { |
|
| 169 | + echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 170 | + }else{ |
|
| 171 | + return $output; |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | - /** |
|
| 175 | + /** |
|
| 176 | 176 | * Render and return a bootstrap button component. |
| 177 | 177 | * |
| 178 | 178 | * @since 1.0.0 |
@@ -182,17 +182,17 @@ discard block |
||
| 182 | 182 | * |
| 183 | 183 | * @return string The rendered component. |
| 184 | 184 | */ |
| 185 | - public function button( $args = array(), $echo = false ) { |
|
| 186 | - $output = AUI_Component_Button::get( $args ); |
|
| 185 | + public function button( $args = array(), $echo = false ) { |
|
| 186 | + $output = AUI_Component_Button::get( $args ); |
|
| 187 | 187 | |
| 188 | - if ( $echo ) { |
|
| 189 | - echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 190 | - }else{ |
|
| 191 | - return $output; |
|
| 192 | - } |
|
| 193 | - } |
|
| 188 | + if ( $echo ) { |
|
| 189 | + echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 190 | + }else{ |
|
| 191 | + return $output; |
|
| 192 | + } |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | - /** |
|
| 195 | + /** |
|
| 196 | 196 | * Render and return a bootstrap button component. |
| 197 | 197 | * |
| 198 | 198 | * @since 1.0.0 |
@@ -202,31 +202,31 @@ discard block |
||
| 202 | 202 | * |
| 203 | 203 | * @return string The rendered component. |
| 204 | 204 | */ |
| 205 | - public function badge( $args = array(), $echo = false ) { |
|
| 206 | - $defaults = array( |
|
| 207 | - 'class' => 'badge badge-primary align-middle', |
|
| 208 | - ); |
|
| 205 | + public function badge( $args = array(), $echo = false ) { |
|
| 206 | + $defaults = array( |
|
| 207 | + 'class' => 'badge badge-primary align-middle', |
|
| 208 | + ); |
|
| 209 | 209 | |
| 210 | - // maybe set type. |
|
| 211 | - if ( empty( $args['href'] ) ) { |
|
| 212 | - $defaults['type'] = 'badge'; |
|
| 213 | - } |
|
| 210 | + // maybe set type. |
|
| 211 | + if ( empty( $args['href'] ) ) { |
|
| 212 | + $defaults['type'] = 'badge'; |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | - /** |
|
| 215 | + /** |
|
| 216 | 216 | * Parse incoming $args into an array and merge it with $defaults |
| 217 | 217 | */ |
| 218 | - $args = wp_parse_args( $args, $defaults ); |
|
| 218 | + $args = wp_parse_args( $args, $defaults ); |
|
| 219 | 219 | |
| 220 | - $output = AUI_Component_Button::get( $args ); |
|
| 220 | + $output = AUI_Component_Button::get( $args ); |
|
| 221 | 221 | |
| 222 | - if ( $echo ) { |
|
| 223 | - echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 224 | - }else{ |
|
| 225 | - return $output; |
|
| 226 | - } |
|
| 227 | - } |
|
| 222 | + if ( $echo ) { |
|
| 223 | + echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 224 | + }else{ |
|
| 225 | + return $output; |
|
| 226 | + } |
|
| 227 | + } |
|
| 228 | 228 | |
| 229 | - /** |
|
| 229 | + /** |
|
| 230 | 230 | * Render and return a bootstrap dropdown component. |
| 231 | 231 | * |
| 232 | 232 | * @since 1.0.0 |
@@ -236,17 +236,17 @@ discard block |
||
| 236 | 236 | * |
| 237 | 237 | * @return string The rendered component. |
| 238 | 238 | */ |
| 239 | - public function dropdown( $args = array(), $echo = false ) { |
|
| 240 | - $output = AUI_Component_Dropdown::get( $args ); |
|
| 239 | + public function dropdown( $args = array(), $echo = false ) { |
|
| 240 | + $output = AUI_Component_Dropdown::get( $args ); |
|
| 241 | 241 | |
| 242 | - if ( $echo ) { |
|
| 243 | - echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 244 | - }else{ |
|
| 245 | - return $output; |
|
| 246 | - } |
|
| 247 | - } |
|
| 242 | + if ( $echo ) { |
|
| 243 | + echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 244 | + }else{ |
|
| 245 | + return $output; |
|
| 246 | + } |
|
| 247 | + } |
|
| 248 | 248 | |
| 249 | - /** |
|
| 249 | + /** |
|
| 250 | 250 | * Render and return a bootstrap select component. |
| 251 | 251 | * |
| 252 | 252 | * @since 1.0.0 |
@@ -256,17 +256,17 @@ discard block |
||
| 256 | 256 | * |
| 257 | 257 | * @return string The rendered component. |
| 258 | 258 | */ |
| 259 | - public function select( $args = array(), $echo = false ) { |
|
| 260 | - $output = AUI_Component_Input::select( $args ); |
|
| 259 | + public function select( $args = array(), $echo = false ) { |
|
| 260 | + $output = AUI_Component_Input::select( $args ); |
|
| 261 | 261 | |
| 262 | - if ( $echo ) { |
|
| 263 | - echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 264 | - }else{ |
|
| 265 | - return $output; |
|
| 266 | - } |
|
| 267 | - } |
|
| 262 | + if ( $echo ) { |
|
| 263 | + echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 264 | + }else{ |
|
| 265 | + return $output; |
|
| 266 | + } |
|
| 267 | + } |
|
| 268 | 268 | |
| 269 | - /** |
|
| 269 | + /** |
|
| 270 | 270 | * Render and return a bootstrap radio component. |
| 271 | 271 | * |
| 272 | 272 | * @since 1.0.0 |
@@ -276,17 +276,17 @@ discard block |
||
| 276 | 276 | * |
| 277 | 277 | * @return string The rendered component. |
| 278 | 278 | */ |
| 279 | - public function radio( $args = array(), $echo = false ) { |
|
| 280 | - $output = AUI_Component_Input::radio( $args ); |
|
| 279 | + public function radio( $args = array(), $echo = false ) { |
|
| 280 | + $output = AUI_Component_Input::radio( $args ); |
|
| 281 | 281 | |
| 282 | - if ( $echo ) { |
|
| 283 | - echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 284 | - }else{ |
|
| 285 | - return $output; |
|
| 286 | - } |
|
| 287 | - } |
|
| 282 | + if ( $echo ) { |
|
| 283 | + echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 284 | + }else{ |
|
| 285 | + return $output; |
|
| 286 | + } |
|
| 287 | + } |
|
| 288 | 288 | |
| 289 | - /** |
|
| 289 | + /** |
|
| 290 | 290 | * Render and return a bootstrap pagination component. |
| 291 | 291 | * |
| 292 | 292 | * @since 1.0.0 |
@@ -296,14 +296,14 @@ discard block |
||
| 296 | 296 | * |
| 297 | 297 | * @return string The rendered component. |
| 298 | 298 | */ |
| 299 | - public function pagination( $args = array(), $echo = false ) { |
|
| 300 | - $output = AUI_Component_Pagination::get( $args ); |
|
| 301 | - |
|
| 302 | - if ( $echo ) { |
|
| 303 | - echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 304 | - }else{ |
|
| 305 | - return $output; |
|
| 306 | - } |
|
| 307 | - } |
|
| 299 | + public function pagination( $args = array(), $echo = false ) { |
|
| 300 | + $output = AUI_Component_Pagination::get( $args ); |
|
| 301 | + |
|
| 302 | + if ( $echo ) { |
|
| 303 | + echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 304 | + }else{ |
|
| 305 | + return $output; |
|
| 306 | + } |
|
| 307 | + } |
|
| 308 | 308 | |
| 309 | 309 | } |
| 310 | 310 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | - exit; // Exit if accessed directly |
|
| 3 | + if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | + exit; // Exit if accessed directly |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -9,64 +9,64 @@ discard block |
||
| 9 | 9 | * |
| 10 | 10 | * @since 1.0.0 |
| 11 | 11 | */ |
| 12 | -class AUI_Component_Dropdown { |
|
| 12 | + class AUI_Component_Dropdown { |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | + /** |
|
| 15 | 15 | * Build the component. |
| 16 | 16 | * |
| 17 | 17 | * @param array $args |
| 18 | 18 | * |
| 19 | 19 | * @return string The rendered component. |
| 20 | 20 | */ |
| 21 | - public static function get($args = array()){ |
|
| 22 | - $defaults = array( |
|
| 23 | - 'type' => 'button', |
|
| 24 | - 'href' => '#', |
|
| 25 | - 'class' => 'btn btn-primary dropdown-toggle', |
|
| 26 | - 'wrapper_class' => '', |
|
| 27 | - 'dropdown_menu_class' => '', |
|
| 28 | - 'id' => '', |
|
| 29 | - 'title' => '', |
|
| 30 | - 'value' => '', |
|
| 31 | - 'content' => '', |
|
| 32 | - 'icon' => '', |
|
| 33 | - 'hover_content' => '', |
|
| 34 | - 'hover_icon' => '', |
|
| 35 | - 'data-toggle' => 'dropdown', |
|
| 36 | - 'aria-haspopup' => 'true', |
|
| 37 | - 'aria-expanded' => 'false', |
|
| 38 | - 'dropdown_menu' => '', // unescaped html menu (non-preferred way) |
|
| 39 | - 'dropdown_items' => array(), // array of AUI calls |
|
| 21 | + public static function get($args = array()){ |
|
| 22 | + $defaults = array( |
|
| 23 | + 'type' => 'button', |
|
| 24 | + 'href' => '#', |
|
| 25 | + 'class' => 'btn btn-primary dropdown-toggle', |
|
| 26 | + 'wrapper_class' => '', |
|
| 27 | + 'dropdown_menu_class' => '', |
|
| 28 | + 'id' => '', |
|
| 29 | + 'title' => '', |
|
| 30 | + 'value' => '', |
|
| 31 | + 'content' => '', |
|
| 32 | + 'icon' => '', |
|
| 33 | + 'hover_content' => '', |
|
| 34 | + 'hover_icon' => '', |
|
| 35 | + 'data-toggle' => 'dropdown', |
|
| 36 | + 'aria-haspopup' => 'true', |
|
| 37 | + 'aria-expanded' => 'false', |
|
| 38 | + 'dropdown_menu' => '', // unescaped html menu (non-preferred way) |
|
| 39 | + 'dropdown_items' => array(), // array of AUI calls |
|
| 40 | 40 | |
| 41 | - ); |
|
| 41 | + ); |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | + /** |
|
| 44 | 44 | * Parse incoming $args into an array and merge it with $defaults |
| 45 | 45 | */ |
| 46 | - $args = wp_parse_args( $args, $defaults ); |
|
| 47 | - $output = ''; |
|
| 48 | - if ( ! empty( $args['type'] ) ) { |
|
| 49 | - // wrapper open |
|
| 50 | - $output .= '<div class="dropdown '.AUI_Component_Helper::esc_classes($args['wrapper_class']).'">'; |
|
| 46 | + $args = wp_parse_args( $args, $defaults ); |
|
| 47 | + $output = ''; |
|
| 48 | + if ( ! empty( $args['type'] ) ) { |
|
| 49 | + // wrapper open |
|
| 50 | + $output .= '<div class="dropdown '.AUI_Component_Helper::esc_classes($args['wrapper_class']).'">'; |
|
| 51 | 51 | |
| 52 | - // button part |
|
| 53 | - $output .= aui()->button($args); |
|
| 52 | + // button part |
|
| 53 | + $output .= aui()->button($args); |
|
| 54 | 54 | |
| 55 | - // dropdown-menu |
|
| 56 | - if(!empty($args['dropdown_menu'])){ |
|
| 57 | - $output .= $args['dropdown_menu']; |
|
| 58 | - }elseif(!empty($args['dropdown_items'])){ |
|
| 59 | - $output .= '<div class="dropdown-menu '.AUI_Component_Helper::esc_classes($args['dropdown_menu_class']).'" aria-labelledby="'.sanitize_html_class($args['id']).'">'; |
|
| 60 | - $output .= aui()->render($args['dropdown_items']); |
|
| 61 | - $output .= '</div>'; |
|
| 62 | - } |
|
| 55 | + // dropdown-menu |
|
| 56 | + if(!empty($args['dropdown_menu'])){ |
|
| 57 | + $output .= $args['dropdown_menu']; |
|
| 58 | + }elseif(!empty($args['dropdown_items'])){ |
|
| 59 | + $output .= '<div class="dropdown-menu '.AUI_Component_Helper::esc_classes($args['dropdown_menu_class']).'" aria-labelledby="'.sanitize_html_class($args['id']).'">'; |
|
| 60 | + $output .= aui()->render($args['dropdown_items']); |
|
| 61 | + $output .= '</div>'; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - // wrapper close |
|
| 65 | - $output .= '</div>'; |
|
| 64 | + // wrapper close |
|
| 65 | + $output .= '</div>'; |
|
| 66 | 66 | |
| 67 | - } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - return $output; |
|
| 70 | - } |
|
| 69 | + return $output; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | - exit; // Exit if accessed directly |
|
| 3 | + if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | + exit; // Exit if accessed directly |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -9,89 +9,89 @@ discard block |
||
| 9 | 9 | * |
| 10 | 10 | * @since 1.0.0 |
| 11 | 11 | */ |
| 12 | -class AUI_Component_Alert { |
|
| 12 | + class AUI_Component_Alert { |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | + /** |
|
| 15 | 15 | * Build the component. |
| 16 | 16 | * |
| 17 | 17 | * @param array $args |
| 18 | 18 | * |
| 19 | 19 | * @return string The rendered component. |
| 20 | 20 | */ |
| 21 | - public static function get($args = array()){ |
|
| 22 | - global $aui_bs5; |
|
| 23 | - $defaults = array( |
|
| 24 | - 'type' => 'info', |
|
| 25 | - 'class' => '', |
|
| 26 | - 'icon' => '', |
|
| 27 | - 'heading' => '', |
|
| 28 | - 'content' => '', |
|
| 29 | - 'footer' => '', |
|
| 30 | - 'dismissible'=> false, |
|
| 31 | - 'data' => '', |
|
| 32 | - ); |
|
| 33 | - |
|
| 34 | - /** |
|
| 21 | + public static function get($args = array()){ |
|
| 22 | + global $aui_bs5; |
|
| 23 | + $defaults = array( |
|
| 24 | + 'type' => 'info', |
|
| 25 | + 'class' => '', |
|
| 26 | + 'icon' => '', |
|
| 27 | + 'heading' => '', |
|
| 28 | + 'content' => '', |
|
| 29 | + 'footer' => '', |
|
| 30 | + 'dismissible'=> false, |
|
| 31 | + 'data' => '', |
|
| 32 | + ); |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | 35 | * Parse incoming $args into an array and merge it with $defaults |
| 36 | 36 | */ |
| 37 | - $args = wp_parse_args( $args, $defaults ); |
|
| 38 | - $output = ''; |
|
| 39 | - if ( ! empty( $args['content'] ) ) { |
|
| 40 | - $type = sanitize_html_class( $args['type'] ); |
|
| 41 | - if($type=='error'){$type='danger';} |
|
| 42 | - $icon = !empty($args['icon']) ? "<i class='".esc_attr($args['icon'])."'></i>" : ''; |
|
| 43 | - |
|
| 44 | - // set default icon |
|
| 45 | - if(!$icon && $args['icon']!==false && $type){ |
|
| 46 | - if($type=='danger'){$icon = '<i class="fas fa-exclamation-circle"></i>';} |
|
| 47 | - elseif($type=='warning'){$icon = '<i class="fas fa-exclamation-triangle"></i>';} |
|
| 48 | - elseif($type=='success'){$icon = '<i class="fas fa-check-circle"></i>';} |
|
| 49 | - elseif($type=='info'){$icon = '<i class="fas fa-info-circle"></i>';} |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - $data = ''; |
|
| 53 | - $class = !empty($args['class']) ? esc_attr($args['class']) : ''; |
|
| 54 | - if($args['dismissible']){$class .= " alert-dismissible fade show";} |
|
| 55 | - |
|
| 56 | - // open |
|
| 57 | - $output .= '<div class="alert alert-' . $type . ' '.$class.'" role="alert" '.$data.'>'; |
|
| 58 | - |
|
| 59 | - // heading |
|
| 60 | - if ( ! empty( $args['heading'] ) ) { |
|
| 61 | - $output .= '<h4 class="alert-heading">' . $args['heading'] . '</h4>'; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - // icon |
|
| 65 | - if ( ! empty( $icon) ) { |
|
| 66 | - $output .= $icon." "; |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - // content |
|
| 70 | - $output .= $args['content']; |
|
| 71 | - |
|
| 72 | - // dismissible |
|
| 73 | - if($args['dismissible']){ |
|
| 74 | - |
|
| 75 | - if ( $aui_bs5 ) { |
|
| 76 | - $output .= '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>'; |
|
| 77 | - }else{ |
|
| 78 | - $output .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close">'; |
|
| 79 | - $output .= '<span aria-hidden="true">×</span>'; |
|
| 80 | - $output .= '</button>'; |
|
| 81 | - } |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - // footer |
|
| 85 | - if ( ! empty( $args['footer'] ) ) { |
|
| 86 | - $output .= '<hr>'; |
|
| 87 | - $output .= '<p class="mb-0">' . $args['footer'] . '</p>'; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - // close |
|
| 91 | - $output .= '</div>'; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - return $output; |
|
| 95 | - } |
|
| 37 | + $args = wp_parse_args( $args, $defaults ); |
|
| 38 | + $output = ''; |
|
| 39 | + if ( ! empty( $args['content'] ) ) { |
|
| 40 | + $type = sanitize_html_class( $args['type'] ); |
|
| 41 | + if($type=='error'){$type='danger';} |
|
| 42 | + $icon = !empty($args['icon']) ? "<i class='".esc_attr($args['icon'])."'></i>" : ''; |
|
| 43 | + |
|
| 44 | + // set default icon |
|
| 45 | + if(!$icon && $args['icon']!==false && $type){ |
|
| 46 | + if($type=='danger'){$icon = '<i class="fas fa-exclamation-circle"></i>';} |
|
| 47 | + elseif($type=='warning'){$icon = '<i class="fas fa-exclamation-triangle"></i>';} |
|
| 48 | + elseif($type=='success'){$icon = '<i class="fas fa-check-circle"></i>';} |
|
| 49 | + elseif($type=='info'){$icon = '<i class="fas fa-info-circle"></i>';} |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + $data = ''; |
|
| 53 | + $class = !empty($args['class']) ? esc_attr($args['class']) : ''; |
|
| 54 | + if($args['dismissible']){$class .= " alert-dismissible fade show";} |
|
| 55 | + |
|
| 56 | + // open |
|
| 57 | + $output .= '<div class="alert alert-' . $type . ' '.$class.'" role="alert" '.$data.'>'; |
|
| 58 | + |
|
| 59 | + // heading |
|
| 60 | + if ( ! empty( $args['heading'] ) ) { |
|
| 61 | + $output .= '<h4 class="alert-heading">' . $args['heading'] . '</h4>'; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + // icon |
|
| 65 | + if ( ! empty( $icon) ) { |
|
| 66 | + $output .= $icon." "; |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + // content |
|
| 70 | + $output .= $args['content']; |
|
| 71 | + |
|
| 72 | + // dismissible |
|
| 73 | + if($args['dismissible']){ |
|
| 74 | + |
|
| 75 | + if ( $aui_bs5 ) { |
|
| 76 | + $output .= '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>'; |
|
| 77 | + }else{ |
|
| 78 | + $output .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close">'; |
|
| 79 | + $output .= '<span aria-hidden="true">×</span>'; |
|
| 80 | + $output .= '</button>'; |
|
| 81 | + } |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + // footer |
|
| 85 | + if ( ! empty( $args['footer'] ) ) { |
|
| 86 | + $output .= '<hr>'; |
|
| 87 | + $output .= '<p class="mb-0">' . $args['footer'] . '</p>'; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + // close |
|
| 91 | + $output .= '</div>'; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + return $output; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | 97 | } |
| 98 | 98 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | - exit; // Exit if accessed directly |
|
| 3 | + if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | + exit; // Exit if accessed directly |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -9,145 +9,145 @@ discard block |
||
| 9 | 9 | * |
| 10 | 10 | * @since 1.0.0 |
| 11 | 11 | */ |
| 12 | -class AUI_Component_Button { |
|
| 12 | + class AUI_Component_Button { |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | + /** |
|
| 15 | 15 | * Build the component. |
| 16 | 16 | * |
| 17 | 17 | * @param array $args |
| 18 | 18 | * |
| 19 | 19 | * @return string The rendered component. |
| 20 | 20 | */ |
| 21 | - public static function get($args = array()){ |
|
| 22 | - $defaults = array( |
|
| 23 | - 'type' => 'a', // a, button, badge |
|
| 24 | - 'href' => '#', |
|
| 25 | - 'new_window' => false, |
|
| 26 | - 'class' => 'btn btn-primary', |
|
| 27 | - 'id' => '', |
|
| 28 | - 'title' => '', |
|
| 29 | - 'value' => '', |
|
| 30 | - 'content' => '', |
|
| 31 | - 'icon' => '', |
|
| 32 | - 'hover_content' => '', |
|
| 33 | - 'hover_icon' => '', |
|
| 34 | - 'new_line_after' => true, |
|
| 35 | - 'no_wrap' => true, |
|
| 36 | - 'onclick' => '', |
|
| 37 | - 'style' => '', |
|
| 38 | - 'extra_attributes' => array(), // an array of extra attributes |
|
| 39 | - 'icon_extra_attributes' => array() // an array of icon extra attributes |
|
| 40 | - ); |
|
| 41 | - |
|
| 42 | - /** |
|
| 21 | + public static function get($args = array()){ |
|
| 22 | + $defaults = array( |
|
| 23 | + 'type' => 'a', // a, button, badge |
|
| 24 | + 'href' => '#', |
|
| 25 | + 'new_window' => false, |
|
| 26 | + 'class' => 'btn btn-primary', |
|
| 27 | + 'id' => '', |
|
| 28 | + 'title' => '', |
|
| 29 | + 'value' => '', |
|
| 30 | + 'content' => '', |
|
| 31 | + 'icon' => '', |
|
| 32 | + 'hover_content' => '', |
|
| 33 | + 'hover_icon' => '', |
|
| 34 | + 'new_line_after' => true, |
|
| 35 | + 'no_wrap' => true, |
|
| 36 | + 'onclick' => '', |
|
| 37 | + 'style' => '', |
|
| 38 | + 'extra_attributes' => array(), // an array of extra attributes |
|
| 39 | + 'icon_extra_attributes' => array() // an array of icon extra attributes |
|
| 40 | + ); |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | 43 | * Parse incoming $args into an array and merge it with $defaults |
| 44 | 44 | */ |
| 45 | - $args = wp_parse_args( $args, $defaults ); |
|
| 46 | - $output = ''; |
|
| 47 | - if ( ! empty( $args['type'] ) ) { |
|
| 48 | - $type = $args['type'] != 'a' ? esc_attr($args['type']) : 'a'; |
|
| 49 | - |
|
| 50 | - // open/type |
|
| 51 | - if($type=='a'){ |
|
| 52 | - $new_window = !empty($args['new_window']) ? ' target="_blank" ' : ''; |
|
| 53 | - $output .= '<a href="' . $args['href'] . '"'.$new_window; |
|
| 54 | - }elseif($type=='badge'){ |
|
| 55 | - $output .= '<span '; |
|
| 56 | - }else{ |
|
| 57 | - $output .= '<button type="' . $type . '" '; |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - // name |
|
| 61 | - if(!empty($args['name'])){ |
|
| 62 | - $output .= AUI_Component_Helper::name($args['name']); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - // id |
|
| 66 | - if(!empty($args['id'])){ |
|
| 67 | - $output .= AUI_Component_Helper::id($args['id']); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - // title |
|
| 71 | - if(!empty($args['title'])){ |
|
| 72 | - $output .= AUI_Component_Helper::title($args['title']); |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - // value |
|
| 76 | - if(!empty($args['value'])){ |
|
| 77 | - $output .= AUI_Component_Helper::value($args['value']); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - // class |
|
| 81 | - $class = !empty($args['class']) ? $args['class'] : ''; |
|
| 82 | - $output .= AUI_Component_Helper::class_attr($class); |
|
| 45 | + $args = wp_parse_args( $args, $defaults ); |
|
| 46 | + $output = ''; |
|
| 47 | + if ( ! empty( $args['type'] ) ) { |
|
| 48 | + $type = $args['type'] != 'a' ? esc_attr($args['type']) : 'a'; |
|
| 49 | + |
|
| 50 | + // open/type |
|
| 51 | + if($type=='a'){ |
|
| 52 | + $new_window = !empty($args['new_window']) ? ' target="_blank" ' : ''; |
|
| 53 | + $output .= '<a href="' . $args['href'] . '"'.$new_window; |
|
| 54 | + }elseif($type=='badge'){ |
|
| 55 | + $output .= '<span '; |
|
| 56 | + }else{ |
|
| 57 | + $output .= '<button type="' . $type . '" '; |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + // name |
|
| 61 | + if(!empty($args['name'])){ |
|
| 62 | + $output .= AUI_Component_Helper::name($args['name']); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + // id |
|
| 66 | + if(!empty($args['id'])){ |
|
| 67 | + $output .= AUI_Component_Helper::id($args['id']); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + // title |
|
| 71 | + if(!empty($args['title'])){ |
|
| 72 | + $output .= AUI_Component_Helper::title($args['title']); |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + // value |
|
| 76 | + if(!empty($args['value'])){ |
|
| 77 | + $output .= AUI_Component_Helper::value($args['value']); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + // class |
|
| 81 | + $class = !empty($args['class']) ? $args['class'] : ''; |
|
| 82 | + $output .= AUI_Component_Helper::class_attr($class); |
|
| 83 | 83 | |
| 84 | - // data-attributes |
|
| 85 | - $output .= AUI_Component_Helper::data_attributes($args); |
|
| 84 | + // data-attributes |
|
| 85 | + $output .= AUI_Component_Helper::data_attributes($args); |
|
| 86 | 86 | |
| 87 | - // aria-attributes |
|
| 88 | - $output .= AUI_Component_Helper::aria_attributes($args); |
|
| 87 | + // aria-attributes |
|
| 88 | + $output .= AUI_Component_Helper::aria_attributes($args); |
|
| 89 | 89 | |
| 90 | - // extra attributes |
|
| 91 | - if(!empty($args['extra_attributes'])){ |
|
| 92 | - $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); |
|
| 93 | - } |
|
| 90 | + // extra attributes |
|
| 91 | + if(!empty($args['extra_attributes'])){ |
|
| 92 | + $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - // onclick, we don't escape this |
|
| 96 | - if(!empty($args['onclick'])){ |
|
| 97 | - $output .= ' onclick="'.$args['onclick'].'" '; |
|
| 98 | - } |
|
| 95 | + // onclick, we don't escape this |
|
| 96 | + if(!empty($args['onclick'])){ |
|
| 97 | + $output .= ' onclick="'.$args['onclick'].'" '; |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - // style, we don't escape this |
|
| 101 | - if(!empty($args['style'])){ |
|
| 102 | - $output .= ' style="'.$args['style'].'" '; |
|
| 103 | - } |
|
| 100 | + // style, we don't escape this |
|
| 101 | + if(!empty($args['style'])){ |
|
| 102 | + $output .= ' style="'.$args['style'].'" '; |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - // close opening tag |
|
| 106 | - $output .= ' >'; |
|
| 105 | + // close opening tag |
|
| 106 | + $output .= ' >'; |
|
| 107 | 107 | |
| 108 | 108 | |
| 109 | - // hover content |
|
| 110 | - $hover_content = false; |
|
| 111 | - if(!empty($args['hover_content']) || !empty($args['hover_icon'])){ |
|
| 112 | - $output .= "<span class='hover-content'>".AUI_Component_Helper::icon($args['hover_icon'],$args['hover_content']).$args['hover_content']."</span>"; |
|
| 113 | - $hover_content = true; |
|
| 114 | - } |
|
| 109 | + // hover content |
|
| 110 | + $hover_content = false; |
|
| 111 | + if(!empty($args['hover_content']) || !empty($args['hover_icon'])){ |
|
| 112 | + $output .= "<span class='hover-content'>".AUI_Component_Helper::icon($args['hover_icon'],$args['hover_content']).$args['hover_content']."</span>"; |
|
| 113 | + $hover_content = true; |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - // content |
|
| 117 | - if($hover_content){$output .= "<span class='hover-content-original'>";} |
|
| 118 | - if(!empty($args['content']) || !empty($args['icon'])){ |
|
| 119 | - $output .= AUI_Component_Helper::icon($args['icon'],$args['content'],$args['icon_extra_attributes']).$args['content']; |
|
| 120 | - } |
|
| 121 | - if($hover_content){$output .= "</span>";} |
|
| 116 | + // content |
|
| 117 | + if($hover_content){$output .= "<span class='hover-content-original'>";} |
|
| 118 | + if(!empty($args['content']) || !empty($args['icon'])){ |
|
| 119 | + $output .= AUI_Component_Helper::icon($args['icon'],$args['content'],$args['icon_extra_attributes']).$args['content']; |
|
| 120 | + } |
|
| 121 | + if($hover_content){$output .= "</span>";} |
|
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | |
| 125 | - // close |
|
| 126 | - if($type=='a'){ |
|
| 127 | - $output .= '</a>'; |
|
| 128 | - }elseif($type=='badge'){ |
|
| 129 | - $output .= '</span>'; |
|
| 130 | - }else{ |
|
| 131 | - $output .= '</button>'; |
|
| 132 | - } |
|
| 125 | + // close |
|
| 126 | + if($type=='a'){ |
|
| 127 | + $output .= '</a>'; |
|
| 128 | + }elseif($type=='badge'){ |
|
| 129 | + $output .= '</span>'; |
|
| 130 | + }else{ |
|
| 131 | + $output .= '</button>'; |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | - // maybe new line after? This adds better spacing between buttons. |
|
| 135 | - if(!empty($args['new_line_after'])){ |
|
| 136 | - $output .= PHP_EOL; |
|
| 137 | - } |
|
| 134 | + // maybe new line after? This adds better spacing between buttons. |
|
| 135 | + if(!empty($args['new_line_after'])){ |
|
| 136 | + $output .= PHP_EOL; |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | 139 | |
| 140 | - // wrap |
|
| 141 | - if(!$args['no_wrap']){ |
|
| 142 | - $output = AUI_Component_Input::wrap(array( |
|
| 143 | - 'content' => $output, |
|
| 144 | - )); |
|
| 145 | - } |
|
| 140 | + // wrap |
|
| 141 | + if(!$args['no_wrap']){ |
|
| 142 | + $output = AUI_Component_Input::wrap(array( |
|
| 143 | + 'content' => $output, |
|
| 144 | + )); |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | 147 | |
| 148 | - } |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - return $output; |
|
| 151 | - } |
|
| 150 | + return $output; |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | 153 | } |
| 154 | 154 | \ No newline at end of file |
@@ -577,40 +577,40 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | switch ( $key ) { |
| 579 | 579 | |
| 580 | - case 'total': |
|
| 581 | - echo '<strong>'; |
|
| 582 | - wpinv_the_price( $payment->get_total(), $payment->get_currency() ); |
|
| 583 | - echo '</strong>'; |
|
| 584 | - break; |
|
| 585 | - |
|
| 586 | - case 'relationship': |
|
| 587 | - echo $payment->is_renewal() ? esc_html__( 'Renewal Invoice', 'invoicing' ) : esc_html__( 'Initial Invoice', 'invoicing' ); |
|
| 588 | - break; |
|
| 589 | - |
|
| 590 | - case 'date': |
|
| 591 | - echo esc_html( getpaid_format_date_value( $payment->get_date_created() ) ); |
|
| 592 | - break; |
|
| 593 | - |
|
| 594 | - case 'status': |
|
| 595 | - $status = $payment->get_status_nicename(); |
|
| 596 | - if ( is_admin() ) { |
|
| 597 | - $status = $payment->get_status_label_html(); |
|
| 598 | - } |
|
| 599 | - |
|
| 600 | - echo wp_kses_post( $status ); |
|
| 601 | - break; |
|
| 602 | - |
|
| 603 | - case 'invoice': |
|
| 604 | - if ( ! is_admin() ) { |
|
| 605 | - $link = $payment->get_view_url(); |
|
| 606 | - } else { |
|
| 607 | - $link = get_edit_post_link( $payment->get_id() ); |
|
| 608 | - } |
|
| 609 | - |
|
| 610 | - $invoice = esc_html( $payment->get_number() ); |
|
| 611 | - |
|
| 612 | - echo wp_kses_post( "<a href='" . ( $link ? esc_url( $link ) : '#' ) . "'>$invoice</a>" ); |
|
| 613 | - break; |
|
| 580 | + case 'total': |
|
| 581 | + echo '<strong>'; |
|
| 582 | + wpinv_the_price( $payment->get_total(), $payment->get_currency() ); |
|
| 583 | + echo '</strong>'; |
|
| 584 | + break; |
|
| 585 | + |
|
| 586 | + case 'relationship': |
|
| 587 | + echo $payment->is_renewal() ? esc_html__( 'Renewal Invoice', 'invoicing' ) : esc_html__( 'Initial Invoice', 'invoicing' ); |
|
| 588 | + break; |
|
| 589 | + |
|
| 590 | + case 'date': |
|
| 591 | + echo esc_html( getpaid_format_date_value( $payment->get_date_created() ) ); |
|
| 592 | + break; |
|
| 593 | + |
|
| 594 | + case 'status': |
|
| 595 | + $status = $payment->get_status_nicename(); |
|
| 596 | + if ( is_admin() ) { |
|
| 597 | + $status = $payment->get_status_label_html(); |
|
| 598 | + } |
|
| 599 | + |
|
| 600 | + echo wp_kses_post( $status ); |
|
| 601 | + break; |
|
| 602 | + |
|
| 603 | + case 'invoice': |
|
| 604 | + if ( ! is_admin() ) { |
|
| 605 | + $link = $payment->get_view_url(); |
|
| 606 | + } else { |
|
| 607 | + $link = get_edit_post_link( $payment->get_id() ); |
|
| 608 | + } |
|
| 609 | + |
|
| 610 | + $invoice = esc_html( $payment->get_number() ); |
|
| 611 | + |
|
| 612 | + echo wp_kses_post( "<a href='" . ( $link ? esc_url( $link ) : '#' ) . "'>$invoice</a>" ); |
|
| 613 | + break; |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | echo '</td>'; |
@@ -705,37 +705,37 @@ discard block |
||
| 705 | 705 | |
| 706 | 706 | switch ( $key ) { |
| 707 | 707 | |
| 708 | - case 'item_name': |
|
| 709 | - $item_name = get_the_title( $subscription_group_item['item_id'] ); |
|
| 710 | - $item_name = empty( $item_name ) ? $subscription_group_item['item_name'] : $item_name; |
|
| 708 | + case 'item_name': |
|
| 709 | + $item_name = get_the_title( $subscription_group_item['item_id'] ); |
|
| 710 | + $item_name = empty( $item_name ) ? $subscription_group_item['item_name'] : $item_name; |
|
| 711 | 711 | |
| 712 | - if ( $invoice->get_template() == 'amount' || 1 == (float) $subscription_group_item['quantity'] ) { |
|
| 713 | - echo esc_html( $item_name ); |
|
| 714 | - } else { |
|
| 715 | - printf( '%1$s x %2$d', esc_html( $item_name ), (float) $subscription_group_item['quantity'] ); |
|
| 716 | - } |
|
| 712 | + if ( $invoice->get_template() == 'amount' || 1 == (float) $subscription_group_item['quantity'] ) { |
|
| 713 | + echo esc_html( $item_name ); |
|
| 714 | + } else { |
|
| 715 | + printf( '%1$s x %2$d', esc_html( $item_name ), (float) $subscription_group_item['quantity'] ); |
|
| 716 | + } |
|
| 717 | 717 | |
| 718 | - break; |
|
| 718 | + break; |
|
| 719 | 719 | |
| 720 | - case 'price': |
|
| 721 | - wpinv_the_price( $subscription_group_item['item_price'], $invoice->get_currency() ); |
|
| 722 | - break; |
|
| 720 | + case 'price': |
|
| 721 | + wpinv_the_price( $subscription_group_item['item_price'], $invoice->get_currency() ); |
|
| 722 | + break; |
|
| 723 | 723 | |
| 724 | - case 'tax': |
|
| 725 | - wpinv_the_price( $subscription_group_item['tax'], $invoice->get_currency() ); |
|
| 726 | - break; |
|
| 724 | + case 'tax': |
|
| 725 | + wpinv_the_price( $subscription_group_item['tax'], $invoice->get_currency() ); |
|
| 726 | + break; |
|
| 727 | 727 | |
| 728 | - case 'discount': |
|
| 729 | - wpinv_the_price( $subscription_group_item['discount'], $invoice->get_currency() ); |
|
| 730 | - break; |
|
| 728 | + case 'discount': |
|
| 729 | + wpinv_the_price( $subscription_group_item['discount'], $invoice->get_currency() ); |
|
| 730 | + break; |
|
| 731 | 731 | |
| 732 | - case 'initial': |
|
| 733 | - wpinv_the_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ); |
|
| 734 | - break; |
|
| 732 | + case 'initial': |
|
| 733 | + wpinv_the_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ); |
|
| 734 | + break; |
|
| 735 | 735 | |
| 736 | - case 'recurring': |
|
| 737 | - echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ) . '</strong>' ); |
|
| 738 | - break; |
|
| 736 | + case 'recurring': |
|
| 737 | + echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ) . '</strong>' ); |
|
| 738 | + break; |
|
| 739 | 739 | |
| 740 | 740 | } |
| 741 | 741 | |
@@ -759,29 +759,29 @@ discard block |
||
| 759 | 759 | |
| 760 | 760 | switch ( $key ) { |
| 761 | 761 | |
| 762 | - case 'item_name': |
|
| 763 | - echo esc_html( $subscription_group_fee['name'] ); |
|
| 764 | - break; |
|
| 762 | + case 'item_name': |
|
| 763 | + echo esc_html( $subscription_group_fee['name'] ); |
|
| 764 | + break; |
|
| 765 | 765 | |
| 766 | - case 'price': |
|
| 767 | - wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() ); |
|
| 768 | - break; |
|
| 766 | + case 'price': |
|
| 767 | + wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() ); |
|
| 768 | + break; |
|
| 769 | 769 | |
| 770 | - case 'tax': |
|
| 771 | - echo '—'; |
|
| 772 | - break; |
|
| 770 | + case 'tax': |
|
| 771 | + echo '—'; |
|
| 772 | + break; |
|
| 773 | 773 | |
| 774 | - case 'discount': |
|
| 775 | - echo '—'; |
|
| 776 | - break; |
|
| 774 | + case 'discount': |
|
| 775 | + echo '—'; |
|
| 776 | + break; |
|
| 777 | 777 | |
| 778 | - case 'initial': |
|
| 779 | - wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() ); |
|
| 780 | - break; |
|
| 778 | + case 'initial': |
|
| 779 | + wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() ); |
|
| 780 | + break; |
|
| 781 | 781 | |
| 782 | - case 'recurring': |
|
| 783 | - echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_fee['recurring_fee'], $invoice->get_currency() ) . '</strong>' ); |
|
| 784 | - break; |
|
| 782 | + case 'recurring': |
|
| 783 | + echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_fee['recurring_fee'], $invoice->get_currency() ) . '</strong>' ); |
|
| 784 | + break; |
|
| 785 | 785 | |
| 786 | 786 | } |
| 787 | 787 | |
@@ -886,39 +886,39 @@ discard block |
||
| 886 | 886 | |
| 887 | 887 | switch ( $key ) { |
| 888 | 888 | |
| 889 | - case 'status': |
|
| 890 | - echo wp_kses_post( $_suscription->get_status_label_html() ); |
|
| 891 | - break; |
|
| 892 | - |
|
| 893 | - case 'item': |
|
| 894 | - $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
| 895 | - echo wp_kses_post( implode( ' | ', $markup ) ); |
|
| 896 | - break; |
|
| 897 | - |
|
| 898 | - case 'renewals': |
|
| 899 | - $max_bills = $_suscription->get_bill_times(); |
|
| 900 | - echo ( (int) $_suscription->get_times_billed() ) . ' / ' . ( empty( $max_bills ) ? '∞' : (int) $max_bills ); |
|
| 901 | - break; |
|
| 902 | - |
|
| 903 | - case 'renewal_date': |
|
| 904 | - echo $_suscription->is_active() ? esc_html( getpaid_format_date_value( $_suscription->get_expiration() ) ) : '—'; |
|
| 905 | - break; |
|
| 906 | - |
|
| 907 | - case 'start_date': |
|
| 908 | - echo 'pending' == $_suscription->get_status() ? '—' : esc_html( getpaid_format_date_value( $_suscription->get_date_created() ) ); |
|
| 909 | - break; |
|
| 910 | - |
|
| 911 | - case 'subscription': |
|
| 912 | - $url = is_admin() ? admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $_suscription->get_id() ) ) : $_suscription->get_view_url(); |
|
| 913 | - printf( |
|
| 914 | - '%1$s#%2$s%3$s', |
|
| 915 | - '<a href="' . esc_url( $url ) . '">', |
|
| 916 | - '<strong>' . intval( $_suscription->get_id() ) . '</strong>', |
|
| 917 | - '</a>' |
|
| 918 | - ); |
|
| 919 | - |
|
| 920 | - echo wp_kses_post( WPInv_Subscriptions_List_Table::column_amount( $_suscription ) ); |
|
| 921 | - break; |
|
| 889 | + case 'status': |
|
| 890 | + echo wp_kses_post( $_suscription->get_status_label_html() ); |
|
| 891 | + break; |
|
| 892 | + |
|
| 893 | + case 'item': |
|
| 894 | + $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
| 895 | + echo wp_kses_post( implode( ' | ', $markup ) ); |
|
| 896 | + break; |
|
| 897 | + |
|
| 898 | + case 'renewals': |
|
| 899 | + $max_bills = $_suscription->get_bill_times(); |
|
| 900 | + echo ( (int) $_suscription->get_times_billed() ) . ' / ' . ( empty( $max_bills ) ? '∞' : (int) $max_bills ); |
|
| 901 | + break; |
|
| 902 | + |
|
| 903 | + case 'renewal_date': |
|
| 904 | + echo $_suscription->is_active() ? esc_html( getpaid_format_date_value( $_suscription->get_expiration() ) ) : '—'; |
|
| 905 | + break; |
|
| 906 | + |
|
| 907 | + case 'start_date': |
|
| 908 | + echo 'pending' == $_suscription->get_status() ? '—' : esc_html( getpaid_format_date_value( $_suscription->get_date_created() ) ); |
|
| 909 | + break; |
|
| 910 | + |
|
| 911 | + case 'subscription': |
|
| 912 | + $url = is_admin() ? admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $_suscription->get_id() ) ) : $_suscription->get_view_url(); |
|
| 913 | + printf( |
|
| 914 | + '%1$s#%2$s%3$s', |
|
| 915 | + '<a href="' . esc_url( $url ) . '">', |
|
| 916 | + '<strong>' . intval( $_suscription->get_id() ) . '</strong>', |
|
| 917 | + '</a>' |
|
| 918 | + ); |
|
| 919 | + |
|
| 920 | + echo wp_kses_post( WPInv_Subscriptions_List_Table::column_amount( $_suscription ) ); |
|
| 921 | + break; |
|
| 922 | 922 | |
| 923 | 923 | } |
| 924 | 924 | |
@@ -20,40 +20,40 @@ |
||
| 20 | 20 | |
| 21 | 21 | switch ( $column ) : |
| 22 | 22 | |
| 23 | - case 'subscription': |
|
| 24 | - $subscription_id = (int) $subscription->get_id(); |
|
| 25 | - $url = esc_url( $subscription->get_view_url() ); |
|
| 26 | - $id_label = sprintf( |
|
| 27 | - esc_attr_x( '#%s', 'subscription id', 'invoicing' ), |
|
| 28 | - (int) $subscription->get_id() |
|
| 29 | - ); |
|
| 23 | + case 'subscription': |
|
| 24 | + $subscription_id = (int) $subscription->get_id(); |
|
| 25 | + $url = esc_url( $subscription->get_view_url() ); |
|
| 26 | + $id_label = sprintf( |
|
| 27 | + esc_attr_x( '#%s', 'subscription id', 'invoicing' ), |
|
| 28 | + (int) $subscription->get_id() |
|
| 29 | + ); |
|
| 30 | 30 | |
| 31 | - echo wp_kses_post( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>" ); |
|
| 32 | - break; |
|
| 31 | + echo wp_kses_post( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>" ); |
|
| 32 | + break; |
|
| 33 | 33 | |
| 34 | - case 'status': |
|
| 35 | - echo wp_kses_post( $subscription->get_status_label_html() ); |
|
| 36 | - break; |
|
| 34 | + case 'status': |
|
| 35 | + echo wp_kses_post( $subscription->get_status_label_html() ); |
|
| 36 | + break; |
|
| 37 | 37 | |
| 38 | - case 'renewal-date': |
|
| 39 | - $renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() ); |
|
| 40 | - echo $subscription->is_active() ? esc_html( $renewal ) : '—'; |
|
| 41 | - break; |
|
| 38 | + case 'renewal-date': |
|
| 39 | + $renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() ); |
|
| 40 | + echo $subscription->is_active() ? esc_html( $renewal ) : '—'; |
|
| 41 | + break; |
|
| 42 | 42 | |
| 43 | - case 'amount': |
|
| 44 | - $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
| 45 | - $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
| 46 | - echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" ); |
|
| 47 | - break; |
|
| 43 | + case 'amount': |
|
| 44 | + $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
| 45 | + $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
| 46 | + echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" ); |
|
| 47 | + break; |
|
| 48 | 48 | |
| 49 | - case 'actions': |
|
| 50 | - echo wp_kses_post( $widget->add_row_actions( '', $subscription ) ); |
|
| 51 | - break; |
|
| 49 | + case 'actions': |
|
| 50 | + echo wp_kses_post( $widget->add_row_actions( '', $subscription ) ); |
|
| 51 | + break; |
|
| 52 | 52 | |
| 53 | - endswitch; |
|
| 53 | + endswitch; |
|
| 54 | 54 | |
| 55 | - do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription ); |
|
| 55 | + do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription ); |
|
| 56 | 56 | |
| 57 | - echo '</td>'; |
|
| 57 | + echo '</td>'; |
|
| 58 | 58 | |
| 59 | -endforeach; |
|
| 59 | + endforeach; |
|
@@ -962,8 +962,8 @@ |
||
| 962 | 962 | aui_flip_color_scheme_on_scroll(); |
| 963 | 963 | |
| 964 | 964 | <?php |
| 965 | - // FSE tweaks. |
|
| 966 | - if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template' || !empty($_REQUEST['canvas']) ){ ?> |
|
| 965 | + // FSE tweaks. |
|
| 966 | + if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template' || !empty($_REQUEST['canvas']) ){ ?> |
|
| 967 | 967 | function aui_fse_set_data_scroll() { |
| 968 | 968 | console.log('init scroll'); |
| 969 | 969 | let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas"); |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php // @todo eventually we need to convert this to non jQuery ?> |
|
| 1 | + <?php // @todo eventually we need to convert this to non jQuery ?> |
|
| 2 | 2 | <script> |
| 3 | 3 | /** |
| 4 | 4 | * An AUI bootstrap adaptation of GreedyNav.js ( by Luke Jackson ). |
@@ -1075,8 +1075,8 @@ discard block |
||
| 1075 | 1075 | aui_flip_color_scheme_on_scroll(); |
| 1076 | 1076 | |
| 1077 | 1077 | <?php |
| 1078 | - // FSE tweaks. |
|
| 1079 | - if(!empty($_REQUEST['postType']) || !empty($_REQUEST['canvas']) ){ ?> |
|
| 1078 | + // FSE tweaks. |
|
| 1079 | + if(!empty($_REQUEST['postType']) || !empty($_REQUEST['canvas']) ){ ?> |
|
| 1080 | 1080 | function aui_fse_set_data_scroll() { |
| 1081 | 1081 | console.log('init scroll'); |
| 1082 | 1082 | let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas"); |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays a single line item in an invoice. |
| 4 | 4 | * |
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | * @var array $columns |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -defined( 'ABSPATH' ) || exit; |
|
| 13 | + defined( 'ABSPATH' ) || exit; |
|
| 14 | 14 | |
| 15 | -do_action( 'getpaid_before_invoice_line_item', $invoice, $item ); |
|
| 15 | + do_action( 'getpaid_before_invoice_line_item', $invoice, $item ); |
|
| 16 | 16 | |
| 17 | -?> |
|
| 17 | + ?> |
|
| 18 | 18 | |
| 19 | 19 | <div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo esc_attr( $item->get_type() ); ?> border-bottom'> |
| 20 | 20 | |
@@ -26,90 +26,90 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | 28 | |
| 29 | - // Fires before printing a line item column. |
|
| 30 | - do_action( "getpaid_invoice_line_item_before_$column", $item, $invoice ); |
|
| 29 | + // Fires before printing a line item column. |
|
| 30 | + do_action( "getpaid_invoice_line_item_before_$column", $item, $invoice ); |
|
| 31 | 31 | |
| 32 | - // Item name. |
|
| 33 | - if ( 'name' === $column ) { |
|
| 32 | + // Item name. |
|
| 33 | + if ( 'name' === $column ) { |
|
| 34 | 34 | |
| 35 | - $has_featured_image = has_post_thumbnail( $item->get_id() ); |
|
| 35 | + $has_featured_image = has_post_thumbnail( $item->get_id() ); |
|
| 36 | 36 | |
| 37 | - if ( $has_featured_image ) { |
|
| 38 | - echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">'; |
|
| 39 | - echo '<div class="getpaid-form-item-image-container mr-2" style="width:85px;">'; |
|
| 40 | - echo get_the_post_thumbnail( $item->get_id(), array( 75, 75 ), array( 'class' => 'getpaid-form-item-image mb-0' ) ); |
|
| 41 | - echo '</div>'; |
|
| 42 | - echo '<div class="getpaid-form-item-name-container">'; |
|
| 43 | - } |
|
| 37 | + if ( $has_featured_image ) { |
|
| 38 | + echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">'; |
|
| 39 | + echo '<div class="getpaid-form-item-image-container mr-2" style="width:85px;">'; |
|
| 40 | + echo get_the_post_thumbnail( $item->get_id(), array( 75, 75 ), array( 'class' => 'getpaid-form-item-image mb-0' ) ); |
|
| 41 | + echo '</div>'; |
|
| 42 | + echo '<div class="getpaid-form-item-name-container">'; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - // Display the name. |
|
| 46 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
| 45 | + // Display the name. |
|
| 46 | + echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
| 47 | 47 | |
| 48 | - // And an optional description. |
|
| 49 | - $description = $item->get_description(); |
|
| 48 | + // And an optional description. |
|
| 49 | + $description = $item->get_description(); |
|
| 50 | 50 | |
| 51 | - if ( ! empty( $description ) ) { |
|
| 52 | - echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
| 53 | - } |
|
| 51 | + if ( ! empty( $description ) ) { |
|
| 52 | + echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - // Fires before printing the line item actions. |
|
| 56 | - do_action( 'getpaid_before_invoice_line_item_actions', $item, $invoice ); |
|
| 55 | + // Fires before printing the line item actions. |
|
| 56 | + do_action( 'getpaid_before_invoice_line_item_actions', $item, $invoice ); |
|
| 57 | 57 | |
| 58 | - $actions = apply_filters( 'getpaid-invoice-page-line-item-actions', array(), $item, $invoice ); |
|
| 58 | + $actions = apply_filters( 'getpaid-invoice-page-line-item-actions', array(), $item, $invoice ); |
|
| 59 | 59 | |
| 60 | - if ( ! empty( $actions ) ) { |
|
| 60 | + if ( ! empty( $actions ) ) { |
|
| 61 | 61 | |
| 62 | - $sanitized = array(); |
|
| 63 | - foreach ( $actions as $key => $item_action ) { |
|
| 64 | - $key = sanitize_html_class( $key ); |
|
| 65 | - $item_action = wp_kses_post( $item_action ); |
|
| 66 | - $sanitized[] = "<span class='$key'>$item_action</span>"; |
|
| 67 | - } |
|
| 62 | + $sanitized = array(); |
|
| 63 | + foreach ( $actions as $key => $item_action ) { |
|
| 64 | + $key = sanitize_html_class( $key ); |
|
| 65 | + $item_action = wp_kses_post( $item_action ); |
|
| 66 | + $sanitized[] = "<span class='$key'>$item_action</span>"; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - echo "<small class='text-primary'>"; |
|
| 70 | - echo wp_kses_post( implode( ' | ', $sanitized ) ); |
|
| 71 | - echo '</small>'; |
|
| 69 | + echo "<small class='text-primary'>"; |
|
| 70 | + echo wp_kses_post( implode( ' | ', $sanitized ) ); |
|
| 71 | + echo '</small>'; |
|
| 72 | 72 | |
| 73 | - } |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - if ( $has_featured_image ) { |
|
| 76 | - echo '</div>'; |
|
| 77 | - echo '</div>'; |
|
| 78 | - } |
|
| 79 | - } |
|
| 75 | + if ( $has_featured_image ) { |
|
| 76 | + echo '</div>'; |
|
| 77 | + echo '</div>'; |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - // Item price. |
|
| 82 | - if ( 'price' === $column ) { |
|
| 81 | + // Item price. |
|
| 82 | + if ( 'price' === $column ) { |
|
| 83 | 83 | |
| 84 | - // Display the item price (or recurring price if this is a renewal invoice) |
|
| 85 | - $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price(); |
|
| 86 | - wpinv_the_price( $price, $invoice->get_currency() ); |
|
| 84 | + // Display the item price (or recurring price if this is a renewal invoice) |
|
| 85 | + $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price(); |
|
| 86 | + wpinv_the_price( $price, $invoice->get_currency() ); |
|
| 87 | 87 | |
| 88 | - } |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - // Tax rate. |
|
| 91 | - if ( 'tax_rate' === $column ) { |
|
| 92 | - echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%'; |
|
| 93 | - } |
|
| 90 | + // Tax rate. |
|
| 91 | + if ( 'tax_rate' === $column ) { |
|
| 92 | + echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%'; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - // Item quantity. |
|
| 96 | - if ( 'quantity' === $column ) { |
|
| 97 | - echo (float) $item->get_quantity(); |
|
| 98 | - } |
|
| 95 | + // Item quantity. |
|
| 96 | + if ( 'quantity' === $column ) { |
|
| 97 | + echo (float) $item->get_quantity(); |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - // Item sub total. |
|
| 101 | - if ( 'subtotal' === $column ) { |
|
| 102 | - $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total(); |
|
| 103 | - wpinv_the_price( $subtotal, $invoice->get_currency() ); |
|
| 104 | - } |
|
| 100 | + // Item sub total. |
|
| 101 | + if ( 'subtotal' === $column ) { |
|
| 102 | + $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total(); |
|
| 103 | + wpinv_the_price( $subtotal, $invoice->get_currency() ); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - // Fires when printing a line item column. |
|
| 107 | - do_action( "getpaid_invoice_line_item_$column", $item, $invoice ); |
|
| 106 | + // Fires when printing a line item column. |
|
| 107 | + do_action( "getpaid_invoice_line_item_$column", $item, $invoice ); |
|
| 108 | 108 | |
| 109 | - // Fires after printing a line item column. |
|
| 110 | - do_action( "getpaid_invoice_line_item_after_$column", $item, $invoice ); |
|
| 109 | + // Fires after printing a line item column. |
|
| 110 | + do_action( "getpaid_invoice_line_item_after_$column", $item, $invoice ); |
|
| 111 | 111 | |
| 112 | - ?> |
|
| 112 | + ?> |
|
| 113 | 113 | |
| 114 | 114 | </div> |
| 115 | 115 | |