| Server IP : 170.10.162.208 / Your IP : 216.73.216.38 Web Server : LiteSpeed System : Linux altar19.supremepanel19.com 4.18.0-553.69.1.lve.el8.x86_64 #1 SMP Wed Aug 13 19:53:59 UTC 2025 x86_64 User : deltahospital ( 1806) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home1/deltahospital/www/wp-content/plugins/fancy-gallery/classes/ |
Upload File : |
<?php Namespace WordPress\Plugin\GalleryManager;
abstract class Taxonomies {
static function init(){
add_Action('init', Array(static::class, 'registerTaxonomies'), 9);
add_Action('init', Array(static::class, 'addTaxonomyArchiveUrls'), 50);
add_Filter('nav_menu_meta_box_object', Array(static::class, 'changeTaxonomyMenuLabel'));
}
static function getTaxonomies(){
return Array(
'gallery-category' => Array(
'label' => I18n::t('Gallery Categories'),
'labels' => Array(
'name' => I18n::t('Categories'),
'singular_name' => I18n::t('Category'),
'all_items' => I18n::t('All Categories'),
'edit_item' => I18n::t('Edit Category'),
'view_item' => I18n::t('View Category'),
'update_item' => I18n::t('Update Category'),
'add_new_item' => I18n::t('Add New Category'),
'new_item_name' => I18n::t('New Category'),
'parent_item' => I18n::t('Parent Category'),
'parent_item_colon' => I18n::t('Parent Category:'),
'search_items' => I18n::t('Search Categories'),
'popular_items' => I18n::t('Popular Categories'),
'separate_items_with_commas' => I18n::t('Separate Categories with commas'),
'add_or_remove_items' => I18n::t('Add or remove Categories'),
'choose_from_most_used' => I18n::t('Choose from the most used Categories'),
'not_found' => I18n::t('No Categories found.')
),
'show_admin_column' => True,
'hierarchical' => False,
'show_ui' => True,
'query_var' => True,
'rewrite' => Array(
'with_front' => False,
'slug' => sprintf(I18n::t('%s/category', 'URL slug'), I18n::t('galleries', 'URL slug'))
),
),
'gallery-tag' => Array(
'label' => I18n::t( 'Gallery Tags' ),
'labels' => Array(
'name' => I18n::t('Tags'),
'singular_name' => I18n::t('Tag'),
'all_items' => I18n::t('All Tags'),
'edit_item' => I18n::t('Edit Tag'),
'view_item' => I18n::t('View Tag'),
'update_item' => I18n::t('Update Tag'),
'add_new_item' => I18n::t('Add New Tag'),
'new_item_name' => I18n::t('New Tag'),
'parent_item' => I18n::t('Parent Tag'),
'parent_item_colon' => I18n::t('Parent Tag:'),
'search_items' => I18n::t('Search Tags'),
'popular_items' => I18n::t('Popular Tags'),
'separate_items_with_commas' => I18n::t('Separate Tags with commas'),
'add_or_remove_items' => I18n::t('Add or remove Tags'),
'choose_from_most_used' => I18n::t('Choose from the most used Tags'),
'not_found' => I18n::t('No Tags found.')
),
'show_admin_column' => True,
'hierarchical' => False,
'show_ui' => True,
'query_var' => True,
'rewrite' => Array(
'with_front' => False,
'slug' => sprintf(I18n::t('%s/tag', 'URL slug'), I18n::t('galleries', 'URL slug'))
),
),
);
}
static function registerTaxonomies(){
# Load Taxonomies
$arr_taxonomies = static::getTaxonomies();
$arr_taxonomies = apply_Filters('gallery-manager-taxonomies', $arr_taxonomies);
# Check the enabled taxonomies
$enabled_taxonomies = Options::get('gallery_taxonomies');
setType($enabled_taxonomies, 'ARRAY');
if (empty($enabled_taxonomies)) return False;
# Register Taxonomies
foreach ($enabled_taxonomies as $taxonomie_name => $attributes){
if (isSet($arr_taxonomies[$taxonomie_name])){
$taxonomy_args = Array_Merge($arr_taxonomies[$taxonomie_name], $attributes);
register_Taxonomy($taxonomie_name, Post_Type::post_type_name, $taxonomy_args);
}
}
}
static function addTaxonomyArchiveUrls(){
foreach (get_Object_Taxonomies(Post_Type::post_type_name) as $taxonomy){
add_Action($taxonomy.'_edit_form_fields', Array(static::class, 'printTaxonomyArchiveUrls'), 10, 3);
}
}
static function printTaxonomyArchiveUrls($tag, $taxonomy){
$taxonomy = get_Taxonomy($taxonomy);
$archive_url = get_Term_Link(get_Term($tag->term_id, $taxonomy->name));
$archive_feed = get_Term_Feed_Link($tag->term_id, $taxonomy->name);
?>
<tr class="form-field">
<th scope="row" valign="top"><?php echo I18n::t('Archive Url') ?></th>
<td>
<a href="<?php echo $archive_url ?>" target="_blank"><?php echo $archive_url ?></a><br>
<span class="description"><?php printf(I18n::t('This is the URL to the archive of this %s.'), $taxonomy->labels->singular_name) ?></span>
</td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><?php echo I18n::t('Archive Feed') ?></th>
<td>
<a href="<?php echo $archive_feed ?>" target="_blank"><?php echo $archive_feed ?></a><br />
<span class="description"><?php printf(I18n::t('This is the URL to the feed of the archive of this %s.'), $taxonomy->labels->singular_name) ?></span>
</td>
</tr>
<?php
}
static function changeTaxonomyMenuLabel($tax){
if (isSet($tax->object_type) && in_Array(Post_Type::post_type_name, $tax->object_type)){
$gallery_post_type_object = get_Post_Type_Object(Post_Type::post_type_name);
$tax->labels->name = sprintf('%1$s → %2$s', $gallery_post_type_object->label, $tax->labels->name);
}
return $tax;
}
static function updateTaxonomyNames(){
global $wpdb;
$arr_rename = Array(
'gallery_category' => 'gallery-category',
'gallery_tag' => 'gallery-tag',
);
foreach ($arr_rename as $rename_from => $rename_to){
$wpdb->update($wpdb->term_taxonomy, Array('taxonomy' => $rename_to), Array('taxonomy' => $rename_from));
}
}
}
Taxonomies::init();