From 233343220a3d539bc0a41b7209e4c8adbd3b1f4e Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Wed, 17 Jan 2024 16:18:08 -0300 Subject: [PATCH] fix: undeclared attributes --- ...n-rest-background-processes-controller.php | 12 +++++-- .../class-tainacan-rest-items-controller.php | 4 +-- src/classes/class-tainacan-roles.php | 6 ++-- src/classes/entities/class-tainacan-term.php | 3 +- .../class-tainacan-export-handler.php | 8 +++++ .../class-tainacan-generic-handler.php | 9 ++++++ .../class-tainacan-importer-handler.php | 8 +++++ src/classes/libs/wp-background-process.php | 32 +++++++++++++++++++ .../oaipmh/class-tainacan-oaipmh-expose.php | 4 +++ .../class-tainacan-oaipmh-list-records.php | 3 +- .../date/class-tainacan-date.php | 1 + 11 files changed, 81 insertions(+), 9 deletions(-) diff --git a/src/classes/api/endpoints/class-tainacan-rest-background-processes-controller.php b/src/classes/api/endpoints/class-tainacan-rest-background-processes-controller.php index 164a46a10..425dc190e 100644 --- a/src/classes/api/endpoints/class-tainacan-rest-background-processes-controller.php +++ b/src/classes/api/endpoints/class-tainacan-rest-background-processes-controller.php @@ -11,8 +11,14 @@ use Tainacan\Entities; * * */ class REST_Background_Processes_Controller extends REST_Controller { - private $collections_repository; - private $collection; + + /** + * table + * + * @var String + * @access protected + */ + private $table; protected function get_schema() { return "TODO:get_schema"; @@ -181,7 +187,7 @@ class REST_Background_Processes_Controller extends REST_Controller { $process_type = ''; if (isset($request['search'])) { $name = $request['search']; - $process_type = "AND name LIKE '%${name}%'"; + $process_type = "AND name LIKE '%$name%'"; $process_type = $wpdb->prepare($process_type); } diff --git a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php index 75986d6af..fa8d6da2d 100644 --- a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php +++ b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php @@ -19,7 +19,7 @@ class REST_Items_Controller extends REST_Controller { private $metadatum_repository; private $terms_repository; private $filters_repository; - private $taxonomy_repository; + private $taxonomies_repository; /** * REST_Items_Controller constructor. @@ -587,7 +587,7 @@ class REST_Items_Controller extends REST_Controller { } $filter_name = is_string($filter_type_component) - ? "tainacan-api-items-${filter_type_component}-filter-arguments" + ? "tainacan-api-items-$filter_type_component-filter-arguments" : 'tainacan-api-items-filter-arguments'; $filters_arguments[] = apply_filters($filter_name, array( diff --git a/src/classes/class-tainacan-roles.php b/src/classes/class-tainacan-roles.php index 751500d7a..2537a4f7a 100644 --- a/src/classes/class-tainacan-roles.php +++ b/src/classes/class-tainacan-roles.php @@ -6,8 +6,10 @@ use Tainacan\Repositories\Repository; class Roles { private static $instance = null; - private $capabilities; + private $meta_caps; + private $meta_section_caps; + private $filters_caps; public static function get_instance() { @@ -585,7 +587,7 @@ class Roles { foreach ( $caps as $cap ) { - if ( array_key_exists($cap, $allcaps) && $allcaps[$cap] === true ) { + if ( isset($cap) && $cap !== false && array_key_exists($cap, $allcaps) && $allcaps[$cap] === true ) { continue; } diff --git a/src/classes/entities/class-tainacan-term.php b/src/classes/entities/class-tainacan-term.php index 176089ee7..37894453d 100644 --- a/src/classes/entities/class-tainacan-term.php +++ b/src/classes/entities/class-tainacan-term.php @@ -15,7 +15,8 @@ class Term extends Entity { $description, $user, $header_image_id, - $taxonomy; + $taxonomy, + $WP_Term; static $post_type = false; diff --git a/src/classes/exporter/class-tainacan-export-handler.php b/src/classes/exporter/class-tainacan-export-handler.php index 2b60a3e4b..ecc03c9ce 100644 --- a/src/classes/exporter/class-tainacan-export-handler.php +++ b/src/classes/exporter/class-tainacan-export-handler.php @@ -4,6 +4,14 @@ namespace Tainacan; class Export_Handler { + /** + * bg_exporter + * + * @var Background_Exporter + * @access protected + */ + protected $bg_exporter; + private $registered_exporters = []; function __construct() { diff --git a/src/classes/generic-background-process/class-tainacan-generic-handler.php b/src/classes/generic-background-process/class-tainacan-generic-handler.php index 829c27eea..7df299f9d 100644 --- a/src/classes/generic-background-process/class-tainacan-generic-handler.php +++ b/src/classes/generic-background-process/class-tainacan-generic-handler.php @@ -4,6 +4,15 @@ namespace Tainacan; class Generic_Process_Handler { + + /** + * bg_process + * + * @var Background_Generic_Process + * @access protected + */ + protected $bg_process; + private $registered_process = []; function __construct() { diff --git a/src/classes/importer/class-tainacan-importer-handler.php b/src/classes/importer/class-tainacan-importer-handler.php index 17973b0f9..8def26ebd 100644 --- a/src/classes/importer/class-tainacan-importer-handler.php +++ b/src/classes/importer/class-tainacan-importer-handler.php @@ -4,6 +4,14 @@ namespace Tainacan; class Importer_Handler { + /** + * bg_importer + * + * @var Background_Importer + * @access protected + */ + protected $bg_importer; + private $registered_importers = []; function __construct() { diff --git a/src/classes/libs/wp-background-process.php b/src/classes/libs/wp-background-process.php index 17642ad8e..4acd9cf8f 100644 --- a/src/classes/libs/wp-background-process.php +++ b/src/classes/libs/wp-background-process.php @@ -51,6 +51,38 @@ */ protected $cron_interval_identifier; + /** + * cron_hook_check_identifier + * + * @var string + * @access protected + */ + protected $cron_hook_check_identifier; + + /** + * process_lock_in_time + * + * @var string + * @access protected + */ + protected $process_lock_in_time; + + /** + * queue_lock_time + * + * @var string + * @access protected + */ + protected $queue_lock_time; + + /** + * cron_interval + * + * @var string + * @access protected + */ + protected $cron_interval; + /** * Initiate new background process */ diff --git a/src/classes/oaipmh/class-tainacan-oaipmh-expose.php b/src/classes/oaipmh/class-tainacan-oaipmh-expose.php index 00890446c..9e7bdac59 100644 --- a/src/classes/oaipmh/class-tainacan-oaipmh-expose.php +++ b/src/classes/oaipmh/class-tainacan-oaipmh-expose.php @@ -29,6 +29,10 @@ class OAIPMH_Expose { var $token_valid; var $token_prefix; + protected $collection_repository; + protected $item_repository; + protected $repositoryIdentifier; + /** * */ diff --git a/src/classes/oaipmh/class-tainacan-oaipmh-list-records.php b/src/classes/oaipmh/class-tainacan-oaipmh-list-records.php index e3b62a03e..52d185b26 100644 --- a/src/classes/oaipmh/class-tainacan-oaipmh-list-records.php +++ b/src/classes/oaipmh/class-tainacan-oaipmh-list-records.php @@ -19,6 +19,7 @@ class OAIPMH_List_Records extends OAIPMH_Expose { public $until; public $sets; public $metadataPrefix; + /** * @signature CONSTRUTOR @@ -186,7 +187,7 @@ class OAIPMH_List_Records extends OAIPMH_Expose { $this->xml_creater->addChild($this->working_node, $key, ''); } } - }catch(Exception $e){ + }catch(\Exception $e){ var_dump($e,$this->working_node,'dc:' . $key); } } diff --git a/src/views/admin/components/metadata-types/date/class-tainacan-date.php b/src/views/admin/components/metadata-types/date/class-tainacan-date.php index 83b59122f..31e36fe88 100644 --- a/src/views/admin/components/metadata-types/date/class-tainacan-date.php +++ b/src/views/admin/components/metadata-types/date/class-tainacan-date.php @@ -12,6 +12,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); class Date extends Metadata_Type { private $format; + private $output_date_format; function __construct() { // call metadatum type constructor