fix: allow dynamic properties
This commit is contained in:
parent
233343220a
commit
368b8d81a0
|
@ -8,6 +8,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
* Entity Super class
|
||||
*
|
||||
*/
|
||||
#[\AllowDynamicProperties]
|
||||
class Entity {
|
||||
/**
|
||||
* The repository of that entity
|
||||
|
@ -202,6 +203,9 @@ class Entity {
|
|||
return $this->$method($value);
|
||||
}
|
||||
}
|
||||
// public function __set(string $name, mixed $value): void {
|
||||
// $this->{$name} = $value;
|
||||
// }
|
||||
|
||||
/**
|
||||
* get the value property
|
||||
|
@ -216,6 +220,9 @@ class Entity {
|
|||
return $this->$method();
|
||||
}
|
||||
}
|
||||
// public function __get(string $name) {
|
||||
// return $this->{$name};
|
||||
// }
|
||||
|
||||
/**
|
||||
* set the status of the entity
|
||||
|
|
|
@ -8,6 +8,8 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
* Represents the Entity Term
|
||||
*/
|
||||
class Term extends Entity {
|
||||
public $WP_Term;
|
||||
|
||||
protected
|
||||
$term_id,
|
||||
$name,
|
||||
|
@ -15,8 +17,7 @@ class Term extends Entity {
|
|||
$description,
|
||||
$user,
|
||||
$header_image_id,
|
||||
$taxonomy,
|
||||
$WP_Term;
|
||||
$taxonomy;
|
||||
|
||||
|
||||
static $post_type = false;
|
||||
|
|
|
@ -173,7 +173,8 @@ class Exposers_Handler {
|
|||
* @return Exposers\Exposer|boolean false
|
||||
*/
|
||||
public static function request_has_exposer($request) {
|
||||
$body = json_decode( $request->get_body(), true );
|
||||
$data_body = $request->get_body() ?? '';
|
||||
$body = json_decode( $data_body, true );
|
||||
$query_url_params = $request->get_query_params();
|
||||
$Tainacan_Exposers = self::get_instance();
|
||||
if(
|
||||
|
|
|
@ -8,6 +8,11 @@ class Bulk_Edit_Process extends Generic_Process {
|
|||
private $meta_key = '_tnc_bulk';
|
||||
private $group_id = false;
|
||||
|
||||
private $items_repository;
|
||||
private $metadatum_repository;
|
||||
private $item_metadata_repository;
|
||||
private $bulk_edit_data;
|
||||
|
||||
public function __construct($attributes = array()) {
|
||||
$this->array_attributes = array_merge($this->array_attributes, [
|
||||
'group_id',
|
||||
|
@ -93,9 +98,9 @@ class Bulk_Edit_Process extends Generic_Process {
|
|||
$metadata_label = __('Changed metadata', 'tainacan');
|
||||
|
||||
$message = __('Bulk edit finished', 'tainacan');
|
||||
$message .= "<p> <strong> ${title_label}: </strong> ${name} </p>";
|
||||
$message .= "<p> <strong> ${author_label}: </strong> ${author_name} </p>";
|
||||
$message .= "<p> <strong> ${metadata_label}: </strong> ${metadata} </p>";
|
||||
$message .= "<p> <strong> $title_label: </strong> $name </p>";
|
||||
$message .= "<p> <strong> $author_label: </strong> $author_name </p>";
|
||||
$message .= "<p> <strong> $metadata_label: </strong> $metadata </p>";
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
@ -516,7 +521,13 @@ class Bulk_Edit_Process extends Generic_Process {
|
|||
|
||||
$this->add_error_log( sprintf( __( 'Please verify, invalid value(s) to edit item ID: "%d"', 'tainacan' ), $item->get_id() ) );
|
||||
$serealize_erro = (object) array('err' => array());
|
||||
array_walk_recursive($item->get_errors(), create_function('&$v, $k, &$t', '$t->err[] = $v;'), $serealize_erro);
|
||||
array_walk_recursive(
|
||||
$item->get_errors(),
|
||||
function (&$v, $k, &$t) {
|
||||
$t->err[] = $v;
|
||||
},
|
||||
$serealize_erro
|
||||
);
|
||||
$this->add_error_log( __('errors: ', 'tainacan') . implode(", ", $serealize_erro->err) );
|
||||
|
||||
return false;
|
||||
|
@ -538,7 +549,12 @@ class Bulk_Edit_Process extends Generic_Process {
|
|||
|
||||
$this->add_error_log( sprintf( __( 'Please verify, invalid value(s) to edit item ID: "%d"', 'tainacan' ), $item->get_id() ) );
|
||||
$serealize_erro = (object) array('err' => array());
|
||||
array_walk_recursive($item->get_errors(), create_function('&$v, $k, &$t', '$t->err[] = $v;'), $serealize_erro);
|
||||
array_walk_recursive(
|
||||
$item->get_errors(),
|
||||
function (&$v, $k, &$t) {
|
||||
$t->err[] = $v;
|
||||
},
|
||||
$serealize_erro);
|
||||
$this->add_error_log( __('errors: ', 'tainacan') . implode(", ", $serealize_erro->err) );
|
||||
|
||||
return false;
|
||||
|
|
|
@ -14,6 +14,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
*/
|
||||
trait Entity_Collection_Relation {
|
||||
|
||||
protected $collection;
|
||||
/**
|
||||
*
|
||||
* @return int collection item ID
|
||||
|
|
|
@ -77,7 +77,7 @@ class Admin {
|
|||
);
|
||||
|
||||
$mobile_app_page_suffix = add_submenu_page(
|
||||
null, // Mobile app page is not listed in the menu
|
||||
'tainacan-no-show-menu', // Mobile app page is not listed in the menu
|
||||
__('Mobile App', 'tainacan'),
|
||||
__('Mobile App', 'tainacan'),
|
||||
'manage_tainacan',
|
||||
|
@ -204,39 +204,39 @@ class Admin {
|
|||
wp_enqueue_style( 'roboto-fonts', 'https://fonts.googleapis.com/css?family=Roboto:400,400i,500,500i,700,700i', [] );
|
||||
wp_enqueue_style( 'tainacan-admin-page', $TAINACAN_BASE_URL . '/assets/css/tainacan-admin.css', [], TAINACAN_VERSION );
|
||||
|
||||
// $undesired_wp_styles = [
|
||||
// 'admin-menu',
|
||||
// 'admin-bar',
|
||||
// 'code-editor',
|
||||
// 'color-picker',
|
||||
// 'customize-controls',
|
||||
// 'customize-nav-menus',
|
||||
// 'customize-widgets',
|
||||
// 'dashboard',
|
||||
// 'dashicons',
|
||||
// 'deprecated-media',
|
||||
// 'edit',
|
||||
// 'wp-pointer',
|
||||
// 'farbtastic',
|
||||
// 'forms',
|
||||
// 'common',
|
||||
// 'install',
|
||||
// 'wp-auth-check',
|
||||
// 'site-icon',
|
||||
// 'buttons',
|
||||
// 'l10n',
|
||||
// 'list-tables',
|
||||
// 'login',
|
||||
// 'media',
|
||||
// 'nav-menus',
|
||||
// 'revisions',
|
||||
// 'themes',
|
||||
// 'widgets',
|
||||
// 'wp-admin'
|
||||
// ];
|
||||
//
|
||||
// wp_dequeue_style( $undesired_wp_styles );
|
||||
// wp_deregister_style( $undesired_wp_styles );
|
||||
// $undesired_wp_styles = [
|
||||
// 'admin-menu',
|
||||
// 'admin-bar',
|
||||
// 'code-editor',
|
||||
// 'color-picker',
|
||||
// 'customize-controls',
|
||||
// 'customize-nav-menus',
|
||||
// 'customize-widgets',
|
||||
// 'dashboard',
|
||||
// 'dashicons',
|
||||
// 'deprecated-media',
|
||||
// 'edit',
|
||||
// 'wp-pointer',
|
||||
// 'farbtastic',
|
||||
// 'forms',
|
||||
// 'common',
|
||||
// 'install',
|
||||
// 'wp-auth-check',
|
||||
// 'site-icon',
|
||||
// 'buttons',
|
||||
// 'l10n',
|
||||
// 'list-tables',
|
||||
// 'login',
|
||||
// 'media',
|
||||
// 'nav-menus',
|
||||
// 'revisions',
|
||||
// 'themes',
|
||||
// 'widgets',
|
||||
// 'wp-admin'
|
||||
// ];
|
||||
|
||||
// wp_dequeue_style( $undesired_wp_styles );
|
||||
// wp_deregister_style( $undesired_wp_styles );
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue