Skip to content

Commit bfb5e3e

Browse files
author
David Ryan
committed
rebuild base beta3
1 parent 2a0cbda commit bfb5e3e

File tree

304 files changed

+817
-20142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

304 files changed

+817
-20142
lines changed

CODE-OF-CONDUCT.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
CONTRIBUTOR COVENANT CODE OF CONDUCT
2+
Our Pledge
3+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
4+
5+
Our Standards
6+
Examples of behavior that contributes to creating a positive environment include:
7+
8+
Using welcoming and inclusive language
9+
Being respectful of differing viewpoints and experiences
10+
Gracefully accepting constructive criticism
11+
Focusing on what is best for the community
12+
Showing empathy towards other community members
13+
Examples of unacceptable behavior by participants include:
14+
15+
The use of sexualized language or imagery and unwelcome sexual attention or advances
16+
Trolling, insulting/derogatory comments, and personal or political attacks
17+
Public or private harassment
18+
Publishing others’ private information, such as a physical or electronic address, without explicit permission
19+
Other conduct which could reasonably be considered inappropriate in a professional setting
20+
Our Responsibilities
21+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
22+
23+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
24+
25+
Scope
26+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
27+
28+
Enforcement
29+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
30+
31+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.
32+
33+
Attribution
34+
This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

DEV-NOTES.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Developing using the Abstract Plugin Base
2+
3+
Learn how to add new functionality, files and build plugins using the Abstract Plugin Base.
4+
5+
https://github.com/WordPress-Phoenix/abstract-plugin-base/wiki/Working-with-the-Abstract-Plugin-Base
6+
7+
# Developing ||PLUGIN_NAME||
8+
9+
Unique, unusual, quirky aspects of ||PLUGIN_NAME||:
10+
*
11+
12+
Known bugs/shortcomings when using ||PLUGIN_NAME||:
13+
*
14+
15+
Other misc. notes:
16+
*
17+

LICENSE

Lines changed: 117 additions & 331 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
1-
# wordpress-development-toolkit
1+
# WordPress Development Toolkit
2+
3+
Tools and resources for WordPress development.
4+
5+
## INSTALL & CONFIGURE
6+
1. Upload the entire `/wordpress-development-toolkit` directory to the `/wp-content/plugins/` directory.
7+
2. Activate WordPress Development Toolkit through the 'Plugins' menu in WordPress. In WordPress Multisite plugins can be activated
8+
per-site or for the entire network.
9+
10+
## FREQUENTLY ASKED QUESTIONS
11+
12+
## HOW TO DEBUG
13+
14+
### DEVELOPER NOTES
15+
* Main plugin file: `wordpress-development-toolkit.php`.
16+
* Main plugin class: `PHX_WP_DEVKIT\V_1_2\Plugin` in `/app/class-plugin.php`.
17+
* Public functionality loaded in `Plugin::init()`
18+
* Auth'd functionality checked with `is_user_logged_in()` and executed in `Plugin::authenticated_init()`
19+
* PHP in `/app`
20+
* JS & CSS in `/app/assets`
21+
* PHP deps in `/vendor` handled by Composer.
22+
23+
Proper PSR-4 class names i.e. (Some_Class named class-some-class.php) in `/app`, `/app/admin`, and `/app/includes`
24+
are autoloaded and don't require manual declaration.
25+
26+
For more, see DEV-NOTES.md. Note production and development dependencies in package.json and composer.json.
27+
28+
## CONTRIBUTORS
29+
30+
This plugin is maintained by David Ryan - WordPress Phoenix.
31+
||PLUGIN_GITHUB_REPO||/graphs/contributors/

app/admin/class-auth-assets.php

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?php
2+
3+
namespace PHX_WP_DEVKIT\V_1_2\Admin;
4+
5+
/**
6+
* Register and enqueue assets used in the WordPress Admin or only when a user is authenticated here.
7+
*
8+
* Class Auth_Assets
9+
*/
10+
class Auth_Assets {
11+
12+
/**
13+
* @var string
14+
*/
15+
public $installed_dir;
16+
17+
/**
18+
* @var string
19+
*/
20+
public $installed_url;
21+
22+
/**
23+
* @var string
24+
*/
25+
public $asset_url;
26+
27+
/**
28+
* @var string
29+
*/
30+
public $version;
31+
32+
/**
33+
* Auth_Assets constructor.
34+
*
35+
* @param string $dir
36+
* @param string $url
37+
* @param string $version
38+
*/
39+
function __construct( $dir, $url, $version ) {
40+
$this->installed_dir = $dir;
41+
$this->installed_url = $url;
42+
$this->asset_url = $this->installed_url . 'app/assets/';
43+
$this->version = $version;
44+
45+
/**
46+
* Enqueue Assets
47+
*/
48+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_auth_assets' ) );
49+
50+
/**
51+
* Register Assets
52+
*/
53+
add_action( 'init', array( $this, 'register_stylesheets' ) );
54+
add_action( 'init', array( $this, 'register_scripts' ) );
55+
}
56+
57+
/**
58+
* Enqueue Assets for Authenticated Users
59+
* @package Wordpress_development_toolkit
60+
*/
61+
function enqueue_auth_assets() {
62+
wp_enqueue_style( 'wordpress-development-toolkit-admin' );
63+
wp_enqueue_script( 'wordpress-development-toolkit-admin' );
64+
}
65+
66+
/**
67+
* Register CSS with WordPress
68+
* @package Wordpress_development_toolkit
69+
*/
70+
function register_stylesheets() {
71+
wp_register_style(
72+
'wordpress-development-toolkit-admin',
73+
$this->asset_url . 'wordpress-development-toolkit-admin.css',
74+
array(),
75+
$this->version
76+
);
77+
}
78+
79+
/**
80+
* Register JavaScript with WordPress for Wordpress_development_toolkit
81+
* @package Wordpress_development_toolkit
82+
*/
83+
function register_scripts() {
84+
wp_register_script(
85+
'wordpress-development-toolkit-admin',
86+
$this->asset_url . 'wordpress-development-toolkit-admin.js',
87+
array( 'jquery' ), // jquery is loaded everywhere in the wp-admin, so not enqueueing addl. scripts
88+
false,
89+
true // load in footer
90+
);
91+
}
92+
93+
} // END class Auth_Assets

app/admin/class-generators-page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace WP_PHX_Dev_Kit\V_1_0\Admin;
3+
namespace PHX_WP_DEVKIT\V_1_2\Admin;
44

55
class Generators_Page {
66
/**

app/admin/class-init.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
3+
namespace PHX_WP_DEVKIT\V_1_2\Admin;
4+
5+
/**
6+
* Class Init
7+
* @package Wordpress_development_toolkit
8+
*/
9+
class Init {
10+
11+
/**
12+
* @var string
13+
*/
14+
public $installed_dir;
15+
16+
/**
17+
* @var string
18+
*/
19+
public $installed_url;
20+
21+
/**
22+
* @var string
23+
*/
24+
public $version;
25+
26+
/**
27+
* Add auth'd/admin functionality via new Class() instantiation, add_action() and add_filter() in this method.
28+
*
29+
* @param string $installed_dir
30+
* @param string $installed_url
31+
* @param string $version
32+
*/
33+
function __construct( $installed_dir, $installed_url, $version ) {
34+
$this->installed_dir = $installed_dir;
35+
$this->installed_url = $installed_url;
36+
$this->version = $version;
37+
38+
// handle authenticated stylesheets and scripts
39+
new Auth_Assets(
40+
$this->installed_dir,
41+
$this->installed_url,
42+
$this->version
43+
);
44+
45+
new Toolkit_Dashboard_Page(
46+
$this->installed_dir,
47+
$this->installed_url
48+
);
49+
50+
new Generators_Page(
51+
$this->installed_dir,
52+
$this->installed_url,
53+
$this->version
54+
);
55+
56+
// initialize site options panel
57+
// new Options_Panel(
58+
// $this->installed_dir,
59+
// $this->installed_url
60+
// );
61+
}
62+
63+
}

app/admin/class-options-panel.php

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<?php
2+
3+
namespace PHX_WP_DEVKIT\V_1_2\Admin;
4+
5+
use WPOP\V_2_9 as Opts;
6+
7+
/**
8+
* Class Options_Panel
9+
*/
10+
class Options_Panel {
11+
12+
/**
13+
* @var string
14+
*/
15+
public $installed_dir;
16+
17+
/**
18+
* @var string
19+
*/
20+
public $installed_url;
21+
22+
/**
23+
* @var string
24+
*/
25+
protected $site_options;
26+
27+
/**
28+
* Options_Panel constructor.
29+
*
30+
* @param string $installed_dir
31+
* @param string $installed_url
32+
*/
33+
function __construct( $installed_dir, $installed_url ) {
34+
$this->installed_dir = $installed_dir;
35+
$this->installed_url = $installed_url;
36+
37+
$this->setup_site_options();
38+
}
39+
40+
/**
41+
* Register Options Panel
42+
*/
43+
function setup_site_options() {
44+
$page = new Opts\page(
45+
array(
46+
'parent_id' => 'options-general.php',
47+
'id' => 'wordpress-development-toolkit-opts',
48+
'page_title' => 'WordPress Development Toolkit Settings' .
49+
' <small style="font-size:0.66rem;"><code>wordpress-development-toolkit</code></small>',
50+
'menu_title' => 'WordPress Development Toolkit',
51+
'dashicon' => 'dashicons-admin-settings',
52+
)
53+
);
54+
55+
$this->site_options = ( $page );
56+
57+
// setup sections
58+
$this->site_options->add_part(
59+
$general_section = new Opts\Section(
60+
'general', array(
61+
'title' => 'General',
62+
'dashicon' => 'dashicons-admin-generic',
63+
)
64+
)
65+
);
66+
67+
/**
68+
* General Configuration Fields
69+
*/
70+
$slug = 'wordpress-development-toolkit_';
71+
$general_section->add_part(
72+
$text_field = new Opts\Text(
73+
$slug . 'text', array(
74+
'label' => 'Text',
75+
)
76+
)
77+
);
78+
79+
$general_section->add_part(
80+
$textarea = new Opts\Textarea(
81+
$slug . 'textarea', array(
82+
'label' => 'Textarea',
83+
)
84+
)
85+
);
86+
87+
$general_section->add_part(
88+
$number = new Opts\Number(
89+
$slug . 'number', array(
90+
'label' => 'Number',
91+
)
92+
)
93+
);
94+
95+
96+
97+
$general_section->add_part(
98+
$media = new Opts\Media(
99+
$slug . 'media', array(
100+
'label' => 'Media',
101+
)
102+
)
103+
);
104+
105+
$general_section->add_part(
106+
$toggle = new Opts\Toggle_Switch(
107+
$slug . 'toggle', array(
108+
'label' => 'Toggle',
109+
'value' => 1,
110+
)
111+
)
112+
);
113+
114+
$general_section->add_part(
115+
$select_field = new Opts\Select(
116+
$slug . 'select', array(
117+
'label' => 'Select',
118+
'values' => array(
119+
'uno' => 'Uno',
120+
'dos' => 'Dos',
121+
'tres' => 'Tres',
122+
),
123+
)
124+
)
125+
);
126+
127+
// initialize_panel() is a function in the opt panel Container class
128+
$this->site_options->initialize_panel();
129+
}
130+
131+
}

0 commit comments

Comments
 (0)