| @@ -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; |
| @@ -182,11 +182,15 @@ | ||
| 182 | 182 | * @param string $template |
| 183 | 183 | * |
| 184 | 184 | * @return string |
| 185 | 185 | */ |
| 186 | - public function locateTemplate( $template ) { | |
| 186 | + public function locateTemplate( $template, $default_path = '' ) { | |
| 187 | 187 | |
| 188 | - $file = $this->pluginDirectory . 'views/' . $template; | |
| 188 | + if ( $default_path ) { | |
| 189 | + $file = trailingslashit( $default_path ) . $template; | |
| 190 | + } else { | |
| 191 | + $file = $this->pluginDirectory . 'views/' . $template; | |
| 192 | + } | |
| 189 | 193 | |
| 190 | 194 | if ( strpos( $template, 'frontend/' ) === 0 ) { |
| 191 | 195 | |
| 192 | 196 | $frontendTemplate = str_replace( 'frontend/', '', $template ); |