This file contains hidden or 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
import pkg from "@peaq-network/sdk"; | |
import * as dotenv from "dotenv"; | |
// Load environment variables | |
dotenv.config(); | |
// Configuration | |
const config = { | |
nodeUrl: process.env.PEAQ_NODE_URL || "wss://wss.agung.peaq.network", | |
seed: process.env.MNEMONIC_SEED, |
This file contains hidden or 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
onst apiResponse = require('./tool/api-response'); | |
const MESSAGE = require('./message/messages'); | |
const UPDATE_OWNERSHIP = 'updateOwnership'; | |
const PLANT = 'Plant'; | |
const USER_TABLE = '_User'; | |
const PLANT_FIELD = 'plant'; | |
const PLANT_OWNERSHIP = 'PlantOwnership'; | |
const OWNERSHIP_ROLE_FIELD = 'ownershipRole'; | |
const OBJECT_ID = 'objectId'; | |
const OWNERSHIP_ROLE = 'OwnershipRole'; |
This file contains hidden or 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
// This function update, migrate and create Classes | |
export const buildSchemas = async (localSchemas: any[]) => { | |
try { | |
const timeout = setTimeout(() => { | |
if (process.env.NODE_ENV === 'production') process.exit(1) | |
}, 20000) | |
const allCloudSchema = (await Parse.Schema.all()).filter( | |
(s: any) => !lib.isDefaultSchema(s.className), | |
) | |
clearTimeout(timeout) |
This file contains hidden or 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
<?php | |
add_action( 'woocommerce_process_product_meta_simple', 'save_options' ); | |
function save_options( $product_id ) { | |
$keys = array( | |
'_ppwp_woo_protected_post', | |
'_ppwp_woo_usage_limit', | |
'_ppwp_woo_expiration', | |
'_ppwp_woo_custom_text', | |
'_ppwp_woo_protection_type', |
This file contains hidden or 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
<?php | |
add_action( 'woocommerce_product_data_panels', 'show_ppwp_access_link_tab_content' ); | |
function show_ppwp_access_link_tab_content() { | |
global $woocommerce, $post; | |
?> | |
<div id="ppwp_woo_options" class="panel woocommerce_options_panel"> | |
<?php | |
woocommerce_wp_select( | |
array( |
This file contains hidden or 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
<?php | |
add_filter('woocommerce_product_data_tabs', 'add_ppwp_access_link_tab'); | |
function add_ppwp_access_link_tab($tabs) { | |
$tabs['ppwp_woo'] = array( | |
'label' => 'PPWP Access Link', | |
'target' => 'ppwp_woo_options', | |
'class' => array( 'show_if_virtual' ), | |
'priority' => 65, | |
); |
This file contains hidden or 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
<?php | |
add_filter( 'pda_before_handle_normal_fap', 'pda_handle_simple_membership', 10, 3 ); | |
/** | |
* Callback to handle before checking FAP. This function will help to fix the problem | |
* when WordPress cookie expired before Simple WordPress Membership one. | |
* | |
* @param bool $is_valid_fap Flag to know whether FAP is valid. | |
* @param int $attachment_id The attachment ID. | |
* @param string $fap_type FAP type. |
This file contains hidden or 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
<?php | |
add_filter( 'ppwp_pro_check_valid_password', 'ppwp_pro_check_valid_sibling_password', 20, 2 ); | |
/** | |
* Check valid sibling password. | |
* | |
* @param array $result The result after entering password including is_valid key. | |
* @param array $params The options passed from the hook including | |
* string password The password user entered. |
This file contains hidden or 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
<?php | |
add_filter( 'ppw_before_return_entire_site_form', 'custom_entire_site_form', 10, 2 ); | |
/** | |
* Customize entire site login form with more options. | |
* | |
* @param string $form The current from in HTML string. | |
* @param array $options The form options including: | |
* string logo_content | |
* string password_label |
This file contains hidden or 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
<?php | |
add_filter( 'ppw_custom_entire_site_login_form', 'custom_login_form' ); | |
function custom_login_form() { | |
$is_wrong_password = isset( $_GET['action'] ) && $_GET['action'] === 'ppw_postpass' && isset( $_POST['input_wp_protect_password'] ) ? 'display: block' : 'display: none'; // Do not remove it. This helps to check whether the user entered password correctly. | |
return ' | |
<div class="pda-form-login"> | |
<!--Customize your own logo--> |
NewerOlder