'addon',
'plural' => 'addons',
'ajax' => false
) );
}
function column_cb($item){
return sprintf(
'',
'addon',
$item->slug
);
}
function column_name( $item ) {
$actions = array();
if ( strtolower( $item->Free ) === 'true' ) {
$actions['activate'] = '' . __( 'Upgrade to Appointments+ to activate', 'appointments' ) . '';
}
else {
if ( ! $item->active ) {
$link = add_query_arg( array( 'action' => 'activate', 'addon' => $item->slug ) );
$link = wp_nonce_url( $link, 'activate-addon' );
$actions['activate'] = '' . __( 'Activate', 'appointments' ) . '';
}
else {
$link = add_query_arg( array( 'action' => 'deactivate', 'addon' => $item->slug ) );
$link = wp_nonce_url( $link, 'deactivate-addon' );
$actions['deactivate'] = '' . __( 'Deactivate', 'appointments' ) . '';
}
}
$name = $item->active ? '' . $item->PluginName . '' : $item->PluginName;
return $name . $this->row_actions( $actions );
}
function column_description( $item ) {
ob_start();
?>
Description; ?>
Version ); ?> |
PluginURI ) . '">' . $item->Author . '' ); ?>
Requires ): ?>
Requires: %s', 'appointments' ), implode( ', ', $item->Requires ) ); ?>
'', //Render a checkbox instead of text
'name' => __( 'Name', 'appointments' ),
'description' => __( 'Description', 'appointments' )
);
return $columns;
}
public function single_row( $item ) {
$class = $item->active ? 'active' : 'inactive';
echo '';
$this->single_row_columns( $item );
echo '
';
}
function get_bulk_actions() {
$actions = array(
'activate' => __( 'Activate', 'appointments' ),
'deactivate' => __( 'Deactivate', 'appointments' )
);
return $actions;
}
public function prepare_items() {
$appointments = appointments();
$addons = $appointments->addons_loader->get_addons();
uasort( $addons, array( $this, '_sort_addons' ) );
$this->items = $addons;
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
}
private function _sort_addons( $a, $b ) {
if ( $a->PluginName === $b->PluginName ) {
return 0;
}
return ( $a->PluginName < $b->PluginName ) ? -1 : 1;
}
}