<?php
-use Glm\GlmThemeOptions\Defines;
+use Glm\GlmThemeOptions\Defines as Defines;
function glm_theme_options_enqueue_scripts($hook){
- $defines = new Glm\GlmThemeOptions\Defines\Defines();
- $plugin_url = $defines::$glm_options_url;
- wp_enqueue_style('glm_admin_style', $plugin_url.'/sass/admin.css');
+ wp_enqueue_style('glm_admin_style', Defines\Defines::GLM_THEME_OPTIONS_URI.'/sass/admin.css');
if($hook !== "toplevel_page_glm-theme-options"){
return;
}
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_style("foundation-css", "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/css/foundation.min.css");
wp_enqueue_script('foundation-js', "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/js/foundation.min.js", true);
- wp_enqueue_script('glm_theme_options_js', $plugin_url.'/build/index.js', array('react', 'react-dom', 'wp-polyfill'),false, true);
+ wp_enqueue_script('glm_theme_options_js', Defines\Defines::GLM_THEME_OPTIONS_URI.'/build/index.js', array('react', 'react-dom', 'wp-polyfill'),false, true);
wp_enqueue_media();
}
add_action('admin_enqueue_scripts', 'glm_theme_options_enqueue_scripts');
\ No newline at end of file
--- /dev/null
+<?php
+/*
+Plugin Name: GLM Theme Options
+Plugin URI: https://www.gaslightmeddia.com
+Description: Theme options for the GLM Theme
+Version: 0.0.1
+Author: gaslightmedia
+Author URI: https://www.gaslightmedia.com
+License: GPL-2.0+
+Text Domain: glmthemeoptions
+minimum PHP Version : 5.4
+*/
+if ( ! defined( 'ABSPATH' ) ) {
+ die();
+}
+require_once get_template_directory().'/includes/defines.php';
+require_once 'utility.php';
+require_once get_template_directory().'/includes/glm-theme-options.php';
+require_once 'includes/glma-addons.php';
+
+use Glm\GlmThemeOptions\GlmaAddons as Addons,
+Glm\GlmThemeOptions\Options as Options,
+Glm\GlmThemeOptions\Utility as Utility;
+
+if(!class_exists('GlmThemeOptionsInit')){
+ class GlmThemeOptionsInit{
+ private $defines;
+ private $glm_theme_options;
+ private static $instance = null;
+ private $utility;
+ private $glma_addons;
+
+ function __construct(){
+ $this->glma_addons = new Addons\GlmaAddons();
+ $this->glm_theme_options = new Options\GlmThemeOptions();
+ }
+
+ public function get_instance(){
+ if (self::$instance === null){
+ self::$instance = new GlmThemeOptionsInit();
+ }else{
+ throw new exception('Class Already Instantiated');
+ }
+ return self::$instance;
+ }
+
+
+ public function init(){
+ require_once 'enqueue.php';
+ require_once 'menus.php';
+ $this->glm_theme_options->glm_init_theme_options();
+ $this->glm_theme_options->glm_create_ajax_actions();
+ // $this->glma_addons->glm_load_addons();
+ }
+ }
+}
+$glmThemeOptionsInit = (new GlmThemeOptionsInit)->get_instance();
+$glmThemeOptionsInit->init();
\ No newline at end of file
+++ /dev/null
-<?php
-/*
-Plugin Name: GLM Theme Options
-Plugin URI: https://www.gaslightmeddia.com
-Description: Theme options for the GLM Theme
-Version: 0.0.1
-Author: gaslightmedia
-Author URI: https://www.gaslightmedia.com
-License: GPL-2.0+
-Text Domain: glmthemeoptions
-minimum PHP Version : 5.4
-*/
-if ( ! defined( 'ABSPATH' ) ) {
- die();
-}
-require_once get_template_directory().'/includes/defines.php';
-require_once 'includes/glma-addons.php';
-
-use Glm\GlmThemeOptions\Defines;
-use Glm\GlmThemeOptions\GlmaAddons;
-
-require_once 'utility.php';
-
-if(!class_exists('GlmThemOptions')){
- class GlmThemOptions{
- private $defines;
- private $glm_theme_options;
- private static $instance = null;
- private $utility;
- private $glma_addons;
-
- function __construct(){
- $this->utility = new GlmThemeUtility();
- $this->defines = new Glm\GlmThemeOptions\Defines\Defines();
- $this->glma_addons = new Glm\GlmThemeOptions\GlmaAddons\GlmaAddons();
- $this->glm_theme_options = $this->defines::$glm_theme_options;
- }
-
- public function get_instance(){
- if (self::$instance === null){
- self::$instance = new GlmThemOptions();
- }else{
- throw new exception('Class Already Instantiated');
- }
- return self::$instance;
- }
- private function glm_init_theme_options(){
- if( !get_option( $this->glm_theme_options ) ){
- update_option( $this->glm_theme_options, json_encode("{}") );
- }
- }
- public function glm_update_theme_options() {
- $data = $_REQUEST['theme_options'];
- if( get_option( $this->glm_theme_options ) ){
- $this->utility::log($data);
- update_option( $this->glm_theme_options , $data );
- }
- // $this->utility::log( get_option($this->glm_theme_options ));
- }
- public function glm_get_theme_options() {
-
- if( get_option( $this->glm_theme_options ) ){
- $data = get_option( $this->glm_theme_options );
- echo stripslashes($data);
- }
- wp_die();
- // $this->utility::log( get_option($this->glm_theme_options ));
- }
- private function glm_create_ajax_actions(){
-
- add_action( 'wp_ajax_glm_update_theme_options', array($this,'glm_update_theme_options') );
- add_action( 'wp_ajax_glm_get_theme_options', array($this,'glm_get_theme_options') );
- // add_action( 'wp_ajax_nopriv_glm_theme_options', 'glm_update_theme_options' );
- }
- public function init(){
- require_once 'enqueue.php';
- require_once 'menus.php';
- $this->glm_init_theme_options();
- $this->glm_create_ajax_actions();
- $this->glma_addons->glm_load_addons();
- }
- }
-}
-$glmThemeOptions = (new GlmThemOptions)->get_instance();
-$glmThemeOptions->init();
\ No newline at end of file
<?php
namespace Glm\GlmThemeOptions\GlmaAddons;
+use Glm\GlmThemeOptions\Utility as Utility;
+
if (! class_exists( 'GlmaAddons') ){
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
+ // require_once ABSPATH . 'wp-admin/includes/plugin.php';
class GlmaAddons{
private $glma_addons;
+ function __construct(){
+
+ }
private function glm_addons_installed(){
- return is_plugin_active( 'glm-member-db/index.php');
+ $active = is_plugin_active( 'glm-member-db/index.php');
+ if( $active ){
+
+ }
+ return $active;
}
public function glm_load_addons(){
if( $this->glm_addons_installed() ){
$this->glma_addons = apply_filters("glm_list_addons",'');
+ foreach($this->glma_addons as $addon=>$data){
+ Utility\GlmThemeUtility::log($addon);
+ }
}
}
/**
* Register the main options menu
*/
-use Glm\GlmThemeOptions\Defines;
+use Glm\GlmThemeOptions\Defines as Defines;
function register_glm_options_menu() {
- $defines = new Glm\GlmThemeOptions\Defines\Defines();
- $plugin_url = $defines::$glm_options_url;
add_menu_page(
__( 'GLM Theme Options', 'textdomain' ),
'GLM Theme',
'manage_options',
'glm-theme-options',
'glm_theme_options_view',
- $plugin_url.'/assets/logo.png',
+ Defines\Defines::GLM_THEME_OPTIONS_URI.'/assets/logo.png',
6
);
}
<?php
+namespace Glm\GlmThemeOptions\Utility;
+
if(!class_exists('GlmThemeUtility')){
- class GlmThemeUtility{
- function __construct(){
+ final class GlmThemeUtility{
+ private function __construct(){
}
public static function log($log){
<?php
+
if( is_admin() ){
- require_once "admin/glm-theme-options.php";
+ require_once "admin/glm-theme-options-init.php";
}
+
require_once 'includes/navigation.php';
// deregister unwanted styles / scripts
namespace Glm\GlmThemeOptions\Defines;
if(!class_exists('Defines')){
- class Defines{
- public static $glm_options_url;
- public static $glm_theme_options = "glm_theme_options";
- function __construct(){
- $this::$glm_options_url = get_template_directory_uri().'/admin';
- }
+ final class Defines{
+ const GLM_THEME_OPTIONS = "glm_theme_options";
+ const GLM_THEME_OPTIONS_URI = WP_CONTENT_URL .'/themes/glmTheme/admin';
}
}
\ No newline at end of file
--- /dev/null
+<?php
+
+namespace Glm\GlmThemeOptions\Options;
+
+use Glm\GlmThemeOptions\Defines as Defines,
+Glm\GlmThemeOptions\Utility as Utility;
+
+if( ! class_exists("GlmThemeOptions") ){
+
+ class GlmThemeOptions{
+
+ function __construct(){
+
+ }
+ public function glm_update_theme_options() {
+ $data = $_REQUEST['theme_options'];
+ if( get_option( Defines\Defines::GLM_THEME_OPTIONS) ){
+ utility\GlmThemeUtility::log($data);
+ update_option( Defines\Defines::GLM_THEME_OPTIONS , $data );
+ }
+ }
+
+ public function glm_get_theme_options() {
+
+ if( get_option( Defines\Defines::GLM_THEME_OPTIONS ) ){
+ $data = get_option( Defines\Defines::GLM_THEME_OPTIONS );
+ echo stripslashes($data);
+ }
+ wp_die();
+ }
+
+ public function glm_init_theme_options(){
+ if( ! get_option( Defines\Defines::GLM_THEME_OPTIONS ) ){
+ update_option( Defines\Defines::GLM_THEME_OPTIONS, json_encode("{}") );
+ }
+ }
+
+ public function glm_create_ajax_actions(){
+ add_action( 'wp_ajax_glm_update_theme_options', array($this,'glm_update_theme_options') );
+ add_action( 'wp_ajax_glm_get_theme_options', array($this,'glm_get_theme_options') );
+ // add_action( 'wp_ajax_nopriv_glm_theme_options', 'glm_update_theme_options' );
+ }
+ }
+}
\ No newline at end of file
},
"animate.css": {
"version": "3.7.2",
+ "resolved": "https://registry.npmjs.org/animate.css/-/animate.css-3.7.2.tgz",
+ "integrity": "sha512-0bE8zYo7C0KvgOYrSVfrzkbYk6IOTVPNqkiHg2cbyF4Pq/PXzilz4BRWA3hwEUBoMp5VBgrC29lQIZyhRWdBTw==",
"dev": true
},
"ansi-colors": {
},
"autoprefixer": {
"version": "9.6.1",
+ "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.6.1.tgz",
+ "integrity": "sha512-aVo5WxR3VyvyJxcJC3h4FKfwCQvQWb1tSI5VHNibddCVWrcD1NvlxEweg3TSgiPztMnWfjpy2FURKA2kvDE+Tw==",
"dev": true,
"requires": {
"browserslist": "^4.6.3",
},
"concurrently": {
"version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-4.1.2.tgz",
+ "integrity": "sha512-Kim9SFrNr2jd8/0yNYqDTFALzUX1tvimmwFWxmp/D4mRI+kbqIIwE2RkBDrxS2ic25O1UgQMI5AtBqdtX3ynYg==",
"dev": true,
"requires": {
"chalk": "^2.4.2",
},
"css-loader": {
"version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-3.2.0.tgz",
+ "integrity": "sha512-QTF3Ud5H7DaZotgdcJjGMvyDj5F3Pn1j/sC6VBEOVp94cbwqyIBdcs/quzj4MC1BKQSrTpQznegH/5giYbhnCQ==",
"dev": true,
"requires": {
"camelcase": "^5.3.1",
},
"cssnano": {
"version": "4.1.10",
+ "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-4.1.10.tgz",
+ "integrity": "sha512-5wny+F6H4/8RgNlaqab4ktc3e0/blKutmq8yNlBFXA//nSFFAqAngjNVRzUvCgYROULmZZUoosL/KSoZo5aUaQ==",
"dev": true,
"requires": {
"cosmiconfig": "^5.0.0",
},
"foundation-sites": {
"version": "6.5.3",
+ "resolved": "https://registry.npmjs.org/foundation-sites/-/foundation-sites-6.5.3.tgz",
+ "integrity": "sha512-ZwI0idjHHjezh6jRjpPxkczvmtUuJ1uGatZHpyloX0MvsFHfM0BFoxrqdXryXugGPdmb+yJi3JYMnz6+5t3K1A==",
"dev": true
},
"fragment-cache": {
},
"gulp-concat": {
"version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/gulp-concat/-/gulp-concat-2.6.1.tgz",
+ "integrity": "sha1-Yz0WyV2IUEYorQJmVmPO5aR5M1M=",
"dev": true,
"requires": {
"concat-with-sourcemaps": "^1.0.0",
},
"gulp-copy": {
"version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/gulp-copy/-/gulp-copy-4.0.1.tgz",
+ "integrity": "sha512-UbdAwmEiVNNv55KAiUYWOP6Za7h8JPHNNyekNx8Gyc5XRlpUzTrlEclps939nOeiDPsd6jUtT2LmfavJirbZQg==",
"dev": true,
"requires": {
"gulp": "^4.0.0",
},
"gulp-postcss": {
"version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/gulp-postcss/-/gulp-postcss-8.0.0.tgz",
+ "integrity": "sha512-Wtl6vH7a+8IS/fU5W9IbOpcaLqKxd5L1DUOzaPmlnCbX1CrG0aWdwVnC3Spn8th0m8D59YbysV5zPUe1n/GJYg==",
"dev": true,
"requires": {
"fancy-log": "^1.3.2",
},
"gulp-rename": {
"version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.4.0.tgz",
+ "integrity": "sha512-swzbIGb/arEoFK89tPY58vg3Ok1bw+d35PfUNwWqdo7KM4jkmuGA78JiDNqR+JeZFaeeHnRg9N7aihX3YPmsyg==",
"dev": true
},
"gulp-replace": {
"version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-1.0.0.tgz",
+ "integrity": "sha512-lgdmrFSI1SdhNMXZQbrC75MOl1UjYWlOWNbNRnz+F/KHmgxt3l6XstBoAYIdadwETFyG/6i+vWUSCawdC3pqOw==",
"dev": true,
"requires": {
"istextorbinary": "2.2.1",
},
"gulp-sass": {
"version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/gulp-sass/-/gulp-sass-4.0.2.tgz",
+ "integrity": "sha512-q8psj4+aDrblJMMtRxihNBdovfzGrXJp1l4JU0Sz4b/Mhsi2DPrKFYCGDwjIWRENs04ELVHxdOJQ7Vs98OFohg==",
"dev": true,
"requires": {
"chalk": "^2.3.0",
},
"gulp-sourcemaps": {
"version": "2.6.5",
+ "resolved": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-2.6.5.tgz",
+ "integrity": "sha512-SYLBRzPTew8T5Suh2U8jCSDKY+4NARua4aqjj8HOysBh2tSgT9u4jc1FYirAdPx1akUxxDeK++fqw6Jg0LkQRg==",
"dev": true,
"requires": {
"@gulp-sourcemaps/identity-map": "1.X",
},
"gulp-uglifyes": {
"version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/gulp-uglifyes/-/gulp-uglifyes-0.2.1.tgz",
+ "integrity": "sha512-N2A47hGX4pK463/3E/tFuMCnTDHw2vXjHNBM6LCWmdFkJ50LF1vqCYi+71AtvT0DZxpEZN1EUMPbhOAwy/ohKw==",
"dev": true,
"requires": {
"plugin-error": "^1.0.1",
},
"jquery": {
"version": "3.4.1",
+ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz",
+ "integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==",
"dev": true
},
"js-base64": {
},
"regenerator-runtime": {
"version": "0.13.3",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz",
+ "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==",
"dev": true
},
"regex-not": {
},
"slick-carousel": {
"version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/slick-carousel/-/slick-carousel-1.8.1.tgz",
+ "integrity": "sha512-XB9Ftrf2EEKfzoQXt3Nitrt/IPbT+f1fgqBdoxO3W/+JYvtEOW6EgxnWfr9GH6nmULv7Y2tPmEX3koxThVmebA==",
"dev": true
},
"snapdragon": {
},
"style-loader": {
"version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-1.0.0.tgz",
+ "integrity": "sha512-B0dOCFwv7/eY31a5PCieNwMgMhVGFe9w+rh7s/Bx8kfFkrth9zfTZquoYvdw8URgiqxObQKcpW51Ugz1HjfdZw==",
"dev": true,
"requires": {
"loader-utils": "^1.2.3",
},
"uglifyjs-webpack-plugin": {
"version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-2.2.0.tgz",
+ "integrity": "sha512-mHSkufBmBuJ+KHQhv5H0MXijtsoA1lynJt1lXOaotja8/I0pR4L9oGaPIZw+bQBOFittXZg9OC1sXSGO9D9ZYg==",
"dev": true,
"requires": {
"cacache": "^12.0.2",