Commit inicial - WordPress Análisis de Precios Unitarios

- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

View File

@@ -0,0 +1,246 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-visual-editor
*/
namespace TCB\UserTemplates;
use TCB\Traits\Is_Singleton;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Category {
use Is_Singleton;
use Has_Taxonomy;
const OPTION_KEY = 'tve_user_templates_categories';
const BACKUP_OPTION_KEY = 'tve_user_templates_categories_backup';
const FINISHED_OPTION_KEY = 'thrive_user_template_category_migration_finished';
const PAGE_TEMPLATE_IDENTIFIER = '[#page#]';
public static $migration_replacement_map = [];
public static $default_categories = [
'uncategorized' => [
'name' => 'Uncategorized',
'old_id' => '',
'slug' => 'uncategorized',
'type' => 'uncategorized',
],
'page-templates' => [
'name' => 'Page Templates',
'old_id' => '[#page#]',
'slug' => 'page-templates',
'type' => 'page_template',
],
];
/**
* @var Migrator
*/
private static $migrator_instance;
/**
* @var int
*/
private $ID;
/**
* @param $id
*/
public function __construct( $id = null ) {
$this->ID = $id;
}
/**
* @return array
*/
public static function get_all() {
$migrator_instance = static::get_migrator_instance();
if ( $migrator_instance->is_finished() ) {
$categories = static::get_terms();
$categories = static::normalize_categories( $categories );
} else {
$categories = static::get_old_categories();
}
return $categories;
}
/**
* @param $categories
*
* @return array
*/
public static function normalize_categories( $categories ) {
$normalized_categories = [];
foreach ( $categories as $category ) {
$normalized_categories[] = [
'id' => $category->term_id,
'name' => $category->name,
];
}
return $normalized_categories;
}
/**
* Move the categories from the option field into the wp_terms table.
* After doing this, it updates the 'id_category' value of the templates ( which are still in the option field, because this always runs first )
*/
public static function maybe_migrate() {
$migrator_instance = static::get_migrator_instance();
if ( ! $migrator_instance->is_finished() ) {
static::insert_default_categories();
$old_categories = static::get_old_categories();
$migrator_instance->migrate_x_items( count( $old_categories ) );
$templates = Template::get_old_templates();
/* update the id_category for the templates */
foreach ( $templates as $index => $template ) {
if ( ! empty( static::$migration_replacement_map[ $template['id_category'] ] ) ) {
$templates[ $index ]['id_category'] = static::$migration_replacement_map[ $template['id_category'] ];
}
}
Template::save_old_templates( $templates );
static::save_old_categories( [] );
$migrator_instance->finish();
}
}
/**
* Adds 'uncategorized' and 'page templates' to the terms table.
*/
public static function insert_default_categories() {
foreach ( static::$default_categories as $default_category ) {
$new_category = static::insert_term( $default_category['name'] );
$new_category_id = is_wp_error( $new_category ) ? $new_category->get_error_data( 'term_exists' ) : $new_category['term_id'];
/* @var Category $category_instance */
$category_instance = static::get_instance_with_id( $new_category_id );
$category_instance->update_meta( 'type', $default_category['type'] );
static::add_to_migration_replacement_map( $default_category['old_id'], $new_category_id );
}
}
/**
* @param $old_category_id
* @param $new_category_id
*/
public static function add_to_migration_replacement_map( $old_category_id, $new_category_id ) {
if ( ! empty( $new_category_id ) ) {
static::$migration_replacement_map[ $old_category_id ] = $new_category_id;
}
}
/**
* @return array|bool|mixed|void
*/
public static function get_old_categories() {
$categories = get_option( static::OPTION_KEY, [] );
if ( empty( $categories ) || ! is_array( $categories ) ) {
$categories = [];
}
return $categories;
}
/**
* @return mixed
*/
public static function get_migrator_instance() {
if ( empty( static::$migrator_instance ) ) {
static::$migrator_instance = new Migrator( [
'option_key' => static::OPTION_KEY,
'backup_option_key' => static::BACKUP_OPTION_KEY,
'finished_option_key' => static::FINISHED_OPTION_KEY,
'migrate_callback' => static function ( $categories ) {
$old_category = array_shift( $categories );
if ( ! empty( $old_category ) ) {
$new_category = static::insert_term( $old_category['name'] );
$new_category_id = is_wp_error( $new_category ) ? $new_category->get_error_data( 'term_exists' ) : $new_category['term_id'];
static::add_to_migration_replacement_map( $old_category['id'], $new_category_id );
}
return $categories;
},
] );
}
return static::$migrator_instance;
}
/**
* @param $categories
*/
public static function save_old_categories( $categories ) {
update_option( static::OPTION_KEY, $categories, 'no' );
}
/**
* @param $category_name
*
* @return array
*/
public static function add( $category_name ) {
$new_category = static::insert_term( $category_name );
return [
'id' => $new_category['term_id'],
'name' => $category_name,
];
}
/**
* @param $name
*/
public function rename( $name ) {
$this->rename_term( $name );
}
public function delete() {
$this->delete_term();
}
/**
* '$category_id' can be empty, '[#page#], or a regular numeric ID
* empty -> get the ID for the 'uncategorized' term slug
* [#page#] -> get the ID for the 'page-templates' term slug
* numeric -> cast to int
*
* @param $category_id
*
* @return int
*/
public static function normalize_category_id( $category_id ) {
if ( empty( $category_id ) ) {
$category = get_term_by( 'slug', static::$default_categories['uncategorized']['slug'], static::get_taxonomy_name() );
$category_id = $category ? $category->term_id : 0;
} else if ( is_numeric( $category_id ) ) {
$category_id = (int) $category_id;
} else if ( $category_id === static::PAGE_TEMPLATE_IDENTIFIER ) {
$category = get_term_by( 'slug', static::$default_categories['page-templates']['slug'], static::get_taxonomy_name() );
$category_id = $category ? $category->term_id : 0;
} else {
$category_id = 0;
}
return $category_id;
}
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-visual-editor
*/
namespace TCB\UserTemplates;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Main {
const TRAITS_DIR = __DIR__ . '/traits';
public static function init() {
Template::register_post_type();
Category::register_taxonomy();
Category::maybe_migrate();
}
public static function includes() {
require_once static::TRAITS_DIR . '/trait-has-preview.php';
require_once static::TRAITS_DIR . '/trait-has-post-type.php';
require_once static::TRAITS_DIR . '/trait-has-taxonomy.php';
require_once __DIR__ . '/class-template.php';
require_once __DIR__ . '/class-category.php';
require_once __DIR__ . '/class-migrator.php';
}
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-visual-editor
*/
namespace TCB\UserTemplates;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Migrator {
private $option_key;
private $backup_option_key;
private $finished_option_key;
private $migrate_callback;
/**
* @param $options
*/
public function __construct( $options ) {
$this->option_key = $options['option_key'];
$this->backup_option_key = $options['backup_option_key'];
$this->finished_option_key = $options['finished_option_key'];
$this->migrate_callback = $options['migrate_callback'];
}
/**
* @param $amount
*/
public function migrate_x_items( $amount ) {
$items = get_option( $this->option_key, [] );
/* make sure we have a backup */
if ( empty( get_option( $this->backup_option_key ) ) ) {
update_option( $this->backup_option_key, $items, 'no' );
}
if ( ! empty( get_option( $this->backup_option_key ) ) ) {
for ( $i = 0; $i < $amount; $i ++ ) {
$items = call_user_func( $this->migrate_callback, $items );
}
}
}
/**
* @return bool
*/
public function is_finished() {
return ! empty( get_option( $this->finished_option_key, 0 ) );
}
public function finish() {
update_option( $this->finished_option_key, 1, 'no' );
}
}

View File

@@ -0,0 +1,342 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-visual-editor
*/
namespace TCB\UserTemplates;
use TCB\Traits\Is_Singleton;
use TCB_Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Template {
use Is_Singleton;
use Has_Preview;
use Has_Post_Type;
use Has_Taxonomy;
const OPTION_KEY = 'tve_user_templates';
const BACKUP_OPTION_KEY = 'tve_user_templates_backup';
const OLD_ID_PREFIX = 'o_';
const MIGRATED_ITEM_AMOUNT = 2;
private static $migrator_instance;
/**
* @var int
*/
private $ID;
/**
* @param $id
*/
public function __construct( $id = null ) {
$this->ID = $id;
}
/**
* @param bool $can_migrate - we migrate only when localizing in the editor, in order to avoid collisions
*
* @return array|mixed|\WP_Post|null
*/
public static function get_all( $can_migrate = false ) {
$migrator_instance = static::get_migrator_instance();
if ( $migrator_instance->is_finished() ) {
$templates = static::get_new_templates();
} else {
if ( $can_migrate ) {
$migrator_instance->migrate_x_items( static::MIGRATED_ITEM_AMOUNT );
}
$old_templates = static::get_old_templates();
if ( empty( $old_templates ) ) {
$migrator_instance->finish();
}
$templates = array_merge( static::get_new_templates(), $old_templates );
}
if ( empty( $templates ) || ! is_array( $templates ) ) {
$templates = [];
}
return static::order_templates_by_migration_status( $templates );
}
/**
* @return array
*/
public function get() {
if ( $this->is_new_template() ) {
$template = $this->get_post_data();
} else {
$templates = array_values( static::get_old_templates() );
$template_index = array_search( $this->ID, array_column( $templates, 'id' ), true );
$template = ( $template_index === false ) ? [] : $templates[ $template_index ];
}
return $template;
}
/**
* @return bool|mixed|void
*/
public static function get_old_templates() {
$templates = get_option( static::OPTION_KEY, [] );
/* add the ID as a field along with a prefix so we can identify it */
foreach ( $templates as $index => $template ) {
$templates[ $index ]['id'] = static::OLD_ID_PREFIX . $index;
}
return $templates;
}
/**
* Retrieve and map the template data
*
* @return array
*/
public static function get_new_templates() {
$normalized_templates = [];
foreach ( static::get_posts() as $template ) {
/* @var Template $template_instance */
$template_instance = static::get_instance_with_id( $template->ID );
$normalized_templates[] = $template_instance->get_post_data();
}
return $normalized_templates;
}
/**
* Reorder the migrated templates so that they show before the non-migrated ones.
* Newly inserted templates should also show at the end of everything that is being migrated.
*
* @param $templates
*
* @return array
*/
public static function order_templates_by_migration_status( $templates ) {
$migrated_or_old_templates = [];
$non_migrated_new_templates = [];
foreach ( $templates as $template ) {
/* @var Template $template_instance */
$template_instance = static::get_instance_with_id( $template['id'] );
if ( empty( $template['is_migrated'] ) && $template_instance->is_new_template() ) {
$non_migrated_new_templates[] = $template;
} else {
$migrated_or_old_templates[] = $template;
}
}
return array_merge( $migrated_or_old_templates, $non_migrated_new_templates );
}
/**
* @param array $templates
*/
public static function save_old_templates( $templates ) {
update_option( static::OPTION_KEY, $templates, 'no' );
}
/**
* @param $template_data
*
* @return int|\WP_Error
*/
public static function insert( $template_data ) {
return static::insert_post( $template_data );
}
/**
* @param $data
*/
public function update( $data ) {
if ( $this->is_new_template() ) {
$this->update_post( $data );
} else {
$templates = static::get_old_templates();
$id = static::normalize_old_id( $this->ID );
if ( isset( $data['id_category'] ) ) {
$category_id = Category::normalize_category_id( $data['id_category'] );
$data['id_category'] = $category_id;
}
$templates[ $id ] = array_merge( $templates[ $id ], $data );
static::save_old_templates( $templates );
}
}
/**
* @param $name
*/
public function rename( $name ) {
if ( $this->is_new_template() ) {
$this->rename_post( $name );
} else {
$templates = static::get_old_templates();
$id = static::normalize_old_id( $this->ID );
$templates[ $id ]['name'] = $name;
static::save_old_templates( $templates );
}
}
public function delete() {
/* @var Template $template_instance */
$template_instance = static::get_instance_with_id( $this->ID );
$template = $template_instance->get();
static::delete_preview_image( $template['name'] );
if ( $this->is_new_template() ) {
$this->delete_post();
} else {
$templates = static::get_old_templates();
$id = static::normalize_old_id( $this->ID );
unset( $templates[ $id ] );
static::save_old_templates( $templates );
}
}
/**
* @param bool $can_migrate - we migrate only when localizing in the editor, in order to avoid collisions
*
* @return array
*/
public static function localize( $can_migrate = false ) {
$templates = static::get_all( $can_migrate );
$localized_data = [];
foreach ( $templates as $template ) {
$template_data = [
'id' => $template['id'],
'label' => rawurldecode( $template['name'] ),
'type' => empty( $template['type'] ) ? '' : $template['type'],
'thumb' => isset( $template['thumb'] ) ? $template['thumb'] : TCB_Utils::get_placeholder_data(),
'id_category' => isset( $template['id_category'] ) ? $template['id_category'] : null,
];
if ( ! empty( $template['thumb']['url'] ) ) {
$template_data['thumb'] = $template['thumb'];
//if the image sizes couldn't be retrieved before
if ( empty( $template['thumb']['h'] ) && ! empty( $template['thumb']['url'] ) && ini_get('allow_url_fopen') ) {
list( $width, $height ) = getimagesize( $template['thumb']['url'] );
$template_data['thumb']['h'] = $height;
$template_data['thumb']['w'] = $width;
}
} else {
$template_data['thumb'] = TCB_Utils::get_placeholder_data();
}
if ( $template_data['type'] === 'button' ) {
$template_data['media'] = $template['media_css'];
$template_data['content'] = stripslashes( $template['content'] );
}
$localized_data[] = $template_data;
}
return $localized_data;
}
/**
* @return array
*/
public function load() {
/* @var $template_instance Template $template_instance */
$template_instance = Template::get_instance_with_id( $this->ID );
$template = $template_instance->get();
$media_css = null;
if ( isset( $template['media_css'] ) ) {
$media_css = $template['media_css'];
}
if ( is_array( $media_css ) ) {
$media_css = array_map( 'stripslashes', $template['media_css'] );
if ( $media_css ) {
/* make sure the server did not mess up the inline rules - e.g. instances where it replaces double quotes with single quotes */
foreach ( $media_css as $k => $value ) {
$media_css[ $k ] = preg_replace( "#data-css='(.+?)'#s", 'data-css="$1"', $value );
}
}
}
$template_data = [
'html_code' => stripslashes( $template['content'] ),
'css_code' => stripslashes( $template['css'] ),
'is_imported' => $template['is_imported'] ?: 0,
'media_css' => $media_css,
];
if ( ob_get_contents() ) {
ob_end_clean();
}
return $template_data;
}
/**
* @return bool
*/
public function is_new_template() {
return is_numeric( $this->ID );
}
/**
* @return Migrator
*/
public static function get_migrator_instance() {
if ( empty( static::$migrator_instance ) ) {
static::$migrator_instance = new Migrator( [
'option_key' => static::OPTION_KEY,
'backup_option_key' => static::BACKUP_OPTION_KEY,
'finished_option_key' => 'thrive_user_template_migration_finished',
'migrate_callback' => static function ( $templates ) {
$template = array_shift( $templates );
if ( ! empty( $template ) ) {
static::insert_post( $template, true );
}
static::save_old_templates( $templates );
return $templates;
},
] );
}
return static::$migrator_instance;
}
/**
* Transforms the format used to identify the old content templates into a numeric one.
* 'o_5' -> 5
*
* @param $old_id
*
* @return int
*/
public static function normalize_old_id( $old_id ) {
return (int) str_replace( static::OLD_ID_PREFIX, '', $old_id );
}
}

View File

@@ -0,0 +1,164 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-visual-editor
*/
namespace TCB\UserTemplates;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
trait Has_Post_Type {
/**
* @var string[]
*/
public static $meta_key_list = [ 'name', 'content', 'type', 'css', 'media_css', 'thumb' ];
/**
* @return string
*/
public static function get_post_type_name() {
/**
* Allow other plugins to save templates under a different post type
*
* Used in ThriveApprentice when saving Certificate template
*
* @param string $post_type
*/
return apply_filters( 'tcb_user_templates_get_post_type_name', 'tve_user_template' );
}
/**
* @return string
*/
public static function get_post_type_prefix() {
return 'template_';
}
/**
* @return string|void
*/
public static function get_post_title() {
return __( 'User template', 'thrive-cb' );
}
public static function register_post_type() {
register_post_type( static::get_post_type_name(), [
'public' => isset( $_GET[ TVE_EDITOR_FLAG ] ),
'publicly_queryable' => is_user_logged_in(),
'query_var' => false,
'exclude_from_search' => true,
'rewrite' => false,
'_edit_link' => 'post.php?post=%d',
'map_meta_cap' => true,
'label' => static::get_post_title(),
'capabilities' => [
'edit_others_posts' => 'tve-edit-cpt',
'edit_published_posts' => 'tve-edit-cpt',
],
'show_in_nav_menus' => false,
'show_in_menu' => false,
'show_in_rest' => true,
'has_archive' => false,
] );
}
/**
* @param array $args
*
* @return int[]|\WP_Post[]
*/
public static function get_posts( $args = [] ) {
$default_args = [
'post_type' => static::get_post_type_name(),
'posts_per_page' => - 1,
'order' => 'ASC',
];
return get_posts( array_merge( $default_args, $args ) );
}
/**
* @return array
*/
public function get_post_data() {
if ( empty( get_post( $this->ID ) ) ) {
return [];
}
$category_id = wp_get_post_terms( $this->ID, static::get_taxonomy_name(), [ 'fields' => 'ids' ] );
$post_data = [
'id' => $this->ID,
'is_migrated' => get_post_meta( $this->ID, 'is_migrated', true ),
'id_category' => empty( $category_id ) || ! is_array( $category_id ) ? '' : $category_id[0],
'is_imported' => get_post_meta( $this->ID, 'tve_kit_imported', true ) //whether or not the template is from ImportContent/Design Pack
];
foreach ( static::$meta_key_list as $meta_key ) {
$post_data[ $meta_key ] = get_post_meta( $this->ID, static::get_post_type_prefix() . $meta_key, true );
}
return $post_data;
}
/**
* @param array $data
* @param bool $is_migrated
*
* @return int|\WP_Error
*/
public static function insert_post( $data, $is_migrated = false ) {
$meta_input = [];
foreach ( static::$meta_key_list as $meta_key ) {
$meta_input[ static::get_post_type_prefix() . $meta_key ] = $data[ $meta_key ];
}
if ( $is_migrated ) {
$meta_input['is_migrated'] = 1;
}
$post_id = wp_insert_post( [
'post_title' => static::get_post_title(),
'post_type' => static::get_post_type_name(),
'post_status' => 'publish',
'meta_input' => $meta_input,
] );
$category_id = empty( $data['id_category'] ) ? '' : $data['id_category'];
wp_set_object_terms( $post_id, Category::normalize_category_id( $category_id ), Category::get_taxonomy_name() );
return $post_id;
}
/**
* @param $data
*/
public function update_post( $data ) {
foreach ( static::$meta_key_list as $meta_key ) {
if ( isset( $data[ $meta_key ] ) ) {
update_post_meta( (int) $this->ID, static::get_post_type_prefix() . $meta_key, $data[ $meta_key ] );
}
}
if ( isset( $data['id_category'] ) ) {
wp_set_object_terms( (int) $this->ID, Category::normalize_category_id( $data['id_category'] ), Category::get_taxonomy_name() );
}
}
/**
* @param $name
*/
public function rename_post( $name ) {
update_post_meta( $this->ID, static::get_post_type_prefix() . 'name', $name );
}
public function delete_post() {
wp_delete_post( (int) $this->ID, true );
}
}

View File

@@ -0,0 +1,93 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-visual-editor
*/
namespace TCB\UserTemplates;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
trait Has_Preview {
/**
* @param array $image_file_data
* @param array $template
*
* @return array
*/
public static function upload_preview_image( $image_file_data, $template ) {
if ( ! function_exists( 'wp_handle_upload' ) ) {
require_once( ABSPATH . 'wp-admin/includes/file.php' );
}
add_filter( 'upload_dir', 'tve_filter_upload_user_template_location' );
$preview_data = wp_handle_upload(
$image_file_data,
[
'action' => 'tcb_editor_ajax',
'unique_filename_callback' => sanitize_file_name( $template['name'] . '.png' ),
]
);
remove_filter( 'upload_dir', 'tve_filter_upload_user_template_location' );
return $preview_data;
}
/**
* @param string $image_file
*/
public static function resize_preview_image( $image_file ) {
$preview = wp_get_image_editor( $image_file );
if ( ! is_wp_error( $preview ) ) {
$preview->resize( static::get_resize_width(), null );
$preview->save( $image_file );
}
}
/**
* @param $name
*/
public static function delete_preview_image( $name ) {
/* black magic in case the name contains spaces */
$name = implode( '-', explode( ' ', $name ) );
$upload_dir = wp_upload_dir();
$file_name = $upload_dir['basedir'] . '/' . static::get_upload_dir_path() . '/' . $name . '.jpg';
@unlink( $file_name );
}
/**
* @return string
*/
public static function get_placeholder_url() {
return tve_editor_url( 'admin/assets/images/no-template-preview.jpg' );
}
/**
* @return array
*/
public static function get_placeholder_data() {
return [
'url' => static::get_placeholder_url(),
/* hardcoded sizes taken from 'no-template-preview.jpg' */
'h' => '120',
'w' => '250',
];
}
public static function get_resize_width() {
return 330;
}
public static function get_upload_dir_path() {
return 'thrive-visual-editor/user_templates';
}
}

View File

@@ -0,0 +1,97 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-visual-editor
*/
namespace TCB\UserTemplates;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
trait Has_Taxonomy {
/**
* @return string
*/
public static function get_taxonomy_name() {
return 'tve_user_template_category';
}
/**
* @return string
*/
public static function get_taxonomy_meta_key_prefix() {
return 'template_category_';
}
/**
* @return string|void
*/
public static function get_taxonomy_title() {
return __( 'User template category', 'thrive-cb' );
}
public static function register_taxonomy() {
register_taxonomy( static::get_taxonomy_name(), [ Template::get_post_type_name() ], [
'hierarchical' => false,
'show_ui' => false,
'show_in_nav_menus' => false,
'show_admin_column' => false,
'query_var' => false,
'show_in_rest' => false,
'public' => false,
] );
register_taxonomy_for_object_type( static::get_taxonomy_name(), Template::get_post_type_name() );
}
/**
* @return int[]|string|string[]|\WP_Error|\WP_Term[]
*/
public static function get_terms() {
return get_terms( [
'taxonomy' => static::get_taxonomy_name(),
'orderby' => 'id',
'hide_empty' => 0,
] );
}
/**
* @param $name
*
* @return array|int[]|\WP_Error
*/
public static function insert_term( $name ) {
return wp_insert_term( $name, static::get_taxonomy_name() );
}
/**
* @param $name
*/
public function rename_term( $name ) {
wp_update_term( $this->ID, static::get_taxonomy_name(), [ 'name' => $name ] );
}
public function delete_term() {
wp_delete_term( $this->ID, static::get_taxonomy_name() );
}
/**
* @param $key
*
* @return mixed
*/
public function get_meta( $key ) {
return get_term_meta( $this->ID, $key, true );
}
/**
* @param $key
* @param $value
*/
public function update_meta( $key, $value ) {
update_term_meta( $this->ID, $key, $value );
}
}