_collection_params() { $types = array(); $subtypes = array(); foreach ( $this->search_handlers as $search_handler ) { $types[] = $search_handler->get_type(); $subtypes = array_merge( $subtypes, $search_handler->get_subtypes() ); } $types = array_unique( $types ); $subtypes = array_unique( $subtypes ); $query_params = parent::get_collection_params(); $query_params['context']['default'] = 'view'; $query_params[ self::PROP_TYPE ] = array( 'default' => $types[0], 'description' => __( 'Limit results to items of an object type.' ), 'type' => 'string', 'enum' => $types, ); $query_params[ self::PROP_SUBTYPE ] = array( 'default' => self::TYPE_ANY, 'description' => __( 'Limit results to items of one or more object subtypes.' ), 'type' => 'array', 'items' => array( 'enum' => array_merge( $subtypes, array( self::TYPE_ANY ) ), 'type' => 'string', ), 'sanitize_callback' => array( $this, 'sanitize_subtypes' ), ); $query_params['exclude'] = array( 'description' => __( 'Ensure result set excludes specific IDs.' ), 'type' => 'array', 'items' => array( 'type' => 'integer', ), 'default' => array(), ); $query_params['include'] = array( 'description' => __( 'Limit result set to specific IDs.' ), 'type' => 'array', 'items' => array( 'type' => 'integer', ), 'default' => array(), ); return $query_params; } /** * Sanitizes the list of subtypes, to ensure only subtypes of the passed type are included. * * @since 5.0.0 * * @param string|array $subtypes One or more subtypes. * @param WP_REST_Request $request Full details about the request. * @param string $parameter Parameter name. * @return string[]|WP_Error List of valid subtypes, or WP_Error object on failure. */ public function sanitize_subtypes( $subtypes, $request, $parameter ) { $subtypes = wp_parse_slug_list( $subtypes ); $subtypes = rest_parse_request_arg( $subtypes, $request, $parameter ); if ( is_wp_error( $subtypes ) ) { return $subtypes; } // 'any' overrides any other subtype. if ( in_array( self::TYPE_ANY, $subtypes, true ) ) { return array( self::TYPE_ANY ); } $handler = $this->get_search_handler( $request ); if ( is_wp_error( $handler ) ) { return $handler; } return array_intersect( $subtypes, $handler->get_subtypes() ); } /** * Gets the search handler to handle the current request. * * @since 5.0.0 * * @param WP_REST_Request $request Full details about the request. * @return WP_REST_Search_Handler|WP_Error Search handler for the request type, or WP_Error object on failure. */ protected function get_search_handler( $request ) { $type = $request->get_param( self::PROP_TYPE ); if ( ! $type || ! isset( $this->search_handlers[ $type ] ) ) { return new WP_Error( 'rest_search_invalid_type', __( 'Invalid type parameter.' ), array( 'status' => 400 ) ); } return $this->search_handlers[ $type ]; } } ntents = cky_read_json_file( dirname( __FILE__ ) . '/contents/categories/en.json' ); wp_cache_set( 'cky_category_contents_en', $contents, 'cky_category_contents', 12 * HOUR_IN_SECONDS ); } return $contents; } /** * Load default cookies. * * @return void */ protected function load_default() { $categories = self::get_defaults(); $lang = cky_default_language(); foreach ( $categories as $slug => $category ) { $object = new \CookieYes\Lite\Admin\Modules\Cookies\Includes\Cookie_Categories(); $name[ $lang ] = isset( $category['name'] ) ? $category['name'] : ''; $description[ $lang ] = isset( $category['description'] ) ? $category['description'] : ''; $object->set_name( $name ); $object->set_description( $description ); $object->set_slug( $slug ); if ( 'necessary' === $slug ) { $object->set_prior_consent( true ); } $object->save(); } } /** * Decode a JSON string if necessary * * @param string $data String data. * @return array */ public function prepare_json( $data ) { if ( empty( $data ) ) { return array(); } return is_string( $data ) ? json_decode( $data, true ) : $data; } /** * Load items from the cache. * * @param boolean $id Category ID. * @return array|object */ protected function get_cache( $id = false ) { $key = 'all'; $categories = array(); $items = Cache::get( $key, $this->cache_group ); if ( false === $items ) { return false; } if ( ! empty( $items ) ) { foreach ( $items as $data ) { $item = $this->prepare_item( $data ); if ( ! empty( $item ) ) { $item->cookies = $data->cookies; $categories[ $item->category_id ] = $item; } } } return isset( $id ) && isset( $categories[ $id ] ) ? $categories[ $id ] : $categories; } /** * Get cookies of each category. * * @param string $category Category slug or id. * @return array */ public function get_cookies( $category = '' ) { $cookies = array(); if ( empty( $category ) ) { return array(); } $items = Cookie_Controller::get_instance()->get_items_by_category( $category ); foreach ( $items as $data ) { $object = new Cookie( $data ); $cookies[] = $object->get_prepared_data(); } return $cookies; } }
Fatal error: Uncaught Error: Class 'CookieYes\Lite\Admin\Modules\Cookies\Includes\Category_Controller' not found in /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/cookies/class-cookies.php:34 Stack trace: #0 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/includes/class-modules.php(54): CookieYes\Lite\Admin\Modules\Cookies\Cookies->init() #1 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/class-admin.php(179): CookieYes\Lite\Includes\Modules->__construct('cookies') #2 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/class-admin.php(81): CookieYes\Lite\Admin\Admin->load_modules() #3 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/includes/class-cli.php(153): CookieYes\Lite\Admin\Admin->__construct('cookie-law-info', '3.2.4') #4 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/includes/class-cli.php(95): CookieYes\Lite\Includes\CLI->define_ in /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/cookies/class-cookies.php on line 34