Skip to content

Commit 0cc724c

Browse files
committed
First release
1 parent aecb297 commit 0cc724c

Some content is hidden

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

41 files changed

+3781
-0
lines changed

Diff for: .gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Example user template template
3+
### Example user template
4+
5+
# IntelliJ project files
6+
.idea
7+
*.iml
8+
out
9+
gen
10+
node_modules
11+
dist

Diff for: LICENSE.txt

+339
Large diffs are not rendered by default.

Diff for: assets/css/jquery.tagsinput.min.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: assets/js/jquery.tagsinput.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: assets/loader.svg

+13
Loading

Diff for: build.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const fse = require('fs-extra');
2+
const zip = require('zip-dir');
3+
const plugin_info = require('./package.json');
4+
const plugin_name = plugin_info.name;
5+
6+
fse.emptyDirSync('dist/');
7+
fse.emptyDirSync('dist/' + plugin_name);
8+
fse.copySync('includes', 'dist/' + plugin_name + '/includes');
9+
fse.copySync('languages', 'dist/' + plugin_name + '/languages');
10+
fse.copySync('assets', 'dist/' + plugin_name + '/assets');
11+
fse.copySync('index.php', 'dist/' + plugin_name + '/index.php');
12+
fse.copySync('LICENSE.txt', 'dist/' + plugin_name + '/LICENSE.txt');
13+
fse.copySync('README.md', 'dist/' + plugin_name + '/README.txt');
14+
fse.copySync('README.md', 'dist/' + plugin_name + '/README.md');
15+
fse.copySync('' + plugin_name + '.php', 'dist/' + plugin_name + '/' + plugin_name + '.php');
16+
fse.copySync('uninstall.php', 'dist/' + plugin_name + '/uninstall.php');
17+
18+
// SET PLUGIN VERSION
19+
fse.writeFileSync('dist/' + plugin_name + '/' + plugin_name + '.php', fse.readFileSync('dist/' + plugin_name + '/' + plugin_name + '.php', 'utf8').replace(/{{plugin-version}}/g, plugin_info.version), 'utf8');
20+
fse.writeFileSync('dist/' + plugin_name + '/README.txt', fse.readFileSync('dist/' + plugin_name + '/README.txt', 'utf8').replace(/{{plugin-version}}/g, plugin_info.version), 'utf8');
21+
fse.writeFileSync('dist/' + plugin_name + '/README.md', fse.readFileSync('dist/' + plugin_name + '/README.md', 'utf8').replace(/{{plugin-version}}/g, plugin_info.version), 'utf8');
22+
23+
zip('dist/', {saveTo: 'dist/' + plugin_name + '_' + plugin_info.version + '.zip'}, function (err, buffer) {
24+
fse.removeSync('dist/' + plugin_name + '');
25+
});
26+
27+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
/**
4+
* Fired during plugin activation
5+
*
6+
* @link http://www.mugaict.com
7+
* @since 1.0.0
8+
*
9+
* @package Woocommerce_Custom_Registration
10+
* @subpackage Woocommerce_Custom_Registration/includes
11+
*/
12+
13+
/**
14+
* Fired during plugin activation.
15+
*
16+
* This class defines all code necessary to run during the plugin's activation.
17+
*
18+
* @since 1.0.0
19+
* @package Woocommerce_Custom_Registration
20+
* @subpackage Woocommerce_Custom_Registration/includes
21+
* @author Umberto Russo <[email protected]>
22+
*/
23+
class Woocommerce_Custom_Registration_Activator
24+
{
25+
26+
/**
27+
* Short Description. (use period)
28+
*
29+
* Long Description.
30+
*
31+
* @since 1.0.0
32+
*/
33+
public static function activate()
34+
{
35+
36+
}
37+
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
/**
4+
* Fired during plugin deactivation
5+
*
6+
* @link http://www.mugaict.com
7+
* @since 1.0.0
8+
*
9+
* @package Woocommerce_Custom_Registration
10+
* @subpackage Woocommerce_Custom_Registration/includes
11+
*/
12+
13+
/**
14+
* Fired during plugin deactivation.
15+
*
16+
* This class defines all code necessary to run during the plugin's deactivation.
17+
*
18+
* @since 1.0.0
19+
* @package Woocommerce_Custom_Registration
20+
* @subpackage Woocommerce_Custom_Registration/includes
21+
* @author Umberto Russo <[email protected]>
22+
*/
23+
class Woocommerce_Custom_Registration_Deactivator
24+
{
25+
26+
/**
27+
* Short Description. (use period)
28+
*
29+
* Long Description.
30+
*
31+
* @since 1.0.0
32+
*/
33+
public static function deactivate()
34+
{
35+
36+
}
37+
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
/**
4+
* Define the internationalization functionality
5+
*
6+
* Loads and defines the internationalization files for this plugin
7+
* so that it is ready for translation.
8+
*
9+
* @link http://www.mugaict.com
10+
* @since 1.0.0
11+
*
12+
* @package Woocommerce_Custom_Registration
13+
* @subpackage Woocommerce_Custom_Registration/includes
14+
*/
15+
16+
/**
17+
* Define the internationalization functionality.
18+
*
19+
* Loads and defines the internationalization files for this plugin
20+
* so that it is ready for translation.
21+
*
22+
* @since 1.0.0
23+
* @package Woocommerce_Custom_Registration
24+
* @subpackage Woocommerce_Custom_Registration/includes
25+
* @author Umberto Russo <[email protected]>
26+
*/
27+
class Woocommerce_Custom_Registration_i18n
28+
{
29+
30+
public static $textdomain = 'woo-custom-registration';
31+
32+
/**
33+
* Load the plugin text domain for translation.
34+
*
35+
* @since 1.0.0
36+
*/
37+
public function load_plugin_textdomain()
38+
{
39+
40+
load_plugin_textdomain(
41+
self::$textdomain,
42+
false,
43+
dirname(dirname(plugin_basename(__FILE__))) . '/languages/'
44+
);
45+
46+
}
47+
48+
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<?php
2+
3+
/**
4+
* Register all actions and filters for the plugin
5+
*
6+
* @link http://www.mugaict.com
7+
* @since 1.0.0
8+
*
9+
* @package Woocommerce_Custom_Registration
10+
* @subpackage Woocommerce_Custom_Registration/includes
11+
*/
12+
13+
/**
14+
* Register all actions and filters for the plugin.
15+
*
16+
* Maintain a list of all hooks that are registered throughout
17+
* the plugin, and register them with the WordPress API. Call the
18+
* run function to execute the list of actions and filters.
19+
*
20+
* @package Woocommerce_Custom_Registration
21+
* @subpackage Woocommerce_Custom_Registration/includes
22+
* @author Umberto Russo <[email protected]>
23+
*/
24+
class Woocommerce_Custom_Registration_Loader
25+
{
26+
27+
/**
28+
* The array of actions registered with WordPress.
29+
*
30+
* @since 1.0.0
31+
* @access protected
32+
* @var array $actions The actions registered with WordPress to fire when the plugin loads.
33+
*/
34+
protected $actions;
35+
36+
/**
37+
* The array of filters registered with WordPress.
38+
*
39+
* @since 1.0.0
40+
* @access protected
41+
* @var array $filters The filters registered with WordPress to fire when the plugin loads.
42+
*/
43+
protected $filters;
44+
45+
/**
46+
* Initialize the collections used to maintain the actions and filters.
47+
*
48+
* @since 1.0.0
49+
*/
50+
public function __construct()
51+
{
52+
53+
$this->actions = array();
54+
$this->filters = array();
55+
56+
}
57+
58+
/**
59+
* Add a new action to the collection to be registered with WordPress.
60+
*
61+
* @since 1.0.0
62+
* @param string $hook The name of the WordPress action that is being registered.
63+
* @param object $component A reference to the instance of the object on which the action is defined.
64+
* @param string $callback The name of the function definition on the $component.
65+
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
66+
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
67+
*/
68+
public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1)
69+
{
70+
$this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args);
71+
}
72+
73+
/**
74+
* Add a new filter to the collection to be registered with WordPress.
75+
*
76+
* @since 1.0.0
77+
* @param string $hook The name of the WordPress filter that is being registered.
78+
* @param object $component A reference to the instance of the object on which the filter is defined.
79+
* @param string $callback The name of the function definition on the $component.
80+
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
81+
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
82+
*/
83+
public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1)
84+
{
85+
$this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args);
86+
}
87+
88+
/**
89+
* A utility function that is used to register the actions and hooks into a single
90+
* collection.
91+
*
92+
* @since 1.0.0
93+
* @access private
94+
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
95+
* @param string $hook The name of the WordPress filter that is being registered.
96+
* @param object $component A reference to the instance of the object on which the filter is defined.
97+
* @param string $callback The name of the function definition on the $component.
98+
* @param int $priority The priority at which the function should be fired.
99+
* @param int $accepted_args The number of arguments that should be passed to the $callback.
100+
* @return array The collection of actions and filters registered with WordPress.
101+
*/
102+
private function add($hooks, $hook, $component, $callback, $priority, $accepted_args)
103+
{
104+
105+
$hooks[] = array(
106+
'hook' => $hook,
107+
'component' => $component,
108+
'callback' => $callback,
109+
'priority' => $priority,
110+
'accepted_args' => $accepted_args
111+
);
112+
113+
return $hooks;
114+
115+
}
116+
117+
/**
118+
* Register the filters and actions with WordPress.
119+
*
120+
* @since 1.0.0
121+
*/
122+
public function run()
123+
{
124+
125+
foreach ($this->filters as $hook) {
126+
add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']);
127+
}
128+
129+
foreach ($this->actions as $hook) {
130+
add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']);
131+
}
132+
133+
}
134+
135+
}

0 commit comments

Comments
 (0)