Skip to content

Commit f947017

Browse files
committed
Documentation
1 parent 2434f2f commit f947017

File tree

17 files changed

+800
-256
lines changed

17 files changed

+800
-256
lines changed

.travis.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ sudo: false
44

55
# Mention the PHP versions
66
php:
7-
- "7.0"
8-
- "5.0"
7+
- "7.4"
8+
- "5.4"
99

1010
# Declare the WordPress requirements
1111
env:
@@ -32,32 +32,32 @@ before_script:
3232
# Create WordPress database.
3333
- mysql -e 'CREATE DATABASE wordpress_test;' -uroot
3434
# Install CodeSniffer for WordPress Coding Standards checks.
35-
#- mkdir php-codesniffer && curl -L https://github.com/squizlabs/PHP_CodeSniffer/archive/master.tar.gz | tar xz --strip-components=1 -C php-codesniffer
35+
- mkdir php-codesniffer && curl -L https://github.com/squizlabs/PHP_CodeSniffer/archive/master.tar.gz | tar xz --strip-components=1 -C php-codesniffer
3636
# Install WordPress Coding Standards.
37-
#- mkdir wordpress-coding-standards && curl -L https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/archive/master.tar.gz | tar xz --strip-components=1 -C wordpress-coding-standards
37+
- mkdir wordpress-coding-standards && curl -L https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/archive/master.tar.gz | tar xz --strip-components=1 -C wordpress-coding-standards
3838
# Hop into CodeSniffer directory.
39-
#- cd php-codesniffer
39+
- cd php-codesniffer
4040
# Set install path for WordPress Coding Standards
4141
# @link https://github.com/squizlabs/PHP_CodeSniffer/blob/4237c2fc98cc838730b76ee9cee316f99286a2a7/CodeSniffer.php#L1941
42-
#- scripts/phpcs --config-set installed_paths ../wordpress-coding-standards
42+
- scripts/phpcs --config-set installed_paths ../wordpress-coding-standards
4343
# Hop into plugins directory.
44-
#- cd $plugin_dir
44+
- cd $plugin_dir
4545
# After CodeSniffer install you should refresh your path.
46-
#- phpenv rehash
46+
- phpenv rehash
4747

4848
script:
4949
# Search plugin for PHP syntax errors.
5050
- find . \( -name '*.php' \) -exec php -lf {} \;
5151
# WordPress Coding Standards
5252
# @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
5353
# @link http://pear.php.net/package/PHP_CodeSniffer/
54-
# -p flag: Show progress of the run.
55-
# -s flag: Show sniff codes in all reports.
56-
# -v flag: Print verbose output.
57-
# -n flag: Do not print warnings (shortcut for --warning-severity=0)
54+
-p flag: Show progress of the run.
55+
-s flag: Show sniff codes in all reports.
56+
-v flag: Print verbose output.
57+
-n flag: Do not print warnings (shortcut for --warning-severity=0)
5858
# --standard: Use WordPress as the standard.
5959
# --extensions: Only sniff PHP files.
60-
#- $WP_DEVELOP_DIR/php-codesniffer/scripts/phpcs -p -s -v -n . --standard=./codesniffer.ruleset.xml --extensions=php
60+
- $WP_DEVELOP_DIR/php-codesniffer/scripts/phpcs -p -s -v -n . --standard=./codesniffer.ruleset.xml --extensions=php
6161

6262
notifications:
6363
email: false

asset/ln/plugin.pot

Whitespace-only changes.

asset/ln/textdomain.pot

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
#, fuzzy
2+
msgid ""
3+
msgstr ""
4+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5+
"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"
8+
"Last-Translator: \n"
9+
"Language-Team: \n"
10+
"MIME-Version: 1.0\n"
11+
"Content-Type: text/plain; charset=UTF-8\n"
12+
"Content-Transfer-Encoding: 8bit\n"
13+
"X-Generator: Poedit 2.4\n"
14+
"X-Poedit-Basepath: ../..\n"
15+
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
16+
"X-Poedit-WPHeader: wp-plugin-framework.php\n"
17+
"X-Poedit-SourceCharset: UTF-8\n"
18+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
19+
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
20+
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
21+
"X-Poedit-SearchPath-0: .\n"
22+
"X-Poedit-SearchPathExcluded-0: *.min.js\n"
23+
24+
#: autoload.php:163
25+
msgid "Database table Not installed correctly."
26+
msgstr ""
27+
28+
#: lib/ajax.php:33
29+
msgid "Text"
30+
msgstr ""
31+
32+
#: lib/cron.php:53
33+
msgid "Every "
34+
msgstr ""
35+
36+
#: lib/table.php:29 lib/table.php:149
37+
msgid "Name"
38+
msgstr ""
39+
40+
#: lib/table.php:30
41+
msgid "Names"
42+
msgstr ""
43+
44+
#: lib/table.php:77
45+
msgid "No Items Added yet."
46+
msgstr ""
47+
48+
#: lib/table.php:107
49+
msgid "Delete"
50+
msgstr ""
51+
52+
#: lib/table.php:150
53+
msgid "Case One"
54+
msgstr ""
55+
56+
#: lib/table.php:151
57+
msgid "Case Two"
58+
msgstr ""
59+
60+
#: lib/table.php:152
61+
msgid "Case Three"
62+
msgstr ""
63+
64+
#: lib/upload.php:36
65+
msgid "Upload"
66+
msgstr ""
67+
68+
#: lib/upload.php:82
69+
msgid "Please Upload correct type of file only."
70+
msgstr ""
71+
72+
#: lib/upload.php:92
73+
msgid "File Upload failed."
74+
msgstr ""
75+
76+
#: lib/upload.php:102
77+
msgid "Successfully saved file details."
78+
msgstr ""
79+
80+
#: src/install.php:60
81+
msgid "The Plugin can't be activated because your PHP version"
82+
msgstr ""
83+
84+
#: src/install.php:61
85+
msgid "is less than required "
86+
msgstr ""
87+
88+
#: src/metabox.php:32
89+
msgid "MetaBox Title"
90+
msgstr ""
91+
92+
#: src/metabox.php:48
93+
msgid "Custom Text"
94+
msgstr ""
95+
96+
#: src/settings.php:45
97+
msgid "Title"
98+
msgstr ""
99+
100+
#: src/settings.php:46
101+
msgid "Description"
102+
msgstr ""
103+
104+
#: src/settings.php:49
105+
msgid "helpLink"
106+
msgstr ""
107+
108+
#: src/settings.php:123
109+
msgid "Show per page"
110+
msgstr ""
111+
112+
#: src/settings.php:147
113+
msgid "Save"
114+
msgstr ""
115+
116+
#: src/settings.php:186
117+
msgid "Section Name"
118+
msgstr ""
119+
120+
#: src/settings.php:189
121+
msgid "Field Name"
122+
msgstr ""
123+
124+
#: src/settings.php:197
125+
msgid "Set up settings"
126+
msgstr ""
127+
128+
#: src/widget.php:24 src/widget.php:26
129+
msgid "Plugin widget"
130+
msgstr ""
131+
132+
#: src/widget.php:38
133+
msgid "Hello, World!"
134+
msgstr ""
135+
136+
#: src/widget.php:47
137+
msgid "Internal Link Master"
138+
msgstr ""
139+
140+
#: src/widget.php:49
141+
msgid "Title:"
142+
msgstr ""
143+
144+
#. Plugin Name of the plugin/theme
145+
msgid "WordPress Plugin Framework"
146+
msgstr ""
147+
148+
#. Plugin URI of the plugin/theme
149+
msgid "https://github.com/nirjharlo/wp-plugin-framework/"
150+
msgstr ""
151+
152+
#. Description of the plugin/theme
153+
msgid ""
154+
"Simple and Light WordPress plugin development framework for organized Object "
155+
"Oriented code for Developers."
156+
msgstr ""
157+
158+
#. Author of the plugin/theme
159+
msgid "Nirjhar Lo"
160+
msgstr ""
161+
162+
#. Author URI of the plugin/theme
163+
msgid "http://nirjharlo.com"
164+
msgstr ""

autoload.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33

44
/**
55
* Main plugin object to define the plugin
6+
* Follow: https://codex.wordpress.org/Plugin_API for details
7+
*
8+
* @author Nirjhar Lo
9+
* @version 1.2.1
10+
* @copyright (c) 2020 Nirjhar Lo
11+
* @license http://www.gnu.org/licenses/gpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE
12+
* @package wp-plugin-framework
613
*/
714
if ( ! class_exists( 'PLUGIN_BUILD' ) ) {
815

@@ -148,7 +155,7 @@ public function db_install() {
148155
/**
149156
* Notice of DB
150157
*
151-
* @return string
158+
* @return Html
152159
*/
153160
public function db_error_msg() { ?>
154161

@@ -314,10 +321,10 @@ public function init() {
314321
$this->functionality();
315322

316323
register_activation_hook( PLUGIN_FILE, array( $this, 'db_install' ) );
317-
register_activation_hook( PLUGIN_FILE, array($this, 'cron_activation' ) );
324+
register_activation_hook( PLUGIN_FILE, array( $this, 'cron_activation' ) );
318325

319326
//remove the DB and CORN upon uninstallation
320-
//$this won't work here.
327+
//using $this won't work here.
321328
register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'db_uninstall' ) );
322329
register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'cron_uninstall' ) );
323330

lib/ajax.php

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
/**
33
* Doing AJAX the WordPress way.
44
* Use this class in admin or user side
5+
*
6+
* @author Nirjhar Lo
7+
* @version 1.2.1
8+
* @package wp-plugin-framework
59
*/
610
if ( ! defined( 'ABSPATH' ) ) exit;
711

@@ -11,48 +15,53 @@
1115
final class PLUGIN_AJAX {
1216

1317

14-
// Add basic actions
18+
/**
19+
* Add basic actions
20+
*
21+
* @return Void
22+
*/
1523
public function __construct() {
1624

17-
//Adding the AJAX
18-
add_action( 'wp_footer', array( $this, 'customName_js' ) );
19-
add_action( 'wp_ajax_customName', array( $this, 'customName' ) );
20-
add_action( 'wp_ajax_nopriv_customName', array( $this, 'customName' ) );
25+
add_action( 'wp_footer', array( $this, 'custom_name_js' ) );
26+
add_action( 'wp_ajax_custom_name', array( $this, 'custom_name' ) );
27+
add_action( 'wp_ajax_nopriv_custom_name', array( $this, 'custom_name' ) );
2128
}
2229

2330

24-
25-
//Output the form
31+
/**
32+
* Output the form
33+
*
34+
* @return Html
35+
*/
2636
public function form() { ?>
2737

28-
<form id="addByAjax" method="POST" action="">
29-
<input type="text" name="textName" placeholder="<?php _e( 'Text', 'textdomain' ); ?>">
30-
<input id="AjaxSubmit" type="submit" name="submit" value="Submit">
38+
<form id="add_by_ajax" method="POST" action="">
39+
<input type="text" name="text_name" placeholder="<?php _e( 'Text', 'textdomain' ); ?>">
40+
<input id="ajax_submit" type="submit" name="submit" value="Submit">
3141
</form>
3242
<?php
3343
}
3444

3545

36-
37-
//The javascript
38-
public function customName_js() { ?>
46+
/**
47+
* The javascript
48+
*
49+
* @return Html
50+
*/
51+
public function custom_name_js() { ?>
3952

4053
<script type="text/javascript">
4154
jQuery(document).ready(function() {
4255

43-
jQuery("#addByAjax form").submit(function() {
56+
jQuery("#add_by_ajax form").submit(function() {
4457

4558
event.preventDefault();
4659

47-
var val = jQuery("input[name='textName']").val();
60+
var val = jQuery("input[name='text_name']").val();
4861

4962
jQuery.post(
50-
<?php if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") { ?>
51-
'<?php echo admin_url("admin-ajax.php", "https"); ?>',
52-
<?php } else { ?>
53-
'<?php echo admin_url("admin-ajax.php"); ?>',
54-
<?php } ?>
55-
{ 'action': 'customName', 'val': val },
63+
'<?php echo admin_url("admin-ajax.php"); ?>',
64+
{ 'action': 'custom_name', 'val': val },
5665
function(response) {
5766
if ( response != '' && response != false && response != undefined ) {
5867

@@ -69,17 +78,20 @@ function(response) {
6978
}
7079

7180

72-
73-
//The data processor
74-
public function customName() {
81+
/**
82+
* The data processor
83+
*
84+
* @return Json
85+
*/
86+
public function custom_name() {
7587

7688
$val = $_POST['val'];
7789

7890
// DO some stuff
79-
91+
8092
$response = array( 'val' => $value );
8193
echo json_encode( $response );
8294
wp_die();
8395
}
8496
}
85-
} ?>
97+
} ?>

0 commit comments

Comments
 (0)