public function setup_deprecated($deprecated_options)
{
$options = array();
if (isset($deprecated_options['id'])) {
$options['id'] = $deprecated_options['id'];
}
if (isset($deprecated_options['action'])) {
$options['action'] = $deprecated_options['action'];
}
if (isset($deprecated_options['num'])) {
$options['num'] = $deprecated_options['num'];
}
if (isset($deprecated_options['title'])) {
$options['items'] = $deprecated_options['title'];
}
if (isset($deprecated_options['item'])) {
$options['item'] = $deprecated_options['item'];
}
if (isset($deprecated_options['label'])) {
$options['label'] = array('add' => $deprecated_options['label'], 'edit' => $deprecated_options['label'], 'duplicate' => $deprecated_options['label']);
}
if (isset($deprecated_options['label_add'])) {
if (isset($options['label'])) {
$options['label']['add'] = $deprecated_options['label_add'];
} else {
$options['label'] = array('add' => $deprecated_options['label_add']);
}
}
if (isset($deprecated_options['label_edit'])) {
if (isset($options['label'])) {
$options['label']['edit'] = $deprecated_options['label_edit'];
} else {
$options['label'] = array('edit' => $deprecated_options['label_edit']);
}
}
if (isset($deprecated_options['label_duplicate'])) {
if (isset($options['label'])) {
$options['label']['duplicate'] = $deprecated_options['label_duplicate'];
} else {
$options['label'] = array('duplicate' => $deprecated_options['label_duplicate']);
}
}
if (isset($deprecated_options['icon'])) {
$options['icon'] = $deprecated_options['icon'];
}
if (isset($deprecated_options['columns'])) {
$options['fields'] = array('manage' => $deprecated_options['columns']);
}
if (isset($deprecated_options['reorder_columns'])) {
if (isset($options['fields'])) {
$options['fields']['reorder'] = $deprecated_options['reorder_columns'];
} else {
$options['fields'] = array('reorder' => $deprecated_options['reorder_columns']);
}
}
if (isset($deprecated_options['add_fields'])) {
if (isset($options['fields'])) {
if (!isset($options['fields']['add'])) {
$options['fields']['add'] = $deprecated_options['add_fields'];
}
if (!isset($options['fields']['edit'])) {
$options['fields']['edit'] = $deprecated_options['add_fields'];
}
if (!isset($options['fields']['duplicate'])) {
$options['fields']['duplicate'] = $deprecated_options['add_fields'];
}
} else {
$options['fields'] = array('add' => $deprecated_options['add_fields'], 'edit' => $deprecated_options['add_fields'], 'duplicate' => $deprecated_options['add_fields']);
}
}
if (isset($deprecated_options['edit_fields'])) {
if (isset($options['fields'])) {
if (!isset($options['fields']['add'])) {
$options['fields']['add'] = $deprecated_options['edit_fields'];
}
if (!isset($options['fields']['edit'])) {
$options['fields']['edit'] = $deprecated_options['edit_fields'];
}
if (!isset($options['fields']['duplicate'])) {
$options['fields']['duplicate'] = $deprecated_options['edit_fields'];
}
} else {
$options['fields'] = array('add' => $deprecated_options['edit_fields'], 'edit' => $deprecated_options['edit_fields'], 'duplicate' => $deprecated_options['edit_fields']);
}
}
if (isset($deprecated_options['duplicate_fields'])) {
if (isset($options['fields'])) {
$options['fields']['duplicate'] = $deprecated_options['duplicate_fields'];
} else {
$options['fields'] = array('duplicate' => $deprecated_options['duplicate_fields']);
}
}
if (isset($deprecated_options['session_filters']) && false === $deprecated_options['session_filters']) {
$options['session'] = false;
}
if (isset($deprecated_options['user_per_page'])) {
if (isset($options['user']) && !empty($options['user'])) {
$options['user'] = array('orderby');
} else {
$options['user'] = false;
}
}
if (isset($deprecated_options['user_sort'])) {
if (isset($options['user']) && !empty($options['user'])) {
$options['user'] = array('show_per_page');
} else {
$options['user'] = false;
}
}
if (isset($deprecated_options['custom_list'])) {
if (isset($options['actions_custom'])) {
$options['actions_custom']['manage'] = $deprecated_options['custom_list'];
} else {
$options['actions_custom'] = array('manage' => $deprecated_options['custom_list']);
}
}
if (isset($deprecated_options['custom_reorder'])) {
if (isset($options['actions_custom'])) {
$options['actions_custom']['reorder'] = $deprecated_options['custom_reorder'];
} else {
$options['actions_custom'] = array('reorder' => $deprecated_options['custom_reorder']);
}
}
if (isset($deprecated_options['custom_add'])) {
if (isset($options['actions_custom'])) {
$options['actions_custom']['add'] = $deprecated_options['custom_add'];
} else {
$options['actions_custom'] = array('add' => $deprecated_options['custom_add']);
}
}
if (isset($deprecated_options['custom_edit'])) {
if (isset($options['actions_custom'])) {
$options['actions_custom']['edit'] = $deprecated_options['custom_edit'];
} else {
$options['actions_custom'] = array('edit' => $deprecated_options['custom_edit']);
}
}
if (isset($deprecated_options['custom_duplicate'])) {
if (isset($options['actions_custom'])) {
$options['actions_custom']['duplicate'] = $deprecated_options['custom_duplicate'];
} else {
$options['actions_custom'] = array('duplicate' => $deprecated_options['custom_duplicate']);
}
}
if (isset($deprecated_options['custom_delete'])) {
if (isset($options['actions_custom'])) {
$options['actions_custom']['delete'] = $deprecated_options['custom_delete'];
} else {
$options['actions_custom'] = array('delete' => $deprecated_options['custom_delete']);
}
}
if (isset($deprecated_options['custom_save'])) {
if (isset($options['actions_custom'])) {
$options['actions_custom']['save'] = $deprecated_options['custom_save'];
} else {
$options['actions_custom'] = array('save' => $deprecated_options['custom_save']);
}
}
if (isset($deprecated_options['custom_actions'])) {
$options['actions_custom'] = $deprecated_options['custom_actions'];
}
if (isset($deprecated_options['action_after_save'])) {
$options['action_after'] = array('add' => $deprecated_options['action_after_save'], 'edit' => $deprecated_options['action_after_save'], 'duplicate' => $deprecated_options['action_after_save']);
}
if (isset($deprecated_options['edit_link'])) {
if (isset($options['action_links'])) {
$options['action_links']['edit'] = $deprecated_options['edit_link'];
} else {
$options['action_links'] = array('edit' => $deprecated_options['edit_link']);
}
}
if (isset($deprecated_options['view_link'])) {
if (isset($options['action_links'])) {
$options['action_links']['view'] = $deprecated_options['view_link'];
} else {
$options['action_links'] = array('view' => $deprecated_options['view_link']);
}
}
if (isset($deprecated_options['duplicate_link'])) {
if (isset($options['action_links'])) {
$options['action_links']['duplicate'] = $deprecated_options['duplicate_link'];
} else {
$options['action_links'] = array('duplicate' => $deprecated_options['duplicate_link']);
}
}
if (isset($deprecated_options['reorder'])) {
$options['reorder'] = array('on' => $deprecated_options['reorder'], 'orderby' => $deprecated_options['reorder']);
}
if (isset($deprecated_options['reorder_sort']) && isset($options['reorder'])) {
$options['reorder']['orderby'] = $deprecated_options['reorder_sort'];
}
if (isset($deprecated_options['reorder_limit']) && isset($options['reorder'])) {
$options['reorder']['limit'] = $deprecated_options['reorder_limit'];
}
if (isset($deprecated_options['reorder_sql']) && isset($options['reorder'])) {
$options['reorder']['sql'] = $deprecated_options['reorder_sql'];
}
if (isset($deprecated_options['sort'])) {
$options['orderby'] = $deprecated_options['sort'];
}
if (isset($deprecated_options['sortable'])) {
$options['sortable'] = $deprecated_options['sortable'];
}
if (isset($deprecated_options['limit'])) {
$options['limit'] = $deprecated_options['limit'];
}
if (isset($deprecated_options['where'])) {
if (isset($options['where'])) {
$options['where']['manage'] = $deprecated_options['where'];
} else {
$options['where'] = array('manage' => $deprecated_options['where']);
}
}
if (isset($deprecated_options['edit_where'])) {
/*if ( isset( $options[ 'where' ] ) )
$options[ 'where' ][ 'edit' ] = $deprecated_options[ 'edit_where' ];
else
$options[ 'where' ] = array( 'edit' => $deprecated_options[ 'edit_where' ] );*/
if (isset($options['restrict'])) {
$options['restrict']['edit'] = (array) $deprecated_options['edit_where'];
} else {
$options['restrict'] = array('edit' => (array) $deprecated_options['edit_where']);
}
}
if (isset($deprecated_options['duplicate_where'])) {
/*if ( isset( $options[ 'where' ] ) )
$options[ 'where' ][ 'duplicate' ] = $deprecated_options[ 'duplicate_where' ];
else
$options[ 'where' ] = array( 'duplicate' => $deprecated_options[ 'duplicate_where' ] );*/
if (isset($options['restrict'])) {
$options['restrict']['duplicate'] = (array) $deprecated_options['duplicate_where'];
} else {
$options['restrict'] = array('duplicate' => (array) $deprecated_options['duplicate_where']);
}
}
if (isset($deprecated_options['delete_where'])) {
/*if ( isset( $options[ 'where' ] ) )
$options[ 'where' ][ 'delete' ] = $deprecated_options[ 'delete_where' ];
else
$options[ 'where' ] = array( 'delete' => $deprecated_options[ 'delete_where' ] );*/
if (isset($options['restrict'])) {
$options['restrict']['delete'] = (array) $deprecated_options['delete_where'];
} else {
$options['restrict'] = array('delete' => (array) $deprecated_options['delete_where']);
}
}
if (isset($deprecated_options['reorder_where'])) {
if (isset($options['where'])) {
$options['where']['reorder'] = $deprecated_options['reorder_where'];
} else {
$options['where'] = array('reorder' => $deprecated_options['reorder_where']);
}
}
if (isset($deprecated_options['sql'])) {
$options['sql'] = array('sql' => $deprecated_options['sql']);
}
if (isset($deprecated_options['search'])) {
$options['searchable'] = $deprecated_options['search'];
}
if (isset($deprecated_options['search_across'])) {
$options['search_across'] = $deprecated_options['search_across'];
}
if (isset($deprecated_options['search_across_picks'])) {
$options['search_across_picks'] = $deprecated_options['search_across_picks'];
}
if (isset($deprecated_options['filters'])) {
$options['filters'] = $deprecated_options['filters'];
}
if (isset($deprecated_options['custom_filters'])) {
if (is_callable($deprecated_options['custom_filters'])) {
add_filter('pods_ui_filters', $deprecated_options['custom_filters']);
} else {
global $pods_ui_custom_filters;
$pods_ui_custom_filters = $deprecated_options['custom_filters'];
add_filter('pods_ui_filters', array($this, 'deprecated_filters'));
}
}
if (isset($deprecated_options['disable_actions'])) {
$options['actions_disabled'] = $deprecated_options['disable_actions'];
}
if (isset($deprecated_options['hide_actions'])) {
$options['actions_hidden'] = $deprecated_options['hide_actions'];
}
if (isset($deprecated_options['wpcss'])) {
$options['wpcss'] = $deprecated_options['wpcss'];
}
$remaining_options = array_diff_assoc($options, $deprecated_options);
foreach ($remaining_options as $option => $value) {
if (isset($deprecated_options[$option]) && isset($this->{$option})) {
$options[$option] = $value;
}
}
return $options;
}