| 1 |
<?php |
| 2 |
|
| 3 |
class SimpleTags_Tag_Clouds |
| 4 |
{ |
| 5 |
|
| 6 |
const MENU_SLUG = 'st_options'; |
| 7 |
|
| 8 |
// class instance |
| 9 |
static $instance; |
| 10 |
|
| 11 |
// WP_List_Table object |
| 12 |
public $terms_table; |
| 13 |
|
| 14 |
/** |
| 15 |
* Constructor |
| 16 |
* |
| 17 |
* @return void |
| 18 |
* @author Olatechpro |
| 19 |
*/ |
| 20 |
public function __construct() |
| 21 |
{ |
| 22 |
|
| 23 |
add_filter('set-screen-option', [__CLASS__, 'set_screen'], 10, 3); |
| 24 |
// Admin menu |
| 25 |
add_action('admin_menu', [$this, 'admin_menu']); |
| 26 |
|
| 27 |
// Javascript |
| 28 |
add_action('admin_enqueue_scripts', [__CLASS__, 'admin_enqueue_scripts'], 11); |
| 29 |
|
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Init somes JS and CSS need for this feature |
| 34 |
* |
| 35 |
* @return void |
| 36 |
* @author Olatechpro |
| 37 |
*/ |
| 38 |
public static function admin_enqueue_scripts() |
| 39 |
{ |
| 40 |
|
| 41 |
// add JS for manage click tags |
| 42 |
if (isset($_GET['page']) && $_GET['page'] == 'st_terms_display') { |
| 43 |
wp_enqueue_style('st-taxonomies-css'); |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
public static function set_screen($status, $option, $value) |
| 48 |
{ |
| 49 |
return $value; |
| 50 |
} |
| 51 |
|
| 52 |
/** Singleton instance */ |
| 53 |
public static function get_instance() |
| 54 |
{ |
| 55 |
if (!isset(self::$instance)) { |
| 56 |
self::$instance = new self(); |
| 57 |
} |
| 58 |
|
| 59 |
return self::$instance; |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Add WP admin menu for Tags |
| 64 |
* |
| 65 |
* @return void |
| 66 |
* @author Olatechpro |
| 67 |
*/ |
| 68 |
public function admin_menu() |
| 69 |
{ |
| 70 |
$hook = add_submenu_page( |
| 71 |
self::MENU_SLUG, |
| 72 |
__('Terms Display', 'simple-tags'), |
| 73 |
__('Terms Display', 'simple-tags'), |
| 74 |
'simple_tags', |
| 75 |
'st_terms_display', |
| 76 |
[ |
| 77 |
$this, |
| 78 |
'page_manage_tagclouds', |
| 79 |
] |
| 80 |
); |
| 81 |
|
| 82 |
if(taxopress_is_screen_main_page()){ |
| 83 |
add_action("load-$hook", [$this, 'screen_option']); |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Screen options |
| 89 |
*/ |
| 90 |
public function screen_option() |
| 91 |
{ |
| 92 |
|
| 93 |
$option = 'per_page'; |
| 94 |
$args = [ |
| 95 |
'label' => __('Number of items per page', 'simple-tags'), |
| 96 |
'default' => 20, |
| 97 |
'option' => 'st_terms_display_per_page' |
| 98 |
]; |
| 99 |
|
| 100 |
add_screen_option($option, $args); |
| 101 |
|
| 102 |
$this->terms_table = new TagClouds_List(); |
| 103 |
} |
| 104 |
|
| 105 |
/** |
| 106 |
* Method for build the page HTML manage tags |
| 107 |
* |
| 108 |
* @return void |
| 109 |
* @author Olatechpro |
| 110 |
*/ |
| 111 |
public function page_manage_tagclouds() |
| 112 |
{ |
| 113 |
// Default order |
| 114 |
if (!isset($_GET['order'])) { |
| 115 |
$_GET['order'] = 'name-asc'; |
| 116 |
} |
| 117 |
|
| 118 |
settings_errors(__CLASS__); |
| 119 |
|
| 120 |
if (!isset($_GET['add'])) { |
| 121 |
//all tax |
| 122 |
?> |
| 123 |
<div class="wrap st_wrap st-manage-taxonomies-page"> |
| 124 |
|
| 125 |
<div id=""> |
| 126 |
<h1 class="wp-heading-inline"><?php _e('Terms Display', 'simple-tags'); ?></h1> |
| 127 |
<a href="<?php echo esc_url(admin_url('admin.php?page=st_terms_display&add=new_item')); ?>" |
| 128 |
class="page-title-action"><?php esc_html_e('Add New', 'simple-tags'); ?></a> |
| 129 |
|
| 130 |
<div class="taxopress-description">This feature allows you to create a customizable display of all the terms in one taxonomy.</div> |
| 131 |
|
| 132 |
|
| 133 |
<?php |
| 134 |
if (isset($_REQUEST['s']) && $search = esc_attr(wp_unslash($_REQUEST['s']))) { |
| 135 |
/* translators: %s: search keywords */ |
| 136 |
printf(' <span class="subtitle">' . __('Search results for “%s”', |
| 137 |
'simple-tags') . '</span>', $search); |
| 138 |
} |
| 139 |
?> |
| 140 |
<?php |
| 141 |
|
| 142 |
//the terms table instance |
| 143 |
$this->terms_table->prepare_items(); |
| 144 |
?> |
| 145 |
|
| 146 |
|
| 147 |
<hr class="wp-header-end"> |
| 148 |
<div id="ajax-response"></div> |
| 149 |
<form class="search-form wp-clearfix st-taxonomies-search-form" method="get"> |
| 150 |
<?php $this->terms_table->search_box(__('Search Terms Display', 'simple-tags'), 'term'); ?> |
| 151 |
</form> |
| 152 |
<div class="clear"></div> |
| 153 |
|
| 154 |
<div id="col-container" class="wp-clearfix"> |
| 155 |
|
| 156 |
<div class="col-wrap"> |
| 157 |
<form action="<?php echo add_query_arg('', '') ?>" method="post"> |
| 158 |
<?php $this->terms_table->display(); //Display the table ?> |
| 159 |
</form> |
| 160 |
<div class="form-wrap edit-term-notes"> |
| 161 |
<p><?php __('Description here.', 'simple-tags') ?></p> |
| 162 |
</div> |
| 163 |
</div> |
| 164 |
|
| 165 |
|
| 166 |
</div> |
| 167 |
|
| 168 |
|
| 169 |
</div> |
| 170 |
<?php } else { |
| 171 |
if ($_GET['add'] == 'new_item') { |
| 172 |
//add/edit taxonomy |
| 173 |
$this->taxopress_manage_tagclouds(); |
| 174 |
echo '<div>'; |
| 175 |
} |
| 176 |
} ?> |
| 177 |
|
| 178 |
|
| 179 |
<?php SimpleTags_Admin::printAdminFooter(); ?> |
| 180 |
</div> |
| 181 |
<?php |
| 182 |
} |
| 183 |
|
| 184 |
|
| 185 |
/** |
| 186 |
* Create our settings page output. |
| 187 |
* |
| 188 |
* @internal |
| 189 |
*/ |
| 190 |
public function taxopress_manage_tagclouds() |
| 191 |
{ |
| 192 |
|
| 193 |
$tab = (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) ? 'edit' : 'new'; |
| 194 |
$tab_class = 'taxopress-' . $tab; |
| 195 |
$current = null; |
| 196 |
|
| 197 |
?> |
| 198 |
|
| 199 |
<div class="wrap <?php echo esc_attr($tab_class); ?>"> |
| 200 |
|
| 201 |
<?php |
| 202 |
|
| 203 |
$tagclouds = taxopress_get_tagcloud_data(); |
| 204 |
$tag_cloud_edit = false; |
| 205 |
$tag_cloud_limit = false; |
| 206 |
|
| 207 |
if ('edit' === $tab) { |
| 208 |
|
| 209 |
|
| 210 |
$selected_tagcloud = taxopress_get_current_tagcloud(); |
| 211 |
|
| 212 |
if ($selected_tagcloud && array_key_exists($selected_tagcloud, $tagclouds)) { |
| 213 |
$current = $tagclouds[$selected_tagcloud]; |
| 214 |
$tag_cloud_edit = true; |
| 215 |
} |
| 216 |
|
| 217 |
} |
| 218 |
|
| 219 |
|
| 220 |
if(!isset($current['title']) && count($tagclouds) > 0 && apply_filters('taxopress_tag_clouds_create_limit', true)){ |
| 221 |
$tag_cloud_limit = true; |
| 222 |
} |
| 223 |
|
| 224 |
|
| 225 |
$ui = new taxopress_admin_ui(); |
| 226 |
?> |
| 227 |
|
| 228 |
|
| 229 |
<div class="wrap <?php echo esc_attr($tab_class); ?>"> |
| 230 |
<h1><?php echo __('Manage Terms Display', 'simple-tags'); ?></h1> |
| 231 |
<div class="wp-clearfix"></div> |
| 232 |
|
| 233 |
<form method="post" action=""> |
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
<div class="tagcloudui"> |
| 238 |
|
| 239 |
|
| 240 |
<div class="tagclouds-postbox-container"> |
| 241 |
<div id="poststuff"> |
| 242 |
<div class="taxopress-section postbox"> |
| 243 |
<div class="postbox-header"> |
| 244 |
<h2 class="hndle ui-sortable-handle"> |
| 245 |
<?php |
| 246 |
if ($tag_cloud_edit) { |
| 247 |
echo esc_html__('Edit Terms Display', 'simple-tags'); |
| 248 |
echo '<input type="hidden" name="edited_tagcloud" value="'.$current['ID'].'" />'; |
| 249 |
echo '<input type="hidden" name="taxopress_tag_cloud[ID]" value="'.$current['ID'].'" />'; |
| 250 |
} else { |
| 251 |
echo esc_html__('Add new Terms Display', 'simple-tags'); |
| 252 |
} |
| 253 |
?> |
| 254 |
</h2> |
| 255 |
</div> |
| 256 |
<div class="inside"> |
| 257 |
<div class="main"> |
| 258 |
|
| 259 |
|
| 260 |
<div class="st-taxonomy-content"> |
| 261 |
|
| 262 |
<?php if($tag_cloud_limit){ |
| 263 |
echo '<div class="taxopress-warning upgrade-pro"> |
| 264 |
<p> |
| 265 |
|
| 266 |
<h2 style="margin-bottom: 5px;">' . __('To create more Terms Display, please upgrade to TaxoPress Pro.','simple-tags').'</h2> |
| 267 |
' . __('With TaxoPress Pro, you can create unlimited Terms Display. You can create Terms Display for any taxonomy and then display those Terms Display anywhere on your site.','simple-tags').' |
| 268 |
|
| 269 |
</p> |
| 270 |
</div>'; |
| 271 |
|
| 272 |
}else{ |
| 273 |
?> |
| 274 |
<table class="form-table taxopress-table"> |
| 275 |
<?php |
| 276 |
echo $ui->get_tr_start(); |
| 277 |
|
| 278 |
echo $ui->get_th_start(); |
| 279 |
echo $ui->get_label('name', esc_html__('Title', 'simple-tags')) . $ui->get_required_span(); |
| 280 |
echo $ui->get_th_end() . $ui->get_td_start(); |
| 281 |
|
| 282 |
echo $ui->get_text_input([ |
| 283 |
'namearray' => 'taxopress_tag_cloud', |
| 284 |
'name' => 'title', |
| 285 |
'textvalue' => isset($current['title']) ? esc_attr($current['title']) : '', |
| 286 |
'maxlength' => '32', |
| 287 |
'helptext' => '', |
| 288 |
'required' => true, |
| 289 |
'placeholder' => false, |
| 290 |
'wrap' => false, |
| 291 |
]); |
| 292 |
|
| 293 |
$select = [ |
| 294 |
'options' => [ |
| 295 |
[ |
| 296 |
'attr' => '0', |
| 297 |
'text' => esc_attr__('False', 'simple-tags'), |
| 298 |
'default' => 'true', |
| 299 |
], |
| 300 |
[ |
| 301 |
'attr' => '1', |
| 302 |
'text' => esc_attr__('True', 'simple-tags'), |
| 303 |
], |
| 304 |
], |
| 305 |
]; |
| 306 |
$selected = ( isset($current) && isset($current['hide_title']) ) ? taxopress_disp_boolean($current['hide_title']) : ''; |
| 307 |
$select['selected'] = !empty($selected) ? $current['hide_title'] : ''; |
| 308 |
echo $ui->get_select_checkbox_input([ |
| 309 |
'namearray' => 'taxopress_tag_cloud', |
| 310 |
'name' => 'hide_title', |
| 311 |
'labeltext' => esc_html__('Hide title in output ?', 'simple-tags'), |
| 312 |
'selections' => $select, |
| 313 |
]); |
| 314 |
|
| 315 |
$select = [ |
| 316 |
'options' => [ |
| 317 |
[ |
| 318 |
'attr' => '0', |
| 319 |
'text' => esc_attr__('False', 'simple-tags'), |
| 320 |
'default' => 'true', |
| 321 |
], |
| 322 |
[ |
| 323 |
'attr' => '1', |
| 324 |
'text' => esc_attr__('True', 'simple-tags'), |
| 325 |
], |
| 326 |
], |
| 327 |
]; |
| 328 |
$selected = ( isset($current) && isset($current['hide_output']) ) ? taxopress_disp_boolean($current['hide_output']) : ''; |
| 329 |
$select['selected'] = !empty($selected) ? $current['hide_output'] : ''; |
| 330 |
echo $ui->get_select_checkbox_input([ |
| 331 |
'namearray' => 'taxopress_tag_cloud', |
| 332 |
'name' => 'hide_output', |
| 333 |
'labeltext' => esc_html__('Hide display output if no terms ?', 'simple-tags'), |
| 334 |
'selections' => $select, |
| 335 |
]); |
| 336 |
|
| 337 |
$options[] = [ 'attr' => '', 'text' => __('All post types', 'simple-tags'), 'default' => 'true' ]; |
| 338 |
foreach ( get_post_types(['public' => true], 'objects') as $post_type ) { |
| 339 |
$options[] = [ 'attr' => $post_type->name, 'text' => $post_type->label ]; |
| 340 |
} |
| 341 |
|
| 342 |
$select = [ |
| 343 |
'options' => $options, |
| 344 |
]; |
| 345 |
$selected = ( isset( $current ) && isset($current['post_type']) ) ? taxopress_disp_boolean( $current['post_type'] ) : ''; |
| 346 |
$select['selected'] = ! empty( $selected ) ? $current['post_type'] : ''; |
| 347 |
echo $ui->get_select_checkbox_input_main( [ |
| 348 |
'namearray' => 'taxopress_tag_cloud', |
| 349 |
'name' => 'post_type', |
| 350 |
'class' => 'st-post-type-select', |
| 351 |
'labeltext' => esc_html__( 'Post Type', 'simple-tags' ), |
| 352 |
'selections' => $select, |
| 353 |
] ); |
| 354 |
|
| 355 |
$options = []; |
| 356 |
foreach ( get_all_taxopress_taxonomies() as $_taxonomy ) { |
| 357 |
$_taxonomy = $_taxonomy->name; |
| 358 |
$tax = get_taxonomy( $_taxonomy ); |
| 359 |
if ( ! $tax->show_tagcloud || empty( $tax->labels->name ) ) { |
| 360 |
continue; |
| 361 |
} |
| 362 |
if($tax->name === 'post_tag'){ |
| 363 |
$options[] = [ 'post_type' => join(',', $tax->object_type), 'attr' => $tax->name, 'text' => $tax->labels->name. ' ('.$tax->name.')', 'default' => 'true' ]; |
| 364 |
}else{ |
| 365 |
$options[] = [ 'post_type' => join(',', $tax->object_type), 'attr' => $tax->name, 'text' => $tax->labels->name. ' ('.$tax->name.')' ]; |
| 366 |
} |
| 367 |
} |
| 368 |
|
| 369 |
$select = [ |
| 370 |
'options' => $options, |
| 371 |
]; |
| 372 |
$selected = isset( $current ) ? taxopress_disp_boolean( $current['taxonomy'] ) : ''; |
| 373 |
$select['selected'] = ! empty( $selected ) ? $current['taxonomy'] : ''; |
| 374 |
echo $ui->get_select_checkbox_input_main( [ |
| 375 |
'namearray' => 'taxopress_tag_cloud', |
| 376 |
'name' => 'taxonomy', |
| 377 |
'class' => 'st-post-taxonomy-select', |
| 378 |
'labeltext' => esc_html__( 'Taxonomy', 'simple-tags' ), |
| 379 |
'required' => true, |
| 380 |
'selections' => $select, |
| 381 |
] ); |
| 382 |
|
| 383 |
echo $ui->get_number_input([ |
| 384 |
'namearray' => 'taxopress_tag_cloud', |
| 385 |
'name' => 'max', |
| 386 |
'textvalue' => isset($current['max']) ? esc_attr($current['max']) : '45', |
| 387 |
'labeltext' => esc_html__('Maximum terms to display', 'simple-tags'), |
| 388 |
'helptext' => '', |
| 389 |
'required' => true, |
| 390 |
]); |
| 391 |
|
| 392 |
$select = [ |
| 393 |
'options' => [ |
| 394 |
[ 'attr' => 'flat', 'text' => esc_attr__( 'Cloud', 'simple-tags' ), 'default' => 'true' ], |
| 395 |
[ 'attr' => 'list', 'text' => esc_attr__( 'List (UL/LI)', 'simple-tags' ) ], |
| 396 |
], |
| 397 |
]; |
| 398 |
$selected = isset( $current ) ? taxopress_disp_boolean( $current['format'] ) : ''; |
| 399 |
$select['selected'] = ! empty( $selected ) ? $current['format'] : ''; |
| 400 |
echo $ui->get_select_checkbox_input_main( [ |
| 401 |
'namearray' => 'taxopress_tag_cloud', |
| 402 |
'name' => 'format', |
| 403 |
'labeltext' => esc_html__( 'Display format', 'simple-tags' ), |
| 404 |
'selections' => $select, |
| 405 |
] ); |
| 406 |
|
| 407 |
$select = [ |
| 408 |
'options' => [ |
| 409 |
[ 'attr' => '1', 'text' => esc_attr__( '24 hours', 'simple-tags' ) ], |
| 410 |
[ 'attr' => '7', 'text' => esc_attr__( '7 days', 'simple-tags' ) ], |
| 411 |
[ 'attr' => '14', 'text' => esc_attr__( '2 weeks', 'simple-tags' ) ], |
| 412 |
[ 'attr' => '30', 'text' => esc_attr__( '1 month', 'simple-tags' ) ], |
| 413 |
[ 'attr' => '180', 'text' => esc_attr__( '6 months', 'simple-tags' ) ], |
| 414 |
[ 'attr' => '365', 'text' => esc_attr__( '1 year', 'simple-tags' ) ], |
| 415 |
[ 'attr' => '0', 'text' => esc_attr__( 'No limit', 'simple-tags'), 'default' => 'true' ], |
| 416 |
], |
| 417 |
]; |
| 418 |
$selected = isset( $current ) ? taxopress_disp_boolean( $current['limit_days'] ) : ''; |
| 419 |
$select['selected'] = ! empty( $selected ) ? $current['limit_days'] : ''; |
| 420 |
echo $ui->get_select_number_select( [ |
| 421 |
'namearray' => 'taxopress_tag_cloud', |
| 422 |
'name' => 'limit_days', |
| 423 |
'labeltext' => esc_html__( 'Limit terms based on timeframe', 'simple-tags' ), |
| 424 |
'selections' => $select, |
| 425 |
] ); |
| 426 |
|
| 427 |
|
| 428 |
$select = [ |
| 429 |
'options' => [ |
| 430 |
[ 'attr' => 'name', 'text' => esc_attr__( 'Name', 'simple-tags' ) ], |
| 431 |
[ 'attr' => 'slug', 'text' => esc_attr__( 'Slug', 'simple-tags' ) ], |
| 432 |
[ 'attr' => 'count', 'text' => esc_attr__( 'Counter', 'simple-tags'), 'default' => 'true' ], |
| 433 |
[ 'attr' => 'random', 'text' => esc_attr__( 'Random', 'simple-tags' ) ], |
| 434 |
], |
| 435 |
]; |
| 436 |
$selected = isset( $current ) ? taxopress_disp_boolean( $current['selectionby'] ) : ''; |
| 437 |
$select['selected'] = ! empty( $selected ) ? $current['selectionby'] : ''; |
| 438 |
echo $ui->get_select_checkbox_input_main( [ |
| 439 |
'namearray' => 'taxopress_tag_cloud', |
| 440 |
'name' => 'selectionby', |
| 441 |
'labeltext' => esc_html__( 'Method for choosing terms from the database', 'simple-tags' ), |
| 442 |
'selections' => $select, |
| 443 |
] ); |
| 444 |
|
| 445 |
|
| 446 |
$select = [ |
| 447 |
'options' => [ |
| 448 |
[ 'attr' => 'asc', 'text' => esc_attr__( 'Ascending', 'simple-tags' ) ], |
| 449 |
[ 'attr' => 'desc', 'text' => esc_attr__( 'Descending', 'simple-tags'), 'default' => 'true' ], |
| 450 |
], |
| 451 |
]; |
| 452 |
$selected = isset( $current ) ? taxopress_disp_boolean( $current['selection'] ) : ''; |
| 453 |
$select['selected'] = ! empty( $selected ) ? $current['selection'] : ''; |
| 454 |
echo $ui->get_select_checkbox_input_main( [ |
| 455 |
'namearray' => 'taxopress_tag_cloud', |
| 456 |
'name' => 'selection', |
| 457 |
'labeltext' => esc_html__( 'Ordering for choosing term from the database', 'simple-tags' ), |
| 458 |
'selections' => $select, |
| 459 |
] ); |
| 460 |
|
| 461 |
|
| 462 |
$select = [ |
| 463 |
'options' => [ |
| 464 |
[ 'attr' => 'name', 'text' => esc_attr__( 'Name', 'simple-tags' ) ], |
| 465 |
[ 'attr' => 'count', 'text' => esc_attr__( 'Counter', 'simple-tags') ], |
| 466 |
[ 'attr' => 'random', 'text' => esc_attr__( 'Random', 'simple-tags' ), 'default' => 'true' ], |
| 467 |
], |
| 468 |
]; |
| 469 |
$selected = isset( $current ) ? taxopress_disp_boolean( $current['orderby'] ) : ''; |
| 470 |
$select['selected'] = ! empty( $selected ) ? $current['orderby'] : ''; |
| 471 |
echo $ui->get_select_checkbox_input_main( [ |
| 472 |
'namearray' => 'taxopress_tag_cloud', |
| 473 |
'name' => 'orderby', |
| 474 |
'labeltext' => esc_html__( 'Method for choosing terms for display', 'simple-tags' ), |
| 475 |
'selections' => $select, |
| 476 |
] ); |
| 477 |
|
| 478 |
|
| 479 |
$select = [ |
| 480 |
'options' => [ |
| 481 |
[ 'attr' => 'asc', 'text' => esc_attr__( 'Ascending', 'simple-tags' ) ], |
| 482 |
[ 'attr' => 'desc', 'text' => esc_attr__( 'Descending', 'simple-tags'), 'default' => 'true' ], |
| 483 |
], |
| 484 |
]; |
| 485 |
$selected = isset( $current ) ? taxopress_disp_boolean( $current['order'] ) : ''; |
| 486 |
$select['selected'] = ! empty( $selected ) ? $current['order'] : ''; |
| 487 |
echo $ui->get_select_checkbox_input_main( [ |
| 488 |
'namearray' => 'taxopress_tag_cloud', |
| 489 |
'name' => 'order', |
| 490 |
'labeltext' => esc_html__( 'Ordering for choosing terms for display', 'simple-tags' ), |
| 491 |
'selections' => $select, |
| 492 |
] ); |
| 493 |
|
| 494 |
echo $ui->get_number_input([ |
| 495 |
'namearray' => 'taxopress_tag_cloud', |
| 496 |
'name' => 'smallest', |
| 497 |
'textvalue' => isset($current['smallest']) ? esc_attr($current['smallest']) : '8', |
| 498 |
'labeltext' => esc_html__('Font size minimum', 'simple-tags'), |
| 499 |
'helptext' => '', |
| 500 |
'required' => true, |
| 501 |
]); |
| 502 |
|
| 503 |
echo $ui->get_number_input([ |
| 504 |
'namearray' => 'taxopress_tag_cloud', |
| 505 |
'name' => 'largest', |
| 506 |
'textvalue' => isset($current['largest']) ? esc_attr($current['largest']) : '22', |
| 507 |
'labeltext' => esc_html__('Font size maximum', 'simple-tags'), |
| 508 |
'helptext' => '', |
| 509 |
'required' => true, |
| 510 |
]); |
| 511 |
|
| 512 |
$select = [ |
| 513 |
'options' => [ |
| 514 |
[ 'attr' => 'pt', 'text' => esc_attr__( 'Point', 'simple-tags' ), 'default' => 'true' ], |
| 515 |
[ 'attr' => 'px', 'text' => esc_attr__( 'Pixel', 'simple-tags' ) ], |
| 516 |
[ 'attr' => 'em', 'text' => esc_attr__( 'Em', 'simple-tags') ], |
| 517 |
[ 'attr' => '%', 'text' => esc_attr__( 'Percent', 'simple-tags') ], |
| 518 |
], |
| 519 |
]; |
| 520 |
$selected = isset( $current ) ? taxopress_disp_boolean( $current['unit'] ) : ''; |
| 521 |
$select['selected'] = ! empty( $selected ) ? $current['unit'] : ''; |
| 522 |
echo $ui->get_select_checkbox_input_main( [ |
| 523 |
'namearray' => 'taxopress_tag_cloud', |
| 524 |
'name' => 'unit', |
| 525 |
'labeltext' => esc_html__( 'Unit font size', 'simple-tags' ), |
| 526 |
'selections' => $select, |
| 527 |
] ); |
| 528 |
|
| 529 |
echo $ui->get_text_input([ |
| 530 |
'namearray' => 'taxopress_tag_cloud', |
| 531 |
'name' => 'mincolor', |
| 532 |
'class' => 'text-color tag-cloud-min', |
| 533 |
'textvalue' => isset($current['mincolor']) ? esc_attr($current['mincolor']) : '#CCCCCC', |
| 534 |
'labeltext' => esc_html__('Font color minimum', 'simple-tags'), |
| 535 |
'required' => true, |
| 536 |
]); |
| 537 |
|
| 538 |
echo $ui->get_text_input([ |
| 539 |
'namearray' => 'taxopress_tag_cloud', |
| 540 |
'name' => 'maxcolor', |
| 541 |
'class' => 'text-color tag-cloud-max', |
| 542 |
'textvalue' => isset($current['maxcolor']) ? esc_attr($current['maxcolor']) : '#000000', |
| 543 |
'labeltext' => esc_html__('Font color maximum', 'simple-tags'), |
| 544 |
'required' => true, |
| 545 |
]); |
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
$select = [ |
| 550 |
'options' => [ |
| 551 |
[ |
| 552 |
'attr' => '0', |
| 553 |
'text' => esc_attr__('False', 'simple-tags'), |
| 554 |
], |
| 555 |
[ |
| 556 |
'attr' => '1', |
| 557 |
'text' => esc_attr__('True', 'simple-tags'), |
| 558 |
//'default' => 'true', removed when default value is checked as this mean box is always checked even when user uncheck it since it's defau;t |
| 559 |
], |
| 560 |
], |
| 561 |
]; |
| 562 |
$selected = ( isset($current) && isset($current['color']) ) ? taxopress_disp_boolean($current['color']) : ''; |
| 563 |
|
| 564 |
if($tag_cloud_edit){ |
| 565 |
$select['selected'] = !empty($selected) ? $current['color'] : ''; |
| 566 |
}else{ |
| 567 |
$select['selected'] = 1; //makeup for default when creating new term display |
| 568 |
} |
| 569 |
echo $ui->get_select_checkbox_input([ |
| 570 |
'namearray' => 'taxopress_tag_cloud', |
| 571 |
'name' => 'color', |
| 572 |
'labeltext' => esc_html__('Automatically fill colors between maximum and minimum', 'simple-tags'), |
| 573 |
'selections' => $select, |
| 574 |
]); |
| 575 |
|
| 576 |
echo $ui->get_text_input([ |
| 577 |
'namearray' => 'taxopress_tag_cloud', |
| 578 |
'name' => 'wrap_class', |
| 579 |
'class' => '', |
| 580 |
'textvalue' => isset($current['wrap_class']) ? esc_attr($current['wrap_class']) : '', |
| 581 |
'labeltext' => esc_html__('Term display div class', 'simple-tags'), |
| 582 |
'helptext' => '', |
| 583 |
'required' => false, |
| 584 |
]); |
| 585 |
|
| 586 |
echo $ui->get_text_input([ |
| 587 |
'namearray' => 'taxopress_tag_cloud', |
| 588 |
'name' => 'link_class', |
| 589 |
'class' => '', |
| 590 |
'textvalue' => isset($current['link_class']) ? esc_attr($current['link_class']) : '', |
| 591 |
'labeltext' => esc_html__('Term link class', 'simple-tags'), |
| 592 |
'helptext' => '', |
| 593 |
'required' => false, |
| 594 |
]); |
| 595 |
|
| 596 |
echo $ui->get_text_input([ |
| 597 |
'namearray' => 'taxopress_tag_cloud', |
| 598 |
'name' => 'xformat', |
| 599 |
'class' => 'st-full-width', |
| 600 |
'textvalue' => isset($current['xformat']) ? esc_attr($current['xformat']) : esc_attr('<a href="%tag_link%" id="tag-link-%tag_id%" class="st-tags t%tag_scale%" title="%tag_count% topics" %tag_rel% style="%tag_size% %tag_color%">%tag_name%</a>'), |
| 601 |
'labeltext' => esc_html__('Term link format', 'simple-tags'), |
| 602 |
'helptext' => __('You can find markers and explanations <a target="blank" href="https://taxopress.com/docs/format-tag-clouds/">in the online documentation.</a>', 'simple-tags'), |
| 603 |
'required' => false, |
| 604 |
]); |
| 605 |
|
| 606 |
echo $ui->get_td_end() . $ui->get_tr_end(); |
| 607 |
?> |
| 608 |
</table> |
| 609 |
|
| 610 |
<?php }//end new fields ?> |
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
</div> |
| 615 |
<div class="clear"></div> |
| 616 |
|
| 617 |
|
| 618 |
</div> |
| 619 |
</div> |
| 620 |
</div> |
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
<?php if($tag_cloud_limit){ ?> |
| 626 |
|
| 627 |
<div class="pp-version-notice-bold-purple" style="margin-left:0px;"><div class="pp-version-notice-bold-purple-message">You're using TaxoPress Free. The Pro version has more features and support. </div><div class="pp-version-notice-bold-purple-button"><a href="https://taxopress.com/pro" target="_blank">Upgrade to Pro</a></div></div> |
| 628 |
|
| 629 |
<?php } ?> |
| 630 |
<?php |
| 631 |
/** |
| 632 |
* Fires after the default fieldsets on the taxonomy screen. |
| 633 |
* |
| 634 |
* @param taxopress_admin_ui $ui Admin UI instance. |
| 635 |
*/ |
| 636 |
do_action('taxopress_taxonomy_after_fieldsets', $ui); |
| 637 |
?> |
| 638 |
|
| 639 |
</div> |
| 640 |
</div> |
| 641 |
|
| 642 |
|
| 643 |
</div> |
| 644 |
|
| 645 |
<div class="taxopress-right-sidebar"> |
| 646 |
<div class="taxopress-right-sidebar-wrapper" style="min-height: 205px;"> |
| 647 |
|
| 648 |
|
| 649 |
<?php |
| 650 |
if(!$tag_cloud_limit){ ?> |
| 651 |
<p class="submit"> |
| 652 |
|
| 653 |
<?php |
| 654 |
wp_nonce_field('taxopress_addedit_tagcloud_nonce_action', |
| 655 |
'taxopress_addedit_tagcloud_nonce_field'); |
| 656 |
if (!empty($_GET) && !empty($_GET['action']) && 'edit' === $_GET['action']) { ?> |
| 657 |
<input type="submit" class="button-primary taxopress-taxonomy-submit taxopress-tag-cloud-submit" name="tagcloud_submit" |
| 658 |
value="<?php echo esc_attr(esc_attr__('Save Terms Display', 'simple-tags')); ?>"/> |
| 659 |
<?php |
| 660 |
} else { ?> |
| 661 |
<input type="submit" class="button-primary taxopress-taxonomy-submit taxopress-tag-cloud-submit" name="tagcloud_submit" |
| 662 |
value="<?php echo esc_attr(esc_attr__('Add Terms Display', 'simple-tags')); ?>"/> |
| 663 |
<?php } ?> |
| 664 |
|
| 665 |
<input type="hidden" name="cpt_tax_status" id="cpt_tax_status" |
| 666 |
value="<?php echo esc_attr($tab); ?>"/> |
| 667 |
</p> |
| 668 |
|
| 669 |
<?php if (!empty($current)) { |
| 670 |
?> |
| 671 |
<p> |
| 672 |
<?php echo '<div class="taxopress-warning" style="">' . __('Shortcode: ','simple-tags'); ?> |
| 673 |
<textarea style="resize: none;padding: 5px;">[taxopress_termsdisplay id="<?php echo $current['ID']; ?>"]</textarea> |
| 674 |
</div> |
| 675 |
</p> |
| 676 |
<?php } ?> |
| 677 |
|
| 678 |
<?php |
| 679 |
} |
| 680 |
?> |
| 681 |
|
| 682 |
</div> |
| 683 |
|
| 684 |
</div> |
| 685 |
|
| 686 |
<div class="clear"></div> |
| 687 |
|
| 688 |
|
| 689 |
</form> |
| 690 |
|
| 691 |
</div><!-- End .wrap --> |
| 692 |
|
| 693 |
<div class="clear"></div> |
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
<?php # Modal Windows; ?> |
| 698 |
<div class="remodal" data-remodal-id="taxopress-modal-alert" |
| 699 |
data-remodal-options="hashTracking: false, closeOnOutsideClick: false"> |
| 700 |
<div class="" style="color:red;"><?php echo __('Please complete the following required fields to save your changes:', 'simple-tags'); ?></div> |
| 701 |
<div id="taxopress-modal-alert-content"></div> |
| 702 |
<br> |
| 703 |
<button data-remodal-action="cancel" class="remodal-cancel"><?php echo __('Okay', 'simple-tags'); ?></button> |
| 704 |
</div> |
| 705 |
|
| 706 |
<div class="remodal" data-remodal-id="taxopress-modal-confirm" |
| 707 |
data-remodal-options="hashTracking: false, closeOnOutsideClick: false"> |
| 708 |
<div id="taxopress-modal-confirm-content"></div> |
| 709 |
<br> |
| 710 |
<button data-remodal-action="cancel" class="remodal-cancel"><?php echo __('No', 'simple-tags'); ?></button> |
| 711 |
<button data-remodal-action="confirm" |
| 712 |
class="remodal-confirm"><?php echo __('Yes', 'simple-tags'); ?></button> |
| 713 |
</div> |
| 714 |
|
| 715 |
<?php |
| 716 |
} |
| 717 |
|
| 718 |
} |
| 719 |
|