Skip to content

Commit 3011a28

Browse files
committed
first commit to upload in git hub
0 parents  commit 3011a28

23 files changed

+1378
-0
lines changed

LICENSE.txt

+339
Large diffs are not rendered by default.

README.txt

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
=== Plugin Name ===
2+
Contributors: (this should be a list of wordpress.org userid's)
3+
Donate link: http://example.com/
4+
Tags: comments, spam
5+
Requires at least: 3.0.1
6+
Tested up to: 3.4
7+
Stable tag: 4.3
8+
License: GPLv2 or later
9+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10+
11+
Here is a short description of the plugin. This should be no more than 150 characters. No markup here.
12+
13+
== Description ==
14+
15+
This is the long description. No limit, and you can use Markdown (as well as in the following sections).
16+
17+
For backwards compatibility, if this section is missing, the full length of the short description will be used, and
18+
Markdown parsed.
19+
20+
A few notes about the sections above:
21+
22+
* "Contributors" is a comma separated list of wp.org/wp-plugins.org usernames
23+
* "Tags" is a comma separated list of tags that apply to the plugin
24+
* "Requires at least" is the lowest version that the plugin will work on
25+
* "Tested up to" is the highest version that you've *successfully used to test the plugin*. Note that it might work on
26+
higher versions... this is just the highest one you've verified.
27+
* Stable tag should indicate the Subversion "tag" of the latest stable version, or "trunk," if you use `/trunk/` for
28+
stable.
29+
30+
Note that the `readme.txt` of the stable tag is the one that is considered the defining one for the plugin, so
31+
if the `/trunk/readme.txt` file says that the stable tag is `4.3`, then it is `/tags/4.3/readme.txt` that'll be used
32+
for displaying information about the plugin. In this situation, the only thing considered from the trunk `readme.txt`
33+
is the stable tag pointer. Thus, if you develop in trunk, you can update the trunk `readme.txt` to reflect changes in
34+
your in-development version, without having that information incorrectly disclosed about the current stable version
35+
that lacks those changes -- as long as the trunk's `readme.txt` points to the correct stable tag.
36+
37+
If no stable tag is provided, it is assumed that trunk is stable, but you should specify "trunk" if that's where
38+
you put the stable version, in order to eliminate any doubt.
39+
40+
== Installation ==
41+
42+
This section describes how to install the plugin and get it working.
43+
44+
e.g.
45+
46+
1. Upload `plugin-name.php` to the `/wp-content/plugins/` directory
47+
1. Activate the plugin through the 'Plugins' menu in WordPress
48+
1. Place `<?php do_action('plugin_name_hook'); ?>` in your templates
49+
50+
== Frequently Asked Questions ==
51+
52+
= A question that someone might have =
53+
54+
An answer to that question.
55+
56+
= What about foo bar? =
57+
58+
Answer to foo bar dilemma.
59+
60+
== Screenshots ==
61+
62+
1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from
63+
the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets
64+
directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png`
65+
(or jpg, jpeg, gif).
66+
2. This is the second screen shot
67+
68+
== Changelog ==
69+
70+
= 1.0 =
71+
* A change since the previous version.
72+
* Another change.
73+
74+
= 0.5 =
75+
* List versions from most recent at top to oldest at bottom.
76+
77+
== Upgrade Notice ==
78+
79+
= 1.0 =
80+
Upgrade notices describe the reason a user should upgrade. No more than 300 characters.
81+
82+
= 0.5 =
83+
This version fixes a security related bug. Upgrade immediately.
84+
85+
== Arbitrary section ==
86+
87+
You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated
88+
plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or
89+
"installation." Arbitrary sections will be shown below the built-in sections outlined above.
90+
91+
== A brief Markdown Example ==
92+
93+
Ordered list:
94+
95+
1. Some feature
96+
1. Another feature
97+
1. Something else about the plugin
98+
99+
Unordered list:
100+
101+
* something
102+
* something else
103+
* third thing
104+
105+
Here's a link to [WordPress](http://wordpress.org/ "Your favorite software") and one to [Markdown's Syntax Documentation][markdown syntax].
106+
Titles are optional, naturally.
107+
108+
[markdown syntax]: http://daringfireball.net/projects/markdown/syntax
109+
"Markdown is what the parser uses to process much of the readme file"
110+
111+
Markdown uses email style notation for blockquotes and I've been told:
112+
> Asterisks for *emphasis*. Double it up for **strong**.
113+
114+
`<?php code(); // goes in backticks ?>`
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/*Admin CSS*/

assets/admin/index.php

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php // Silence is golden

assets/admin/js/plugin-name-admin.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//admin JS
2+
(function ($) {
3+
$(document).ready(function () {
4+
var $window = $(window);
5+
$window.on("load", function () {
6+
7+
});
8+
9+
});
10+
11+
})(jQuery);

assets/css/plugin-name-public.css

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/*Public CSS*/

assets/index.php

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php // Silence is golden

assets/js/plugin-name-public.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(function ($) {
2+
$(document).ready(function () {
3+
var $window = $(window);
4+
$window.on("load", function () {
5+
6+
});
7+
8+
});
9+
10+
})(jQuery);

includes/class-autoloader.php

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
3+
namespace Plugin_Name_Dir\Includes;
4+
class Autoloader
5+
{
6+
public function __construct()
7+
{
8+
spl_autoload_register(array($this, 'autoload'));
9+
}
10+
11+
public function autoload($class_name)
12+
{
13+
// If the specified $class_name does not include our namespace, duck out.
14+
if (false === strpos($class_name, 'Plugin_Name_Dir')) {
15+
return;
16+
}
17+
18+
// Split the class name into an array to read the namespace and class.
19+
$file_parts = explode('\\', $class_name);
20+
21+
// Do a reverse loop through $file_parts to build the path to the file.
22+
$namespace = '';
23+
$file_name = '';
24+
for ($i = count($file_parts) - 1; $i > 0; $i--) {
25+
// Read the current component of the file part.
26+
$current = strtolower($file_parts[$i]);
27+
$current = str_ireplace('_', '-', $current);
28+
29+
// If we're at the first entry, then we're at the filename.
30+
if (count($file_parts) - 1 === $i) {
31+
32+
/* If 'interface' is contained in the parts of the file name, then
33+
* define the $file_name differently so that it's properly loaded.
34+
* Otherwise, just set the $file_name equal to that of the class
35+
* filename structure.
36+
*/
37+
if (strpos(strtolower($file_parts[count($file_parts) - 1]), 'interface')) {
38+
39+
// Grab the name of the interface from its qualified name.
40+
$interface_name = explode('_', $file_parts[count($file_parts) - 1]);
41+
$interface_name = $interface_name[0];
42+
43+
$file_name = "interface-$interface_name.php";
44+
45+
} else {
46+
$file_name = "class-$current.php";
47+
}
48+
} else {
49+
$namespace = '/' . $current . $namespace;
50+
}
51+
}
52+
53+
// Now build a path to the file using mapping to the file location.
54+
$filepath = trailingslashit(dirname(dirname(__FILE__)) . $namespace);
55+
$filepath .= $file_name;
56+
57+
// If the file exists in the specified path, then include it.
58+
if (file_exists($filepath)) {
59+
include_once($filepath);
60+
} else {
61+
wp_die(
62+
esc_html("The file attempting to be loaded at $filepath does not exist.")
63+
);
64+
}
65+
}
66+
67+
68+
}
69+
70+
new Autoloader();
71+

includes/init/class-activator.php

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
namespace Plugin_Name_Dir\Includes\Init;
3+
class Activator
4+
{
5+
6+
//Install Database
7+
//Initialize Config
8+
//update_option('my_first_plugin',1);
9+
public static function activate()
10+
{
11+
//Create table in plugin activation
12+
13+
14+
15+
}
16+
17+
18+
}

includes/init/class-admin-hook.php

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?php
2+
3+
/**
4+
* The admin-specific functionality of the plugin.
5+
*
6+
* @link http://example.com
7+
* @since 1.0.0
8+
*
9+
* @package Plugin_Name
10+
* @subpackage Plugin_Name/admin
11+
*/
12+
namespace Plugin_Name_Dir\Includes\Init;
13+
/**
14+
* The admin-specific functionality of the plugin.
15+
*
16+
* Defines the plugin name, version, and two examples hooks for how to
17+
* enqueue the admin-specific stylesheet and JavaScript.
18+
*
19+
* @package Plugin_Name
20+
* @subpackage Plugin_Name/admin
21+
* @author Your Name <[email protected]>
22+
*/
23+
class Admin_Hook {
24+
25+
/**
26+
* The ID of this plugin.
27+
*
28+
* @since 1.0.0
29+
* @access private
30+
* @var string $plugin_name The ID of this plugin.
31+
*/
32+
private $plugin_name;
33+
34+
/**
35+
* The version of this plugin.
36+
*
37+
* @since 1.0.0
38+
* @access private
39+
* @var string $version The current version of this plugin.
40+
*/
41+
private $version;
42+
43+
/**
44+
* Initialize the class and set its properties.
45+
*
46+
* @since 1.0.0
47+
* @param string $plugin_name The name of this plugin.
48+
* @param string $version The version of this plugin.
49+
*/
50+
public function __construct( $plugin_name, $version ) {
51+
52+
$this->plugin_name = $plugin_name;
53+
$this->version = $version;
54+
55+
}
56+
57+
/**
58+
* Register the stylesheets for the admin area.
59+
*
60+
* @since 1.0.0
61+
*/
62+
public function enqueue_styles() {
63+
64+
/**
65+
* This function is provided for demonstration purposes only.
66+
*
67+
* An instance of this class should be passed to the run() function
68+
* defined in Plugin_Name_Loader as all of the hooks are defined
69+
* in that particular class.
70+
*
71+
* The Plugin_Name_Loader will then create the relationship
72+
* between the defined hooks and the functions defined in this
73+
* class.
74+
*/
75+
76+
wp_enqueue_style( $this->plugin_name.'-admin-style', PLUGIN_NAME_ADMIN_CSS. 'plugin-name-admin.css', array(), $this->version, 'all' );
77+
78+
}
79+
80+
/**
81+
* Register the JavaScript for the admin area.
82+
*
83+
* @since 1.0.0
84+
*/
85+
public function enqueue_scripts() {
86+
87+
/**
88+
* This function is provided for demonstration purposes only.
89+
*
90+
* An instance of this class should be passed to the run() function
91+
* defined in Plugin_Name_Loader as all of the hooks are defined
92+
* in that particular class.
93+
*
94+
* The Plugin_Name_Loader will then create the relationship
95+
* between the defined hooks and the functions defined in this
96+
* class.
97+
*/
98+
99+
wp_enqueue_script( $this->plugin_name.'-admin-script', PLUGIN_NAME_ADMIN_JS. 'plugin-name-admin.js', array( 'jquery' ), $this->version, false );
100+
101+
}
102+
103+
}

0 commit comments

Comments
 (0)