| @@ -94,10 +94,10 @@ | ||
| 94 | 94 | * |
| 95 | 95 | * @param string $__template |
| 96 | 96 | * @param array $__variables |
| 97 | 97 | */ |
| 98 | - public function includeTemplate( $__template, array $__variables = array() ) { | |
| 99 | - $__template = $this->locateTemplate( $__template ); | |
| 98 | + public function includeTemplate( $__template, array $__variables = array(), $__default_path = '' ) { | |
| 99 | + $__template = $this->locateTemplate( $__template, $__default_path ); | |
| 100 | 100 | |
| 101 | 101 | if ( $__template ) { |
| 102 | 102 | allowedExtract( $__variables ); |
| 103 | 103 | |
| @@ -115,11 +115,11 @@ | ||
| 115 | 115 | * @param array $variables |
| 116 | 116 | * |
| 117 | 117 | * @return string |
| 118 | 118 | */ |
| 119 | - public function renderTemplate( $template, array $variables = array() ) { | |
| 119 | + public function renderTemplate( $template, array $variables = array(), $default_path = '' ) { | |
| 120 | 120 | ob_start(); |
| 121 | - $this->includeTemplate( $template, $variables ); | |
| 121 | + $this->includeTemplate( $template, $variables, $default_path ); | |
| 122 | 122 | $content = ob_get_contents(); |
| 123 | 123 | ob_end_clean(); |
| 124 | 124 | |
| 125 | 125 | return $content; |
| @@ -156,8 +156,28 @@ | ||
| 156 | 156 | return apply_filters( 'tiered_pricing_table/assets/js/url', $this->pluginUrl . 'assets/' . $file . $js, $file ); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | + * Locate CSS assets | |
| 161 | + * | |
| 162 | + * @param string $file | |
| 163 | + * | |
| 164 | + * @return string | |
| 165 | + */ | |
| 166 | + public function locateCSSAsset( $file ) { | |
| 167 | + | |
| 168 | + $file = str_replace( '.css', '', $file ); | |
| 169 | + | |
| 170 | + $css = '.css'; | |
| 171 | + | |
| 172 | + if ( defined( 'TIERED_PRICING_PRODUCTION' ) ) { | |
| 173 | + $css = '.min.css'; | |
| 174 | + } | |
| 175 | + | |
| 176 | + return apply_filters( 'tiered_pricing_table/assets/css/url', $this->pluginUrl . 'assets/' . $file . $css, $file ); | |
| 177 | + } | |
| 178 | + | |
| 179 | + /** | |
| 160 | 180 | * Locate template |
| 161 | 181 | * |
| 162 | 182 | * @param string $template |
| 163 | 183 | * |
| @@ -162,11 +182,15 @@ | ||
| 162 | 182 | * @param string $template |
| 163 | 183 | * |
| 164 | 184 | * @return string |
| 165 | 185 | */ |
| 166 | - public function locateTemplate( $template ) { | |
| 186 | + public function locateTemplate( $template, $default_path = '' ) { | |
| 167 | 187 | |
| 168 | - $file = $this->pluginDirectory . 'views/' . $template; | |
| 188 | + if ( $default_path ) { | |
| 189 | + $file = trailingslashit( $default_path ) . $template; | |
| 190 | + } else { | |
| 191 | + $file = $this->pluginDirectory . 'views/' . $template; | |
| 192 | + } | |
| 169 | 193 | |
| 170 | 194 | if ( strpos( $template, 'frontend/' ) === 0 ) { |
| 171 | 195 | |
| 172 | 196 | $frontendTemplate = str_replace( 'frontend/', '', $template ); |