Your environment doesn't meet the system requirements listed below. Therefore Plugin Name has been deactivated.
4 | 5 |2 | 3 |
4 | -------------------------------------------------------------------------------- /plugin-name/app/templates/admin/page-settings/page-settings.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
132 | * // get_the_ID function won't be accessible below if the route is registered
133 | * // with 'frontend' type. get_the_ID function will be accessible only if
134 | * // route is registered on Route_Type::LATE_FRONTEND or
135 | * // Route_Type::LATE_FRONTEND_WITH_POSSIBLE_AJAX
136 | * $router->
137 | * ->register_route_of_type( Route_Type::LATE_FRONTEND_WITH_POSSIBLE_AJAX )
138 | * ->with_controller(
139 | * function() {
140 | * if ( get_the_ID() == '3367' ) {
141 | * return 'Sample_Controller';
142 | * }
143 | * return false;
144 | * }
145 | * )
146 | * ->with_view( 'Sample_View' );
147 | *
148 | *
149 | * @since 1.0.0
150 | */
151 | const LATE_FRONTEND_WITH_POSSIBLE_AJAX = 'late_frontend_with_possible_ajax';
152 |
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/plugin-name/core/class-router.php:
--------------------------------------------------------------------------------
1 | register_hook_callbacks();
47 | }
48 |
49 | /**
50 | * Register callbacks for actions and filters
51 | *
52 | * @since 1.0.0
53 | */
54 | protected function register_hook_callbacks() {
55 | add_action( 'init', array( $this, 'register_generic_model_only_routes' ) );
56 | add_action( 'wp', array( $this, 'register_late_frontend_model_only_routes' ) );
57 |
58 | add_action( 'init', array( $this, 'register_generic_routes' ) );
59 | add_action( 'wp', array( $this, 'register_late_frontend_routes' ) );
60 | }
61 |
62 | /**
63 | * Register Generic `Model Only` Routes
64 | *
65 | * @return void
66 | * @since 1.0.0
67 | */
68 | public function register_generic_model_only_routes() {
69 | $this->register_model_only_routes();
70 | }
71 |
72 | /**
73 | * Register Late Frontend `Model Only` Routes
74 | *
75 | * @return void
76 | * @since 1.0.0
77 | */
78 | public function register_late_frontend_model_only_routes() {
79 | $this->register_model_only_routes( self::REGISTER_LATE_FRONTEND_ROUTES );
80 | }
81 |
82 | /**
83 | * Register Generic Routes
84 | *
85 | * @return void
86 | * @since 1.0.0
87 | */
88 | public function register_generic_routes() {
89 | $this->register_routes();
90 | }
91 |
92 | /**
93 | * Register Late Frontend Routes
94 | *
95 | * @return void
96 | * @since 1.0.0
97 | */
98 | public function register_late_frontend_routes() {
99 | $this->register_routes( self::REGISTER_LATE_FRONTEND_ROUTES );
100 | }
101 |
102 | /**
103 | * Returns List of commonly/mostly used Route types
104 | *
105 | * @since 1.0.0
106 | * @return array
107 | */
108 | public function generic_route_types() {
109 | return apply_filters(
110 | 'plugin_name_route_types', [
111 | Route_Type::ANY,
112 | Route_Type::ADMIN,
113 | Route_Type::ADMIN_WITH_POSSIBLE_AJAX,
114 | Route_Type::AJAX,
115 | Route_Type::CRON,
116 | Route_Type::FRONTEND,
117 | Route_Type::FRONTEND_WITH_POSSIBLE_AJAX,
118 | ]
119 | );
120 | }
121 |
122 | /**
123 | * Returns list of Route types belonging to Frontend but registered late
124 | *
125 | * @since 1.0.0
126 | * @return array
127 | */
128 | public function late_frontend_route_types() {
129 | return apply_filters(
130 | 'plugin_name_late_frontend_route_types', [
131 | Route_Type::LATE_FRONTEND,
132 | Route_Type::LATE_FRONTEND_WITH_POSSIBLE_AJAX,
133 | ]
134 | );
135 | }
136 |
137 | /**
138 | * Type of Route to be registered. Every time a new route needs to be
139 | * registered, this function should be called first on `$route` object
140 | *
141 | * @param string $type Type of route to be registered.
142 | * @return Router Returns `Router` object.
143 | * @since 1.0.0
144 | */
145 | public function register_route_of_type( $type ) {
146 | if ( in_array( $type, $this->late_frontend_route_types() ) && did_action( 'wp' ) ) {
147 | trigger_error( __( 'Late Routes can not be registered after `wp` hook is triggered. Register your route before `wp` hook is triggered.', Plugin_Name::PLUGIN_ID ), E_USER_ERROR ); // @codingStandardsIgnoreLine.
148 | }
149 |
150 | if ( in_array( $type, $this->generic_route_types() ) && did_action( 'init' ) ) {
151 | trigger_error( __( 'Non-Late Routes can not be registered after `init` hook is triggered. Register your route before `init` hook is triggered.', Plugin_Name::PLUGIN_ID ), E_USER_ERROR ); // @codingStandardsIgnoreLine.
152 | }
153 |
154 | $this->route_type_to_register = $type;
155 | return $this;
156 | }
157 |
158 | /**
159 | * Enqueues a model to be associated with the Model only` Route
160 | *
161 | * @param mixed $model Model to be associated with the Route. Could be String or callback.
162 | * @return mixed
163 | * @since 1.0.0
164 | */
165 | public function with_just_model( $model ) {
166 | if ( false === $model ) {
167 | return $this;
168 | }
169 | static::$models[ $this->route_type_to_register ][] = $model;
170 | }
171 |
172 | /**
173 | * Generates a Unique id for each controller
174 | *
175 | * This unique id is used as an array key inside mvc_components array which
176 | * is used while enqueueing models and views to associate them with the
177 | * controller.
178 | *
179 | * @param mixed $controller Controller to be associated with the Route. Could be String or callback.
180 | * @return string
181 | * @since 1.0.0
182 | */
183 | public function build_controller_unique_id( $controller ) {
184 | $prefix = mt_rand() . '_';
185 |
186 | if ( is_string( $controller ) ) {
187 | return $prefix . $controller;
188 | }
189 |
190 | if ( is_object( $controller ) ) {
191 | // Closures are currently implemented as objects.
192 | $controller = array( $controller, '' );
193 | } else {
194 | $controller = (array) $controller;
195 | }
196 |
197 | if ( is_object( $controller[0] ) ) {
198 | // Object Class Calling.
199 | return $prefix . spl_object_hash( $controller[0] ) . $controller[1];
200 | }
201 |
202 | if ( is_string( $controller[0] ) ) {
203 | // Static Calling.
204 | return $prefix . $controller[0] . '::' . $controller[1];
205 | }
206 | }
207 |
208 | /**
209 | * Enqueues a controller to be associated with the Route
210 | *
211 | * @param mixed $controller Controller to be associated with the Route. Could be String or callback.
212 | * @return object Returns Router Object
213 | * @since 1.0.0
214 | */
215 | public function with_controller( $controller ) {
216 | if ( false === $controller ) {
217 | return $this;
218 | }
219 |
220 | $this->current_controller = $this->build_controller_unique_id( $controller );
221 |
222 | static::$mvc_components[ $this->route_type_to_register ][ $this->current_controller ] = [ 'controller' => $controller ];
223 |
224 | return $this;
225 | }
226 |
227 | /**
228 | * Enqueues a model to be associated with the Route
229 | *
230 | * The object of this model is passed to controller.
231 | *
232 | * @param mixed $model Model to be associated with the Route. Could be String or callback.
233 | * @return object Returns Router Object
234 | * @since 1.0.0
235 | */
236 | public function with_model( $model ) {
237 | if ( isset( static::$mvc_components[ $this->route_type_to_register ][ $this->current_controller ]['controller'] ) ) {
238 | static::$mvc_components[ $this->route_type_to_register ][ $this->current_controller ]['model'] = $model;
239 | }
240 | return $this;
241 | }
242 |
243 | /**
244 | * Registers view with the Route. The object of this view is passed to controller
245 | *
246 | * @param mixed $view View to be associated with the Route. Could be String or callback.
247 | * @return object Returns Router Object
248 | * @since 1.0.0
249 | */
250 | public function with_view( $view ) {
251 | if ( isset( static::$mvc_components[ $this->route_type_to_register ][ $this->current_controller ]['controller'] ) ) {
252 | static::$mvc_components[ $this->route_type_to_register ][ $this->current_controller ]['view'] = $view;
253 | }
254 | return $this;
255 | }
256 |
257 | /**
258 | * Registers Enqueued Routes
259 | *
260 | * @param boolean $register_late_frontend_routes Whether to register late frontend routes.
261 | * @return void
262 | * @since 1.0.0
263 | */
264 | private function register_routes( $register_late_frontend_routes = false ) {
265 | if ( $register_late_frontend_routes ) {
266 | $route_types = $this->late_frontend_route_types();
267 | } else {
268 | $route_types = $this->generic_route_types();
269 | }
270 |
271 | if ( empty( $route_types ) ) {
272 | return;
273 | }
274 |
275 | foreach ( $route_types as $route_type ) {
276 | if ( $this->is_request( $route_type ) && ! empty( static::$mvc_components[ $route_type ] ) ) {
277 | foreach ( static::$mvc_components[ $route_type ] as $mvc_component ) {
278 | $this->dispatch( $mvc_component, $route_type );
279 | }
280 | }
281 | }
282 | }
283 |
284 | /**
285 | * Dispatches the route of specified $route_type by creating a controller object
286 | *
287 | * @param array $mvc_component Model-View-Controller triads for all registered routes.
288 | * @param string $route_type Route Type.
289 | * @return void
290 | * @since 1.0.0
291 | */
292 | private function dispatch( $mvc_component, $route_type ) {
293 | $model = false;
294 | $view = false;
295 |
296 | if ( isset( $mvc_component['controller'] ) && false === $mvc_component['controller'] ) {
297 | return;
298 | }
299 |
300 | if ( is_callable( $mvc_component['controller'] ) ) {
301 | $mvc_component['controller'] = call_user_func( $mvc_component['controller'] );
302 |
303 | if ( false === $mvc_component['controller'] ) {
304 | return;
305 | }
306 | }
307 |
308 | if ( isset( $mvc_component['model'] ) && false !== $mvc_component['model'] ) {
309 | if ( is_callable( $mvc_component['model'] ) ) {
310 | $mvc_component['model'] = call_user_func( $mvc_component['model'] );
311 | }
312 |
313 | $model = $this->get_fully_qualified_class_name( $mvc_component['model'], 'model', $route_type );
314 | }
315 |
316 | if ( isset( $mvc_component['view'] ) && false !== $mvc_component['view'] ) {
317 | if ( is_callable( $mvc_component['view'] ) ) {
318 | $mvc_component['view'] = call_user_func( $mvc_component['view'] );
319 | }
320 |
321 | $view = $this->get_fully_qualified_class_name( $mvc_component['view'], 'view', $route_type );
322 | }
323 |
324 | @list($controller, $action) = explode( '@', $mvc_component['controller'] );
325 |
326 | $controller = $this->get_fully_qualified_class_name( $controller, 'controller', $route_type );
327 |
328 | $controller_instance = $controller::get_instance( $model, $view );
329 |
330 | if ( null !== $action ) {
331 | $controller_instance->$action();
332 | }
333 | }
334 |
335 | /**
336 | * Registers `Model Only` Enqueued Routes
337 | *
338 | * @param boolean $register_late_frontend_routes Whether to register late frontend routes.
339 | * @return void
340 | * @since 1.0.0
341 | */
342 | public function register_model_only_routes( $register_late_frontend_routes = false ) {
343 | if ( $register_late_frontend_routes && empty( $route_types = $this->late_frontend_route_types() ) ) { // @codingStandardsIgnoreLine.
344 | return;
345 | } elseif ( empty( $route_types = $this->generic_route_types() ) ) { // @codingStandardsIgnoreLine.
346 | return;
347 | }
348 |
349 | foreach ( $route_types as $route_type ) {
350 | if ( $this->is_request( $route_type ) && ! empty( static::$models[ $route_type ] ) ) {
351 | foreach ( static::$models[ $route_type ] as $model ) {
352 | $this->dispatch_only_model( $model, $route_type );
353 | }
354 | }
355 | }
356 | }
357 |
358 | /**
359 | * Dispatches the model only route by creating a Model object
360 | *
361 | * @param mixed $model Model to be associated with the Route. Could be String or callback.
362 | * @param string $route_type Route Type.
363 | * @return void
364 | * @since 1.0.0
365 | */
366 | private function dispatch_only_model( $model, $route_type ) {
367 | if ( false === $model ) {
368 | return;
369 | }
370 |
371 | if ( is_callable( $model ) ) {
372 | $model = call_user_func( $model );
373 |
374 | if ( false === $model ) {
375 | return;
376 | }
377 | }
378 |
379 | @list($model, $action) = explode( '@', $model );
380 | $model = $this->get_fully_qualified_class_name( $model, 'model', $route_type );
381 | $model_instance = $model::get_instance();
382 |
383 | if ( null !== $action ) {
384 | $model_instance->$action();
385 | }
386 | }
387 |
388 | /**
389 | * Returns the Full Qualified Class Name for given class name
390 | *
391 | * @param string $class Class whose FQCN needs to be found out.
392 | * @param string $mvc_component_type Could be between 'model', 'view' or 'controller'.
393 | * @param string $route_type Could be 'admin' or 'frontend'.
394 | * @return string Retuns Full Qualified Class Name.
395 | * @since 1.0.0
396 | */
397 | private function get_fully_qualified_class_name( $class, $mvc_component_type, $route_type ) {
398 |
399 | // If route type is admin or frontend.
400 | if ( \strpos( $route_type, 'admin' ) !== false || \strpos( $route_type, 'frontend' ) !== false ) {
401 | $fqcn = '\Plugin_Name\App\\';
402 | $fqcn .= \ucfirst( $mvc_component_type ) . 's\\';
403 | $fqcn .= \strpos( $route_type, 'admin' ) !== false ? 'Admin\\' : 'Frontend\\';
404 |
405 | if ( class_exists( $fqcn . $class ) ) {
406 | return $fqcn . $class;
407 | }
408 | }
409 |
410 | return $class;
411 | }
412 |
413 | /**
414 | * Identifies Request Type
415 | *
416 | * @param string $route_type Route Type to identify.
417 | * @return boolean
418 | * @since 1.0.0
419 | */
420 | private function is_request( $route_type ) {
421 | switch ( $route_type ) {
422 | case Route_Type::ANY:
423 | return true;
424 | case ROUTE_TYPE::ADMIN:
425 | case ROUTE_TYPE::ADMIN_WITH_POSSIBLE_AJAX:
426 | return is_admin();
427 | case ROUTE_TYPE::AJAX:
428 | return defined( 'DOING_AJAX' );
429 | case ROUTE_TYPE::CRON:
430 | return defined( 'DOING_CRON' );
431 | case ROUTE_TYPE::FRONTEND:
432 | case ROUTE_TYPE::FRONTEND_WITH_POSSIBLE_AJAX:
433 | return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' ) && ! defined( 'REST_REQUEST' );
434 | case ROUTE_TYPE::LATE_FRONTEND:
435 | case ROUTE_TYPE::LATE_FRONTEND_WITH_POSSIBLE_AJAX:
436 | return $this->is_request( 'frontend' ) || ( current_action() == 'wp' ) || ( did_action( 'wp' ) === 1 );
437 | }
438 | }
439 | }
440 |
441 | }
442 |
--------------------------------------------------------------------------------
/plugin-name/core/class-view.php:
--------------------------------------------------------------------------------
1 |
13 | */
14 | class View {
15 | /**
16 | * Render Templates
17 | *
18 | * @access public
19 | * @param mixed $template_name Template file to render.
20 | * @param array $args Variables to make available inside template file.
21 | * @param string $template_path Directory to search for template.
22 | * @param string $default_path Fallback directory to search for template if not found at $template_path.
23 | * @return void
24 | */
25 | public static function render_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
26 | if ( $args && is_array( $args ) ) {
27 | extract( $args ); // @codingStandardsIgnoreLine.
28 | }
29 |
30 | $located = static::locate_template( $template_name, $template_path, $default_path );
31 | if ( false == $located ) {
32 | return;
33 | }
34 |
35 | ob_start();
36 | do_action( 'plugin_name_before_template_render', $template_name, $template_path, $located, $args );
37 | include( $located );
38 | do_action( 'plugin_name_after_template_render', $template_name, $template_path, $located, $args );
39 |
40 | return ob_get_clean(); // @codingStandardsIgnoreLine.
41 | }
42 |
43 | /**
44 | * Locate a template and return the path for inclusion.
45 | *
46 | * This is the load order:
47 | *
48 | * yourtheme / $template_path / $template_name
49 | * yourtheme / $template_name
50 | * $default_path / $template_name
51 | *
52 | * @access public
53 | * @param mixed $template_name Template file to locate.
54 | * @param string $template_path $template_path Directory to search for template.
55 | * @param string $default_path Fallback directory to search for template if not found at $template_path.
56 | * @return string
57 | */
58 | public static function locate_template( $template_name, $template_path = '', $default_path = '' ) {
59 | if ( ! $template_path ) {
60 | $template_path = 'plugin-name-templates/';
61 | }
62 | if ( ! $default_path ) {
63 | $default_path = Plugin_Name::get_plugin_path() . 'app/templates/';
64 | }
65 |
66 | // Look within passed path within the theme - this is priority.
67 | $template = locate_template(
68 | array(
69 | trailingslashit( $template_path ) . $template_name,
70 | $template_name,
71 | )
72 | );
73 |
74 | // Get default template.
75 | if ( ! $template ) {
76 | $template = $default_path . $template_name;
77 | }
78 |
79 | if ( file_exists( $template ) ) {
80 | // Return what we found.
81 | return apply_filters( 'plugin_name_locate_template', $template, $template_name, $template_path );
82 | } else {
83 | return false;
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/plugin-name/core/registry/class-controller.php:
--------------------------------------------------------------------------------
1 |
14 | */
15 | class Controller {
16 | use Base_Registry;
17 |
18 | /**
19 | * Returns key used to store a particular Controller Object
20 | *
21 | * @param string $controller_class_name Controller Class Name.
22 | * @param string $model_class_name Model Class Name.
23 | * @param string $view_class_name View Class Name.
24 | * @return string
25 | */
26 | public static function get_key( $controller_class_name, $model_class_name, $view_class_name ) {
27 | return "{$controller_class_name}__{$model_class_name}__{$view_class_name}";
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/plugin-name/core/registry/class-model.php:
--------------------------------------------------------------------------------
1 |
14 | */
15 | class Model {
16 | use Base_Registry;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/plugin-name/core/registry/trait-base-registry.php:
--------------------------------------------------------------------------------
1 |
20 | */
21 | trait Base_Registry {
22 |
23 | /**
24 | * Variable that holds all objects in registry.
25 | *
26 | * @var array
27 | */
28 | protected static $stored_objects = [];
29 |
30 | /**
31 | * Add object to registry
32 | *
33 | * @param string $key Key to be used to map with Object.
34 | * @param mixed $value Object to Store.
35 | * @return void
36 | * @since 1.0.0
37 | */
38 | public static function set( $key, $value ) {
39 | if ( ! is_string( $key ) ) {
40 | trigger_error( __( 'Key passed to `set` method must be key', Plugin_Name::PLUGIN_ID ), E_USER_ERROR ); // @codingStandardsIgnoreLine.
41 | }
42 | static::$stored_objects[ $key ] = $value;
43 | }
44 |
45 | /**
46 | * Get object from registry
47 | *
48 | * @param string $key Key of the object to restore.
49 | * @return mixed
50 | * @since 1.0.0
51 | */
52 | public static function get( $key ) {
53 | if ( ! is_string( $key ) ) {
54 | trigger_error( __( 'Key passed to `get` method must be key', Plugin_Name::PLUGIN_ID ), E_USER_ERROR ); // @codingStandardsIgnoreLine.
55 | }
56 |
57 | if ( ! isset( static::$stored_objects[ $key ] ) ) {
58 | return null;
59 | }
60 |
61 | return static::$stored_objects[ $key ];
62 | }
63 |
64 | /**
65 | * Returns all objects
66 | *
67 | * @return array
68 | * @since 1.0.0
69 | */
70 | public static function get_all_objects() {
71 | return static::$stored_objects;
72 | }
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-App-Activator.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\App\Activator
2 | ===============
3 |
4 | Fired during plugin activation.
5 |
6 | This class defines all code necessary to run during the plugin's activation.
7 |
8 |
9 | * Class name: Activator
10 | * Namespace: Plugin_Name\App
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Methods
19 | -------
20 |
21 |
22 | ### activate
23 |
24 | mixed Plugin_Name\App\Activator::activate()
25 |
26 | Short Description. (use period)
27 |
28 | Long Description.
29 |
30 | * Visibility: **public**
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-App-Controllers-Admin-Admin_Settings.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\App\Controllers\Admin\Admin_Settings
2 | ===============
3 |
4 | Controller class that implements Plugin Admin Settings configurations
5 |
6 |
7 |
8 |
9 | * Class name: Admin_Settings
10 | * Namespace: Plugin_Name\App\Controllers\Admin
11 | * Parent class: [Plugin_Name\App\Controllers\Admin\Base_Controller](Plugin_Name-App-Controllers-Admin-Base_Controller.md)
12 |
13 |
14 |
15 | Constants
16 | ----------
17 |
18 |
19 | ### SETTINGS_PAGE_SLUG
20 |
21 | const SETTINGS_PAGE_SLUG = \Plugin_Name::PLUGIN_ID
22 |
23 |
24 |
25 |
26 |
27 | ### REQUIRED_CAPABILITY
28 |
29 | const REQUIRED_CAPABILITY = 'manage_options'
30 |
31 |
32 |
33 |
34 |
35 | Properties
36 | ----------
37 |
38 |
39 | ### $hook_suffix
40 |
41 | private string $hook_suffix = 'settings_page_' . \Plugin_Name::PLUGIN_ID
42 |
43 | Holds suffix for dynamic add_action called on settings page.
44 |
45 |
46 |
47 | * Visibility: **private**
48 | * This property is **static**.
49 |
50 |
51 | ### $model
52 |
53 | protected Object $model
54 |
55 | Holds Model object
56 |
57 |
58 |
59 | * Visibility: **protected**
60 |
61 |
62 | ### $view
63 |
64 | protected Object $view
65 |
66 | Holds View Object
67 |
68 |
69 |
70 | * Visibility: **protected**
71 |
72 |
73 | Methods
74 | -------
75 |
76 |
77 | ### register_hook_callbacks
78 |
79 | mixed Plugin_Name\App\Controllers\Admin\Base_Controller::register_hook_callbacks()
80 |
81 | Register callbacks for actions and filters. Most of your add_action/add_filter
82 | go into this method.
83 |
84 | NOTE: register_hook_callbacks method is not called automatically. You
85 | as a developer have to call this method where you see fit. For Example,
86 | You may want to call this in constructor, if you feel hooks/filters
87 | callbacks should be registered when the new instance of the class
88 | is created.
89 |
90 | The purpose of this method is to set the convention that first place to
91 | find add_action/add_filter is register_hook_callbacks method.
92 |
93 | * Visibility: **protected**
94 | * This method is **abstract**.
95 | * This method is defined by [Plugin_Name\App\Controllers\Admin\Base_Controller](Plugin_Name-App-Controllers-Admin-Base_Controller.md)
96 |
97 |
98 |
99 |
100 | ### plugin_menu
101 |
102 | mixed Plugin_Name\App\Controllers\Admin\Admin_Settings::plugin_menu()
103 |
104 | Create menu for Plugin inside Settings menu
105 |
106 |
107 |
108 | * Visibility: **public**
109 |
110 |
111 |
112 |
113 | ### enqueue_scripts
114 |
115 | mixed Plugin_Name\App\Controllers\Admin\Admin_Settings::enqueue_scripts()
116 |
117 | Register the JavaScript for the admin area.
118 |
119 |
120 |
121 | * Visibility: **public**
122 |
123 |
124 |
125 |
126 | ### enqueue_styles
127 |
128 | mixed Plugin_Name\App\Controllers\Admin\Admin_Settings::enqueue_styles()
129 |
130 | Register the JavaScript for the admin area.
131 |
132 |
133 |
134 | * Visibility: **public**
135 |
136 |
137 |
138 |
139 | ### markup_settings_page
140 |
141 | mixed Plugin_Name\App\Controllers\Admin\Admin_Settings::markup_settings_page()
142 |
143 | Creates the markup for the Settings page
144 |
145 |
146 |
147 | * Visibility: **public**
148 |
149 |
150 |
151 |
152 | ### register_fields
153 |
154 | mixed Plugin_Name\App\Controllers\Admin\Admin_Settings::register_fields()
155 |
156 | Registers settings sections and fields
157 |
158 |
159 |
160 | * Visibility: **public**
161 |
162 |
163 |
164 |
165 | ### markup_section_headers
166 |
167 | mixed Plugin_Name\App\Controllers\Admin\Admin_Settings::markup_section_headers(array $section)
168 |
169 | Adds the section introduction text to the Settings page
170 |
171 |
172 |
173 | * Visibility: **public**
174 |
175 |
176 | #### Arguments
177 | * $section **array** - <p>Array containing information Section Id, Section
178 | Title & Section Callback.</p>
179 |
180 |
181 |
182 | ### markup_fields
183 |
184 | mixed Plugin_Name\App\Controllers\Admin\Admin_Settings::markup_fields(array $field_args)
185 |
186 | Delivers the markup for settings fields
187 |
188 |
189 |
190 | * Visibility: **public**
191 |
192 |
193 | #### Arguments
194 | * $field_args **array** - <p>Field arguments passed in <code>add_settings_field</code>
195 | function.</p>
196 |
197 |
198 |
199 | ### add_plugin_action_links
200 |
201 | array Plugin_Name\App\Controllers\Admin\Admin_Settings::add_plugin_action_links(array $links)
202 |
203 | Adds links to the plugin's action link section on the Plugins page
204 |
205 |
206 |
207 | * Visibility: **public**
208 |
209 |
210 | #### Arguments
211 | * $links **array** - <p>The links currently mapped to the plugin.</p>
212 |
213 |
214 |
215 | ### get_instance
216 |
217 | object Plugin_Name\Core\Controller::get_instance(mixed $model_class_name, mixed $view_class_name)
218 |
219 | Provides access to a single instance of a module using the singleton pattern
220 |
221 |
222 |
223 | * Visibility: **public**
224 | * This method is **static**.
225 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
226 |
227 |
228 | #### Arguments
229 | * $model_class_name **mixed** - <p>Model Class to be associated with the controller.</p>
230 | * $view_class_name **mixed** - <p>View Class to be associated with the controller.</p>
231 |
232 |
233 |
234 | ### get_model
235 |
236 | object Plugin_Name\Core\Controller::get_model()
237 |
238 | Get model.
239 |
240 | In most of the cases, the model will be set as per routes in defined in routes.php.
241 | So if you are not sure which model class is currently being used, search for the
242 | current controller class name in the routes.php
243 |
244 | * Visibility: **protected**
245 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
246 |
247 |
248 |
249 |
250 | ### get_view
251 |
252 | object Plugin_Name\Core\Controller::get_view()
253 |
254 | Get view
255 |
256 | In most of the cases, the view will be set as per routes in defined in routes.php.
257 | So if you are not sure which view class is currently being used, search for the
258 | current controller class name in the routes.php
259 |
260 | * Visibility: **protected**
261 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
262 |
263 |
264 |
265 |
266 | ### set_model
267 |
268 | void Plugin_Name\Core\Controller::set_model(\Plugin_Name\Core\Model $model)
269 |
270 | Sets the model to be used
271 |
272 |
273 |
274 | * Visibility: **protected**
275 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
276 |
277 |
278 | #### Arguments
279 | * $model **[Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)** - <p>Model object to be associated with the current controller object.</p>
280 |
281 |
282 |
283 | ### set_view
284 |
285 | void Plugin_Name\Core\Controller::set_view(\Plugin_Name\Core\View $view)
286 |
287 | Sets the view to be used
288 |
289 |
290 |
291 | * Visibility: **protected**
292 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
293 |
294 |
295 | #### Arguments
296 | * $view **[Plugin_Name\Core\View](Plugin_Name-Core-View.md)** - <p>View object to be associated with the current controller object.</p>
297 |
298 |
299 |
300 | ### __construct
301 |
302 | mixed Plugin_Name\Core\Controller::__construct(\Plugin_Name\Core\Model $model, mixed $view)
303 |
304 | Constructor
305 |
306 |
307 |
308 | * Visibility: **protected**
309 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
310 |
311 |
312 | #### Arguments
313 | * $model **[Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)** - <p>Model object to be used with current controller object.</p>
314 | * $view **mixed** - <p>View object to be used with current controller object. Otherwise false.</p>
315 |
316 |
317 |
318 | ### init
319 |
320 | void Plugin_Name\Core\Controller::init(\Plugin_Name\Core\Model $model, mixed $view)
321 |
322 | Sets Model & View to be used with current controller
323 |
324 |
325 |
326 | * Visibility: **protected**
327 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
328 |
329 |
330 | #### Arguments
331 | * $model **[Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)** - <p>Model to be associated with this controller.</p>
332 | * $view **mixed** - <p>Either View/its child class object or False.</p>
333 |
334 |
335 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-App-Controllers-Admin-Base_Controller.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\App\Controllers\Admin\Base_Controller
2 | ===============
3 |
4 | Blueprint for Admin related Controllers. All Admin Controllers should extend this Base_Controller
5 |
6 |
7 |
8 |
9 | * Class name: Base_Controller
10 | * Namespace: Plugin_Name\App\Controllers\Admin
11 | * This is an **abstract** class
12 | * Parent class: [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
13 |
14 |
15 |
16 |
17 |
18 | Properties
19 | ----------
20 |
21 |
22 | ### $model
23 |
24 | protected Object $model
25 |
26 | Holds Model object
27 |
28 |
29 |
30 | * Visibility: **protected**
31 |
32 |
33 | ### $view
34 |
35 | protected Object $view
36 |
37 | Holds View Object
38 |
39 |
40 |
41 | * Visibility: **protected**
42 |
43 |
44 | Methods
45 | -------
46 |
47 |
48 | ### register_hook_callbacks
49 |
50 | mixed Plugin_Name\App\Controllers\Admin\Base_Controller::register_hook_callbacks()
51 |
52 | Register callbacks for actions and filters. Most of your add_action/add_filter
53 | go into this method.
54 |
55 | NOTE: register_hook_callbacks method is not called automatically. You
56 | as a developer have to call this method where you see fit. For Example,
57 | You may want to call this in constructor, if you feel hooks/filters
58 | callbacks should be registered when the new instance of the class
59 | is created.
60 |
61 | The purpose of this method is to set the convention that first place to
62 | find add_action/add_filter is register_hook_callbacks method.
63 |
64 | * Visibility: **protected**
65 | * This method is **abstract**.
66 |
67 |
68 |
69 |
70 | ### get_instance
71 |
72 | object Plugin_Name\Core\Controller::get_instance(mixed $model_class_name, mixed $view_class_name)
73 |
74 | Provides access to a single instance of a module using the singleton pattern
75 |
76 |
77 |
78 | * Visibility: **public**
79 | * This method is **static**.
80 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
81 |
82 |
83 | #### Arguments
84 | * $model_class_name **mixed** - <p>Model Class to be associated with the controller.</p>
85 | * $view_class_name **mixed** - <p>View Class to be associated with the controller.</p>
86 |
87 |
88 |
89 | ### get_model
90 |
91 | object Plugin_Name\Core\Controller::get_model()
92 |
93 | Get model.
94 |
95 | In most of the cases, the model will be set as per routes in defined in routes.php.
96 | So if you are not sure which model class is currently being used, search for the
97 | current controller class name in the routes.php
98 |
99 | * Visibility: **protected**
100 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
101 |
102 |
103 |
104 |
105 | ### get_view
106 |
107 | object Plugin_Name\Core\Controller::get_view()
108 |
109 | Get view
110 |
111 | In most of the cases, the view will be set as per routes in defined in routes.php.
112 | So if you are not sure which view class is currently being used, search for the
113 | current controller class name in the routes.php
114 |
115 | * Visibility: **protected**
116 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
117 |
118 |
119 |
120 |
121 | ### set_model
122 |
123 | void Plugin_Name\Core\Controller::set_model(\Plugin_Name\Core\Model $model)
124 |
125 | Sets the model to be used
126 |
127 |
128 |
129 | * Visibility: **protected**
130 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
131 |
132 |
133 | #### Arguments
134 | * $model **[Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)** - <p>Model object to be associated with the current controller object.</p>
135 |
136 |
137 |
138 | ### set_view
139 |
140 | void Plugin_Name\Core\Controller::set_view(\Plugin_Name\Core\View $view)
141 |
142 | Sets the view to be used
143 |
144 |
145 |
146 | * Visibility: **protected**
147 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
148 |
149 |
150 | #### Arguments
151 | * $view **[Plugin_Name\Core\View](Plugin_Name-Core-View.md)** - <p>View object to be associated with the current controller object.</p>
152 |
153 |
154 |
155 | ### __construct
156 |
157 | mixed Plugin_Name\Core\Controller::__construct(\Plugin_Name\Core\Model $model, mixed $view)
158 |
159 | Constructor
160 |
161 |
162 |
163 | * Visibility: **protected**
164 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
165 |
166 |
167 | #### Arguments
168 | * $model **[Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)** - <p>Model object to be used with current controller object.</p>
169 | * $view **mixed** - <p>View object to be used with current controller object. Otherwise false.</p>
170 |
171 |
172 |
173 | ### init
174 |
175 | void Plugin_Name\Core\Controller::init(\Plugin_Name\Core\Model $model, mixed $view)
176 |
177 | Sets Model & View to be used with current controller
178 |
179 |
180 |
181 | * Visibility: **protected**
182 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
183 |
184 |
185 | #### Arguments
186 | * $model **[Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)** - <p>Model to be associated with this controller.</p>
187 | * $view **mixed** - <p>Either View/its child class object or False.</p>
188 |
189 |
190 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-App-Controllers-Frontend-Base_Controller.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\App\Controllers\Frontend\Base_Controller
2 | ===============
3 |
4 | Blueprint for Frontend related Controllers. All Frontend Controllers should extend this Base_Controller
5 |
6 |
7 |
8 |
9 | * Class name: Base_Controller
10 | * Namespace: Plugin_Name\App\Controllers\Frontend
11 | * This is an **abstract** class
12 | * Parent class: [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
13 |
14 |
15 |
16 |
17 |
18 | Properties
19 | ----------
20 |
21 |
22 | ### $model
23 |
24 | protected Object $model
25 |
26 | Holds Model object
27 |
28 |
29 |
30 | * Visibility: **protected**
31 |
32 |
33 | ### $view
34 |
35 | protected Object $view
36 |
37 | Holds View Object
38 |
39 |
40 |
41 | * Visibility: **protected**
42 |
43 |
44 | Methods
45 | -------
46 |
47 |
48 | ### register_hook_callbacks
49 |
50 | mixed Plugin_Name\App\Controllers\Frontend\Base_Controller::register_hook_callbacks()
51 |
52 | Register callbacks for actions and filters. Most of your add_action/add_filter
53 | go into this method.
54 |
55 | NOTE: register_hook_callbacks method is not called automatically. You
56 | as a developer have to call this method where you see fit. For Example,
57 | You may want to call this in constructor, if you feel hooks/filters
58 | callbacks should be registered when the new instance of the class
59 | is created.
60 |
61 | The purpose of this method is to set the convention that first place to
62 | find add_action/add_filter is register_hook_callbacks method.
63 |
64 | * Visibility: **protected**
65 | * This method is **abstract**.
66 |
67 |
68 |
69 |
70 | ### get_instance
71 |
72 | object Plugin_Name\Core\Controller::get_instance(mixed $model_class_name, mixed $view_class_name)
73 |
74 | Provides access to a single instance of a module using the singleton pattern
75 |
76 |
77 |
78 | * Visibility: **public**
79 | * This method is **static**.
80 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
81 |
82 |
83 | #### Arguments
84 | * $model_class_name **mixed** - <p>Model Class to be associated with the controller.</p>
85 | * $view_class_name **mixed** - <p>View Class to be associated with the controller.</p>
86 |
87 |
88 |
89 | ### get_model
90 |
91 | object Plugin_Name\Core\Controller::get_model()
92 |
93 | Get model.
94 |
95 | In most of the cases, the model will be set as per routes in defined in routes.php.
96 | So if you are not sure which model class is currently being used, search for the
97 | current controller class name in the routes.php
98 |
99 | * Visibility: **protected**
100 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
101 |
102 |
103 |
104 |
105 | ### get_view
106 |
107 | object Plugin_Name\Core\Controller::get_view()
108 |
109 | Get view
110 |
111 | In most of the cases, the view will be set as per routes in defined in routes.php.
112 | So if you are not sure which view class is currently being used, search for the
113 | current controller class name in the routes.php
114 |
115 | * Visibility: **protected**
116 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
117 |
118 |
119 |
120 |
121 | ### set_model
122 |
123 | void Plugin_Name\Core\Controller::set_model(\Plugin_Name\Core\Model $model)
124 |
125 | Sets the model to be used
126 |
127 |
128 |
129 | * Visibility: **protected**
130 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
131 |
132 |
133 | #### Arguments
134 | * $model **[Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)** - <p>Model object to be associated with the current controller object.</p>
135 |
136 |
137 |
138 | ### set_view
139 |
140 | void Plugin_Name\Core\Controller::set_view(\Plugin_Name\Core\View $view)
141 |
142 | Sets the view to be used
143 |
144 |
145 |
146 | * Visibility: **protected**
147 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
148 |
149 |
150 | #### Arguments
151 | * $view **[Plugin_Name\Core\View](Plugin_Name-Core-View.md)** - <p>View object to be associated with the current controller object.</p>
152 |
153 |
154 |
155 | ### __construct
156 |
157 | mixed Plugin_Name\Core\Controller::__construct(\Plugin_Name\Core\Model $model, mixed $view)
158 |
159 | Constructor
160 |
161 |
162 |
163 | * Visibility: **protected**
164 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
165 |
166 |
167 | #### Arguments
168 | * $model **[Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)** - <p>Model object to be used with current controller object.</p>
169 | * $view **mixed** - <p>View object to be used with current controller object. Otherwise false.</p>
170 |
171 |
172 |
173 | ### init
174 |
175 | void Plugin_Name\Core\Controller::init(\Plugin_Name\Core\Model $model, mixed $view)
176 |
177 | Sets Model & View to be used with current controller
178 |
179 |
180 |
181 | * Visibility: **protected**
182 | * This method is defined by [Plugin_Name\Core\Controller](Plugin_Name-Core-Controller.md)
183 |
184 |
185 | #### Arguments
186 | * $model **[Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)** - <p>Model to be associated with this controller.</p>
187 | * $view **mixed** - <p>Either View/its child class object or False.</p>
188 |
189 |
190 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-App-Deactivator.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\App\Deactivator
2 | ===============
3 |
4 | Fired during plugin deactivation.
5 |
6 | This class defines all code necessary to run during the plugin's deactivation.
7 |
8 |
9 | * Class name: Deactivator
10 | * Namespace: Plugin_Name\App
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Methods
19 | -------
20 |
21 |
22 | ### deactivate
23 |
24 | mixed Plugin_Name\App\Deactivator::deactivate()
25 |
26 | Short Description. (use period)
27 |
28 | Long Description.
29 |
30 | * Visibility: **public**
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-App-Models-Admin-Admin_Settings.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\App\Models\Admin\Admin_Settings
2 | ===============
3 |
4 | Model class that implements Plugin Admin Settings
5 |
6 |
7 |
8 |
9 | * Class name: Admin_Settings
10 | * Namespace: Plugin_Name\App\Models\Admin
11 | * Parent class: [Plugin_Name\App\Models\Admin\Base_Model](Plugin_Name-App-Models-Admin-Base_Model.md)
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Methods
20 | -------
21 |
22 |
23 | ### __construct
24 |
25 | mixed Plugin_Name\App\Models\Admin\Admin_Settings::__construct()
26 |
27 | Constructor
28 |
29 |
30 |
31 | * Visibility: **protected**
32 |
33 |
34 |
35 |
36 | ### register_hook_callbacks
37 |
38 | mixed Plugin_Name\App\Models\Admin\Base_Model::register_hook_callbacks()
39 |
40 | Register callbacks for actions and filters. Most of your add_action/add_filter
41 | go into this method.
42 |
43 | NOTE: register_hook_callbacks method is not called automatically. You
44 | as a developer have to call this method where you see fit. For Example,
45 | You may want to call this in constructor, if you feel hooks/filters
46 | callbacks should be registered when the new instance of the class
47 | is created.
48 |
49 | The purpose of this method is to set the convention that first place to
50 | find add_action/add_filter is register_hook_callbacks method.
51 |
52 | This method is not marked abstract because it may not be needed in every
53 | model. Making it abstract would enforce every child class to implement
54 | the method.
55 |
56 | If I were you, I would define register_hook_callbacks method in the child
57 | class when it is a 'Model only' route. This is not a rule, it
58 | is just my opinion when I would define this method.
59 |
60 | * Visibility: **protected**
61 | * This method is defined by [Plugin_Name\App\Models\Admin\Base_Model](Plugin_Name-App-Models-Admin-Base_Model.md)
62 |
63 |
64 |
65 |
66 | ### register_settings
67 |
68 | mixed Plugin_Name\App\Models\Admin\Admin_Settings::register_settings()
69 |
70 | Register settings
71 |
72 |
73 |
74 | * Visibility: **public**
75 |
76 |
77 |
78 |
79 | ### sanitize
80 |
81 | array Plugin_Name\App\Models\Admin\Admin_Settings::sanitize(array $input)
82 |
83 | Validates submitted setting values before they get saved to the database.
84 |
85 |
86 |
87 | * Visibility: **public**
88 |
89 |
90 | #### Arguments
91 | * $input **array** - <p>Settings Being Saved.</p>
92 |
93 |
94 |
95 | ### get_plugin_settings_option_key
96 |
97 | string Plugin_Name\App\Models\Admin\Admin_Settings::get_plugin_settings_option_key()
98 |
99 | Returns the option key used to store the settings in database
100 |
101 |
102 |
103 | * Visibility: **public**
104 |
105 |
106 |
107 |
108 | ### get_setting
109 |
110 | array Plugin_Name\App\Models\Admin\Admin_Settings::get_setting(string $setting_name)
111 |
112 | Retrieves all of the settings from the database
113 |
114 |
115 |
116 | * Visibility: **public**
117 |
118 |
119 | #### Arguments
120 | * $setting_name **string** - <p>Setting to be retrieved.</p>
121 |
122 |
123 |
124 | ### get_instance
125 |
126 | object Plugin_Name\Core\Model::get_instance()
127 |
128 | Provides access to a single instance of a module using the singleton pattern
129 |
130 |
131 |
132 | * Visibility: **public**
133 | * This method is **static**.
134 | * This method is defined by [Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-App-Models-Admin-Base_Model.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\App\Models\Admin\Base_Model
2 | ===============
3 |
4 | Blueprint for Admin related Models. All Admin Models should extend this Base_Model
5 |
6 |
7 |
8 |
9 | * Class name: Base_Model
10 | * Namespace: Plugin_Name\App\Models\Admin
11 | * This is an **abstract** class
12 | * Parent class: [Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | Methods
21 | -------
22 |
23 |
24 | ### register_hook_callbacks
25 |
26 | mixed Plugin_Name\App\Models\Admin\Base_Model::register_hook_callbacks()
27 |
28 | Register callbacks for actions and filters. Most of your add_action/add_filter
29 | go into this method.
30 |
31 | NOTE: register_hook_callbacks method is not called automatically. You
32 | as a developer have to call this method where you see fit. For Example,
33 | You may want to call this in constructor, if you feel hooks/filters
34 | callbacks should be registered when the new instance of the class
35 | is created.
36 |
37 | The purpose of this method is to set the convention that first place to
38 | find add_action/add_filter is register_hook_callbacks method.
39 |
40 | This method is not marked abstract because it may not be needed in every
41 | model. Making it abstract would enforce every child class to implement
42 | the method.
43 |
44 | If I were you, I would define register_hook_callbacks method in the child
45 | class when it is a 'Model only' route. This is not a rule, it
46 | is just my opinion when I would define this method.
47 |
48 | * Visibility: **protected**
49 |
50 |
51 |
52 |
53 | ### get_instance
54 |
55 | object Plugin_Name\Core\Model::get_instance()
56 |
57 | Provides access to a single instance of a module using the singleton pattern
58 |
59 |
60 |
61 | * Visibility: **public**
62 | * This method is **static**.
63 | * This method is defined by [Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-App-Models-Frontend-Base_Model.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\App\Models\Frontend\Base_Model
2 | ===============
3 |
4 | Blueprint for Frontend related Models. All Frontend Models should extend this Base_Model
5 |
6 |
7 |
8 |
9 | * Class name: Base_Model
10 | * Namespace: Plugin_Name\App\Models\Frontend
11 | * This is an **abstract** class
12 | * Parent class: [Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | Methods
21 | -------
22 |
23 |
24 | ### register_hook_callbacks
25 |
26 | mixed Plugin_Name\App\Models\Frontend\Base_Model::register_hook_callbacks()
27 |
28 | Register callbacks for actions and filters. Most of your add_action/add_filter
29 | go into this method.
30 |
31 | NOTE: register_hook_callbacks method is not called automatically. You
32 | as a developer have to call this method where you see fit. For Example,
33 | You may want to call this in constructor, if you feel hooks/filters
34 | callbacks should be registered when the new instance of the class
35 | is created.
36 |
37 | The purpose of this method is to set the convention that first place to
38 | find add_action/add_filter is register_hook_callbacks method.
39 |
40 | This method is not marked abstract because it may not be needed in every
41 | model. Making it abstract would enforce every child class to implement
42 | the method.
43 |
44 | If I were you, I would define register_hook_callbacks method in the child
45 | class when it is a 'Model only' route. This is not hard & fast rule, it
46 | is just my opinion when I would define this method.
47 |
48 | * Visibility: **protected**
49 |
50 |
51 |
52 |
53 | ### get_instance
54 |
55 | object Plugin_Name\Core\Model::get_instance()
56 |
57 | Provides access to a single instance of a module using the singleton pattern
58 |
59 |
60 |
61 | * Visibility: **public**
62 | * This method is **static**.
63 | * This method is defined by [Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-App-Models-Settings.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\App\Models\Settings
2 | ===============
3 |
4 | Implements operations related to Plugin Settings.
5 |
6 |
7 |
8 |
9 | * Class name: Settings
10 | * Namespace: Plugin_Name\App\Models
11 | * Parent class: [Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)
12 |
13 |
14 |
15 | Constants
16 | ----------
17 |
18 |
19 | ### SETTINGS_NAME
20 |
21 | const SETTINGS_NAME = \Plugin_Name::PLUGIN_ID
22 |
23 |
24 |
25 |
26 |
27 | Properties
28 | ----------
29 |
30 |
31 | ### $settings
32 |
33 | protected array $settings
34 |
35 | Holds all Settings
36 |
37 |
38 |
39 | * Visibility: **protected**
40 | * This property is **static**.
41 |
42 |
43 | Methods
44 | -------
45 |
46 |
47 | ### get_plugin_settings_option_key
48 |
49 | string Plugin_Name\App\Models\Settings::get_plugin_settings_option_key()
50 |
51 | Returns the Option name/key saved in the database
52 |
53 |
54 |
55 | * Visibility: **public**
56 | * This method is **static**.
57 |
58 |
59 |
60 |
61 | ### get_settings
62 |
63 | array Plugin_Name\App\Models\Settings::get_settings()
64 |
65 | Helper method that retuns all Saved Settings related to Plugin
66 |
67 |
68 |
69 | * Visibility: **public**
70 | * This method is **static**.
71 |
72 |
73 |
74 |
75 | ### get_setting
76 |
77 | mixed Plugin_Name\App\Models\Settings::get_setting(string $setting_name)
78 |
79 | Helper method that returns a individual setting
80 |
81 |
82 |
83 | * Visibility: **public**
84 | * This method is **static**.
85 |
86 |
87 | #### Arguments
88 | * $setting_name **string** - <p>Setting to be retrieved.</p>
89 |
90 |
91 |
92 | ### delete_settings
93 |
94 | void Plugin_Name\App\Models\Settings::delete_settings()
95 |
96 | Helper method to delete all settings related to plugin
97 |
98 |
99 |
100 | * Visibility: **public**
101 | * This method is **static**.
102 |
103 |
104 |
105 |
106 | ### delete_setting
107 |
108 | void Plugin_Name\App\Models\Settings::delete_setting(string $setting_name)
109 |
110 | Helper method to delete a specific setting
111 |
112 |
113 |
114 | * Visibility: **public**
115 | * This method is **static**.
116 |
117 |
118 | #### Arguments
119 | * $setting_name **string** - <p>Setting to be Deleted.</p>
120 |
121 |
122 |
123 | ### update_settings
124 |
125 | void Plugin_Name\App\Models\Settings::update_settings(array $new_settings)
126 |
127 | Helper method to Update Settings
128 |
129 |
130 |
131 | * Visibility: **public**
132 | * This method is **static**.
133 |
134 |
135 | #### Arguments
136 | * $new_settings **array** - <p>New Setting Values to store.</p>
137 |
138 |
139 |
140 | ### update_setting
141 |
142 | void Plugin_Name\App\Models\Settings::update_setting(string $setting_name, mixed $setting_value)
143 |
144 | Helper method Update Single Setting
145 |
146 | Similar to update_settings, this function won't by called anywhere automatically.
147 | This is a custom helper function to delete individual setting. You can
148 | delete this method if you don't want this ability.
149 |
150 | * Visibility: **public**
151 | * This method is **static**.
152 |
153 |
154 | #### Arguments
155 | * $setting_name **string** - <p>Setting to be Updated.</p>
156 | * $setting_value **mixed** - <p>New value to set for that setting.</p>
157 |
158 |
159 |
160 | ### get_instance
161 |
162 | object Plugin_Name\Core\Model::get_instance()
163 |
164 | Provides access to a single instance of a module using the singleton pattern
165 |
166 |
167 |
168 | * Visibility: **public**
169 | * This method is **static**.
170 | * This method is defined by [Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)
171 |
172 |
173 |
174 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-App-Uninstaller.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\App\Uninstaller
2 | ===============
3 |
4 | Fired during plugin uninstallation.
5 |
6 | This class defines all code necessary to run during the plugin's uninstallation.
7 |
8 |
9 | * Class name: Uninstaller
10 | * Namespace: Plugin_Name\App
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Methods
19 | -------
20 |
21 |
22 | ### uninstall
23 |
24 | mixed Plugin_Name\App\Uninstaller::uninstall()
25 |
26 | Short Description. (use period)
27 |
28 | Long Description.
29 |
30 | * Visibility: **public**
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-App-Views-Admin-Admin_Settings.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\App\Views\Admin\Admin_Settings
2 | ===============
3 |
4 | View class to load all templates related to Plugin's Admin Settings Page
5 |
6 |
7 |
8 |
9 | * Class name: Admin_Settings
10 | * Namespace: Plugin_Name\App\Views\Admin
11 | * Parent class: [Plugin_Name\Core\View](Plugin_Name-Core-View.md)
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Methods
20 | -------
21 |
22 |
23 | ### admin_settings_page
24 |
25 | void Plugin_Name\App\Views\Admin\Admin_Settings::admin_settings_page(array $args)
26 |
27 | Prints Settings Page.
28 |
29 |
30 |
31 | * Visibility: **public**
32 |
33 |
34 | #### Arguments
35 | * $args **array** - <p>Arguments passed by <code>markup_settings_page</code> method from <code>Plugin_Name\App\Controllers\Admin\Admin_Settings</code> controller.</p>
36 |
37 |
38 |
39 | ### section_headers
40 |
41 | void Plugin_Name\App\Views\Admin\Admin_Settings::section_headers(array $args)
42 |
43 | Prints Section's Description.
44 |
45 |
46 |
47 | * Visibility: **public**
48 |
49 |
50 | #### Arguments
51 | * $args **array** - <p>Arguments passed by <code>markup_section_headers</code> method from <code>Plugin_Name\App\Controllers\Admin\Admin_Settings</code> controller.</p>
52 |
53 |
54 |
55 | ### markup_fields
56 |
57 | void Plugin_Name\App\Views\Admin\Admin_Settings::markup_fields(array $args)
58 |
59 | Prints text field
60 |
61 |
62 |
63 | * Visibility: **public**
64 |
65 |
66 | #### Arguments
67 | * $args **array** - <p>Arguments passed by <code>markup_fields</code> method from <code>Plugin_Name\App\Controllers\Admin\Admin_Settings</code> controller.</p>
68 |
69 |
70 |
71 | ### render_template
72 |
73 | void Plugin_Name\Core\View::render_template(mixed $template_name, array $args, string $template_path, string $default_path)
74 |
75 | Render Templates
76 |
77 |
78 |
79 | * Visibility: **public**
80 | * This method is **static**.
81 | * This method is defined by [Plugin_Name\Core\View](Plugin_Name-Core-View.md)
82 |
83 |
84 | #### Arguments
85 | * $template_name **mixed** - <p>Template file to render.</p>
86 | * $args **array** - <p>Variables to make available inside template file.</p>
87 | * $template_path **string** - <p>Directory to search for template.</p>
88 | * $default_path **string** - <p>Fallback directory to search for template if not found at $template_path.</p>
89 |
90 |
91 |
92 | ### locate_template
93 |
94 | string Plugin_Name\Core\View::locate_template(mixed $template_name, string $template_path, string $default_path)
95 |
96 | Locate a template and return the path for inclusion.
97 |
98 | This is the load order:
99 |
100 | yourtheme / $template_path / $template_name
101 | yourtheme / $template_name
102 | $default_path / $template_name
103 |
104 | * Visibility: **public**
105 | * This method is **static**.
106 | * This method is defined by [Plugin_Name\Core\View](Plugin_Name-Core-View.md)
107 |
108 |
109 | #### Arguments
110 | * $template_name **mixed** - <p>Template file to locate.</p>
111 | * $template_path **string** - <p>$template_path Directory to search for template.</p>
112 | * $default_path **string** - <p>Fallback directory to search for template if not found at $template_path.</p>
113 |
114 |
115 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-Core-Controller.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\Core\Controller
2 | ===============
3 |
4 | Abstract class to define/implement base methods for all controller classes
5 |
6 |
7 |
8 |
9 | * Class name: Controller
10 | * Namespace: Plugin_Name\Core
11 | * This is an **abstract** class
12 |
13 |
14 |
15 |
16 |
17 | Properties
18 | ----------
19 |
20 |
21 | ### $model
22 |
23 | protected Object $model
24 |
25 | Holds Model object
26 |
27 |
28 |
29 | * Visibility: **protected**
30 |
31 |
32 | ### $view
33 |
34 | protected Object $view
35 |
36 | Holds View Object
37 |
38 |
39 |
40 | * Visibility: **protected**
41 |
42 |
43 | Methods
44 | -------
45 |
46 |
47 | ### get_instance
48 |
49 | object Plugin_Name\Core\Controller::get_instance(mixed $model_class_name, mixed $view_class_name)
50 |
51 | Provides access to a single instance of a module using the singleton pattern
52 |
53 |
54 |
55 | * Visibility: **public**
56 | * This method is **static**.
57 |
58 |
59 | #### Arguments
60 | * $model_class_name **mixed** - <p>Model Class to be associated with the controller.</p>
61 | * $view_class_name **mixed** - <p>View Class to be associated with the controller.</p>
62 |
63 |
64 |
65 | ### get_model
66 |
67 | object Plugin_Name\Core\Controller::get_model()
68 |
69 | Get model.
70 |
71 | In most of the cases, the model will be set as per routes in defined in routes.php.
72 | So if you are not sure which model class is currently being used, search for the
73 | current controller class name in the routes.php
74 |
75 | * Visibility: **protected**
76 |
77 |
78 |
79 |
80 | ### get_view
81 |
82 | object Plugin_Name\Core\Controller::get_view()
83 |
84 | Get view
85 |
86 | In most of the cases, the view will be set as per routes in defined in routes.php.
87 | So if you are not sure which view class is currently being used, search for the
88 | current controller class name in the routes.php
89 |
90 | * Visibility: **protected**
91 |
92 |
93 |
94 |
95 | ### set_model
96 |
97 | void Plugin_Name\Core\Controller::set_model(\Plugin_Name\Core\Model $model)
98 |
99 | Sets the model to be used
100 |
101 |
102 |
103 | * Visibility: **protected**
104 |
105 |
106 | #### Arguments
107 | * $model **[Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)** - <p>Model object to be associated with the current controller object.</p>
108 |
109 |
110 |
111 | ### set_view
112 |
113 | void Plugin_Name\Core\Controller::set_view(\Plugin_Name\Core\View $view)
114 |
115 | Sets the view to be used
116 |
117 |
118 |
119 | * Visibility: **protected**
120 |
121 |
122 | #### Arguments
123 | * $view **[Plugin_Name\Core\View](Plugin_Name-Core-View.md)** - <p>View object to be associated with the current controller object.</p>
124 |
125 |
126 |
127 | ### __construct
128 |
129 | mixed Plugin_Name\Core\Controller::__construct(\Plugin_Name\Core\Model $model, mixed $view)
130 |
131 | Constructor
132 |
133 |
134 |
135 | * Visibility: **protected**
136 |
137 |
138 | #### Arguments
139 | * $model **[Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)** - <p>Model object to be used with current controller object.</p>
140 | * $view **mixed** - <p>View object to be used with current controller object. Otherwise false.</p>
141 |
142 |
143 |
144 | ### init
145 |
146 | void Plugin_Name\Core\Controller::init(\Plugin_Name\Core\Model $model, mixed $view)
147 |
148 | Sets Model & View to be used with current controller
149 |
150 |
151 |
152 | * Visibility: **protected**
153 |
154 |
155 | #### Arguments
156 | * $model **[Plugin_Name\Core\Model](Plugin_Name-Core-Model.md)** - <p>Model to be associated with this controller.</p>
157 | * $view **mixed** - <p>Either View/its child class object or False.</p>
158 |
159 |
160 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-Core-Model.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\Core\Model
2 | ===============
3 |
4 | Abstract class to define/implement base methods for model classes
5 |
6 |
7 |
8 |
9 | * Class name: Model
10 | * Namespace: Plugin_Name\Core
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Methods
19 | -------
20 |
21 |
22 | ### get_instance
23 |
24 | object Plugin_Name\Core\Model::get_instance()
25 |
26 | Provides access to a single instance of a module using the singleton pattern
27 |
28 |
29 |
30 | * Visibility: **public**
31 | * This method is **static**.
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-Core-Registry-Controller.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\Core\Registry\Controller
2 | ===============
3 |
4 | Controller Registry
5 |
6 | Maintains the list of all controllers objects
7 |
8 |
9 | * Class name: Controller
10 | * Namespace: Plugin_Name\Core\Registry
11 |
12 |
13 |
14 |
15 |
16 | Properties
17 | ----------
18 |
19 |
20 | ### $stored_objects
21 |
22 | protected array $stored_objects = array()
23 |
24 | Variable that holds all objects in registry.
25 |
26 |
27 |
28 | * Visibility: **protected**
29 | * This property is **static**.
30 |
31 |
32 | Methods
33 | -------
34 |
35 |
36 | ### get_key
37 |
38 | string Plugin_Name\Core\Registry\Controller::get_key(string $controller_class_name, string $model_class_name, string $view_class_name)
39 |
40 | Returns key used to store a particular Controller Object
41 |
42 |
43 |
44 | * Visibility: **public**
45 | * This method is **static**.
46 |
47 |
48 | #### Arguments
49 | * $controller_class_name **string** - <p>Controller Class Name.</p>
50 | * $model_class_name **string** - <p>Model Class Name.</p>
51 | * $view_class_name **string** - <p>View Class Name.</p>
52 |
53 |
54 |
55 | ### set
56 |
57 | void Plugin_Name\Core\Registry\Controller::set(string $key, mixed $value)
58 |
59 | Add object to registry
60 |
61 |
62 |
63 | * Visibility: **public**
64 | * This method is **static**.
65 |
66 |
67 | #### Arguments
68 | * $key **string** - <p>Key to be used to map with Object.</p>
69 | * $value **mixed** - <p>Object to Store.</p>
70 |
71 |
72 |
73 | ### get
74 |
75 | mixed Plugin_Name\Core\Registry\Controller::get(string $key)
76 |
77 | Get object from registry
78 |
79 |
80 |
81 | * Visibility: **public**
82 | * This method is **static**.
83 |
84 |
85 | #### Arguments
86 | * $key **string** - <p>Key of the object to restore.</p>
87 |
88 |
89 |
90 | ### get_all_objects
91 |
92 | array Plugin_Name\Core\Registry\Controller::get_all_objects()
93 |
94 | Returns all objects
95 |
96 |
97 |
98 | * Visibility: **public**
99 | * This method is **static**.
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-Core-Registry-Model.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\Core\Registry\Model
2 | ===============
3 |
4 | Model Registry
5 |
6 | Maintains the list of all models objects
7 |
8 |
9 | * Class name: Model
10 | * Namespace: Plugin_Name\Core\Registry
11 |
12 |
13 |
14 |
15 |
16 | Properties
17 | ----------
18 |
19 |
20 | ### $stored_objects
21 |
22 | protected array $stored_objects = array()
23 |
24 | Variable that holds all objects in registry.
25 |
26 |
27 |
28 | * Visibility: **protected**
29 | * This property is **static**.
30 |
31 |
32 | Methods
33 | -------
34 |
35 |
36 | ### set
37 |
38 | void Plugin_Name\Core\Registry\Model::set(string $key, mixed $value)
39 |
40 | Add object to registry
41 |
42 |
43 |
44 | * Visibility: **public**
45 | * This method is **static**.
46 |
47 |
48 | #### Arguments
49 | * $key **string** - <p>Key to be used to map with Object.</p>
50 | * $value **mixed** - <p>Object to Store.</p>
51 |
52 |
53 |
54 | ### get
55 |
56 | mixed Plugin_Name\Core\Registry\Model::get(string $key)
57 |
58 | Get object from registry
59 |
60 |
61 |
62 | * Visibility: **public**
63 | * This method is **static**.
64 |
65 |
66 | #### Arguments
67 | * $key **string** - <p>Key of the object to restore.</p>
68 |
69 |
70 |
71 | ### get_all_objects
72 |
73 | array Plugin_Name\Core\Registry\Model::get_all_objects()
74 |
75 | Returns all objects
76 |
77 |
78 |
79 | * Visibility: **public**
80 | * This method is **static**.
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-Core-Route_Type.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\Core\Route_Type
2 | ===============
3 |
4 | Class Responsible for registering Route Types supported by the Application
5 |
6 |
7 |
8 |
9 | * Class name: Route_Type
10 | * Namespace: Plugin_Name\Core
11 |
12 |
13 |
14 | Constants
15 | ----------
16 |
17 |
18 | ### ANY
19 |
20 | const ANY = 'any'
21 |
22 |
23 |
24 |
25 |
26 | ### ADMIN
27 |
28 | const ADMIN = 'admin'
29 |
30 |
31 |
32 |
33 |
34 | ### ADMIN_WITH_POSSIBLE_AJAX
35 |
36 | const ADMIN_WITH_POSSIBLE_AJAX = 'admin_with_possible_ajax'
37 |
38 |
39 |
40 |
41 |
42 | ### AJAX
43 |
44 | const AJAX = 'ajax'
45 |
46 |
47 |
48 |
49 |
50 | ### CRON
51 |
52 | const CRON = 'cron'
53 |
54 |
55 |
56 |
57 |
58 | ### FRONTEND
59 |
60 | const FRONTEND = 'frontend'
61 |
62 |
63 |
64 |
65 |
66 | ### FRONTEND_WITH_POSSIBLE_AJAX
67 |
68 | const FRONTEND_WITH_POSSIBLE_AJAX = 'frontend_with_possible_ajax'
69 |
70 |
71 |
72 |
73 |
74 | ### LATE_FRONTEND
75 |
76 | const LATE_FRONTEND = 'late_frontend'
77 |
78 |
79 |
80 |
81 |
82 | ### LATE_FRONTEND_WITH_POSSIBLE_AJAX
83 |
84 | const LATE_FRONTEND_WITH_POSSIBLE_AJAX = 'late_frontend_with_possible_ajax'
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-Core-Router.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\Core\Router
2 | ===============
3 |
4 | Class Responsible for registering Routes
5 |
6 |
7 |
8 |
9 | * Class name: Router
10 | * Namespace: Plugin_Name\Core
11 |
12 |
13 |
14 | Constants
15 | ----------
16 |
17 |
18 | ### REGISTER_LATE_FRONTEND_ROUTES
19 |
20 | const REGISTER_LATE_FRONTEND_ROUTES = true
21 |
22 |
23 |
24 |
25 |
26 | Properties
27 | ----------
28 |
29 |
30 | ### $models
31 |
32 | private array $models = array()
33 |
34 | Holds List of Models used for 'Model Only' Routes
35 |
36 |
37 |
38 | * Visibility: **private**
39 | * This property is **static**.
40 |
41 |
42 | ### $mvc_components
43 |
44 | private array $mvc_components = array()
45 |
46 | Holds Model, View & Controllers triad for All routes except 'Model Only' Routes
47 |
48 |
49 |
50 | * Visibility: **private**
51 | * This property is **static**.
52 |
53 |
54 | Methods
55 | -------
56 |
57 |
58 | ### __construct
59 |
60 | mixed Plugin_Name\Core\Router::__construct()
61 |
62 | Constructor
63 |
64 |
65 |
66 | * Visibility: **public**
67 |
68 |
69 |
70 |
71 | ### register_hook_callbacks
72 |
73 | mixed Plugin_Name\Core\Router::register_hook_callbacks()
74 |
75 | Register callbacks for actions and filters
76 |
77 |
78 |
79 | * Visibility: **protected**
80 |
81 |
82 |
83 |
84 | ### register_generic_model_only_routes
85 |
86 | void Plugin_Name\Core\Router::register_generic_model_only_routes()
87 |
88 | Register Generic `Model Only` Routes
89 |
90 |
91 |
92 | * Visibility: **public**
93 |
94 |
95 |
96 |
97 | ### register_late_frontend_model_only_routes
98 |
99 | void Plugin_Name\Core\Router::register_late_frontend_model_only_routes()
100 |
101 | Register Late Frontend `Model Only` Routes
102 |
103 |
104 |
105 | * Visibility: **public**
106 |
107 |
108 |
109 |
110 | ### register_generic_routes
111 |
112 | void Plugin_Name\Core\Router::register_generic_routes()
113 |
114 | Register Generic Routes
115 |
116 |
117 |
118 | * Visibility: **public**
119 |
120 |
121 |
122 |
123 | ### register_late_frontend_routes
124 |
125 | void Plugin_Name\Core\Router::register_late_frontend_routes()
126 |
127 | Register Late Frontend Routes
128 |
129 |
130 |
131 | * Visibility: **public**
132 |
133 |
134 |
135 |
136 | ### generic_route_types
137 |
138 | array Plugin_Name\Core\Router::generic_route_types()
139 |
140 | Returns List of commonly/mostly used Route types
141 |
142 |
143 |
144 | * Visibility: **public**
145 |
146 |
147 |
148 |
149 | ### late_frontend_route_types
150 |
151 | array Plugin_Name\Core\Router::late_frontend_route_types()
152 |
153 | Returns list of Route types belonging to Frontend but registered late
154 |
155 |
156 |
157 | * Visibility: **public**
158 |
159 |
160 |
161 |
162 | ### register_route_of_type
163 |
164 | \Plugin_Name\Core\Router Plugin_Name\Core\Router::register_route_of_type(string $type)
165 |
166 | Type of Route to be registered. Every time a new route needs to be
167 | registered, this function should be called first on `$route` object
168 |
169 |
170 |
171 | * Visibility: **public**
172 |
173 |
174 | #### Arguments
175 | * $type **string** - <p>Type of route to be registered.</p>
176 |
177 |
178 |
179 | ### with_just_model
180 |
181 | mixed Plugin_Name\Core\Router::with_just_model(mixed $model)
182 |
183 | Enqueues a model to be associated with the Model only` Route
184 |
185 |
186 |
187 | * Visibility: **public**
188 |
189 |
190 | #### Arguments
191 | * $model **mixed** - <p>Model to be associated with the Route. Could be String or callback.</p>
192 |
193 |
194 |
195 | ### build_controller_unique_id
196 |
197 | string Plugin_Name\Core\Router::build_controller_unique_id(mixed $controller)
198 |
199 | Generates a Unique id for each controller
200 |
201 | This unique id is used as an array key inside mvc_components array which
202 | is used while enqueueing models and views to associate them with the
203 | controller.
204 |
205 | * Visibility: **public**
206 |
207 |
208 | #### Arguments
209 | * $controller **mixed** - <p>Controller to be associated with the Route. Could be String or callback.</p>
210 |
211 |
212 |
213 | ### with_controller
214 |
215 | object Plugin_Name\Core\Router::with_controller(mixed $controller)
216 |
217 | Enqueues a controller to be associated with the Route
218 |
219 |
220 |
221 | * Visibility: **public**
222 |
223 |
224 | #### Arguments
225 | * $controller **mixed** - <p>Controller to be associated with the Route. Could be String or callback.</p>
226 |
227 |
228 |
229 | ### with_model
230 |
231 | object Plugin_Name\Core\Router::with_model(mixed $model)
232 |
233 | Enqueues a model to be associated with the Route
234 |
235 | The object of this model is passed to controller.
236 |
237 | * Visibility: **public**
238 |
239 |
240 | #### Arguments
241 | * $model **mixed** - <p>Model to be associated with the Route. Could be String or callback.</p>
242 |
243 |
244 |
245 | ### with_view
246 |
247 | object Plugin_Name\Core\Router::with_view(mixed $view)
248 |
249 | Registers view with the Route. The object of this view is passed to controller
250 |
251 |
252 |
253 | * Visibility: **public**
254 |
255 |
256 | #### Arguments
257 | * $view **mixed** - <p>View to be associated with the Route. Could be String or callback.</p>
258 |
259 |
260 |
261 | ### register_routes
262 |
263 | void Plugin_Name\Core\Router::register_routes(boolean $register_late_frontend_routes)
264 |
265 | Registers Enqueued Routes
266 |
267 |
268 |
269 | * Visibility: **private**
270 |
271 |
272 | #### Arguments
273 | * $register_late_frontend_routes **boolean** - <p>Whether to register late frontend routes.</p>
274 |
275 |
276 |
277 | ### dispatch
278 |
279 | void Plugin_Name\Core\Router::dispatch(array $mvc_component, string $route_type)
280 |
281 | Dispatches the route of specified $route_type by creating a controller object
282 |
283 |
284 |
285 | * Visibility: **private**
286 |
287 |
288 | #### Arguments
289 | * $mvc_component **array** - <p>Model-View-Controller triads for all registered routes.</p>
290 | * $route_type **string** - <p>Route Type.</p>
291 |
292 |
293 |
294 | ### register_model_only_routes
295 |
296 | void Plugin_Name\Core\Router::register_model_only_routes(boolean $register_late_frontend_routes)
297 |
298 | Registers `Model Only` Enqueued Routes
299 |
300 |
301 |
302 | * Visibility: **public**
303 |
304 |
305 | #### Arguments
306 | * $register_late_frontend_routes **boolean** - <p>Whether to register late frontend routes.</p>
307 |
308 |
309 |
310 | ### dispatch_only_model
311 |
312 | void Plugin_Name\Core\Router::dispatch_only_model(mixed $model, string $route_type)
313 |
314 | Dispatches the model only route by creating a Model object
315 |
316 |
317 |
318 | * Visibility: **private**
319 |
320 |
321 | #### Arguments
322 | * $model **mixed** - <p>Model to be associated with the Route. Could be String or callback.</p>
323 | * $route_type **string** - <p>Route Type.</p>
324 |
325 |
326 |
327 | ### get_fully_qualified_class_name
328 |
329 | string Plugin_Name\Core\Router::get_fully_qualified_class_name(string $class, string $mvc_component_type, string $route_type)
330 |
331 | Returns the Full Qualified Class Name for given class name
332 |
333 |
334 |
335 | * Visibility: **private**
336 |
337 |
338 | #### Arguments
339 | * $class **string** - <p>Class whose FQCN needs to be found out.</p>
340 | * $mvc_component_type **string** - <p>Could be between 'model', 'view' or 'controller'.</p>
341 | * $route_type **string** - <p>Could be 'admin' or 'frontend'.</p>
342 |
343 |
344 |
345 | ### is_request
346 |
347 | boolean Plugin_Name\Core\Router::is_request(string $route_type)
348 |
349 | Identifies Request Type
350 |
351 |
352 |
353 | * Visibility: **private**
354 |
355 |
356 | #### Arguments
357 | * $route_type **string** - <p>Route Type to identify.</p>
358 |
359 |
360 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-Core-View.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\Core\View
2 | ===============
3 |
4 | Class Responsible for Loading Templates
5 |
6 |
7 |
8 |
9 | * Class name: View
10 | * Namespace: Plugin_Name\Core
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Methods
19 | -------
20 |
21 |
22 | ### render_template
23 |
24 | void Plugin_Name\Core\View::render_template(mixed $template_name, array $args, string $template_path, string $default_path)
25 |
26 | Render Templates
27 |
28 |
29 |
30 | * Visibility: **public**
31 | * This method is **static**.
32 |
33 |
34 | #### Arguments
35 | * $template_name **mixed** - <p>Template file to render.</p>
36 | * $args **array** - <p>Variables to make available inside template file.</p>
37 | * $template_path **string** - <p>Directory to search for template.</p>
38 | * $default_path **string** - <p>Fallback directory to search for template if not found at $template_path.</p>
39 |
40 |
41 |
42 | ### locate_template
43 |
44 | string Plugin_Name\Core\View::locate_template(mixed $template_name, string $template_path, string $default_path)
45 |
46 | Locate a template and return the path for inclusion.
47 |
48 | This is the load order:
49 |
50 | yourtheme / $template_path / $template_name
51 | yourtheme / $template_name
52 | $default_path / $template_name
53 |
54 | * Visibility: **public**
55 | * This method is **static**.
56 |
57 |
58 | #### Arguments
59 | * $template_name **mixed** - <p>Template file to locate.</p>
60 | * $template_path **string** - <p>$template_path Directory to search for template.</p>
61 | * $default_path **string** - <p>Fallback directory to search for template if not found at $template_path.</p>
62 |
63 |
64 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-Includes-Dependency_Loader.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\Includes\Dependency_Loader
2 | ===============
3 |
4 | Includes all methods required for loading Plugin Dependencies
5 |
6 |
7 |
8 |
9 | * Class name: Dependency_Loader
10 | * Namespace: Plugin_Name\Includes
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Methods
19 | -------
20 |
21 |
22 | ### load_dependencies
23 |
24 | mixed Plugin_Name\Includes\Dependency_Loader::load_dependencies(string $class)
25 |
26 | Loads all Plugin dependencies
27 |
28 | Converts Class parameter passed to the method into the file path & then
29 | `require_once` that path. It works with Class as well as with Traits.
30 |
31 | * Visibility: **public**
32 |
33 |
34 | #### Arguments
35 | * $class **string** - <p>Class need to be loaded.</p>
36 |
37 |
38 |
39 | ### load_registries
40 |
41 | void Plugin_Name\Includes\Dependency_Loader::load_registries()
42 |
43 | Load All Registry Class Files
44 |
45 |
46 |
47 | * Visibility: **protected**
48 |
49 |
50 |
51 |
52 | ### load_core
53 |
54 | void Plugin_Name\Includes\Dependency_Loader::load_core()
55 |
56 | Load Core MVC Classes
57 |
58 |
59 |
60 | * Visibility: **protected**
61 |
62 |
63 |
64 |
65 | ### autoload_dependencies
66 |
67 | mixed Plugin_Name\Includes\Dependency_Loader::autoload_dependencies()
68 |
69 | Method responsible to call all the dependencies
70 |
71 |
72 |
73 | * Visibility: **protected**
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-Includes-Requirements_Checker.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\Includes\Requirements_Checker
2 | ===============
3 |
4 | Checks whether plugin's requirements are being met or not
5 |
6 |
7 |
8 |
9 | * Class name: Requirements_Checker
10 | * Namespace: Plugin_Name\Includes
11 |
12 |
13 |
14 |
15 |
16 | Properties
17 | ----------
18 |
19 |
20 | ### $min_php_version
21 |
22 | private string $min_php_version = '5.6'
23 |
24 | Holds minimum php version for plugin if not defined in `requirements.php`.
25 |
26 |
27 |
28 | * Visibility: **private**
29 |
30 |
31 | ### $min_wp_version
32 |
33 | private string $min_wp_version = '4.8'
34 |
35 | Holds minimum wp version for plugin if not defined in `requirements.php`.
36 |
37 |
38 |
39 | * Visibility: **private**
40 |
41 |
42 | ### $is_multisite_compatible
43 |
44 | private boolean $is_multisite_compatible = false
45 |
46 | Holds the information whether plugin is compatible with Multisite or not.
47 |
48 |
49 |
50 | * Visibility: **private**
51 |
52 |
53 | ### $required_plugins
54 |
55 | private array $required_plugins = array()
56 |
57 | Holds list of required plugins to be installed and active for our plugin to work
58 |
59 |
60 |
61 | * Visibility: **private**
62 |
63 |
64 | ### $errors
65 |
66 | private array $errors = array()
67 |
68 | Holds Error messages if dependencies are not met
69 |
70 |
71 |
72 | * Visibility: **private**
73 |
74 |
75 | Methods
76 | -------
77 |
78 |
79 | ### __construct
80 |
81 | mixed Plugin_Name\Includes\Requirements_Checker::__construct(array $requirements_data)
82 |
83 | Constructor
84 |
85 |
86 |
87 | * Visibility: **public**
88 |
89 |
90 | #### Arguments
91 | * $requirements_data **array** - <p>Requirements Data mentioned in <code>requirements.php</code>.</p>
92 |
93 |
94 |
95 | ### is_php_version_dependency_met
96 |
97 | boolean Plugin_Name\Includes\Requirements_Checker::is_php_version_dependency_met()
98 |
99 | Checks if Installed PHP Version is higher than required PHP Version
100 |
101 |
102 |
103 | * Visibility: **private**
104 |
105 |
106 |
107 |
108 | ### is_wp_version_dependency_met
109 |
110 | boolean Plugin_Name\Includes\Requirements_Checker::is_wp_version_dependency_met()
111 |
112 | Checks if Installed WP Version is higher than required WP Version
113 |
114 |
115 |
116 | * Visibility: **private**
117 |
118 |
119 |
120 |
121 | ### is_wp_multisite_dependency_met
122 |
123 | boolean Plugin_Name\Includes\Requirements_Checker::is_wp_multisite_dependency_met()
124 |
125 | Checks if Multisite Dependencies are met
126 |
127 |
128 |
129 | * Visibility: **private**
130 |
131 |
132 |
133 |
134 | ### is_plugin_active
135 |
136 | boolean Plugin_Name\Includes\Requirements_Checker::is_plugin_active(string $plugin_name, string $plugin_slug)
137 |
138 | Checks whether plugin is active or not
139 |
140 |
141 |
142 | * Visibility: **private**
143 |
144 |
145 | #### Arguments
146 | * $plugin_name **string** - <p>Name of the plugin.</p>
147 | * $plugin_slug **string** - <p>Slug of the plugin.</p>
148 |
149 |
150 |
151 | ### get_plugin_version
152 |
153 | string Plugin_Name\Includes\Requirements_Checker::get_plugin_version(string $plugin_slug)
154 |
155 | Returns the plugin version of passed plugin
156 |
157 |
158 |
159 | * Visibility: **private**
160 |
161 |
162 | #### Arguments
163 | * $plugin_slug **string** - <p>Plugin Slug of whose version needs to be retrieved.</p>
164 |
165 |
166 |
167 | ### is_required_plugin_version_active
168 |
169 | boolean Plugin_Name\Includes\Requirements_Checker::is_required_plugin_version_active(string $plugin_name, string $plugin_slug, string $min_plugin_version)
170 |
171 | Checks whether required version of plugin is active
172 |
173 |
174 |
175 | * Visibility: **private**
176 |
177 |
178 | #### Arguments
179 | * $plugin_name **string** - <p>Plugin Name.</p>
180 | * $plugin_slug **string** - <p>Plugin Slug.</p>
181 | * $min_plugin_version **string** - <p>Minimum version required of the plugin.</p>
182 |
183 |
184 |
185 | ### are_required_plugins_dependency_met
186 |
187 | boolean Plugin_Name\Includes\Requirements_Checker::are_required_plugins_dependency_met()
188 |
189 | Checks whether all required plugins are installed & active with proper versions.
190 |
191 |
192 |
193 | * Visibility: **private**
194 |
195 |
196 |
197 |
198 | ### add_error_notice
199 |
200 | void Plugin_Name\Includes\Requirements_Checker::add_error_notice(string $error_message, string $supportive_information)
201 |
202 | Adds Error message in $errors variable
203 |
204 |
205 |
206 | * Visibility: **private**
207 |
208 |
209 | #### Arguments
210 | * $error_message **string** - <p>Error Message.</p>
211 | * $supportive_information **string** - <p>Supportive Information to be displayed along with Error Message in brackets.</p>
212 |
213 |
214 |
215 | ### requirements_met
216 |
217 | boolean Plugin_Name\Includes\Requirements_Checker::requirements_met()
218 |
219 | Checks if all plugins requirements are met or not
220 |
221 |
222 |
223 | * Visibility: **public**
224 |
225 |
226 |
227 |
228 | ### show_requirements_errors
229 |
230 | mixed Plugin_Name\Includes\Requirements_Checker::show_requirements_errors()
231 |
232 | Prints an error that the system requirements weren't met.
233 |
234 |
235 |
236 | * Visibility: **public**
237 |
238 |
239 |
240 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name-Includes-i18n.md:
--------------------------------------------------------------------------------
1 | Plugin_Name\Includes\i18n
2 | ===============
3 |
4 | Define the internationalization functionality
5 |
6 | Loads and defines the internationalization files for this plugin
7 | so that it is ready for translation.
8 |
9 |
10 | * Class name: i18n
11 | * Namespace: Plugin_Name\Includes
12 |
13 |
14 |
15 |
16 |
17 | Properties
18 | ----------
19 |
20 |
21 | ### $domain
22 |
23 | private string $domain
24 |
25 | The domain specified for this plugin.
26 |
27 |
28 |
29 | * Visibility: **private**
30 |
31 |
32 | Methods
33 | -------
34 |
35 |
36 | ### load_plugin_textdomain
37 |
38 | mixed Plugin_Name\Includes\i18n::load_plugin_textdomain()
39 |
40 | Load the plugin text domain for translation.
41 |
42 |
43 |
44 | * Visibility: **public**
45 |
46 |
47 |
48 |
49 | ### set_domain
50 |
51 | mixed Plugin_Name\Includes\i18n::set_domain(string $domain)
52 |
53 | Set the domain equal to that of the specified domain.
54 |
55 |
56 |
57 | * Visibility: **public**
58 |
59 |
60 | #### Arguments
61 | * $domain **string** - <p>The domain that represents the locale of this plugin.</p>
62 |
63 |
64 |
--------------------------------------------------------------------------------
/plugin-name/docs/Plugin_Name.md:
--------------------------------------------------------------------------------
1 | Plugin_Name
2 | ===============
3 |
4 | The main plugin class
5 |
6 |
7 |
8 |
9 | * Class name: Plugin_Name
10 | * Namespace:
11 | * Parent class: [Plugin_Name\Includes\Dependency_Loader](Plugin_Name-Includes-Dependency_Loader.md)
12 |
13 |
14 |
15 | Constants
16 | ----------
17 |
18 |
19 | ### PLUGIN_ID
20 |
21 | const PLUGIN_ID = 'plugin-name'
22 |
23 |
24 |
25 |
26 |
27 | ### PLUGIN_NAME
28 |
29 | const PLUGIN_NAME = 'Plugin Name'
30 |
31 |
32 |
33 |
34 |
35 | ### PLUGIN_VERSION
36 |
37 | const PLUGIN_VERSION = '1.0.0'
38 |
39 |
40 |
41 |
42 |
43 | Properties
44 | ----------
45 |
46 |
47 | ### $instance
48 |
49 | private \Plugin_Name $instance
50 |
51 | Holds instance of this class
52 |
53 |
54 |
55 | * Visibility: **private**
56 | * This property is **static**.
57 |
58 |
59 | ### $plugin_path
60 |
61 | private string $plugin_path
62 |
63 | Main plugin path /wp-content/plugins/