function woocommerce_json_api_settings_page()
{
    $helpers = new JSONAPIHelpers();
    $params = $_POST;
    $nonce = $helpers->orEq($params, '_wpnonce', false);
    $key = $helpers->getPluginPrefix() . '_sitewide_settings';
    if ($nonce && wp_verify_nonce($nonce, $helpers->getPluginPrefix() . '_sitewide_settings') && isset($params[$key])) {
        foreach ($params[$key] as $key2 => $value) {
            update_option($helpers->getPluginPrefix() . '_' . $key2, maybe_serialize($value));
        }
        $key = $helpers->getPluginPrefix() . '_default_permissions';
        if (isset($params[$key])) {
            update_option($key, $params[$key]);
        }
    }
    //$json_api_slug = get_option( $helpers->getPluginPrefix() . '_slug' );
    // $pages = get_pages( array('post_type' => 'page') );
    // $options = array();
    // foreach ( $pages as $page ) {
    //   $options[] = array('value' => $page->post_name, 'content' => $page->post_title);
    // }
    $attrs = array('json_api_sitewide_settings' => array('title' => __('WooCommerce JSON API Settings', 'woocommerce_json_api'), 'fields' => array(array('name' => $helpers->getPluginPrefix() . '_sitewide_settings[enabled]', 'id' => 'json_api_enabled_id', 'value' => get_option($helpers->getPluginPrefix() . '_enabled'), 'options' => array(array('value' => 'yes', 'content' => __('Yes', 'woocommerce_json_api')), array('value' => 'no', 'content' => __('No', 'woocommerce_json_api'))), 'type' => 'select', 'label' => __('API Enabled?', 'woocommerce_json_api'), 'description' => __('Quickly enable/disable The API', 'woocommerce_json_api')), array('name' => $helpers->getPluginPrefix() . '_sitewide_settings[require_https]', 'id' => 'json_api_require_https_id', 'value' => get_option($helpers->getPluginPrefix() . '_require_https'), 'options' => array(array('value' => 'yes', 'content' => __('Yes', 'woocommerce_json_api')), array('value' => 'no', 'content' => __('No', 'woocommerce_json_api'))), 'type' => 'select', 'label' => __('Require HTTPS', 'woocommerce_json_api'), 'description' => __('Only serve HTTPS requests?', 'woocommerce_json_api')), array('name' => $helpers->getPluginPrefix() . '_sitewide_settings[auto_generate_token]', 'id' => 'json_api_auto_generate_token', 'value' => get_option($helpers->getPluginPrefix() . '_auto_generate_token'), 'options' => array(array('value' => 'yes', 'content' => __('Yes', 'woocommerce_json_api')), array('value' => 'no', 'content' => __('No', 'woocommerce_json_api'))), 'type' => 'select', 'label' => __('Automatically Generate Token', 'woocommerce_json_api'), 'description' => __('Generate a token automatically when a user is registered?', 'woocommerce_json_api')))));
    // Here we implement some permissions, a simple yes/no.
    $meta = get_option($helpers->getPluginPrefix() . '_default_permissions');
    if (!is_array($meta)) {
        $meta = array();
    }
    $method = 'access_the_api';
    $field = array('name' => $helpers->getPluginPrefix() . '_default_permissions[can_' . $method . ']', 'id' => 'json_api_can_' . $method . '_id', 'value' => $helpers->orEq($meta, 'can_' . $method, 'yes'), 'type' => 'select', 'options' => array(array('value' => 'yes', 'content' => __('Yes', 'woocommerce_json_api')), array('value' => 'no', 'content' => __('No', 'woocommerce_json_api'))), 'label' => __('Default Can access ', 'woocommerce_json_api') . ucwords(str_replace('_', ' ', $method)), 'description' => __('Whether or not this user can access this method', 'woocommerce_json_api'));
    $attrs['json_api_sitewide_settings']['fields'][] = $field;
    foreach (WooCommerce_JSON_API::getImplementedMethods() as $method) {
        if (strpos($method, 'set_') !== false) {
            $default_value = 'no';
        } else {
            $default_value = 'yes';
        }
        $field = array('name' => $helpers->getPluginPrefix() . '_default_permissions[can_' . $method . ']', 'id' => 'json_api_can_' . $method . '_id', 'value' => $helpers->orEq($meta, 'can_' . $method, $default_value), 'type' => 'select', 'options' => array(array('value' => 'yes', 'content' => __('Yes', 'woocommerce_json_api')), array('value' => 'no', 'content' => __('No', 'woocommerce_json_api'))), 'label' => __('Default Can access ', 'woocommerce_json_api') . ucwords(str_replace('_', ' ', $method)), 'description' => __('Whether or not this user can access this method', 'woocommerce_json_api'));
        $attrs['json_api_sitewide_settings']['fields'][] = $field;
    }
    $attrs = apply_filters('woocommerce_json_api_sitewide_settings_fields', $attrs);
    echo $helpers->renderTemplate('admin-settings-page.php', array('attrs' => $attrs));
}
 public static function getImplementedMethods()
 {
     self::$implemented_methods = array('get_system_time', 'get_supported_attributes', 'get_products', 'get_categories', 'get_taxes', 'get_shipping_methods', 'get_payment_gateways', 'get_tags', 'get_products_by_tags', 'get_customers', 'get_users', 'get_orders', 'get_orders_from_trash', 'get_products_from_trash', 'get_store_settings', 'get_site_settings', 'get_api_methods', 'get_coupons', 'get_images', 'get_user_meta', 'get_post_meta', 'set_products', 'set_products_quantities', 'set_categories', 'set_orders', 'set_store_settings', 'set_site_settings', 'set_coupons', 'set_customers_passwords', 'set_images', 'set_user_meta', 'set_post_meta', 'delete_products');
     return self::$implemented_methods;
 }