58 |
--------------------------------------------------------------------------------
/plugins/wp-spwh/includes/class-wp-spwh-activator.php:
--------------------------------------------------------------------------------
1 |
22 | */
23 | class Wp_Spwh_Activator {
24 |
25 | /**
26 | * Short Description. (use period)
27 | *
28 | * Long Description.
29 | *
30 | * @since 1.0.0
31 | */
32 | public static function activate() {
33 |
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/plugins/wp-spwh/includes/class-wp-spwh-deactivator.php:
--------------------------------------------------------------------------------
1 |
22 | */
23 | class Wp_Spwh_Deactivator {
24 |
25 | /**
26 | * Short Description. (use period)
27 | *
28 | * Long Description.
29 | *
30 | * @since 1.0.0
31 | */
32 | public static function deactivate() {
33 |
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/plugins/wp-spwh/includes/class-wp-spwh-i18n.php:
--------------------------------------------------------------------------------
1 |
26 | */
27 | class Wp_Spwh_i18n {
28 |
29 |
30 | /**
31 | * Load the plugin text domain for translation.
32 | *
33 | * @since 1.0.0
34 | */
35 | public function load_plugin_textdomain() {
36 |
37 | load_plugin_textdomain(
38 | 'wp-spwh',
39 | false,
40 | dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
41 | );
42 |
43 | }
44 |
45 |
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/plugins/wp-spwh/includes/class-wp-spwh-loader.php:
--------------------------------------------------------------------------------
1 |
23 | */
24 | class Wp_Spwh_Loader {
25 |
26 | /**
27 | * The array of actions registered with WordPress.
28 | *
29 | * @since 1.0.0
30 | * @access protected
31 | * @var array $actions The actions registered with WordPress to fire when the plugin loads.
32 | */
33 | protected $actions;
34 |
35 | /**
36 | * The array of filters registered with WordPress.
37 | *
38 | * @since 1.0.0
39 | * @access protected
40 | * @var array $filters The filters registered with WordPress to fire when the plugin loads.
41 | */
42 | protected $filters;
43 |
44 | /**
45 | * Initialize the collections used to maintain the actions and filters.
46 | *
47 | * @since 1.0.0
48 | */
49 | public function __construct() {
50 |
51 | $this->actions = array();
52 | $this->filters = array();
53 |
54 | }
55 |
56 | /**
57 | * Add a new action to the collection to be registered with WordPress.
58 | *
59 | * @since 1.0.0
60 | * @param string $hook The name of the WordPress action that is being registered.
61 | * @param object $component A reference to the instance of the object on which the action is defined.
62 | * @param string $callback The name of the function definition on the $component.
63 | * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
64 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
65 | */
66 | public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
67 | $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
68 | }
69 |
70 | /**
71 | * Add a new filter to the collection to be registered with WordPress.
72 | *
73 | * @since 1.0.0
74 | * @param string $hook The name of the WordPress filter that is being registered.
75 | * @param object $component A reference to the instance of the object on which the filter is defined.
76 | * @param string $callback The name of the function definition on the $component.
77 | * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
78 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
79 | */
80 | public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
81 | $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
82 | }
83 |
84 | /**
85 | * A utility function that is used to register the actions and hooks into a single
86 | * collection.
87 | *
88 | * @since 1.0.0
89 | * @access private
90 | * @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
91 | * @param string $hook The name of the WordPress filter that is being registered.
92 | * @param object $component A reference to the instance of the object on which the filter is defined.
93 | * @param string $callback The name of the function definition on the $component.
94 | * @param int $priority The priority at which the function should be fired.
95 | * @param int $accepted_args The number of arguments that should be passed to the $callback.
96 | * @return array The collection of actions and filters registered with WordPress.
97 | */
98 | private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
99 |
100 | $hooks[] = array(
101 | 'hook' => $hook,
102 | 'component' => $component,
103 | 'callback' => $callback,
104 | 'priority' => $priority,
105 | 'accepted_args' => $accepted_args
106 | );
107 |
108 | return $hooks;
109 |
110 | }
111 |
112 | /**
113 | * Register the filters and actions with WordPress.
114 | *
115 | * @since 1.0.0
116 | */
117 | public function run() {
118 |
119 | foreach ( $this->filters as $hook ) {
120 | add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
121 | }
122 |
123 | foreach ( $this->actions as $hook ) {
124 | add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
125 | }
126 |
127 | }
128 |
129 | }
130 |
--------------------------------------------------------------------------------
/plugins/wp-spwh/includes/class-wp-spwh.php:
--------------------------------------------------------------------------------
1 |
29 | */
30 | class Wp_Spwh {
31 |
32 | /**
33 | * The loader that's responsible for maintaining and registering all hooks that power
34 | * the plugin.
35 | *
36 | * @since 1.0.0
37 | * @access protected
38 | * @var Wp_Spwh_Loader $loader Maintains and registers all hooks for the plugin.
39 | */
40 | protected $loader;
41 |
42 | /**
43 | * The unique identifier of this plugin.
44 | *
45 | * @since 1.0.0
46 | * @access protected
47 | * @var string $plugin_name The string used to uniquely identify this plugin.
48 | */
49 | protected $plugin_name;
50 |
51 | /**
52 | * The current version of the plugin.
53 | *
54 | * @since 1.0.0
55 | * @access protected
56 | * @var string $version The current version of the plugin.
57 | */
58 | protected $version;
59 |
60 | /**
61 | * Define the core functionality of the plugin.
62 | *
63 | * Set the plugin name and the plugin version that can be used throughout the plugin.
64 | * Load the dependencies, define the locale, and set the hooks for the admin area and
65 | * the public-facing side of the site.
66 | *
67 | * @since 1.0.0
68 | */
69 | public function __construct() {
70 | if ( defined( 'PLUGIN_NAME_VERSION' ) ) {
71 | $this->version = PLUGIN_NAME_VERSION;
72 | } else {
73 | $this->version = '1.0.0';
74 | }
75 | $this->plugin_name = 'wp-spwh';
76 |
77 | $this->load_dependencies();
78 | $this->set_locale();
79 | $this->define_admin_hooks();
80 | $this->define_public_hooks();
81 |
82 | }
83 |
84 | /**
85 | * Load the required dependencies for this plugin.
86 | *
87 | * Include the following files that make up the plugin:
88 | *
89 | * - Wp_Spwh_Loader. Orchestrates the hooks of the plugin.
90 | * - Wp_Spwh_i18n. Defines internationalization functionality.
91 | * - Wp_Spwh_Admin. Defines all hooks for the admin area.
92 | * - Wp_Spwh_Public. Defines all hooks for the public side of the site.
93 | *
94 | * Create an instance of the loader which will be used to register the hooks
95 | * with WordPress.
96 | *
97 | * @since 1.0.0
98 | * @access private
99 | */
100 | private function load_dependencies() {
101 |
102 | /**
103 | * The class responsible for orchestrating the actions and filters of the
104 | * core plugin.
105 | */
106 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wp-spwh-loader.php';
107 |
108 | /**
109 | * The class responsible for defining internationalization functionality
110 | * of the plugin.
111 | */
112 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wp-spwh-i18n.php';
113 |
114 | /**
115 | * The class responsible for defining all actions that occur in the admin area.
116 | */
117 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wp-spwh-admin.php';
118 |
119 | /**
120 | * The class responsible for defining all actions that occur in the public-facing
121 | * side of the site.
122 | */
123 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wp-spwh-public.php';
124 |
125 | $this->loader = new Wp_Spwh_Loader();
126 |
127 | }
128 |
129 | /**
130 | * Define the locale for this plugin for internationalization.
131 | *
132 | * Uses the Wp_Spwh_i18n class in order to set the domain and to register the hook
133 | * with WordPress.
134 | *
135 | * @since 1.0.0
136 | * @access private
137 | */
138 | private function set_locale() {
139 |
140 | $plugin_i18n = new Wp_Spwh_i18n();
141 |
142 | $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
143 |
144 | }
145 |
146 | /**
147 | * Register all of the hooks related to the admin area functionality
148 | * of the plugin.
149 | *
150 | * @since 1.0.0
151 | * @access private
152 | */
153 | private function define_admin_hooks() {
154 |
155 | $plugin_admin = new Wp_Spwh_Admin( $this->get_plugin_name(), $this->get_version() );
156 |
157 | $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
158 | $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
159 |
160 | // Add menu item.
161 | $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_admin_menu' );
162 |
163 | // Add Settings link to the plugin.
164 | $plugin_basename = plugin_basename( plugin_dir_path( __DIR__ ) . $this->plugin_name . '.php' );
165 | $this->loader->add_filter( 'plugin_action_links_' . $plugin_basename, $plugin_admin, 'add_action_links' );
166 |
167 | // Save or Update plugin options.
168 | $this->loader->add_action('admin_init', $plugin_admin, 'options_update');
169 |
170 | // Hook into save_post action.
171 | $this->loader->add_action('save_post', $plugin_admin ,'send_notification_to_endpoint');
172 | // Hook into edit_post action.
173 | $this->loader->add_action('edit_post', $plugin_admin ,'send_notification_to_endpoint');
174 | }
175 |
176 | /**
177 | * Register all of the hooks related to the public-facing functionality
178 | * of the plugin.
179 | *
180 | * @since 1.0.0
181 | * @access private
182 | */
183 | private function define_public_hooks() {
184 |
185 | $plugin_public = new Wp_Spwh_Public( $this->get_plugin_name(), $this->get_version() );
186 |
187 | $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
188 | $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
189 | }
190 |
191 | /**
192 | * Run the loader to execute all of the hooks with WordPress.
193 | *
194 | * @since 1.0.0
195 | */
196 | public function run() {
197 | $this->loader->run();
198 | }
199 |
200 | /**
201 | * The name of the plugin used to uniquely identify it within the context of
202 | * WordPress and to define internationalization functionality.
203 | *
204 | * @since 1.0.0
205 | * @return string The name of the plugin.
206 | */
207 | public function get_plugin_name() {
208 | return $this->plugin_name;
209 | }
210 |
211 | /**
212 | * The reference to the class that orchestrates the hooks with the plugin.
213 | *
214 | * @since 1.0.0
215 | * @return Wp_Spwh_Loader Orchestrates the hooks of the plugin.
216 | */
217 | public function get_loader() {
218 | return $this->loader;
219 | }
220 |
221 | /**
222 | * Retrieve the version number of the plugin.
223 | *
224 | * @since 1.0.0
225 | * @return string The version number of the plugin.
226 | */
227 | public function get_version() {
228 | return $this->version;
229 | }
230 |
231 | }
232 |
--------------------------------------------------------------------------------
/plugins/wp-spwh/includes/index.php:
--------------------------------------------------------------------------------
1 |
22 | */
23 | class Wp_Spwh_Public {
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 the 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 public-facing side of the site.
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 Wp_Spwh_Loader as all of the hooks are defined
69 | * in that particular class.
70 | *
71 | * The Wp_Spwh_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, plugin_dir_url( __FILE__ ) . 'css/wp-spwh-public.css', array(), $this->version, 'all' );
77 |
78 | }
79 |
80 | /**
81 | * Register the JavaScript for the public-facing side of the site.
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 Wp_Spwh_Loader as all of the hooks are defined
92 | * in that particular class.
93 | *
94 | * The Wp_Spwh_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, plugin_dir_url( __FILE__ ) . 'js/wp-spwh-public.js', array( 'jquery' ), $this->version, false );
100 |
101 | }
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/plugins/wp-spwh/public/css/wp-spwh-public.css:
--------------------------------------------------------------------------------
1 | /**
2 | * All of the CSS for your public-facing functionality should be
3 | * included in this file.
4 | */
--------------------------------------------------------------------------------
/plugins/wp-spwh/public/index.php:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/plugins/wp-spwh/uninstall.php:
--------------------------------------------------------------------------------
1 | run();
75 |
76 | }
77 | run_wp_spwh();
78 |
--------------------------------------------------------------------------------
/themes/index.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | You are trying to access an page that is intended to be used only as part of a WP Headless CMS.
12 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/themes/wp-headless/style.css:
--------------------------------------------------------------------------------
1 | /*
2 | Theme Name: WP Headless CMS
3 | Author: Integris Web
4 | */
5 |
--------------------------------------------------------------------------------