$_REQUEST['privateKey'],
"name"=> $_REQUEST['name'],
"surname" => $_REQUEST['surname'],
"building" => $_REQUEST['building'],
"street" => $_REQUEST['street'],
"postCode" => $_REQUEST['postCode'],
"countryCode" => $_REQUEST['countryCode'],
"email" => $_REQUEST['email'],
);
$data_string = json_encode($data_from_front_end);
# Create a connection
$ch = curl_init($_REQUEST['enteredURL']);
# Setting our options
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
# Get the response
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpCode != 200){
echo "Return code is {$httpCode} \n"
.curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
exit;
}
add_action( 'admin_menu', 'agecheck_add_admin_menu' );
add_action( 'admin_init', 'agecheck_settings_init' );
add_action('wp_enqueue_scripts', 'agechecked_enqueue_scripts');
function agecheck_add_admin_menu( ) {
add_menu_page( 'AgeChecked', 'AgeChecked', 'manage_options', 'agechecked_for_wordpress', 'admin_page_html', plugin_dir_url( __FILE__ ) . 'assets/images/agechecked-icon.png');
}
function admin_page_html() {
//Get the active tab from the $_GET param
$default_tab = null;
$tab = isset($_GET['tab']) ? $_GET['tab'] : $default_tab;
?>
Settings
About
Support
About
AgeChecked offers a range of simple solutions for you to verify your customers.
Batch Upload, Client API, Consumer Gateway or a combination.
Please rate AgeChecked ★★★★★ on WordPress.org to help us spread the word. Thank you from the AgeChecked team!
Support
If you have any questions or require any support, please review our support documentation .
Lorem Ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem Ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem Ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem Ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
2. WooCommerce Product Categories', 'agecheck' ),
' ',
'pluginPage',
'agecheck_pluginPage_section'
);
add_settings_field(
'agechecked_settings_select_product_categories',
__( 'Select Product Categories', 'agecheck' ),
'agechecked_settings_select_product_categories_render',
'pluginPage',
'agecheck_pluginPage_section'
);
add_settings_field(
'',
__( '3. Extra Settings ', 'agecheck' ),
'',
'pluginPage',
'agecheck_pluginPage_section'
);
add_settings_field(
'agechecked_settings_enabled',
__( 'Enable/Disable', 'agecheck' ),
'agechecked_settings_enabled_render',
'pluginPage',
'agecheck_pluginPage_section'
);
add_settings_field(
'agechecked_settings_select_pages',
__( 'Select Individual Pages', 'agecheck' ),
'agechecked_settings_select_pages_render',
'pluginPage',
'agecheck_pluginPage_section'
);
add_settings_field(
'agechecked_settings_button_class_name',
__( 'Button onClick Event', 'agecheck' ),
'agechecked_settings_button_class_name_render',
'pluginPage',
'agecheck_pluginPage_section'
);
}
function agechecked_settings_enabled_render( ) {
$options = get_option( 'agecheck_settings' );
?>
value='1'>Click here to enable age checks for individual pages
Enables AgeCheck to work on your chosen pages.
";
?>
'>
Add your API URL. Please ensure the URL does not end with a '/'.
";
?>
'>
Add your Public Key.
";
?>
'>
Add your Secret Key.
";
?>
'.$item.'';
endforeach;
?>
By default all pages are selected. Please hold the Ctrl key to select multiple pages
";
?>
$orderby,
'order' => $order,
'hide_empty' => $hide_empty,
);
$product_categories = get_terms( 'product_cat', $cat_args );
$productCategoryNames = array();
if( !empty($product_categories) ){
foreach ($product_categories as $key => $category) {
array_push($productCategoryNames, $category->name);
}
}
$options = get_option( 'agecheck_settings' );
$numberOfProductCategories = sizeof($productCategoryNames);
$selectedProductCategories= isset($options['agechecked_settings_select_product_categories']) ? $options['agechecked_settings_select_product_categories'] : array();
?>
'.$item.'';
endforeach;
?>
Please hold the Ctrl key to select multiple product categories.
";
?>
agechecked-on-click-class-name";
?>
Add this className to the button you would like to activate the AgeChecked plugin. For an example of how to do this, please review the screenshots found on the support documentation
";
?>
1: Enter your API URL, Public Key and Secret Key that was sent to you from AgeChecked into the below fields. ";
echo "2: Select the WooCommerce product category that you would like to perform age checks on. ";
echo "3: By default the AgeChecked plugin is enabled for all pages, however if you want to only enable the plugin on certain pages then please select those individual pages. To perform agechecks when a user clicks a button on your website, add the following className to the button - agechecked-on-click-class-name ";
echo "If you have any questions or require any support, please review our support documentation .";
echo "1. API Keys and URL ";
checks();
}
function checks() {
$options = get_option( 'agecheck_settings' );
if ( checked( isset($options['agechecked_settings_enabled']) ? $options['agechecked_settings_enabled'] : false, 0 ) ) {
return false;
}
// PHP Version
if ( version_compare( phpversion(), '5.3', '<' ) ) {
echo '' . sprintf( __( 'AgeChecked Error: AgeChecked requires PHP 5.3 and above. You are using version %s.', 'agecheck' ), phpversion() ) . '
';
return false;
}
// Check required fields
if (!$options['agechecked_settings_url']) {
echo '' . __( 'AgeChecked Error: Please enter your API URL', 'agecheck' ) . '
';
return false;
}
// Check required fields
if ( ! $options['agechecked_settings_public_key'] || ! $options['agechecked_settings_private_key'] ) {
echo '' . __( 'AgeChecked: Please enter your public and secret keys', 'agecheck' ) . '
';
return false;
}
return true;
}
function agecheck_options_page() {
?>
$public_key, 'version' => '1.0'), $url . '/jsapi/getjavascript');
wp_enqueue_script('wp_agechecked_js', $url, array('jquery'), null);
wp_enqueue_style('wp_agechecked_style', plugins_url('agecheck/assets/css/style.css'), array());
}
add_action( 'get_footer', 'agechecked_ui_for_class_name' );
//Loading AgeChecked UI on button click event
function agechecked_ui_for_class_name()
{
?>
cart->get_cart() as $cart_item ) {
// checking for the specific product category name
$new_term_slugs = wp_get_post_terms( $cart_item['product_id'], 'product_cat', array('fields' => 'names') );
array_push($productCategoriesInCart, ...$new_term_slugs);
}
if (!count(array_intersect($selectedProductCategories, $productCategoriesInCart))) {
return;
}
?>
console.log('PHP: " . json_encode($options) . "');";
if(!array_key_exists( 'agechecked_settings_enabled', $options ) || !checks()) return false;
//Check if the current page is in the selected pages array
$selectedPages = isset($options['agechecked_settings_select_pages']) ? $options['agechecked_settings_select_pages'] : array();
$currentpagetitle = get_the_title();
if (!in_array( $currentpagetitle ,$selectedPages ) && !empty($selectedPages)) {
return false;
}
?>
Settings';
array_unshift($links, $settings_link);
return $links;
}
$plugin = plugin_basename(__FILE__);
add_filter("plugin_action_links_$plugin", 'my_plugin_settings_link' );
?>