@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -defined( 'ABSPATH' ) || exit; |
|
| 9 | +defined('ABSPATH') || exit; |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Post types Class |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | * Hook in methods. |
| 19 | 19 | */ |
| 20 | 20 | public function __construct() { |
| 21 | - add_action( 'init', array( __CLASS__, 'register_post_types' ), 1 ); |
|
| 22 | - add_action( 'init', array( __CLASS__, 'register_post_status' ), 4 ); |
|
| 23 | - add_action( 'getpaid_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) ); |
|
| 24 | - add_action( 'getpaid_after_register_post_types', array( __CLASS__, 'maybe_flush_rewrite_rules' ) ); |
|
| 21 | + add_action('init', array(__CLASS__, 'register_post_types'), 1); |
|
| 22 | + add_action('init', array(__CLASS__, 'register_post_status'), 4); |
|
| 23 | + add_action('getpaid_flush_rewrite_rules', array(__CLASS__, 'flush_rewrite_rules')); |
|
| 24 | + add_action('getpaid_after_register_post_types', array(__CLASS__, 'maybe_flush_rewrite_rules')); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public static function register_post_types() { |
| 31 | 31 | |
| 32 | - if ( ! is_blog_installed() || post_type_exists( 'wpi_item' ) ) { |
|
| 32 | + if (!is_blog_installed() || post_type_exists('wpi_item')) { |
|
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $capabilities = wpinv_current_user_can_manage_invoicing(); |
| 37 | 37 | |
| 38 | 38 | // Fires before registering post types. |
| 39 | - do_action( 'getpaid_register_post_types' ); |
|
| 39 | + do_action('getpaid_register_post_types'); |
|
| 40 | 40 | |
| 41 | 41 | // Register item post type. |
| 42 | 42 | register_post_type( |
@@ -45,29 +45,29 @@ discard block |
||
| 45 | 45 | 'wpinv_register_post_type_invoice_item', |
| 46 | 46 | array( |
| 47 | 47 | 'labels' => array( |
| 48 | - 'name' => _x( 'Items', 'post type general name', 'invoicing' ), |
|
| 49 | - 'singular_name' => _x( 'Item', 'post type singular name', 'invoicing' ), |
|
| 50 | - 'menu_name' => _x( 'Items', 'admin menu', 'invoicing' ), |
|
| 51 | - 'name_admin_bar' => _x( 'Item', 'add new on admin bar', 'invoicing' ), |
|
| 52 | - 'add_new' => _x( 'Add New', 'Item', 'invoicing' ), |
|
| 53 | - 'add_new_item' => __( 'Add New Item', 'invoicing' ), |
|
| 54 | - 'new_item' => __( 'New Item', 'invoicing' ), |
|
| 55 | - 'edit_item' => __( 'Edit Item', 'invoicing' ), |
|
| 56 | - 'view_item' => __( 'View Item', 'invoicing' ), |
|
| 57 | - 'all_items' => __( 'Items', 'invoicing' ), |
|
| 58 | - 'search_items' => __( 'Search items', 'invoicing' ), |
|
| 59 | - 'parent_item_colon' => __( 'Parent item:', 'invoicing' ), |
|
| 60 | - 'not_found' => __( 'No items found.', 'invoicing' ), |
|
| 61 | - 'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' ), |
|
| 48 | + 'name' => _x('Items', 'post type general name', 'invoicing'), |
|
| 49 | + 'singular_name' => _x('Item', 'post type singular name', 'invoicing'), |
|
| 50 | + 'menu_name' => _x('Items', 'admin menu', 'invoicing'), |
|
| 51 | + 'name_admin_bar' => _x('Item', 'add new on admin bar', 'invoicing'), |
|
| 52 | + 'add_new' => _x('Add New', 'Item', 'invoicing'), |
|
| 53 | + 'add_new_item' => __('Add New Item', 'invoicing'), |
|
| 54 | + 'new_item' => __('New Item', 'invoicing'), |
|
| 55 | + 'edit_item' => __('Edit Item', 'invoicing'), |
|
| 56 | + 'view_item' => __('View Item', 'invoicing'), |
|
| 57 | + 'all_items' => __('Items', 'invoicing'), |
|
| 58 | + 'search_items' => __('Search items', 'invoicing'), |
|
| 59 | + 'parent_item_colon' => __('Parent item:', 'invoicing'), |
|
| 60 | + 'not_found' => __('No items found.', 'invoicing'), |
|
| 61 | + 'not_found_in_trash' => __('No items found in trash.', 'invoicing'), |
|
| 62 | 62 | ), |
| 63 | - 'description' => __( 'This is where you can add new invoice items.', 'invoicing' ), |
|
| 63 | + 'description' => __('This is where you can add new invoice items.', 'invoicing'), |
|
| 64 | 64 | 'public' => false, |
| 65 | 65 | 'has_archive' => false, |
| 66 | 66 | '_builtin' => false, |
| 67 | 67 | 'show_ui' => $capabilities ? true : false, |
| 68 | 68 | 'show_in_menu' => $capabilities ? 'wpinv' : false, |
| 69 | 69 | 'show_in_nav_menus' => false, |
| 70 | - 'supports' => array( 'title', 'excerpt', 'thumbnail' ), |
|
| 70 | + 'supports' => array('title', 'excerpt', 'thumbnail'), |
|
| 71 | 71 | 'rewrite' => false, |
| 72 | 72 | 'query_var' => false, |
| 73 | 73 | 'map_meta_cap' => true, |
@@ -84,22 +84,22 @@ discard block |
||
| 84 | 84 | 'wpinv_register_post_type_payment_form', |
| 85 | 85 | array( |
| 86 | 86 | 'labels' => array( |
| 87 | - 'name' => _x( 'Payment Forms', 'post type general name', 'invoicing' ), |
|
| 88 | - 'singular_name' => _x( 'Payment Form', 'post type singular name', 'invoicing' ), |
|
| 89 | - 'menu_name' => _x( 'Payment Forms', 'admin menu', 'invoicing' ), |
|
| 90 | - 'name_admin_bar' => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ), |
|
| 91 | - 'add_new' => _x( 'Add New', 'Payment Form', 'invoicing' ), |
|
| 92 | - 'add_new_item' => __( 'Add New Payment Form', 'invoicing' ), |
|
| 93 | - 'new_item' => __( 'New Payment Form', 'invoicing' ), |
|
| 94 | - 'edit_item' => __( 'Edit Payment Form', 'invoicing' ), |
|
| 95 | - 'view_item' => __( 'View Payment Form', 'invoicing' ), |
|
| 96 | - 'all_items' => __( 'Payment Forms', 'invoicing' ), |
|
| 97 | - 'search_items' => __( 'Search Payment Forms', 'invoicing' ), |
|
| 98 | - 'parent_item_colon' => __( 'Parent Payment Forms:', 'invoicing' ), |
|
| 99 | - 'not_found' => __( 'No payment forms found.', 'invoicing' ), |
|
| 100 | - 'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' ), |
|
| 87 | + 'name' => _x('Payment Forms', 'post type general name', 'invoicing'), |
|
| 88 | + 'singular_name' => _x('Payment Form', 'post type singular name', 'invoicing'), |
|
| 89 | + 'menu_name' => _x('Payment Forms', 'admin menu', 'invoicing'), |
|
| 90 | + 'name_admin_bar' => _x('Payment Form', 'add new on admin bar', 'invoicing'), |
|
| 91 | + 'add_new' => _x('Add New', 'Payment Form', 'invoicing'), |
|
| 92 | + 'add_new_item' => __('Add New Payment Form', 'invoicing'), |
|
| 93 | + 'new_item' => __('New Payment Form', 'invoicing'), |
|
| 94 | + 'edit_item' => __('Edit Payment Form', 'invoicing'), |
|
| 95 | + 'view_item' => __('View Payment Form', 'invoicing'), |
|
| 96 | + 'all_items' => __('Payment Forms', 'invoicing'), |
|
| 97 | + 'search_items' => __('Search Payment Forms', 'invoicing'), |
|
| 98 | + 'parent_item_colon' => __('Parent Payment Forms:', 'invoicing'), |
|
| 99 | + 'not_found' => __('No payment forms found.', 'invoicing'), |
|
| 100 | + 'not_found_in_trash' => __('No payment forms found in trash.', 'invoicing'), |
|
| 101 | 101 | ), |
| 102 | - 'description' => __( 'Add new payment forms.', 'invoicing' ), |
|
| 102 | + 'description' => __('Add new payment forms.', 'invoicing'), |
|
| 103 | 103 | 'public' => false, |
| 104 | 104 | 'show_ui' => $capabilities ? true : false, |
| 105 | 105 | 'show_in_menu' => $capabilities ? 'wpinv' : false, |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | 'has_archive' => false, |
| 111 | 111 | 'hierarchical' => false, |
| 112 | 112 | 'menu_position' => null, |
| 113 | - 'supports' => array( 'title' ), |
|
| 113 | + 'supports' => array('title'), |
|
| 114 | 114 | 'menu_icon' => 'dashicons-media-form', |
| 115 | 115 | ) |
| 116 | 116 | ) |
@@ -123,32 +123,32 @@ discard block |
||
| 123 | 123 | 'wpinv_register_post_type_invoice', |
| 124 | 124 | array( |
| 125 | 125 | 'labels' => array( |
| 126 | - 'name' => __( 'Invoices', 'invoicing' ), |
|
| 127 | - 'singular_name' => __( 'Invoice', 'invoicing' ), |
|
| 128 | - 'all_items' => __( 'Invoices', 'invoicing' ), |
|
| 129 | - 'menu_name' => _x( 'Invoices', 'Admin menu name', 'invoicing' ), |
|
| 130 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
| 131 | - 'add_new_item' => __( 'Add new invoice', 'invoicing' ), |
|
| 132 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
| 133 | - 'edit_item' => __( 'Edit invoice', 'invoicing' ), |
|
| 134 | - 'new_item' => __( 'New invoice', 'invoicing' ), |
|
| 135 | - 'view_item' => __( 'View invoice', 'invoicing' ), |
|
| 136 | - 'view_items' => __( 'View Invoices', 'invoicing' ), |
|
| 137 | - 'search_items' => __( 'Search invoices', 'invoicing' ), |
|
| 138 | - 'not_found' => __( 'No invoices found', 'invoicing' ), |
|
| 139 | - 'not_found_in_trash' => __( 'No invoices found in trash', 'invoicing' ), |
|
| 140 | - 'parent' => __( 'Parent invoice', 'invoicing' ), |
|
| 141 | - 'featured_image' => __( 'Invoice image', 'invoicing' ), |
|
| 142 | - 'set_featured_image' => __( 'Set invoice image', 'invoicing' ), |
|
| 143 | - 'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ), |
|
| 144 | - 'use_featured_image' => __( 'Use as invoice image', 'invoicing' ), |
|
| 145 | - 'insert_into_item' => __( 'Insert into invoice', 'invoicing' ), |
|
| 146 | - 'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ), |
|
| 147 | - 'filter_items_list' => __( 'Filter invoices', 'invoicing' ), |
|
| 148 | - 'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ), |
|
| 149 | - 'items_list' => __( 'Invoices list', 'invoicing' ), |
|
| 126 | + 'name' => __('Invoices', 'invoicing'), |
|
| 127 | + 'singular_name' => __('Invoice', 'invoicing'), |
|
| 128 | + 'all_items' => __('Invoices', 'invoicing'), |
|
| 129 | + 'menu_name' => _x('Invoices', 'Admin menu name', 'invoicing'), |
|
| 130 | + 'add_new' => __('Add New', 'invoicing'), |
|
| 131 | + 'add_new_item' => __('Add new invoice', 'invoicing'), |
|
| 132 | + 'edit' => __('Edit', 'invoicing'), |
|
| 133 | + 'edit_item' => __('Edit invoice', 'invoicing'), |
|
| 134 | + 'new_item' => __('New invoice', 'invoicing'), |
|
| 135 | + 'view_item' => __('View invoice', 'invoicing'), |
|
| 136 | + 'view_items' => __('View Invoices', 'invoicing'), |
|
| 137 | + 'search_items' => __('Search invoices', 'invoicing'), |
|
| 138 | + 'not_found' => __('No invoices found', 'invoicing'), |
|
| 139 | + 'not_found_in_trash' => __('No invoices found in trash', 'invoicing'), |
|
| 140 | + 'parent' => __('Parent invoice', 'invoicing'), |
|
| 141 | + 'featured_image' => __('Invoice image', 'invoicing'), |
|
| 142 | + 'set_featured_image' => __('Set invoice image', 'invoicing'), |
|
| 143 | + 'remove_featured_image' => __('Remove invoice image', 'invoicing'), |
|
| 144 | + 'use_featured_image' => __('Use as invoice image', 'invoicing'), |
|
| 145 | + 'insert_into_item' => __('Insert into invoice', 'invoicing'), |
|
| 146 | + 'uploaded_to_this_item' => __('Uploaded to this invoice', 'invoicing'), |
|
| 147 | + 'filter_items_list' => __('Filter invoices', 'invoicing'), |
|
| 148 | + 'items_list_navigation' => __('Invoices navigation', 'invoicing'), |
|
| 149 | + 'items_list' => __('Invoices list', 'invoicing'), |
|
| 150 | 150 | ), |
| 151 | - 'description' => __( 'This is where invoices are stored.', 'invoicing' ), |
|
| 151 | + 'description' => __('This is where invoices are stored.', 'invoicing'), |
|
| 152 | 152 | 'public' => true, |
| 153 | 153 | 'has_archive' => false, |
| 154 | 154 | 'publicly_queryable' => true, |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | 'show_ui' => $capabilities ? true : false, |
| 157 | 157 | 'show_in_menu' => $capabilities ? 'wpinv' : false, |
| 158 | 158 | 'show_in_nav_menus' => false, |
| 159 | - 'supports' => array( 'title', 'author', 'excerpt' ), |
|
| 159 | + 'supports' => array('title', 'author', 'excerpt'), |
|
| 160 | 160 | 'rewrite' => array( |
| 161 | 161 | 'slug' => 'invoice', |
| 162 | 162 | 'with_front' => false, |
@@ -179,32 +179,32 @@ discard block |
||
| 179 | 179 | 'wpinv_register_post_type_discount', |
| 180 | 180 | array( |
| 181 | 181 | 'labels' => array( |
| 182 | - 'name' => __( 'Discounts', 'invoicing' ), |
|
| 183 | - 'singular_name' => __( 'Discount', 'invoicing' ), |
|
| 184 | - 'all_items' => __( 'Discounts', 'invoicing' ), |
|
| 185 | - 'menu_name' => _x( 'Discounts', 'Admin menu name', 'invoicing' ), |
|
| 186 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
| 187 | - 'add_new_item' => __( 'Add new discount', 'invoicing' ), |
|
| 188 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
| 189 | - 'edit_item' => __( 'Edit discount', 'invoicing' ), |
|
| 190 | - 'new_item' => __( 'New discount', 'invoicing' ), |
|
| 191 | - 'view_item' => __( 'View discount', 'invoicing' ), |
|
| 192 | - 'view_items' => __( 'View Discounts', 'invoicing' ), |
|
| 193 | - 'search_items' => __( 'Search discounts', 'invoicing' ), |
|
| 194 | - 'not_found' => __( 'No discounts found', 'invoicing' ), |
|
| 195 | - 'not_found_in_trash' => __( 'No discounts found in trash', 'invoicing' ), |
|
| 196 | - 'parent' => __( 'Parent discount', 'invoicing' ), |
|
| 197 | - 'featured_image' => __( 'Discount image', 'invoicing' ), |
|
| 198 | - 'set_featured_image' => __( 'Set discount image', 'invoicing' ), |
|
| 199 | - 'remove_featured_image' => __( 'Remove discount image', 'invoicing' ), |
|
| 200 | - 'use_featured_image' => __( 'Use as discount image', 'invoicing' ), |
|
| 201 | - 'insert_into_item' => __( 'Insert into discount', 'invoicing' ), |
|
| 202 | - 'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ), |
|
| 203 | - 'filter_items_list' => __( 'Filter discounts', 'invoicing' ), |
|
| 204 | - 'items_list_navigation' => __( 'Discount navigation', 'invoicing' ), |
|
| 205 | - 'items_list' => __( 'Discounts list', 'invoicing' ), |
|
| 182 | + 'name' => __('Discounts', 'invoicing'), |
|
| 183 | + 'singular_name' => __('Discount', 'invoicing'), |
|
| 184 | + 'all_items' => __('Discounts', 'invoicing'), |
|
| 185 | + 'menu_name' => _x('Discounts', 'Admin menu name', 'invoicing'), |
|
| 186 | + 'add_new' => __('Add New', 'invoicing'), |
|
| 187 | + 'add_new_item' => __('Add new discount', 'invoicing'), |
|
| 188 | + 'edit' => __('Edit', 'invoicing'), |
|
| 189 | + 'edit_item' => __('Edit discount', 'invoicing'), |
|
| 190 | + 'new_item' => __('New discount', 'invoicing'), |
|
| 191 | + 'view_item' => __('View discount', 'invoicing'), |
|
| 192 | + 'view_items' => __('View Discounts', 'invoicing'), |
|
| 193 | + 'search_items' => __('Search discounts', 'invoicing'), |
|
| 194 | + 'not_found' => __('No discounts found', 'invoicing'), |
|
| 195 | + 'not_found_in_trash' => __('No discounts found in trash', 'invoicing'), |
|
| 196 | + 'parent' => __('Parent discount', 'invoicing'), |
|
| 197 | + 'featured_image' => __('Discount image', 'invoicing'), |
|
| 198 | + 'set_featured_image' => __('Set discount image', 'invoicing'), |
|
| 199 | + 'remove_featured_image' => __('Remove discount image', 'invoicing'), |
|
| 200 | + 'use_featured_image' => __('Use as discount image', 'invoicing'), |
|
| 201 | + 'insert_into_item' => __('Insert into discount', 'invoicing'), |
|
| 202 | + 'uploaded_to_this_item' => __('Uploaded to this discount', 'invoicing'), |
|
| 203 | + 'filter_items_list' => __('Filter discounts', 'invoicing'), |
|
| 204 | + 'items_list_navigation' => __('Discount navigation', 'invoicing'), |
|
| 205 | + 'items_list' => __('Discounts list', 'invoicing'), |
|
| 206 | 206 | ), |
| 207 | - 'description' => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ), |
|
| 207 | + 'description' => __('This is where you can add new discounts that users can use in invoices.', 'invoicing'), |
|
| 208 | 208 | 'public' => false, |
| 209 | 209 | 'can_export' => $capabilities ? true : false, |
| 210 | 210 | '_builtin' => false, |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | 'map_meta_cap' => true, |
| 218 | 218 | 'has_archive' => false, |
| 219 | 219 | 'hierarchical' => false, |
| 220 | - 'supports' => array( 'title', 'excerpt' ), |
|
| 220 | + 'supports' => array('title', 'excerpt'), |
|
| 221 | 221 | 'show_in_nav_menus' => false, |
| 222 | 222 | 'show_in_admin_bar' => $capabilities ? true : false, |
| 223 | 223 | 'menu_position' => null, |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | ) |
| 226 | 226 | ); |
| 227 | 227 | |
| 228 | - do_action( 'getpaid_after_register_post_types' ); |
|
| 228 | + do_action('getpaid_after_register_post_types'); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -238,79 +238,79 @@ discard block |
||
| 238 | 238 | array( |
| 239 | 239 | |
| 240 | 240 | 'wpi-pending' => array( |
| 241 | - 'label' => _x( 'Pending Payment', 'Invoice status', 'invoicing' ), |
|
| 241 | + 'label' => _x('Pending Payment', 'Invoice status', 'invoicing'), |
|
| 242 | 242 | 'public' => true, |
| 243 | 243 | 'exclude_from_search' => true, |
| 244 | 244 | 'show_in_admin_all_list' => true, |
| 245 | 245 | 'show_in_admin_status_list' => true, |
| 246 | 246 | /* translators: %s: number of invoices */ |
| 247 | - 'label_count' => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' ), |
|
| 247 | + 'label_count' => _n_noop('Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing'), |
|
| 248 | 248 | ), |
| 249 | 249 | |
| 250 | 250 | 'wpi-processing' => array( |
| 251 | - 'label' => _x( 'Processing', 'Invoice status', 'invoicing' ), |
|
| 251 | + 'label' => _x('Processing', 'Invoice status', 'invoicing'), |
|
| 252 | 252 | 'public' => true, |
| 253 | 253 | 'exclude_from_search' => true, |
| 254 | 254 | 'show_in_admin_all_list' => true, |
| 255 | 255 | 'show_in_admin_status_list' => true, |
| 256 | 256 | /* translators: %s: number of invoices */ |
| 257 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' ), |
|
| 257 | + 'label_count' => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing'), |
|
| 258 | 258 | ), |
| 259 | 259 | |
| 260 | 260 | 'wpi-onhold' => array( |
| 261 | - 'label' => _x( 'On Hold', 'Invoice status', 'invoicing' ), |
|
| 261 | + 'label' => _x('On Hold', 'Invoice status', 'invoicing'), |
|
| 262 | 262 | 'public' => true, |
| 263 | 263 | 'exclude_from_search' => true, |
| 264 | 264 | 'show_in_admin_all_list' => true, |
| 265 | 265 | 'show_in_admin_status_list' => true, |
| 266 | 266 | /* translators: %s: number of invoices */ |
| 267 | - 'label_count' => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' ), |
|
| 267 | + 'label_count' => _n_noop('On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing'), |
|
| 268 | 268 | ), |
| 269 | 269 | |
| 270 | 270 | 'wpi-cancelled' => array( |
| 271 | - 'label' => _x( 'Cancelled', 'Invoice status', 'invoicing' ), |
|
| 271 | + 'label' => _x('Cancelled', 'Invoice status', 'invoicing'), |
|
| 272 | 272 | 'public' => true, |
| 273 | 273 | 'exclude_from_search' => true, |
| 274 | 274 | 'show_in_admin_all_list' => true, |
| 275 | 275 | 'show_in_admin_status_list' => true, |
| 276 | 276 | /* translators: %s: number of invoices */ |
| 277 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' ), |
|
| 277 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing'), |
|
| 278 | 278 | ), |
| 279 | 279 | |
| 280 | 280 | 'wpi-refunded' => array( |
| 281 | - 'label' => _x( 'Refunded', 'Invoice status', 'invoicing' ), |
|
| 281 | + 'label' => _x('Refunded', 'Invoice status', 'invoicing'), |
|
| 282 | 282 | 'public' => true, |
| 283 | 283 | 'exclude_from_search' => true, |
| 284 | 284 | 'show_in_admin_all_list' => true, |
| 285 | 285 | 'show_in_admin_status_list' => true, |
| 286 | 286 | /* translators: %s: number of invoices */ |
| 287 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' ), |
|
| 287 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing'), |
|
| 288 | 288 | ), |
| 289 | 289 | |
| 290 | 290 | 'wpi-failed' => array( |
| 291 | - 'label' => _x( 'Failed', 'Invoice status', 'invoicing' ), |
|
| 291 | + 'label' => _x('Failed', 'Invoice status', 'invoicing'), |
|
| 292 | 292 | 'public' => true, |
| 293 | 293 | 'exclude_from_search' => true, |
| 294 | 294 | 'show_in_admin_all_list' => true, |
| 295 | 295 | 'show_in_admin_status_list' => true, |
| 296 | 296 | /* translators: %s: number of invoices */ |
| 297 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' ), |
|
| 297 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing'), |
|
| 298 | 298 | ), |
| 299 | 299 | |
| 300 | 300 | 'wpi-renewal' => array( |
| 301 | - 'label' => _x( 'Renewal', 'Invoice status', 'invoicing' ), |
|
| 301 | + 'label' => _x('Renewal', 'Invoice status', 'invoicing'), |
|
| 302 | 302 | 'public' => true, |
| 303 | 303 | 'exclude_from_search' => true, |
| 304 | 304 | 'show_in_admin_all_list' => true, |
| 305 | 305 | 'show_in_admin_status_list' => true, |
| 306 | 306 | /* translators: %s: number of invoices */ |
| 307 | - 'label_count' => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' ), |
|
| 307 | + 'label_count' => _n_noop('Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing'), |
|
| 308 | 308 | ), |
| 309 | 309 | ) |
| 310 | 310 | ); |
| 311 | 311 | |
| 312 | - foreach ( $invoice_statuses as $invoice_statuse => $args ) { |
|
| 313 | - register_post_status( $invoice_statuse, $args ); |
|
| 312 | + foreach ($invoice_statuses as $invoice_statuse => $args) { |
|
| 313 | + register_post_status($invoice_statuse, $args); |
|
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | |
@@ -326,8 +326,8 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | */ |
| 328 | 328 | public static function maybe_flush_rewrite_rules() { |
| 329 | - if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) { |
|
| 330 | - update_option( 'getpaid_flushed_rewrite_rules', '1' ); |
|
| 329 | + if (!get_option('getpaid_flushed_rewrite_rules')) { |
|
| 330 | + update_option('getpaid_flushed_rewrite_rules', '1'); |
|
| 331 | 331 | self::flush_rewrite_rules(); |
| 332 | 332 | } |
| 333 | 333 | } |
@@ -3,11 +3,11 @@ discard block |
||
| 3 | 3 | * Displays a list of all subscriptions rules |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 6 | +if (!defined('ABSPATH')) { |
|
| 7 | 7 | exit; |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 10 | +if (!class_exists('WP_List_Table')) { |
|
| 11 | 11 | include_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $this->prepare_query(); |
| 82 | 82 | |
| 83 | - $this->base_url = remove_query_arg( 'status' ); |
|
| 83 | + $this->base_url = remove_query_arg('status'); |
|
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
@@ -93,13 +93,13 @@ discard block |
||
| 93 | 93 | $query = array( |
| 94 | 94 | 'number' => $this->per_page, |
| 95 | 95 | 'paged' => $this->get_paged(), |
| 96 | - 'status' => ( isset( $_GET['status'] ) && array_key_exists( $_GET['status'], getpaid_get_subscription_statuses() ) ) ? sanitize_text_field( $_GET['status'] ) : 'all', |
|
| 97 | - 'orderby' => ( isset( $_GET['orderby'] ) ) ? sanitize_text_field( $_GET['orderby'] ) : 'id', |
|
| 98 | - 'order' => ( isset( $_GET['order'] ) ) ? sanitize_text_field( $_GET['order'] ) : 'DESC', |
|
| 96 | + 'status' => (isset($_GET['status']) && array_key_exists($_GET['status'], getpaid_get_subscription_statuses())) ? sanitize_text_field($_GET['status']) : 'all', |
|
| 97 | + 'orderby' => (isset($_GET['orderby'])) ? sanitize_text_field($_GET['orderby']) : 'id', |
|
| 98 | + 'order' => (isset($_GET['order'])) ? sanitize_text_field($_GET['order']) : 'DESC', |
|
| 99 | 99 | 'customer_in' => $this->get_user_in(), |
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | - if ( is_array( $query['customer_in'] ) && empty( $query['customer_in'] ) ) { |
|
| 102 | + if (is_array($query['customer_in']) && empty($query['customer_in'])) { |
|
| 103 | 103 | $this->total_count = 0; |
| 104 | 104 | $this->current_total_count = 0; |
| 105 | 105 | $this->items = array(); |
@@ -108,15 +108,15 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // Prepare class properties. |
| 111 | - $this->query = new GetPaid_Subscriptions_Query( $query ); |
|
| 111 | + $this->query = new GetPaid_Subscriptions_Query($query); |
|
| 112 | 112 | $this->total_count = $this->query->get_total(); |
| 113 | 113 | $this->current_total_count = $this->query->get_total(); |
| 114 | 114 | $this->items = $this->query->get_results(); |
| 115 | - $this->status_counts = getpaid_get_subscription_status_counts( $query ); |
|
| 115 | + $this->status_counts = getpaid_get_subscription_status_counts($query); |
|
| 116 | 116 | |
| 117 | - if ( 'all' != $query['status'] ) { |
|
| 118 | - unset( $query['status'] ); |
|
| 119 | - $this->total_count = getpaid_get_subscriptions( $query, 'count' ); |
|
| 117 | + if ('all' != $query['status']) { |
|
| 118 | + unset($query['status']); |
|
| 119 | + $this->total_count = getpaid_get_subscriptions($query, 'count'); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | } |
@@ -128,14 +128,14 @@ discard block |
||
| 128 | 128 | public function get_user_in() { |
| 129 | 129 | |
| 130 | 130 | // Abort if no user. |
| 131 | - if ( empty( $_GET['s'] ) ) { |
|
| 131 | + if (empty($_GET['s'])) { |
|
| 132 | 132 | return null; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | // Or invalid user. |
| 136 | - $user = wp_unslash( sanitize_text_field( $_REQUEST['s'] ) ); |
|
| 136 | + $user = wp_unslash(sanitize_text_field($_REQUEST['s'])); |
|
| 137 | 137 | |
| 138 | - if ( empty( $user ) ) { |
|
| 138 | + if (empty($user)) { |
|
| 139 | 139 | return null; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -164,26 +164,26 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function get_views() { |
| 166 | 166 | |
| 167 | - $current = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : 'all'; |
|
| 167 | + $current = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : 'all'; |
|
| 168 | 168 | $views = array( |
| 169 | 169 | |
| 170 | 170 | 'all' => sprintf( |
| 171 | 171 | '<a href="%s" %s>%s <span class="count">(%d)</span></a>', |
| 172 | - esc_url( add_query_arg( 'status', false, $this->base_url ) ), |
|
| 172 | + esc_url(add_query_arg('status', false, $this->base_url)), |
|
| 173 | 173 | $current === 'all' ? ' class="current"' : '', |
| 174 | - __( 'All', 'invoicing' ), |
|
| 174 | + __('All', 'invoicing'), |
|
| 175 | 175 | $this->total_count |
| 176 | 176 | ), |
| 177 | 177 | |
| 178 | 178 | ); |
| 179 | 179 | |
| 180 | - foreach ( array_filter( $this->status_counts ) as $status => $count ) { |
|
| 180 | + foreach (array_filter($this->status_counts) as $status => $count) { |
|
| 181 | 181 | |
| 182 | - $views[ $status ] = sprintf( |
|
| 182 | + $views[$status] = sprintf( |
|
| 183 | 183 | '<a href="%s" %s>%s <span class="count">(%d)</span></a>', |
| 184 | - esc_url( add_query_arg( 'status', urlencode( $status ), $this->base_url ) ), |
|
| 184 | + esc_url(add_query_arg('status', urlencode($status), $this->base_url)), |
|
| 185 | 185 | $current === $status ? ' class="current"' : '', |
| 186 | - esc_html( getpaid_get_subscription_status_label( $status ) ), |
|
| 186 | + esc_html(getpaid_get_subscription_status_label($status)), |
|
| 187 | 187 | $count |
| 188 | 188 | ); |
| 189 | 189 | |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | * @since 1.0.0 |
| 201 | 201 | * @return string |
| 202 | 202 | */ |
| 203 | - public function column_default( $item, $column_name ) { |
|
| 204 | - return apply_filters( "getpaid_subscriptions_table_column_$column_name", $item->$column_name ); |
|
| 203 | + public function column_default($item, $column_name) { |
|
| 204 | + return apply_filters("getpaid_subscriptions_table_column_$column_name", $item->$column_name); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | * @param WPInv_Subscription $item |
| 211 | 211 | * @return string |
| 212 | 212 | */ |
| 213 | - public function column_cb( $item ) { |
|
| 214 | - return sprintf( '<input type="checkbox" name="id[]" value="%s" />', esc_html( $item->get_id() ) ); |
|
| 213 | + public function column_cb($item) { |
|
| 214 | + return sprintf('<input type="checkbox" name="id[]" value="%s" />', esc_html($item->get_id())); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @since 1.0.0 |
| 222 | 222 | * @return string |
| 223 | 223 | */ |
| 224 | - public function column_status( $item ) { |
|
| 224 | + public function column_status($item) { |
|
| 225 | 225 | return $item->get_status_label_html(); |
| 226 | 226 | } |
| 227 | 227 | |
@@ -232,26 +232,26 @@ discard block |
||
| 232 | 232 | * @since 1.0.0 |
| 233 | 233 | * @return string |
| 234 | 234 | */ |
| 235 | - public function column_subscription( $item ) { |
|
| 235 | + public function column_subscription($item) { |
|
| 236 | 236 | |
| 237 | - $username = __( '(Missing User)', 'invoicing' ); |
|
| 237 | + $username = __('(Missing User)', 'invoicing'); |
|
| 238 | 238 | |
| 239 | - $user = get_userdata( $item->get_customer_id() ); |
|
| 239 | + $user = get_userdata($item->get_customer_id()); |
|
| 240 | 240 | $capabilities = wpinv_current_user_can_manage_invoicing(); |
| 241 | 241 | |
| 242 | - if ( $user ) { |
|
| 242 | + if ($user) { |
|
| 243 | 243 | $username = sprintf( |
| 244 | 244 | '<a href="user-edit.php?user_id=%s">%s</a>', |
| 245 | - absint( $user->ID ), |
|
| 246 | - ! empty( $user->display_name ) ? esc_html( $user->display_name ) : sanitize_email( $user->user_email ) |
|
| 245 | + absint($user->ID), |
|
| 246 | + !empty($user->display_name) ? esc_html($user->display_name) : sanitize_email($user->user_email) |
|
| 247 | 247 | ); |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | // translators: $1: is opening link, $2: is subscription id number, $3: is closing link tag, $4: is user's name |
| 251 | 251 | $column_content = sprintf( |
| 252 | - _x( '%1$s#%2$s%3$s for %4$s', 'Subscription title on admin table. (e.g.: #211 for John Doe)', 'invoicing' ), |
|
| 253 | - '<a href="' . esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $item->get_id() ) ) ) . '">', |
|
| 254 | - '<strong>' . esc_attr( $item->get_id() ) . '</strong>', |
|
| 252 | + _x('%1$s#%2$s%3$s for %4$s', 'Subscription title on admin table. (e.g.: #211 for John Doe)', 'invoicing'), |
|
| 253 | + '<a href="' . esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($item->get_id()))) . '">', |
|
| 254 | + '<strong>' . esc_attr($item->get_id()) . '</strong>', |
|
| 255 | 255 | '</a>', |
| 256 | 256 | $username |
| 257 | 257 | ); |
@@ -259,18 +259,18 @@ discard block |
||
| 259 | 259 | $row_actions = array(); |
| 260 | 260 | |
| 261 | 261 | // View subscription. |
| 262 | - $view_url = esc_url( add_query_arg( 'id', $item->get_id(), admin_url( 'admin.php?page=wpinv-subscriptions' ) ) ); |
|
| 263 | - $row_actions['view'] = '<a href="' . $view_url . '">' . __( 'View Subscription', 'invoicing' ) . '</a>'; |
|
| 262 | + $view_url = esc_url(add_query_arg('id', $item->get_id(), admin_url('admin.php?page=wpinv-subscriptions'))); |
|
| 263 | + $row_actions['view'] = '<a href="' . $view_url . '">' . __('View Subscription', 'invoicing') . '</a>'; |
|
| 264 | 264 | |
| 265 | 265 | // View invoice. |
| 266 | - $invoice = get_post( $item->get_parent_invoice_id() ); |
|
| 266 | + $invoice = get_post($item->get_parent_invoice_id()); |
|
| 267 | 267 | |
| 268 | - if ( ! empty( $invoice ) ) { |
|
| 269 | - $invoice_url = get_edit_post_link( $invoice ); |
|
| 270 | - $row_actions['invoice'] = '<a href="' . $invoice_url . '">' . __( 'View Invoice', 'invoicing' ) . '</a>'; |
|
| 268 | + if (!empty($invoice)) { |
|
| 269 | + $invoice_url = get_edit_post_link($invoice); |
|
| 270 | + $row_actions['invoice'] = '<a href="' . $invoice_url . '">' . __('View Invoice', 'invoicing') . '</a>'; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - $delete_url = esc_url( |
|
| 273 | + $delete_url = esc_url( |
|
| 274 | 274 | wp_nonce_url( |
| 275 | 275 | add_query_arg( |
| 276 | 276 | array( |
@@ -282,15 +282,15 @@ discard block |
||
| 282 | 282 | 'getpaid-nonce' |
| 283 | 283 | ) |
| 284 | 284 | ); |
| 285 | - $row_actions['delete'] = '<a class="text-danger" href="' . $delete_url . '">' . __( 'Delete Subscription', 'invoicing' ) . '</a>'; |
|
| 285 | + $row_actions['delete'] = '<a class="text-danger" href="' . $delete_url . '">' . __('Delete Subscription', 'invoicing') . '</a>'; |
|
| 286 | 286 | |
| 287 | - if ( ! $capabilities ) { |
|
| 287 | + if (!$capabilities) { |
|
| 288 | 288 | $row_actions = array(); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - $row_actions = $this->row_actions( apply_filters( 'getpaid_subscription_table_row_actions', $row_actions, $item ) ); |
|
| 291 | + $row_actions = $this->row_actions(apply_filters('getpaid_subscription_table_row_actions', $row_actions, $item)); |
|
| 292 | 292 | |
| 293 | - return "<strong>$column_content</strong>" . $this->column_amount( $item ) . $row_actions; |
|
| 293 | + return "<strong>$column_content</strong>" . $this->column_amount($item) . $row_actions; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
@@ -300,8 +300,8 @@ discard block |
||
| 300 | 300 | * @since 1.0.0 |
| 301 | 301 | * @return string |
| 302 | 302 | */ |
| 303 | - public function column_renewal_date( $item ) { |
|
| 304 | - return getpaid_format_date_value( $item->get_expiration() ); |
|
| 303 | + public function column_renewal_date($item) { |
|
| 304 | + return getpaid_format_date_value($item->get_expiration()); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -311,27 +311,27 @@ discard block |
||
| 311 | 311 | * @since 1.0.0 |
| 312 | 312 | * @return string |
| 313 | 313 | */ |
| 314 | - public function column_start_date( $item ) { |
|
| 314 | + public function column_start_date($item) { |
|
| 315 | 315 | |
| 316 | 316 | $gateway = $item->get_parent_invoice()->get_gateway_title(); |
| 317 | 317 | |
| 318 | - if ( empty( $gateway ) ) { |
|
| 319 | - return getpaid_format_date_value( $item->get_date_created() ); |
|
| 318 | + if (empty($gateway)) { |
|
| 319 | + return getpaid_format_date_value($item->get_date_created()); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - $url = apply_filters( 'getpaid_remote_subscription_profile_url', '', $item ); |
|
| 323 | - if ( ! empty( $url ) ) { |
|
| 322 | + $url = apply_filters('getpaid_remote_subscription_profile_url', '', $item); |
|
| 323 | + if (!empty($url)) { |
|
| 324 | 324 | |
| 325 | - return getpaid_format_date_value( $item->get_date_created() ) . '<br>' . sprintf( |
|
| 326 | - __( 'Via %s', 'invoicing' ), |
|
| 327 | - '<strong><a href="' . esc_url( $url ) . '" target="_blank">' . esc_html( $item->get_parent_invoice()->get_gateway_title() ) . '</a></strong>' |
|
| 325 | + return getpaid_format_date_value($item->get_date_created()) . '<br>' . sprintf( |
|
| 326 | + __('Via %s', 'invoicing'), |
|
| 327 | + '<strong><a href="' . esc_url($url) . '" target="_blank">' . esc_html($item->get_parent_invoice()->get_gateway_title()) . '</a></strong>' |
|
| 328 | 328 | ); |
| 329 | 329 | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - return getpaid_format_date_value( $item->get_date_created() ) . '<br>' . sprintf( |
|
| 333 | - __( 'Via %s', 'invoicing' ), |
|
| 334 | - '<strong>' . esc_html( $item->get_parent_invoice()->get_gateway_title() ) . '</strong>' |
|
| 332 | + return getpaid_format_date_value($item->get_date_created()) . '<br>' . sprintf( |
|
| 333 | + __('Via %s', 'invoicing'), |
|
| 334 | + '<strong>' . esc_html($item->get_parent_invoice()->get_gateway_title()) . '</strong>' |
|
| 335 | 335 | ); |
| 336 | 336 | |
| 337 | 337 | } |
@@ -343,8 +343,8 @@ discard block |
||
| 343 | 343 | * @since 1.0.19 |
| 344 | 344 | * @return string |
| 345 | 345 | */ |
| 346 | - public static function column_amount( $item ) { |
|
| 347 | - $amount = getpaid_get_formatted_subscription_amount( $item ); |
|
| 346 | + public static function column_amount($item) { |
|
| 347 | + $amount = getpaid_get_formatted_subscription_amount($item); |
|
| 348 | 348 | return "<span class='text-muted form-text mt-2 mb-2'>$amount</span>"; |
| 349 | 349 | } |
| 350 | 350 | |
@@ -355,9 +355,9 @@ discard block |
||
| 355 | 355 | * @since 1.0.0 |
| 356 | 356 | * @return string |
| 357 | 357 | */ |
| 358 | - public function column_renewals( $item ) { |
|
| 358 | + public function column_renewals($item) { |
|
| 359 | 359 | $max_bills = $item->get_bill_times(); |
| 360 | - return $item->get_times_billed() . ' / ' . ( empty( $max_bills ) ? '∞' : $max_bills ); |
|
| 360 | + return $item->get_times_billed() . ' / ' . (empty($max_bills) ? '∞' : $max_bills); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -367,15 +367,15 @@ discard block |
||
| 367 | 367 | * @since 1.0.0 |
| 368 | 368 | * @return string |
| 369 | 369 | */ |
| 370 | - public function column_item( $item ) { |
|
| 371 | - $subscription_group = getpaid_get_invoice_subscription_group( $item->get_parent_invoice_id(), $item->get_id() ); |
|
| 370 | + public function column_item($item) { |
|
| 371 | + $subscription_group = getpaid_get_invoice_subscription_group($item->get_parent_invoice_id(), $item->get_id()); |
|
| 372 | 372 | |
| 373 | - if ( empty( $subscription_group ) ) { |
|
| 374 | - return $this->generate_item_markup( $item->get_product_id() ); |
|
| 373 | + if (empty($subscription_group)) { |
|
| 374 | + return $this->generate_item_markup($item->get_product_id()); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - $markup = array_map( array( $this, 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
| 378 | - return implode( ' | ', $markup ); |
|
| 377 | + $markup = array_map(array($this, 'generate_item_markup'), array_keys($subscription_group['items'])); |
|
| 378 | + return implode(' | ', $markup); |
|
| 379 | 379 | |
| 380 | 380 | } |
| 381 | 381 | |
@@ -386,16 +386,16 @@ discard block |
||
| 386 | 386 | * @since 1.0.0 |
| 387 | 387 | * @return string |
| 388 | 388 | */ |
| 389 | - public static function generate_item_markup( $item_id ) { |
|
| 390 | - $item = get_post( $item_id ); |
|
| 389 | + public static function generate_item_markup($item_id) { |
|
| 390 | + $item = get_post($item_id); |
|
| 391 | 391 | |
| 392 | - if ( ! empty( $item ) ) { |
|
| 393 | - $link = get_edit_post_link( $item ); |
|
| 394 | - $link = esc_url( $link ); |
|
| 395 | - $name = esc_html( get_the_title( $item ) ); |
|
| 392 | + if (!empty($item)) { |
|
| 393 | + $link = get_edit_post_link($item); |
|
| 394 | + $link = esc_url($link); |
|
| 395 | + $name = esc_html(get_the_title($item)); |
|
| 396 | 396 | return wpinv_current_user_can_manage_invoicing() ? "<a href='$link'>$name</a>" : $name; |
| 397 | 397 | } else { |
| 398 | - return sprintf( __( 'Item #%s', 'invoicing' ), $item_id ); |
|
| 398 | + return sprintf(__('Item #%s', 'invoicing'), $item_id); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | } |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | * @return int |
| 407 | 407 | */ |
| 408 | 408 | public function get_paged() { |
| 409 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 409 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | /** |
@@ -419,13 +419,13 @@ discard block |
||
| 419 | 419 | $hidden = array(); |
| 420 | 420 | $sortable = $this->get_sortable_columns(); |
| 421 | 421 | |
| 422 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 422 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 423 | 423 | |
| 424 | 424 | $this->set_pagination_args( |
| 425 | 425 | array( |
| 426 | 426 | 'total_items' => $this->current_total_count, |
| 427 | 427 | 'per_page' => $this->per_page, |
| 428 | - 'total_pages' => ceil( $this->current_total_count / $this->per_page ), |
|
| 428 | + 'total_pages' => ceil($this->current_total_count / $this->per_page), |
|
| 429 | 429 | ) |
| 430 | 430 | ); |
| 431 | 431 | } |
@@ -438,15 +438,15 @@ discard block |
||
| 438 | 438 | public function get_columns() { |
| 439 | 439 | $columns = array( |
| 440 | 440 | 'cb' => '<input type="checkbox" />', |
| 441 | - 'subscription' => __( 'Subscription', 'invoicing' ), |
|
| 442 | - 'start_date' => __( 'Start Date', 'invoicing' ), |
|
| 443 | - 'renewal_date' => __( 'Next Payment', 'invoicing' ), |
|
| 444 | - 'renewals' => __( 'Payments', 'invoicing' ), |
|
| 445 | - 'item' => __( 'Items', 'invoicing' ), |
|
| 446 | - 'status' => __( 'Status', 'invoicing' ), |
|
| 441 | + 'subscription' => __('Subscription', 'invoicing'), |
|
| 442 | + 'start_date' => __('Start Date', 'invoicing'), |
|
| 443 | + 'renewal_date' => __('Next Payment', 'invoicing'), |
|
| 444 | + 'renewals' => __('Payments', 'invoicing'), |
|
| 445 | + 'item' => __('Items', 'invoicing'), |
|
| 446 | + 'status' => __('Status', 'invoicing'), |
|
| 447 | 447 | ); |
| 448 | 448 | |
| 449 | - return apply_filters( 'manage_getpaid_subscriptions_table_columns', $columns ); |
|
| 449 | + return apply_filters('manage_getpaid_subscriptions_table_columns', $columns); |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | /** |
@@ -456,15 +456,15 @@ discard block |
||
| 456 | 456 | */ |
| 457 | 457 | public function get_sortable_columns() { |
| 458 | 458 | $sortable = array( |
| 459 | - 'subscription' => array( 'id', true ), |
|
| 460 | - 'start_date' => array( 'created', true ), |
|
| 461 | - 'renewal_date' => array( 'expiration', true ), |
|
| 462 | - 'renewals' => array( 'bill_times', true ), |
|
| 463 | - 'item' => array( 'product_id', true ), |
|
| 464 | - 'status' => array( 'status', true ), |
|
| 459 | + 'subscription' => array('id', true), |
|
| 460 | + 'start_date' => array('created', true), |
|
| 461 | + 'renewal_date' => array('expiration', true), |
|
| 462 | + 'renewals' => array('bill_times', true), |
|
| 463 | + 'item' => array('product_id', true), |
|
| 464 | + 'status' => array('status', true), |
|
| 465 | 465 | ); |
| 466 | 466 | |
| 467 | - return apply_filters( 'manage_getpaid_subscriptions_sortable_table_columns', $sortable ); |
|
| 467 | + return apply_filters('manage_getpaid_subscriptions_sortable_table_columns', $sortable); |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | /** |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | * @return bool |
| 474 | 474 | */ |
| 475 | 475 | public function has_items() { |
| 476 | - return ! empty( $this->current_total_count ); |
|
| 476 | + return !empty($this->current_total_count); |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
@@ -15,20 +15,20 @@ discard block |
||
| 15 | 15 | * @package GetPaid |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -defined( 'ABSPATH' ) || exit; |
|
| 18 | +defined('ABSPATH') || exit; |
|
| 19 | 19 | |
| 20 | 20 | // Define constants. |
| 21 | -if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) { |
|
| 22 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
| 21 | +if (!defined('WPINV_PLUGIN_FILE')) { |
|
| 22 | + define('WPINV_PLUGIN_FILE', __FILE__); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -if ( ! defined( 'WPINV_VERSION' ) ) { |
|
| 26 | - define( 'WPINV_VERSION', '2.8.12' ); |
|
| 25 | +if (!defined('WPINV_VERSION')) { |
|
| 26 | + define('WPINV_VERSION', '2.8.12'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | // Include the main Invoicing class. |
| 30 | -if ( ! class_exists( 'WPInv_Plugin', false ) ) { |
|
| 31 | - require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
| 30 | +if (!class_exists('WPInv_Plugin', false)) { |
|
| 31 | + require_once plugin_dir_path(WPINV_PLUGIN_FILE) . 'includes/class-wpinv.php'; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | function getpaid() { |
| 41 | 41 | |
| 42 | - if ( empty( $GLOBALS['invoicing'] ) ) { |
|
| 42 | + if (empty($GLOBALS['invoicing'])) { |
|
| 43 | 43 | $GLOBALS['invoicing'] = new WPInv_Plugin(); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * @since 2.0.8 |
| 53 | 53 | */ |
| 54 | 54 | function getpaid_deactivation_hook() { |
| 55 | - update_option( 'wpinv_flush_permalinks', 1 ); |
|
| 55 | + update_option('wpinv_flush_permalinks', 1); |
|
| 56 | 56 | } |
| 57 | -register_deactivation_hook( __FILE__, 'getpaid_deactivation_hook' ); |
|
| 57 | +register_deactivation_hook(__FILE__, 'getpaid_deactivation_hook'); |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * @deprecated |
@@ -64,4 +64,4 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // Kickstart the plugin. |
| 67 | -add_action( 'plugins_loaded', 'getpaid', -100 ); |
|
| 67 | +add_action('plugins_loaded', 'getpaid', -100); |
|