PluginProbe
Tiered Pricing Table for WooCommerce / 2.2.0
Tiered Pricing Table for WooCommerce v2.2.0
8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 All 91 releases
tier-pricing-table / vendor / premmerce / wordpress-sdk / readme.md

readme.md in Tiered Pricing Table for WooCommerce 2.2.0, at vendor/premmerce/wordpress-sdk/readme.md

124 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 # Premmerce Wordpress SDK
2
3 Premmerce wordpress SDK used in plugins generated by premmerce-dev-tools plugin.
4
5 ## FileManager
6
7 File manager is responsible for plugin resources(assets, views, paths) management.
8 Class should be initialized with plugin main file full path as parameter.
9
10
11 params:
12 * string $mainFile - main plugin file path
13 * string $templatePath - theme directory to override plugin templates located in `frontend` directory
14
15 ```php
16 $fileManager = new FileManager($mainFile);
17
18 //V2
19 $fileManager = new FileManager($mainFile, $templatePath);
20 ```
21
22 ### includeTemplate
23
24 includeTemplate(string $template, array $variables = [])
25
26
27 params:
28 * string $template - relative path to file
29 * array $variables - array of variables used in template file
30
31 Includes template located in plugin `views` folder with passed variables in scope
32
33 Each template located in `views/forntend` directory can be overridden in theme in `/plugin_name/` directory
34
35 ```php
36
37 $fileManager->includeTemplate('admin/index.php',['title' => 'My title']);
38 ```
39
40 ### renderTemplate
41
42 renderTemplate(string $template, array $variables = [])
43
44 params:
45 * string $template - relative path to file
46 * array $variables - array of variables used in template file
47
48 Returns rendered template located in plugin `views` folder with passed variables in scope
49
50 Each template located in `views/forntend` directory can be overridden in theme in `/plugin_name/` directory
51
52 ```php
53
54 $rendered = $fileManager->includeTemplate('admin/index.php',['title' => 'My title']);
55
56 ```
57
58 ### locateAsset
59
60 locateAsset(string $file)
61
62 Returns asset url located in plugin `assets` folder
63
64 params:
65 * string $template - relative path to file
66
67
68 ```php
69
70 $url = $fileManager->locateAsset('admin/css/style.css');
71
72 wp_enqueue_style('my_style', $fileManager->locateAsset('front/css/style.css'));
73
74 ```
75
76 ## AdminNotifier
77
78 Class is responsible for displaying messages in admin area. AdminNotifier should be instantiated, before `admin_notices` action
79
80 ### push
81
82 Show message on admin_notices action
83
84 push(string $message, string $type = self::SUCCESS, bool $isDismissible = false)
85
86 params:
87 * string $message - message text
88 * string $type - message type, one of predefined constants: AdminNotifier::SUCCESS|AdminNotifier::ERROR|AdminNotifier::WARNING|AdminNotifier::INFO
89 * bool $isDismissible - can user dismiss message
90
91 ```php
92
93 $notifier->push('Message text', AdminNotifier::SUCCESS, true)
94
95 ```
96 ### flash
97
98 Save flash message to show during next request
99
100 flash(string $message, string $type = self::SUCCESS, bool $isDismissible = false)
101
102 params:
103 * string $message - message text
104 * string $type - message type, one of predefined constants: AdminNotifier::SUCCESS|AdminNotifier::ERROR|AdminNotifier::WARNING|AdminNotifier::INFO
105 * bool $isDismissible - can user dismiss message
106
107
108 ```php
109
110 $notifier->flash('Message text', AdminNotifier::SUCCESS, true)
111
112 ```
113
114 ## PluginInterface
115
116 The Interface that should be implemented by plugin main file
117
118 ### Changelog
119
120 #### V2
121
122 * Added second parameter to FileManager `__construct()`
123 * Added `flash` method to AdminNotifier
124