Skip to content

Commit

Permalink
updated: token functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mh-rafi committed Jan 14, 2022
1 parent c75f5b8 commit 1c34c92
Show file tree
Hide file tree
Showing 13 changed files with 308 additions and 107 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"phpcs.enable": true,
"phpcs.executablePath": "./vendor/bin/phpcs",
"phpcs.standard": "WordPress"
}
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
"authors": [
],
"minimum-stability": "dev",
"require": {},
"autoload": {
"psr-4": {
"UIlib\\Gumpress\\": "includes/"
},
"files": ["includes/functions.php"]
},
"require-dev": {
"squizlabs/php_codesniffer": "4.0.x-dev",
"dealerdirect/phpcodesniffer-composer-installer": "dev-master"
}
}
}
137 changes: 134 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 27 additions & 20 deletions gumpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/


if ( ! defined( 'ABSPATH' ) ) {
if (!defined('ABSPATH')) {
exit;
}

Expand All @@ -21,7 +21,8 @@
/**
* The main plugin class
*/
final class Gumpress {
final class Gumpress
{

/**
* Plugin version
Expand All @@ -33,23 +34,25 @@ final class Gumpress {
/**
* Class construcotr
*/
private function __construct() {
private function __construct()
{
$this->define_constants();

register_activation_hook( __FILE__, [ $this, 'activate' ] );
register_activation_hook(__FILE__, [$this, 'activate']);

add_action( 'plugins_loaded', [ $this, 'init_plugin' ] );
add_action('plugins_loaded', [$this, 'init_plugin']);
}

/**
* Initializes a singleton instance
*
* @return \Gumpress
*/
public static function init() {
public static function init()
{
static $instance = false;

if ( ! $instance ) {
if (!$instance) {
$instance = new self();
}

Expand All @@ -61,38 +64,40 @@ public static function init() {
*
* @return void
*/
public function define_constants() {
define( 'UL_GUMPRESS_VERSION', self::version );
define( 'UL_GUMPRESS_FILE', __FILE__ );
define( 'UL_GUMPRESS_PATH', __DIR__ );
define( 'UL_GUMPRESS_URL', plugins_url( '', UL_GUMPRESS_FILE ) );
define( 'UL_GUMPRESS_ASSETS', UL_GUMPRESS_URL . '/assets' );
public function define_constants()
{
define('UL_GUMPRESS_VERSION', self::version);
define('UL_GUMPRESS_FILE', __FILE__);
define('UL_GUMPRESS_PATH', __DIR__);
define('UL_GUMPRESS_URL', plugins_url('', UL_GUMPRESS_FILE));
define('UL_GUMPRESS_ASSETS', UL_GUMPRESS_URL . '/assets');
}

/**
* Initialize the plugin
*
* @return void
*/
public function init_plugin() {

public function init_plugin()
{

new UIlib\Gumpress\Assets();

if ( is_admin() ) {
if (is_admin()) {
new \UIlib\Gumpress\Admin();
} else {
// wp_die(';fjdlskfl');
new \UIlib\Gumpress\Frontend();
}

}

/**
* Do stuff upon plugin activation
*
* @return void
*/
public function activate() {
public function activate()
{
$installer = new \UIlib\Gumpress\Installer();
$installer->run();
}
Expand All @@ -103,9 +108,11 @@ public function activate() {
*
* @return \Gumpress
*/
function gumpress() {
function gumpress()
{
return Gumpress::init();
}

// kick-off the plugin
gumpress();
gumpress();

2 changes: 1 addition & 1 deletion includes/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function __construct() {

/**
* Dispatch and bind actions
*
* @param object $settings | Instance of Settings
* @return void
*/
public function dispatch_actions($settings) {
Expand Down
2 changes: 0 additions & 2 deletions includes/Admin/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ public function admin_menu() {
$capability = 'manage_options';

add_menu_page( __( 'Gumpress', 'gumpress' ), __( 'Gumpress', 'gumpress' ), $capability, $parent_slug, [ $this->settings, 'settings_page' ], 'dashicons-vault' );
// add_submenu_page( $parent_slug, __( 'Gumpress', 'gumpress' ), __( 'Gumpress', 'gumpress' ), $capability, $parent_slug, [ $this, 'gumpress_page' ] );
// add_submenu_page( $parent_slug, __( 'Settings', 'gumpress' ), __( 'Settings', 'gumpress' ), $capability, 'gumpress-settings', [ $this->settings, 'settings_page' ] );
}


Expand Down
Loading

0 comments on commit 1c34c92

Please sign in to comment.