diff --git a/assets/images/gumpress.svg b/assets/images/gumpress.svg new file mode 100644 index 0000000..60c6f0d --- /dev/null +++ b/assets/images/gumpress.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/composer.json b/composer.json index 26315ae..48def54 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,5 @@ "UIlib\\Gumpress\\": "includes/" }, "files": ["includes/functions.php"] - }, - "require-dev": { - } } diff --git a/composer.lock b/composer.lock index a0a9ab7..331600a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,143 +4,12 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2f57c96cafdcaebf4db717c31e369c7e", + "content-hash": "8836b3dfa0f30b6c1856cece91fc19e0", "packages": [], - "packages-dev": [ - { - "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "858566c0b7fe3798f91f1918e1b455636cbf57af" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/858566c0b7fe3798f91f1918e1b455636cbf57af", - "reference": "858566c0b7fe3798f91f1918e1b455636cbf57af", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0" - }, - "require-dev": { - "composer/composer": "*", - "php-parallel-lint/php-parallel-lint": "^1.3.1", - "phpcompatibility/php-compatibility": "^9.0" - }, - "default-branch": true, - "type": "composer-plugin", - "extra": { - "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" - }, - "autoload": { - "psr-4": { - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Franck Nijhof", - "email": "franck.nijhof@dealerdirect.com", - "homepage": "http://www.frenck.nl", - "role": "Developer / IT Manager" - } - ], - "description": "PHP_CodeSniffer Standards Composer Installer Plugin", - "homepage": "http://www.dealerdirect.com", - "keywords": [ - "PHPCodeSniffer", - "PHP_CodeSniffer", - "code quality", - "codesniffer", - "composer", - "installer", - "phpcs", - "plugin", - "qa", - "quality", - "standard", - "standards", - "style guide", - "stylecheck", - "tests" - ], - "support": { - "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", - "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" - }, - "time": "2021-11-30T15:06:39+00:00" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "4.0.x-dev", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "be50a18aa1bef2aca769bdb3d6297b2708ee75cb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/be50a18aa1bef2aca769bdb3d6297b2708ee75cb", - "reference": "be50a18aa1bef2aca769bdb3d6297b2708ee75cb", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=7.2.0" - }, - "require-dev": { - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards" - ], - "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" - }, - "time": "2022-01-11T23:50:29+00:00" - } - ], + "packages-dev": [], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "squizlabs/php_codesniffer": 20, - "dealerdirect/phpcodesniffer-composer-installer": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": [], diff --git a/gumpress.php b/gumpress.php index a6476af..658644a 100644 --- a/gumpress.php +++ b/gumpress.php @@ -1,14 +1,15 @@ settings, 'settings_page' ], 'dashicons-vault' ); + add_menu_page( __( 'Gumpress', 'gumpress' ), __( 'Gumpress', 'gumpress' ), $capability, $parent_slug, [ $this->settings, 'settings_page' ], UL_GUMPRESS_ASSETS . '/images/gumpress.svg', 58 ); } diff --git a/includes/Admin/Product.php b/includes/Admin/Product.php index 17645bb..f7f084f 100644 --- a/includes/Admin/Product.php +++ b/includes/Admin/Product.php @@ -5,8 +5,7 @@ /** * The Menu handler class */ -class Product -{ +class Product { /** * Initialize the class diff --git a/includes/Admin/views/settings.php b/includes/Admin/views/settings.php index c8fc209..bae9bdf 100644 --- a/includes/Admin/views/settings.php +++ b/includes/Admin/views/settings.php @@ -1,25 +1,24 @@


-
-
+ - + +
Gumroad access token [?] - + - +
+

Sync Products

+


-
- -

Sync products

\ No newline at end of file diff --git a/includes/Settings.php b/includes/Settings.php index c4839ac..ee04220 100644 --- a/includes/Settings.php +++ b/includes/Settings.php @@ -15,6 +15,14 @@ function __construct() { * Render settings page */ public function settings_page() { + if ( ! is_woocommerce_activated() ) { + $message = __('Please install and activate Woocommerce first.', 'uilib-gumpress'); + echo "
+

{$message}

+
"; + return; + } + include __DIR__ . '/Admin/views/settings.php'; $action = isset( $_GET['action'] ); @@ -139,7 +147,12 @@ public function sync_products() { 'variants' => $variants, ], true); } + } + echo "

{$gumroad_product['name']} - updated!

"; + if ( $key === array_key_last( $product_list ) ) { + $admin_products_page = admin_url('edit.php?post_type=product'); + echo "

Done! Check out product page

"; } } } diff --git a/includes/functions.php b/includes/functions.php index f47610d..520ccca 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -6,6 +6,17 @@ function dd( $data ) { die(); } +if ( ! function_exists( 'is_woocommerce_activated' ) ) { + /** + * Check is woocommerce installed and activated + * + * @return boolean + */ + function is_woocommerce_activated() { + if ( class_exists( 'woocommerce' ) ) { return true; } else { return false; } + } +} + /** * Insert/Update a row of relationship of gumroad and woocommerce products * diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index a22b489..0000000 --- a/package-lock.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "gumpress", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "prettier": { - "version": "npm:wp-prettier@2.2.1-beta-1", - "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.2.1-beta-1.tgz", - "integrity": "sha512-+JHkqs9LC/JPp51yy1hzs3lQ7qeuWCwOcSzpQNeeY/G7oSpnF61vxt7hRh87zNRTr6ob2ndy0W8rVzhgrcA+Gw==", - "dev": true - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index fc34bd5..0000000 --- a/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "gumpress", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/mh-rafi/gumpress.git" - }, - "author": "", - "license": "ISC", - "bugs": { - "url": "https://github.com/mh-rafi/gumpress/issues" - }, - "homepage": "https://github.com/mh-rafi/gumpress#readme", - "devDependencies": { - "prettier": "npm:wp-prettier@^2.2.1-beta-1" - } -} diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..b50c7a0 --- /dev/null +++ b/readme.txt @@ -0,0 +1,21 @@ +=== Gumpress === +Contributors: uilib +Tags: gumroad, woocommerce +Requires at least: 4.7 +Tested up to: 5.4 +Stable tag: 1.0 +Requires PHP: 7.0 +License: GPLv2 or later +License URI: https://www.gnu.org/licenses/gpl-2.0.html + +Sync and checkout with Gumroad. + +== Description == + +Import and sync your Gumroad products with your woocommerce products. +This plugin also integrates gumroad checkout. Works with any woocommerce theme. + +== Changelog == + += 1.0 = +* Initial release \ No newline at end of file