| 1 |
<?php |
| 2 |
class WPC_Admin{ |
| 3 |
public static function add_user_role() { |
| 4 |
add_role('cargo_agent', 'WPCargo Agent', array( |
| 5 |
'read' => true, |
| 6 |
)); |
| 7 |
|
| 8 |
add_role('wpcargo_employee', 'WPCargo Employee', array( |
| 9 |
'read' => true, |
| 10 |
)); |
| 11 |
add_role('wpcargo_client', 'WPCargo Client', array( |
| 12 |
'read' => true, |
| 13 |
)); |
| 14 |
} |
| 15 |
public static function remove_user_role() { |
| 16 |
remove_role( 'cargo_agent' ); |
| 17 |
remove_role( 'wpcargo_employee' ); |
| 18 |
remove_role( 'wpcargo_client' ); |
| 19 |
} |
| 20 |
public static function add_wpc_custom_pages() { |
| 21 |
if (post_exists('Track') == false) { |
| 22 |
$form = array( |
| 23 |
'comment_status' => 'closed', |
| 24 |
'ping_status' => 'closed', |
| 25 |
'post_author' => 1, |
| 26 |
'post_date' => date('Y-m-d H:i:s'), |
| 27 |
'post_name' => 'track-form', |
| 28 |
'post_status' => 'publish', |
| 29 |
'post_title' => 'Track', |
| 30 |
'post_type' => 'page', |
| 31 |
'post_content' => '[wpcargo_trackform]' |
| 32 |
); |
| 33 |
$trackf = wp_insert_post($form, false); |
| 34 |
} |
| 35 |
if (post_exists('Account') == false) { |
| 36 |
$form = array( |
| 37 |
'comment_status' => 'closed', |
| 38 |
'ping_status' => 'closed', |
| 39 |
'post_author' => 1, |
| 40 |
'post_date' => date('Y-m-d H:i:s'), |
| 41 |
'post_name' => 'my-account', |
| 42 |
'post_status' => 'publish', |
| 43 |
'post_title' => 'Account', |
| 44 |
'post_type' => 'page', |
| 45 |
'post_content' => '[wpcargo_account]' |
| 46 |
); |
| 47 |
$account = wp_insert_post($form, false); |
| 48 |
} |
| 49 |
} |
| 50 |
static function wpcargo_load_textdomain() { |
| 51 |
load_plugin_textdomain( 'wpcargo', false, '/wpcargo/languages' ); |
| 52 |
|
| 53 |
} |
| 54 |
} |