WC_Auth::make_validation PHP Method

make_validation() protected method

Make validation.
Since: 2.4.0
protected make_validation ( )
        protected function make_validation()
        {
            $params = array('app_name', 'user_id', 'return_url', 'callback_url', 'scope');
            foreach ($params as $param) {
                if (empty($_REQUEST[$param])) {
                    /* translators: %s: parameter */
                    throw new Exception(sprintf(__('Missing parameter %s', 'woocommerce'), $param));
                }
            }
            if (!in_array($_REQUEST['scope'], array('read', 'write', 'read_write'))) {
                /* translators: %s: scope */
                throw new Exception(sprintf(__('Invalid scope %s', 'woocommerce'), wc_clean($_REQUEST['scope'])));
            }
            foreach (array('return_url', 'callback_url') as $param) {
                $param = $this->get_formatted_url($_REQUEST[$param]);
                if (false === filter_var($param, FILTER_VALIDATE_URL)) {
                    /* translators: %s: url */
                    throw new Exception(sprintf(__('The %s is not a valid URL', 'woocommerce'), $param));
                }
            }
            $callback_url = $this->get_formatted_url($_REQUEST['callback_url']);
            if (0 !== stripos($callback_url, 'https://')) {
                throw new Exception(__('The callback_url need to be over SSL', 'woocommerce'));
            }
        }