-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fa0a4e0
Showing
50 changed files
with
13,136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/.wordpress-org | ||
/.git | ||
/.github | ||
/node_modules | ||
/resources | ||
.distignore | ||
.gitignore | ||
.npmrc | ||
composer.json | ||
composer.lock | ||
package.json | ||
pnpm-lock.yaml | ||
webpack.mix.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Create Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-dist --no-interaction --no-dev --no-suggest --optimize-autoloader | ||
|
||
- name: Cache pnpm modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-pnpm-modules | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}- | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: 5.17.2 | ||
run_install: true | ||
|
||
- name: Compile assets | ||
run: pnpm run production | ||
|
||
- name: Clean node modules | ||
run: rm -rf node_modules | ||
|
||
- name: WordPress Plugin SVN Deploy | ||
uses: nk-o/action-wordpress-plugin-deploy@master | ||
env: | ||
SVN_USERNAME: ${{ secrets.WORDPRESS_SVN_USERNAME }} | ||
SVN_PASSWORD: ${{ secrets.WORDPRESS_SVN_PASSWORD }} | ||
SLUG: asura-connector | ||
|
||
- name: Create zip | ||
uses: montudor/[email protected] | ||
with: | ||
args: zip -qq -r "connector-${{ steps.get_version.outputs.VERSION }}.zip" . -x *.git* node_modules/\* pnpm-lock.yaml composer.lock | ||
|
||
- name: Create release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
|
||
- name: Upload zip to release | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./connector-${{ steps.get_version.outputs.VERSION }}.zip | ||
asset_name: connector-${{ steps.get_version.outputs.VERSION }}.zip | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/dist | ||
/languages | ||
/node_modules | ||
/storage/*.key | ||
/vendor | ||
|
||
# misc files | ||
mix-manifest.json | ||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shamefully-hoist=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
|
||
namespace Dplugins\Asura\Connector; | ||
|
||
class Admin | ||
{ | ||
public function __construct() | ||
{ | ||
add_action('admin_menu', [$this, 'admin_menu']); | ||
} | ||
|
||
public function admin_menu(): void | ||
{ | ||
$capability = 'manage_options'; | ||
|
||
if (current_user_can($capability)) { | ||
$hook = add_submenu_page( | ||
'ct_dashboard_page', | ||
__('Asura Connector', 'asura-connector'), | ||
__('Asura Connector', 'asura-connector'), | ||
$capability, | ||
Connector::$module_id, | ||
[ | ||
$this, | ||
'plugin_page' | ||
] | ||
); | ||
|
||
add_action('load-' . $hook, [$this, 'init_hooks']); | ||
} | ||
} | ||
|
||
public function init_hooks(): void | ||
{ | ||
add_action('admin_enqueue_scripts', [$this, 'enqueue_scripts']); | ||
} | ||
|
||
public function enqueue_scripts(): void | ||
{ | ||
if (!isset($_GET['tab']) || $_GET['tab'] === 'dashboard') { | ||
wp_enqueue_style(Connector::$module_id . "-admin"); | ||
wp_enqueue_script(Connector::$module_id . "-admin"); | ||
wp_set_script_translations(Connector::$module_id . "-admin", 'asura-connector', dirname(ASURA_CONNECTOR_FILE) . '/languages/'); | ||
wp_localize_script( | ||
Connector::$module_id . "-admin", | ||
'thelostasura', | ||
[ | ||
'ajax_url' => admin_url('admin-ajax.php'), | ||
'nonce' => wp_create_nonce(Connector::$module_id . "-admin"), | ||
'module_id' => Connector::$module_id, | ||
'web_history' => add_query_arg([ | ||
'page' => Connector::$module_id, | ||
'tab' => 'dashboard', | ||
], admin_url('admin.php')) | ||
] | ||
); | ||
} | ||
} | ||
|
||
public function plugin_page(): void | ||
{ | ||
$active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'dashboard'; | ||
?> | ||
<hr class="wp-header-end"> | ||
<h2 class="nav-tab-wrapper"> | ||
<a href="<?php echo add_query_arg([ | ||
'page' => Connector::$module_id, | ||
'tab' => 'dashboard#/provider', | ||
], admin_url('admin.php')); ?>" class="nav-tab <?php echo $active_tab == 'dashboard' ? 'nav-tab-active' : ''; ?>"> Dashboard </a> | ||
<a href="https://asura.docs.oxyrealm.com/guide/asura-connector.html" target="_blank" class="nav-tab" style="display: inline-flex;"> | ||
Documentation | ||
<svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" data-v-641633f9=""> | ||
<path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> | ||
<polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon> | ||
</svg> | ||
</a> | ||
</h2> | ||
<?php | ||
switch ($active_tab) { | ||
case 'dashboard': | ||
default: | ||
$this->dashboard_tab(); | ||
break; | ||
} | ||
} | ||
|
||
public function dashboard_tab(): void | ||
{ | ||
echo '<div id="thelostasura-app"></div>'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Dplugins\Asura\Connector; | ||
|
||
use Dplugins\Asura\Connector\Ajax\Admin; | ||
use Dplugins\Asura\Connector\Ajax\Frontend; | ||
use Dplugins\Asura\Connector\Utils\OxygenBuilder; | ||
use WP_Error; | ||
|
||
class Ajax | ||
{ | ||
public function __construct() | ||
{ | ||
if (OxygenBuilder::can()) { | ||
new Frontend(); | ||
} | ||
|
||
if (OxygenBuilder::can(true)) { | ||
new Admin(); | ||
} | ||
} | ||
|
||
public static function send_json_error($code, $message, $http_status = 400) | ||
{ | ||
wp_send_json_error( | ||
new WP_Error($code, $message), | ||
$http_status | ||
); | ||
} | ||
} |
Oops, something went wrong.