1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
<?php
function papi_tabs_setup( array $tabs ) {
$_tabs = [];
foreach ( $tabs as $tab ) {
if ( $tab instanceof Papi_Core_Tab === false ) {
continue;
}
if ( papi_current_user_is_allowed( $tab->capabilities ) ) {
$_tabs[] = $tab;
}
}
$tabs = papi_sort_order( $_tabs );
$len = count( $tabs );
for ( $i = 0; $i < $len; $i ++ ) {
$tabs[$i]->id = papi_html_name( $tabs[$i]->title ) . '_' . $i;
}
return $tabs;
}
function papi_tab( $file_or_options, $properties = [] ) {
list( $options, $properties ) = papi_get_options_and_properties( $file_or_options, $properties, false );
return new Papi_Core_Tab( $options, $properties );
}