1 | <?php |
||
36 | final class Shortcodes |
||
37 | { |
||
38 | |||
39 | /** |
||
40 | * Class Constructor. |
||
41 | * |
||
42 | * @return void |
||
|
|||
43 | */ |
||
44 | private function __construct() |
||
45 | { |
||
46 | |||
47 | add_action('init', array( $this, 'register')); |
||
48 | |||
49 | return $this; |
||
50 | |||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Instantiate our class. |
||
55 | * |
||
56 | * @return mixed The instance of this class. |
||
57 | */ |
||
58 | public static function instance() |
||
59 | { |
||
60 | |||
61 | static $instance = null; |
||
62 | |||
63 | if (null === $instance ) { |
||
64 | |||
65 | $instance = new Shortcodes(); |
||
66 | |||
67 | } |
||
68 | |||
69 | return $instance; |
||
70 | |||
71 | } |
||
72 | |||
73 | /** |
||
74 | * Instantiate our class. |
||
75 | * |
||
76 | * @return void |
||
77 | */ |
||
78 | public function register() |
||
79 | { |
||
80 | |||
81 | add_shortcode('subway_login', array( $this, 'loginForm' )); |
||
82 | |||
83 | add_action('login_form_middle', array( $this, 'loginFormAction' ), 10, 2); |
||
84 | |||
85 | add_action('login_form_middle', array( $this, 'lostPasswordLink' ), 10, 2); |
||
86 | |||
87 | return; |
||
88 | |||
89 | } |
||
90 | |||
91 | /** |
||
92 | * Displays the login form |
||
93 | * |
||
94 | * @return void |
||
95 | */ |
||
96 | public function loginForm( $atts ) |
||
117 | |||
118 | /** |
||
119 | * Include the specific plugin file if there is no template file. |
||
120 | * |
||
121 | * @param mixed $atts The shortcode attribute. |
||
122 | * @param string $file The shortcode template file. |
||
123 | * |
||
124 | * @return string The html template content. |
||
125 | */ |
||
126 | protected function renderTemplate( $atts, $file = '' ) |
||
164 | |||
165 | /** |
||
166 | * The action for our login form. |
||
167 | * |
||
168 | * @param string $__content The current filtered contents. |
||
169 | * |
||
170 | * @return string The content of our login form action. |
||
171 | */ |
||
172 | public function loginFormAction( $__content ) |
||
182 | |||
183 | /** |
||
184 | * The action for our 'lost password' link. |
||
185 | * |
||
186 | * @param string $content The current filtered contents. |
||
187 | * |
||
188 | * @return string The content of our lost password link. |
||
189 | */ |
||
190 | public function lostPasswordLink( $content ) |
||
199 | |||
200 | } |
||
201 | |||
202 | $subway_shortcode = Shortcodes::instance(); |
||
203 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.