@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * Class Constructor. |
| 41 | 41 | * |
| 42 | - * @return void |
|
| 42 | + * @return Shortcodes |
|
| 43 | 43 | */ |
| 44 | 44 | private function __construct() |
| 45 | 45 | { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * Instantiate our class. |
| 55 | 55 | * |
| 56 | - * @return mixed The instance of this class. |
|
| 56 | + * @return Shortcodes|null The instance of this class. |
|
| 57 | 57 | */ |
| 58 | 58 | public static function instance() |
| 59 | 59 | { |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | /** |
| 92 | 92 | * Displays the login form |
| 93 | 93 | * |
| 94 | - * @return void |
|
| 94 | + * @return null|string |
|
| 95 | 95 | */ |
| 96 | 96 | public function loginForm() |
| 97 | 97 | { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | namespace Subway; |
| 21 | 21 | |
| 22 | 22 | if (! defined('ABSPATH') ) { |
| 23 | - return; |
|
| 23 | + return; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -36,153 +36,153 @@ discard block |
||
| 36 | 36 | final class Shortcodes |
| 37 | 37 | { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Class Constructor. |
|
| 41 | - * |
|
| 42 | - * @return void |
|
| 43 | - */ |
|
| 44 | - private function __construct() |
|
| 45 | - { |
|
| 39 | + /** |
|
| 40 | + * Class Constructor. |
|
| 41 | + * |
|
| 42 | + * @return void |
|
| 43 | + */ |
|
| 44 | + private function __construct() |
|
| 45 | + { |
|
| 46 | 46 | |
| 47 | - add_action('init', array( $this, 'register')); |
|
| 47 | + add_action('init', array( $this, 'register')); |
|
| 48 | 48 | |
| 49 | - return $this; |
|
| 49 | + return $this; |
|
| 50 | 50 | |
| 51 | - } |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Instantiate our class. |
|
| 55 | - * |
|
| 56 | - * @return mixed The instance of this class. |
|
| 57 | - */ |
|
| 58 | - public static function instance() |
|
| 59 | - { |
|
| 53 | + /** |
|
| 54 | + * Instantiate our class. |
|
| 55 | + * |
|
| 56 | + * @return mixed The instance of this class. |
|
| 57 | + */ |
|
| 58 | + public static function instance() |
|
| 59 | + { |
|
| 60 | 60 | |
| 61 | - static $instance = null; |
|
| 61 | + static $instance = null; |
|
| 62 | 62 | |
| 63 | - if (null === $instance ) { |
|
| 63 | + if (null === $instance ) { |
|
| 64 | 64 | |
| 65 | - $instance = new Shortcodes(); |
|
| 65 | + $instance = new Shortcodes(); |
|
| 66 | 66 | |
| 67 | - } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - return $instance; |
|
| 69 | + return $instance; |
|
| 70 | 70 | |
| 71 | - } |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Instantiate our class. |
|
| 75 | - * |
|
| 76 | - * @return void |
|
| 77 | - */ |
|
| 78 | - public function register() |
|
| 79 | - { |
|
| 73 | + /** |
|
| 74 | + * Instantiate our class. |
|
| 75 | + * |
|
| 76 | + * @return void |
|
| 77 | + */ |
|
| 78 | + public function register() |
|
| 79 | + { |
|
| 80 | 80 | |
| 81 | - add_shortcode('subway_login', array( $this, 'loginForm' )); |
|
| 81 | + add_shortcode('subway_login', array( $this, 'loginForm' )); |
|
| 82 | 82 | |
| 83 | - add_action('login_form_middle', array( $this, 'loginFormAction' ), 10, 2); |
|
| 83 | + add_action('login_form_middle', array( $this, 'loginFormAction' ), 10, 2); |
|
| 84 | 84 | |
| 85 | - add_action('login_form_middle', array( $this, 'lostPasswordLink' ), 10, 2); |
|
| 85 | + add_action('login_form_middle', array( $this, 'lostPasswordLink' ), 10, 2); |
|
| 86 | 86 | |
| 87 | - return; |
|
| 87 | + return; |
|
| 88 | 88 | |
| 89 | - } |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * Displays the login form |
|
| 93 | - * |
|
| 94 | - * @return void |
|
| 95 | - */ |
|
| 96 | - public function loginForm() |
|
| 97 | - { |
|
| 91 | + /** |
|
| 92 | + * Displays the login form |
|
| 93 | + * |
|
| 94 | + * @return void |
|
| 95 | + */ |
|
| 96 | + public function loginForm() |
|
| 97 | + { |
|
| 98 | 98 | |
| 99 | - $atts = array(); |
|
| 99 | + $atts = array(); |
|
| 100 | 100 | |
| 101 | - return $this->renderTemplate($atts, 'login-form.php'); |
|
| 101 | + return $this->renderTemplate($atts, 'login-form.php'); |
|
| 102 | 102 | |
| 103 | - } |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * Include the specific plugin file if there is no template file. |
|
| 107 | - * |
|
| 108 | - * @param mixed $atts The shortcode attribute. |
|
| 109 | - * @param string $file The shortcode template file. |
|
| 110 | - * |
|
| 111 | - * @return string The html template content. |
|
| 112 | - */ |
|
| 113 | - protected function renderTemplate( $atts, $file = '' ) |
|
| 114 | - { |
|
| 115 | - |
|
| 116 | - ob_start(); |
|
| 117 | - |
|
| 118 | - if (empty($file) ) { |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * Include the specific plugin file if there is no template file. |
|
| 107 | + * |
|
| 108 | + * @param mixed $atts The shortcode attribute. |
|
| 109 | + * @param string $file The shortcode template file. |
|
| 110 | + * |
|
| 111 | + * @return string The html template content. |
|
| 112 | + */ |
|
| 113 | + protected function renderTemplate( $atts, $file = '' ) |
|
| 114 | + { |
|
| 115 | + |
|
| 116 | + ob_start(); |
|
| 117 | + |
|
| 118 | + if (empty($file) ) { |
|
| 119 | 119 | |
| 120 | - return; |
|
| 120 | + return; |
|
| 121 | 121 | |
| 122 | - } |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - $template = SUBWAY_DIR_PATH . 'templates/'.$file; |
|
| 124 | + $template = SUBWAY_DIR_PATH . 'templates/'.$file; |
|
| 125 | 125 | |
| 126 | - if (file_exists($template) ) { |
|
| 126 | + if (file_exists($template) ) { |
|
| 127 | 127 | |
| 128 | - $theme_template = locate_template(array('gears/shortcodes/'.$file )); |
|
| 128 | + $theme_template = locate_template(array('gears/shortcodes/'.$file )); |
|
| 129 | 129 | |
| 130 | - if ($theme_template) { |
|
| 130 | + if ($theme_template) { |
|
| 131 | 131 | |
| 132 | - $template = $theme_template; |
|
| 132 | + $template = $theme_template; |
|
| 133 | 133 | |
| 134 | - } |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - include $template; |
|
| 136 | + include $template; |
|
| 137 | 137 | |
| 138 | - } else { |
|
| 138 | + } else { |
|
| 139 | 139 | |
| 140 | - echo sprintf( |
|
| 141 | - esc_html_e( |
|
| 142 | - 'Subway Error: Unable to find template file in: %1s', 'subway' |
|
| 143 | - ), |
|
| 144 | - $template |
|
| 145 | - ); |
|
| 140 | + echo sprintf( |
|
| 141 | + esc_html_e( |
|
| 142 | + 'Subway Error: Unable to find template file in: %1s', 'subway' |
|
| 143 | + ), |
|
| 144 | + $template |
|
| 145 | + ); |
|
| 146 | 146 | |
| 147 | - } |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - return ob_get_clean(); |
|
| 150 | - } |
|
| 149 | + return ob_get_clean(); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - /** |
|
| 153 | - * The action for our login form. |
|
| 154 | - * |
|
| 155 | - * @param string $__content The current filtered contents. |
|
| 156 | - * |
|
| 157 | - * @return string The content of our login form action. |
|
| 158 | - */ |
|
| 159 | - public function loginFormAction( $__content ) |
|
| 160 | - { |
|
| 152 | + /** |
|
| 153 | + * The action for our login form. |
|
| 154 | + * |
|
| 155 | + * @param string $__content The current filtered contents. |
|
| 156 | + * |
|
| 157 | + * @return string The content of our login form action. |
|
| 158 | + */ |
|
| 159 | + public function loginFormAction( $__content ) |
|
| 160 | + { |
|
| 161 | 161 | |
| 162 | - ob_start(); |
|
| 162 | + ob_start(); |
|
| 163 | 163 | |
| 164 | - do_action('login_form'); |
|
| 164 | + do_action('login_form'); |
|
| 165 | 165 | |
| 166 | - return $__content . ob_get_clean(); |
|
| 167 | - |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * The action for our 'lost password' link. |
|
| 172 | - * |
|
| 173 | - * @param string $content The current filtered contents. |
|
| 174 | - * |
|
| 175 | - * @return string The content of our lost password link. |
|
| 176 | - */ |
|
| 177 | - public function lostPasswordLink( $content ) |
|
| 178 | - { |
|
| 166 | + return $__content . ob_get_clean(); |
|
| 167 | + |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * The action for our 'lost password' link. |
|
| 172 | + * |
|
| 173 | + * @param string $content The current filtered contents. |
|
| 174 | + * |
|
| 175 | + * @return string The content of our lost password link. |
|
| 176 | + */ |
|
| 177 | + public function lostPasswordLink( $content ) |
|
| 178 | + { |
|
| 179 | 179 | |
| 180 | - return $content . $this->renderTemplate( |
|
| 181 | - array(), |
|
| 182 | - 'login-form-lost-password.php' |
|
| 183 | - ); |
|
| 180 | + return $content . $this->renderTemplate( |
|
| 181 | + array(), |
|
| 182 | + 'login-form-lost-password.php' |
|
| 183 | + ); |
|
| 184 | 184 | |
| 185 | - } |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | 187 | } |
| 188 | 188 | |