コード例 #1
0
ファイル: products.php プロジェクト: rene-hermenau/ingot
 /**
  * Register the routes for the objects of the controller.
  *
  * @since 0.2.0
  */
 public function register_routes()
 {
     $namespace = util::get_namespace();
     register_rest_route($namespace, '/products', array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_items'), 'permission_callback' => array($this, 'get_items_permissions_check'), 'args' => array('plugin' => array('default' => 'edd', 'sanitize_callback' => array($this, 'strip_tags')))));
     register_rest_route($namespace, '/products/price/(?P<id>[\\d]+)', array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_price'), 'permission_callback' => array($this, 'get_items_permissions_check'), 'args' => array('plugin' => array('default' => 'edd', 'sanitize_callback' => array($this, 'strip_tags')))));
     register_rest_route($namespace, '/products/plugins', array('methods' => \WP_REST_Server::READABLE, 'callback' => array($this, 'get_plugins'), 'permission_callback' => array($this, 'get_items_permissions_check'), 'args' => array('context' => array('default' => 'select-options'))));
 }
コード例 #2
0
ファイル: session.php プロジェクト: rene-hermenau/ingot
 /**
  * Verify sessions nonce
  *
  * @since 0.3.0
  *
  * @param \WP_REST_Request $request Full data about the request.
  *
  * @return \WP_Error|\WP_REST_Response
  */
 public function verify_session_nonce($request)
 {
     return true;
     $allowed = util::verify_session_nonce($request);
     return (bool) $allowed;
 }
コード例 #3
0
ファイル: load.php プロジェクト: rene-hermenau/ingot
 /**
  * Data needed in app
  *
  * @since 0.2.0
  *
  * @access protected
  *
  * @return array
  */
 protected function vars()
 {
     return array('api' => esc_url_raw(util::get_url()), 'nonce' => wp_create_nonce('wp_rest'), 'partials' => esc_url_raw(INGOT_URL . 'assets/admin/partials/'), 'spinner_url' => trailingslashit(INGOT_URL) . 'assets/img/loading.gif', 'edd_active' => esc_attr(ingot_is_edd_active()), 'woo_active' => esc_attr(ingot_is_woo_active()), 'price_tests_enabled' => esc_attr(ingot_enable_price_testing()), 'click_type_options' => types::allowed_click_types(true), 'price_type_options' => types::allowed_price_types(), 'destinations' => \ingot\testing\tests\click\destination\types::destination_types(true, true), 'dev_mode' => INGOT_DEV_MODE);
 }
コード例 #4
0
ファイル: ingot.php プロジェクト: rene-hermenau/ingot
 /**
  * Data to be localize as INGOT_UI
  *
  * @return array
  */
 public static function js_vars()
 {
     $session = self::$instance->current_session_data;
     unset($session['session']);
     $vars = array('api_url' => esc_url_raw(util::get_url()), 'nonce' => wp_create_nonce('wp_rest'), 'session_nonce' => wp_create_nonce('ingot_session'), 'session' => $session);
     return $vars;
 }
コード例 #5
0
ファイル: rest-test-case.php プロジェクト: Ramoonus/ingot
 /**
  * Test that this route is registered properly
  *
  * @since 0.2.0
  *
  * @group rest
  * @group settings_rest
  * @group group_rest
  * @group tracking_rest
  * @group session_rest
  * @group variant_rest
  */
 public function test_register_route()
 {
     $routes = $this->server->get_routes();
     $this->assertArrayHasKey('/' . \ingot\testing\api\rest\util::get_namespace() . '/' . $this->route_name, $routes, get_class($this));
     $this->assertArrayHasKey($this->namespaced_route, $routes, get_class($this));
 }
コード例 #6
0
ファイル: route.php プロジェクト: Ramoonus/ingot
 /**
  * Make namespace for routes
  *
  * @since 0.0.8
  *
  * @access protected
  *
  * @return string
  */
 protected function make_namespace()
 {
     return util::get_namespace();
 }
コード例 #7
0
ファイル: ingot.php プロジェクト: Ramoonus/ingot
 /**
  * Data to be localize as INGOT_UI
  *
  * @return array
  */
 public static function js_vars()
 {
     $vars = array('api_url' => esc_url_raw(util::get_url()), 'nonce' => wp_create_nonce('wp_rest'), 'session_nonce' => wp_create_nonce('ingot_session'), 'session' => \ingot\testing\object\session::instance()->get_session_info());
     return $vars;
 }