Skip to content

Commit d66bb99

Browse files
committed
Composer/Namespace integration
1 parent b04223c commit d66bb99

30 files changed

+968
-148
lines changed

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,44 @@ NOTE: Requires PHP 5.4 and up. Uses `cURL` for API integration class.
1515
Also, change the `/asset` file paths in plugin file `wp-plugin-framework.php` to your chosen folder path name.
1616
It's a precaution to avoid conflict.
1717

18-
2. In `autoload.php` the `PLUGIN_BUILD` class includes all the files in instance and declares the classes inside them. You can remove existing files or add more files. It's recomended to put all the plugin features instances inside `PLUGIN_BUILD`. This will help in organising the code.
18+
2. In `plugin/PluginLoader.php` the `PluginLoader` class includes all the files in instance and declares the classes inside them. You can remove existing files or add more files. It's recomended to put all the plugin features instances inside `PluginLoader`. This will help in organising the code.
1919

20-
3. In `autoload.php` the installation and uninstallation classes contain possible situations, including DB installation and uninstallation features.
20+
3. In `plugin/PluginLoader.php` the installation and uninstallation classes contain possible situations, including DB installation and uninstallation features.
2121

2222
## Features
2323

2424
Go through the files in `/lib/class-` and `/src/class-`. First one contains classes for extra features, while the latter is using essential features.
2525

26-
### `/lib` Files
26+
### `/plugin/lib` Files
2727

28-
`/lib/class-cron.php` :: `PLUGIN_CRON` to schedule operations.
28+
`/plugin/lib/Cron.php` :: `Cron` to schedule operations.
2929

30-
`/lib/class-api.php` :: `PLUGIN_API` to integrate 3rd party APIs.
30+
`/plugin/lib/Api.php` :: `Api` to integrate 3rd party APIs.
3131

32-
`lib/table.php` :: `PLUGIN_TABLE` to display data tables.
32+
`/plugin/lib/Table.php` :: `Table` to display data tables.
3333

34-
`/lib/class-ajax.php` :: `PLUGIN_AJAX` to make AJAX requests.
34+
`/plugin/lib/Ajax.php` :: `Ajax` to make AJAX requests.
3535

36-
`/lib/class-upload.php` :: `PLUGIN_UPLOAD` to upload a file.
36+
`/plugin/lib/Upload.php` :: `Upload` to upload a file.
3737

38-
`/lib/class-script.php` :: `PLUGIN_SCRIPT` to add required CSS and JS.
38+
`/plugin/lib/Script.php` :: `Script` to add required CSS and JS.
3939

40-
### `/src` Files
40+
### `/plugin/src` Files
4141

42-
`/src/class-install.php` :: `PLUGIN_INSTALL` to handle activation process.
42+
`/plugin/src/Install.php` :: `Install` to handle activation process.
4343

44-
`/src/class-db.php` :: `PLUGIN_DB` to install database tables.
44+
`/plugin/src/Db.php` :: `Db` to install database tables.
4545

46-
`/src/class-settings.php` :: `PLUGIN_SETTINGS` to create admin settings pages.
46+
`/plugin/src/Settings.php` :: `Settings` to create admin settings pages.
4747

48-
`/src/class-cpt.php` :: `PLUGIN_CPT` to create custom post type.
48+
`/plugin/src/Cpt.php` :: `Cpt` to create custom post type.
4949

50-
`/src/class-widget.php` :: `PLUGIN_WIDGET` to add custom widget.
50+
`/plugin/src/Widget.php` :: `Widget` to add custom widget.
5151

52-
`/src/class-metabox.php` :: `PLUGIN_METABOX` to add custom metabox in editor screen.
52+
`/plugin/src/Metabox.php` :: `Metabox` to add custom metabox in editor screen.
5353

54-
`/src/class-shortcode.php`:: `PLUGIN_SHORTCODE` to add and display shortcodes.
54+
`/plugin/src/Shortcode.php`:: `Shortcode` to add and display shortcodes.
5555

56-
`/src/class-query.php`:: `PLUGIN_QUERY` to use post and user query. It uses `wp_pagenavi()` for breadceumbs
56+
`/plugin/src/Query.php`:: `Query` to use post and user query. It uses `wp_pagenavi()` for breadceumbs
5757

58-
`/src/class-rest.php`:: `PLUGIN_CUSTOM_ROUTE` to extend REST API.
58+
`/plugin/src/RestApi.php`:: `RestApi` to extend REST API.

asset/ln/textdomain.pot

Lines changed: 153 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ msgid ""
33
msgstr ""
44
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
55
"Project-Id-Version: WordPress Plugin Framework\n"
6-
"POT-Creation-Date: 2020-07-25 13:12+0530\n"
7-
"PO-Revision-Date: 2020-07-25 13:12+0530\n"
6+
"POT-Creation-Date: 2021-02-20 18:26+0530\n"
7+
"PO-Revision-Date: 2021-02-20 18:26+0530\n"
88
"Last-Translator: \n"
99
"Language-Team: \n"
1010
"MIME-Version: 1.0\n"
1111
"Content-Type: text/plain; charset=UTF-8\n"
1212
"Content-Transfer-Encoding: 8bit\n"
13-
"X-Generator: Poedit 2.4\n"
13+
"X-Generator: Poedit 2.4.2\n"
1414
"X-Poedit-Basepath: ../..\n"
1515
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
1616
"X-Poedit-WPHeader: wp-plugin-framework.php\n"
@@ -20,124 +20,241 @@ msgstr ""
2020
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
2121
"X-Poedit-SearchPath-0: .\n"
2222
"X-Poedit-SearchPathExcluded-0: *.min.js\n"
23+
"X-Poedit-SearchPathExcluded-1: vendor\n"
2324

24-
#: autoload.php:163
25-
msgid "Database table Not installed correctly."
26-
msgstr ""
27-
28-
#: lib/ajax.php:33
25+
#: plugin/Lib/Ajax.php:40
2926
msgid "Text"
3027
msgstr ""
3128

32-
#: lib/cron.php:53
29+
#: plugin/Lib/Cron.php:61
3330
msgid "Every "
3431
msgstr ""
3532

36-
#: lib/table.php:29 lib/table.php:149
33+
#: plugin/Lib/Table.php:32 plugin/Lib/Table.php:178
3734
msgid "Name"
3835
msgstr ""
3936

40-
#: lib/table.php:30
37+
#: plugin/Lib/Table.php:33
4138
msgid "Names"
4239
msgstr ""
4340

44-
#: lib/table.php:77
41+
#: plugin/Lib/Table.php:90
4542
msgid "No Items Added yet."
4643
msgstr ""
4744

48-
#: lib/table.php:107
45+
#: plugin/Lib/Table.php:126
4946
msgid "Delete"
5047
msgstr ""
5148

52-
#: lib/table.php:150
49+
#: plugin/Lib/Table.php:179
5350
msgid "Case One"
5451
msgstr ""
5552

56-
#: lib/table.php:151
53+
#: plugin/Lib/Table.php:180
5754
msgid "Case Two"
5855
msgstr ""
5956

60-
#: lib/table.php:152
57+
#: plugin/Lib/Table.php:181
6158
msgid "Case Three"
6259
msgstr ""
6360

64-
#: lib/upload.php:36
61+
#: plugin/Lib/Upload.php:41
6562
msgid "Upload"
6663
msgstr ""
6764

68-
#: lib/upload.php:82
65+
#: plugin/Lib/Upload.php:94
6966
msgid "Please Upload correct type of file only."
7067
msgstr ""
7168

72-
#: lib/upload.php:92
69+
#: plugin/Lib/Upload.php:108
7370
msgid "File Upload failed."
7471
msgstr ""
7572

76-
#: lib/upload.php:102
73+
#: plugin/Lib/Upload.php:122
7774
msgid "Successfully saved file details."
7875
msgstr ""
7976

80-
#: src/install.php:60
77+
#: plugin/PluginLoader.php:169
78+
msgid "Database table Not installed correctly."
79+
msgstr ""
80+
81+
#: plugin/PluginLoader.php:323
82+
msgid "You are not currently logged in."
83+
msgstr ""
84+
85+
#: plugin/Src/Cpt.php:60
86+
msgctxt "Post Type General Name"
87+
msgid ""
88+
msgstr ""
89+
90+
#: plugin/Src/Cpt.php:61
91+
msgctxt "Post Type Singular Name"
92+
msgid ""
93+
msgstr ""
94+
95+
#: plugin/Src/Cpt.php:130
96+
#, php-format
97+
msgid "CPT updated. <a href=\"%s\">View CPT</a>"
98+
msgstr ""
99+
100+
#: plugin/Src/Cpt.php:131
101+
msgid "field updated."
102+
msgstr ""
103+
104+
#: plugin/Src/Cpt.php:132
105+
msgid "field deleted."
106+
msgstr ""
107+
108+
#: plugin/Src/Cpt.php:133
109+
msgid "CPT updated."
110+
msgstr ""
111+
112+
#: plugin/Src/Cpt.php:134
113+
#, php-format
114+
msgid "CPT restored to revision from %s"
115+
msgstr ""
116+
117+
#: plugin/Src/Cpt.php:135
118+
#, php-format
119+
msgid "CPT published. <a href=\"%s\">View Cpt</a>"
120+
msgstr ""
121+
122+
#: plugin/Src/Cpt.php:136
123+
msgid "CPT saved."
124+
msgstr ""
125+
126+
#: plugin/Src/Cpt.php:137
127+
#, php-format
128+
msgid "CPT submitted. <a target=\"_blank\" href=\"%s\">Preview cpt</a>"
129+
msgstr ""
130+
131+
#: plugin/Src/Cpt.php:138
132+
#, php-format
133+
msgid ""
134+
"CPT scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s"
135+
"\">Preview cpt</a>"
136+
msgstr ""
137+
138+
#: plugin/Src/Cpt.php:138
139+
msgid "M j, Y @ G:i"
140+
msgstr ""
141+
142+
#: plugin/Src/Cpt.php:139
143+
#, php-format
144+
msgid "CPT draft updated. <a target=\"_blank\" href=\"%s\">Preview cpt</a>"
145+
msgstr ""
146+
147+
#: plugin/Src/Cpt.php:154
148+
msgctxt "taxonomy general name"
149+
msgid "Taxonomy"
150+
msgstr ""
151+
152+
#: plugin/Src/Cpt.php:155
153+
msgctxt "taxonomy singular name"
154+
msgid "Taxonomy"
155+
msgstr ""
156+
157+
#: plugin/Src/Cpt.php:156
158+
msgid "Search Taxonomy"
159+
msgstr ""
160+
161+
#: plugin/Src/Cpt.php:157
162+
msgid "All Taxonomies"
163+
msgstr ""
164+
165+
#: plugin/Src/Cpt.php:158
166+
msgid "Parent Taxonomy"
167+
msgstr ""
168+
169+
#: plugin/Src/Cpt.php:159
170+
msgid "Parent Taxonomy:"
171+
msgstr ""
172+
173+
#: plugin/Src/Cpt.php:160
174+
msgid "Edit Taxonomy"
175+
msgstr ""
176+
177+
#: plugin/Src/Cpt.php:161
178+
msgid "Update Taxonomy"
179+
msgstr ""
180+
181+
#: plugin/Src/Cpt.php:162
182+
msgid "Add New Taxonomy"
183+
msgstr ""
184+
185+
#: plugin/Src/Cpt.php:163
186+
msgid "New Taxonomy Name"
187+
msgstr ""
188+
189+
#: plugin/Src/Cpt.php:164
190+
msgid "Taxonomy"
191+
msgstr ""
192+
193+
#: plugin/Src/Install.php:72
81194
msgid "The Plugin can't be activated because your PHP version"
82195
msgstr ""
83196

84-
#: src/install.php:61
197+
#: plugin/Src/Install.php:73
85198
msgid "is less than required "
86199
msgstr ""
87200

88-
#: src/metabox.php:32
201+
#: plugin/Src/Metabox.php:39
89202
msgid "MetaBox Title"
90203
msgstr ""
91204

92-
#: src/metabox.php:48
205+
#: plugin/Src/Metabox.php:59
93206
msgid "Custom Text"
94207
msgstr ""
95208

96-
#: src/settings.php:45
209+
#: plugin/Src/RestApi.php:52
210+
msgid "message"
211+
msgstr ""
212+
213+
#: plugin/Src/Settings.php:77
97214
msgid "Title"
98215
msgstr ""
99216

100-
#: src/settings.php:46
217+
#: plugin/Src/Settings.php:78
101218
msgid "Description"
102219
msgstr ""
103220

104-
#: src/settings.php:49
221+
#: plugin/Src/Settings.php:81
105222
msgid "helpLink"
106223
msgstr ""
107224

108-
#: src/settings.php:123
225+
#: plugin/Src/Settings.php:181
109226
msgid "Show per page"
110227
msgstr ""
111228

112-
#: src/settings.php:147
229+
#: plugin/Src/Settings.php:208
113230
msgid "Save"
114231
msgstr ""
115232

116-
#: src/settings.php:186
233+
#: plugin/Src/Settings.php:252
117234
msgid "Section Name"
118235
msgstr ""
119236

120-
#: src/settings.php:189
237+
#: plugin/Src/Settings.php:255
121238
msgid "Field Name"
122239
msgstr ""
123240

124-
#: src/settings.php:197
241+
#: plugin/Src/Settings.php:266
125242
msgid "Set up settings"
126243
msgstr ""
127244

128-
#: src/widget.php:24 src/widget.php:26
245+
#: plugin/Src/Widget.php:26 plugin/Src/Widget.php:28
129246
msgid "Plugin widget"
130247
msgstr ""
131248

132-
#: src/widget.php:38
249+
#: plugin/Src/Widget.php:46
133250
msgid "Hello, World!"
134251
msgstr ""
135252

136-
#: src/widget.php:47
253+
#: plugin/Src/Widget.php:60
137254
msgid "Internal Link Master"
138255
msgstr ""
139256

140-
#: src/widget.php:49
257+
#: plugin/Src/Widget.php:62
141258
msgid "Title:"
142259
msgstr ""
143260

composer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@
1515
],
1616
"require": {
1717
"php": ">=5.3.0"
18-
}
19-
}
18+
},
19+
"autoload": {
20+
"psr-4": {"NirjharLo\\WP_Plugin_Framework\\": "./plugin"}
21+
}
22+
23+
}

index.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
// silence is golden

lib/class-ajax.php renamed to plugin/Lib/Ajax.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
namespace NirjharLo\WP_Plugin_Framework\Lib;
3+
24
/**
35
* Doing AJAX the WordPress way.
46
* Use this class in admin or user side
@@ -9,9 +11,9 @@
911
if ( ! defined( 'ABSPATH' ) ) exit;
1012

1113
//AJAX helper class
12-
if ( ! class_exists( 'PLUGIN_AJAX' ) ) {
14+
if ( ! class_exists( 'Ajax' ) ) {
1315

14-
final class PLUGIN_AJAX {
16+
final class Ajax {
1517

1618

1719
/**

0 commit comments

Comments
 (0)