@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if (!defined('ABSPATH')) { |
|
| 3 | 3 | exit; |
| 4 | 4 | } |
| 5 | 5 | |
@@ -22,15 +22,15 @@ discard block |
||
| 22 | 22 | 'block-keywords'=> "['invoicing','history']", |
| 23 | 23 | 'class_name' => __CLASS__, |
| 24 | 24 | 'base_id' => 'wpinv_history', |
| 25 | - 'name' => __('GetPaid > Invoice History','invoicing'), |
|
| 25 | + 'name' => __('GetPaid > Invoice History', 'invoicing'), |
|
| 26 | 26 | 'widget_ops' => array( |
| 27 | 27 | 'classname' => 'wpinv-history-class bsui', |
| 28 | - 'description' => esc_html__('Displays invoice history.','invoicing'), |
|
| 28 | + 'description' => esc_html__('Displays invoice history.', 'invoicing'), |
|
| 29 | 29 | ), |
| 30 | 30 | 'arguments' => array( |
| 31 | 31 | 'title' => array( |
| 32 | - 'title' => __( 'Widget title', 'invoicing' ), |
|
| 33 | - 'desc' => __( 'Enter widget title.', 'invoicing' ), |
|
| 32 | + 'title' => __('Widget title', 'invoicing'), |
|
| 33 | + 'desc' => __('Enter widget title.', 'invoicing'), |
|
| 34 | 34 | 'type' => 'text', |
| 35 | 35 | 'desc_tip' => true, |
| 36 | 36 | 'default' => '', |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | |
| 44 | - parent::__construct( $options ); |
|
| 44 | + parent::__construct($options); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return mixed|string|bool |
| 55 | 55 | */ |
| 56 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
| 56 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
| 57 | 57 | return getpaid_invoice_history(); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if (!defined('ABSPATH')) { |
|
| 3 | 3 | exit; |
| 4 | 4 | } |
| 5 | 5 | |
@@ -22,15 +22,15 @@ discard block |
||
| 22 | 22 | 'block-keywords'=> "['invoicing','receipt']", |
| 23 | 23 | 'class_name' => __CLASS__, |
| 24 | 24 | 'base_id' => 'wpinv_receipt', |
| 25 | - 'name' => __('GetPaid > Invoice Receipt','invoicing'), |
|
| 25 | + 'name' => __('GetPaid > Invoice Receipt', 'invoicing'), |
|
| 26 | 26 | 'widget_ops' => array( |
| 27 | 27 | 'classname' => 'wpinv-receipt-class bsui', |
| 28 | - 'description' => esc_html__('Displays invoice receipt after checkout.','invoicing'), |
|
| 28 | + 'description' => esc_html__('Displays invoice receipt after checkout.', 'invoicing'), |
|
| 29 | 29 | ), |
| 30 | 30 | 'arguments' => array( |
| 31 | 31 | 'title' => array( |
| 32 | - 'title' => __( 'Widget title', 'invoicing' ), |
|
| 33 | - 'desc' => __( 'Enter widget title.', 'invoicing' ), |
|
| 32 | + 'title' => __('Widget title', 'invoicing'), |
|
| 33 | + 'desc' => __('Enter widget title.', 'invoicing'), |
|
| 34 | 34 | 'type' => 'text', |
| 35 | 35 | 'desc_tip' => true, |
| 36 | 36 | 'default' => '', |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | |
| 44 | - parent::__construct( $options ); |
|
| 44 | + parent::__construct($options); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return mixed|string|bool |
| 55 | 55 | */ |
| 56 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
| 56 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
| 57 | 57 | return wpinv_payment_receipt(); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | * @version 1.0.19 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -defined( 'ABSPATH' ) || exit; |
|
| 11 | +defined('ABSPATH') || exit; |
|
| 12 | 12 | |
| 13 | 13 | return array( |
| 14 | 14 | 'AED' => 'د.إ', |
@@ -8,168 +8,168 @@ |
||
| 8 | 8 | * @version 1.0.19 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -defined( 'ABSPATH' ) || exit; |
|
| 11 | +defined('ABSPATH') || exit; |
|
| 12 | 12 | |
| 13 | 13 | return array( |
| 14 | - 'USD' => __( 'US Dollar', 'invoicing' ), |
|
| 15 | - 'EUR' => __( 'Euro', 'invoicing' ), |
|
| 16 | - 'GBP' => __( 'Pound Sterling', 'invoicing' ), |
|
| 17 | - 'AED' => __( 'United Arab Emirates', 'invoicing' ), |
|
| 18 | - 'AFN' => __( 'Afghan Afghani', 'invoicing' ), |
|
| 19 | - 'ALL' => __( 'Albanian Lek', 'invoicing' ), |
|
| 20 | - 'AMD' => __( 'Armenian Dram', 'invoicing' ), |
|
| 21 | - 'ANG' => __( 'Netherlands Antillean Guilder', 'invoicing' ), |
|
| 22 | - 'AOA' => __( 'Angolan Kwanza', 'invoicing' ), |
|
| 23 | - 'ARS' => __( 'Argentine Peso', 'invoicing' ), |
|
| 24 | - 'AUD' => __( 'Australian Dollar', 'invoicing' ), |
|
| 25 | - 'AWG' => __( 'Aruban Florin', 'invoicing' ), |
|
| 26 | - 'AZN' => __( 'Azerbaijani Manat', 'invoicing' ), |
|
| 27 | - 'BAM' => __( 'Bosnia and Herzegovina Convertible Marka', 'invoicing' ), |
|
| 28 | - 'BBD' => __( 'Barbadian Dollar', 'invoicing' ), |
|
| 29 | - 'BDT' => __( 'Bangladeshi Taka', 'invoicing' ), |
|
| 30 | - 'BGN' => __( 'Bulgarian Lev', 'invoicing' ), |
|
| 31 | - 'BHD' => __( 'Bahraini Dinar', 'invoicing' ), |
|
| 32 | - 'BIF' => __( 'Burundian Franc', 'invoicing' ), |
|
| 33 | - 'BMD' => __( 'Bermudian Dollar', 'invoicing' ), |
|
| 34 | - 'BND' => __( 'Brunei Dollar', 'invoicing' ), |
|
| 35 | - 'BOB' => __( 'Bolivian Boliviano', 'invoicing' ), |
|
| 36 | - 'BRL' => __( 'Brazilian Real', 'invoicing' ), |
|
| 37 | - 'BSD' => __( 'Bahamian Dollar', 'invoicing' ), |
|
| 38 | - 'BTC' => __( 'Bitcoin', 'invoicing' ), |
|
| 39 | - 'BTN' => __( 'Bhutanese Ngultrum', 'invoicing' ), |
|
| 40 | - 'BWP' => __( 'Botswana Pula', 'invoicing' ), |
|
| 41 | - 'BYN' => __( 'Belarusian Ruble', 'invoicing' ), |
|
| 42 | - 'BZD' => __( 'Belize Dollar', 'invoicing' ), |
|
| 43 | - 'CAD' => __( 'Canadian Dollar', 'invoicing' ), |
|
| 44 | - 'CDF' => __( 'Congolese Franc', 'invoicing' ), |
|
| 45 | - 'CHF' => __( 'Swiss Franc', 'invoicing' ), |
|
| 46 | - 'CLP' => __( 'Chilean Peso', 'invoicing' ), |
|
| 47 | - 'CNY' => __( 'Chinese Yuan', 'invoicing' ), |
|
| 48 | - 'COP' => __( 'Colombian Peso', 'invoicing' ), |
|
| 49 | - 'CRC' => __( 'Costa Rican Colon', 'invoicing' ), |
|
| 50 | - 'CUC' => __( 'Cuban Convertible Peso', 'invoicing' ), |
|
| 51 | - 'CUP' => __( 'Cuban Peso', 'invoicing' ), |
|
| 52 | - 'CVE' => __( 'Cape Verdean escudo', 'invoicing' ), |
|
| 53 | - 'CZK' => __( 'Czech Koruna', 'invoicing' ), |
|
| 54 | - 'DJF' => __( 'Djiboutian Franc', 'invoicing' ), |
|
| 55 | - 'DKK' => __( 'Danish Krone', 'invoicing' ), |
|
| 56 | - 'DOP' => __( 'Dominican Peso', 'invoicing' ), |
|
| 57 | - 'DZD' => __( 'Algerian Dinar', 'invoicing' ), |
|
| 58 | - 'EGP' => __( 'Egyptian Pound', 'invoicing' ), |
|
| 59 | - 'ERN' => __( 'Eritrean Nakfa', 'invoicing' ), |
|
| 60 | - 'ETB' => __( 'Ethiopian Irr', 'invoicing' ), |
|
| 61 | - 'FJD' => __( 'Fijian Dollar', 'invoicing' ), |
|
| 62 | - 'FKP' => __( 'Falkland Islands Pound', 'invoicing' ), |
|
| 63 | - 'GEL' => __( 'Georgian Lari', 'invoicing' ), |
|
| 64 | - 'GGP' => __( 'Guernsey Pound', 'invoicing' ), |
|
| 65 | - 'GHS' => __( 'Ghana Cedi', 'invoicing' ), |
|
| 66 | - 'GIP' => __( 'Gibraltar Pound', 'invoicing' ), |
|
| 67 | - 'GMD' => __( 'Gambian Dalasi', 'invoicing' ), |
|
| 68 | - 'GNF' => __( 'Guinean Franc', 'invoicing' ), |
|
| 69 | - 'GTQ' => __( 'Guatemalan Quetzal', 'invoicing' ), |
|
| 70 | - 'GYD' => __( 'Guyanese Dollar', 'invoicing' ), |
|
| 71 | - 'HKD' => __( 'Hong Kong Dollar', 'invoicing' ), |
|
| 72 | - 'HNL' => __( 'Honduran Lempira', 'invoicing' ), |
|
| 73 | - 'HRK' => __( 'Croatian Kuna', 'invoicing' ), |
|
| 74 | - 'HTG' => __( 'Haitian Gourde', 'invoicing' ), |
|
| 75 | - 'HUF' => __( 'Hungarian Forint', 'invoicing' ), |
|
| 76 | - 'IDR' => __( 'Indonesian Rupiah', 'invoicing' ), |
|
| 77 | - 'ILS' => __( 'Israeli New Shekel', 'invoicing' ), |
|
| 78 | - 'IMP' => __( 'Manx Pound', 'invoicing' ), |
|
| 79 | - 'INR' => __( 'Indian Rupee', 'invoicing' ), |
|
| 80 | - 'IQD' => __( 'Iraqi Dinar', 'invoicing' ), |
|
| 81 | - 'IRR' => __( 'Iranian Rial', 'invoicing' ), |
|
| 82 | - 'IRT' => __( 'Iranian Toman', 'invoicing' ), |
|
| 83 | - 'ISK' => __( 'Icelandic Krona', 'invoicing' ), |
|
| 84 | - 'JEP' => __( 'Jersey Pound', 'invoicing' ), |
|
| 85 | - 'JMD' => __( 'Jamaican Dollar', 'invoicing' ), |
|
| 86 | - 'JOD' => __( 'Jordanian Dinar', 'invoicing' ), |
|
| 87 | - 'JPY' => __( 'Japanese Yen', 'invoicing' ), |
|
| 88 | - 'KES' => __( 'Kenyan Shilling', 'invoicing' ), |
|
| 89 | - 'KGS' => __( 'Kyrgyzstani Som', 'invoicing' ), |
|
| 90 | - 'KHR' => __( 'Cambodian Riel', 'invoicing' ), |
|
| 91 | - 'KMF' => __( 'Comorian Franc', 'invoicing' ), |
|
| 92 | - 'KPW' => __( 'North Korean Won', 'invoicing' ), |
|
| 93 | - 'KRW' => __( 'South Korean Won', 'invoicing' ), |
|
| 94 | - 'KWD' => __( 'Kuwaiti Dinar', 'invoicing' ), |
|
| 95 | - 'KYD' => __( 'Cayman Islands Dollar', 'invoicing' ), |
|
| 96 | - 'KZT' => __( 'Kazakhstani Tenge', 'invoicing' ), |
|
| 97 | - 'LAK' => __( 'Lao Kip', 'invoicing' ), |
|
| 98 | - 'LBP' => __( 'Lebanese Pound', 'invoicing' ), |
|
| 99 | - 'LKR' => __( 'Sri Lankan Rupee', 'invoicing' ), |
|
| 100 | - 'LRD' => __( 'Liberian Dollar', 'invoicing' ), |
|
| 101 | - 'LSL' => __( 'Lesotho Loti', 'invoicing' ), |
|
| 102 | - 'LYD' => __( 'Libyan Dinar', 'invoicing' ), |
|
| 103 | - 'MAD' => __( 'Moroccan Dirham', 'invoicing' ), |
|
| 104 | - 'MDL' => __( 'Moldovan Leu', 'invoicing' ), |
|
| 105 | - 'MGA' => __( 'Malagasy Ariary', 'invoicing' ), |
|
| 106 | - 'MKD' => __( 'Macedonian Denar', 'invoicing' ), |
|
| 107 | - 'MMK' => __( 'Burmese Kyat', 'invoicing' ), |
|
| 108 | - 'MNT' => __( 'Mongolian Tughrik', 'invoicing' ), |
|
| 109 | - 'MOP' => __( 'Macanese Pataca', 'invoicing' ), |
|
| 110 | - 'MRO' => __( 'Mauritanian Ouguiya', 'invoicing' ), |
|
| 111 | - 'MUR' => __( 'Mauritian Rupee', 'invoicing' ), |
|
| 112 | - 'MVR' => __( 'Maldivian Rufiyaa', 'invoicing' ), |
|
| 113 | - 'MWK' => __( 'Malawian Kwacha', 'invoicing' ), |
|
| 114 | - 'MXN' => __( 'Mexican Peso', 'invoicing' ), |
|
| 115 | - 'MYR' => __( 'Malaysian Ringgit', 'invoicing' ), |
|
| 116 | - 'MZN' => __( 'Mozambican Metical', 'invoicing' ), |
|
| 117 | - 'NAD' => __( 'Namibian Dollar', 'invoicing' ), |
|
| 118 | - 'NGN' => __( 'Nigerian Naira', 'invoicing' ), |
|
| 119 | - 'NIO' => __( 'Nicaraguan Cordoba', 'invoicing' ), |
|
| 120 | - 'NOK' => __( 'Norwegian Krone', 'invoicing' ), |
|
| 121 | - 'NPR' => __( 'Nepalese Rupee', 'invoicing' ), |
|
| 122 | - 'NZD' => __( 'New Zealand Dollar', 'invoicing' ), |
|
| 123 | - 'OMR' => __( 'Omani Rial', 'invoicing' ), |
|
| 124 | - 'PAB' => __( 'Panamanian Balboa', 'invoicing' ), |
|
| 125 | - 'PEN' => __( 'Peruvian Nuevo Sol', 'invoicing' ), |
|
| 126 | - 'PGK' => __( 'Papua New Guinean Kina', 'invoicing' ), |
|
| 127 | - 'PHP' => __( 'Philippine Peso', 'invoicing' ), |
|
| 128 | - 'PKR' => __( 'Pakistani Rupee', 'invoicing' ), |
|
| 129 | - 'PLN' => __( 'Polish Zloty', 'invoicing' ), |
|
| 130 | - 'PRB' => __( 'Transnistrian Ruble', 'invoicing' ), |
|
| 131 | - 'PYG' => __( 'Paraguayan Guarani', 'invoicing' ), |
|
| 132 | - 'QAR' => __( 'Qatari Riyal', 'invoicing' ), |
|
| 133 | - 'RON' => __( 'Romanian Leu', 'invoicing' ), |
|
| 134 | - 'RSD' => __( 'Serbian Dinar', 'invoicing' ), |
|
| 135 | - 'RUB' => __( 'Russian Ruble', 'invoicing' ), |
|
| 136 | - 'RWF' => __( 'Rwandan Franc', 'invoicing' ), |
|
| 137 | - 'SAR' => __( 'Saudi Riyal', 'invoicing' ), |
|
| 138 | - 'SBD' => __( 'Solomon Islands Dollar', 'invoicing' ), |
|
| 139 | - 'SCR' => __( 'Seychellois Rupee', 'invoicing' ), |
|
| 140 | - 'SDG' => __( 'Sudanese Pound', 'invoicing' ), |
|
| 141 | - 'SEK' => __( 'Swedish Krona', 'invoicing' ), |
|
| 142 | - 'SGD' => __( 'Singapore Dollar', 'invoicing' ), |
|
| 143 | - 'SHP' => __( 'Saint Helena Pound', 'invoicing' ), |
|
| 144 | - 'SLL' => __( 'Sierra Leonean Leone', 'invoicing' ), |
|
| 145 | - 'SOS' => __( 'Somali Shilling', 'invoicing' ), |
|
| 146 | - 'SRD' => __( 'Surinamese Dollar', 'invoicing' ), |
|
| 147 | - 'SSP' => __( 'South Sudanese Pound', 'invoicing' ), |
|
| 148 | - 'STD' => __( 'Sao Tomean Dobra', 'invoicing' ), |
|
| 149 | - 'SYP' => __( 'Syrian Pound', 'invoicing' ), |
|
| 150 | - 'SZL' => __( 'Swazi Lilangeni', 'invoicing' ), |
|
| 151 | - 'THB' => __( 'Thai Baht', 'invoicing' ), |
|
| 152 | - 'TJS' => __( 'Tajikistani Somoni', 'invoicing' ), |
|
| 153 | - 'TMT' => __( 'Turkmenistan Manat', 'invoicing' ), |
|
| 154 | - 'TND' => __( 'Tunisian Dinar', 'invoicing' ), |
|
| 155 | - 'TOP' => __( 'Tongan Paʻanga', 'invoicing' ), |
|
| 156 | - 'TRY' => __( 'Turkish Lira', 'invoicing' ), |
|
| 157 | - 'TTD' => __( 'Trinidad and Tobago Dollar', 'invoicing' ), |
|
| 158 | - 'TWD' => __( 'New Taiwan Dollar', 'invoicing' ), |
|
| 159 | - 'TZS' => __( 'Tanzanian Shilling', 'invoicing' ), |
|
| 160 | - 'UAH' => __( 'Ukrainian Hryvnia', 'invoicing' ), |
|
| 161 | - 'UGX' => __( 'Ugandan Shilling', 'invoicing' ), |
|
| 162 | - 'UYU' => __( 'Uruguayan Peso', 'invoicing' ), |
|
| 163 | - 'UZS' => __( 'Uzbekistani Som', 'invoicing' ), |
|
| 164 | - 'VEF' => __( 'Venezuelan Bolívar', 'invoicing' ), |
|
| 165 | - 'VND' => __( 'Vietnamese Dong', 'invoicing' ), |
|
| 166 | - 'VUV' => __( 'Vanuatu Vatu', 'invoicing' ), |
|
| 167 | - 'WST' => __( 'Samoan Tala', 'invoicing' ), |
|
| 168 | - 'XAF' => __( 'Central African CFA Franc', 'invoicing' ), |
|
| 169 | - 'XCD' => __( 'East Caribbean Dollar', 'invoicing' ), |
|
| 170 | - 'XOF' => __( 'West African CFA Franc', 'invoicing' ), |
|
| 171 | - 'XPF' => __( 'CFP Franc', 'invoicing' ), |
|
| 172 | - 'YER' => __( 'Yemeni Rial', 'invoicing' ), |
|
| 173 | - 'ZAR' => __( 'South African Rand', 'invoicing' ), |
|
| 174 | - 'ZMW' => __( 'Zambian Kwacha', 'invoicing' ), |
|
| 14 | + 'USD' => __('US Dollar', 'invoicing'), |
|
| 15 | + 'EUR' => __('Euro', 'invoicing'), |
|
| 16 | + 'GBP' => __('Pound Sterling', 'invoicing'), |
|
| 17 | + 'AED' => __('United Arab Emirates', 'invoicing'), |
|
| 18 | + 'AFN' => __('Afghan Afghani', 'invoicing'), |
|
| 19 | + 'ALL' => __('Albanian Lek', 'invoicing'), |
|
| 20 | + 'AMD' => __('Armenian Dram', 'invoicing'), |
|
| 21 | + 'ANG' => __('Netherlands Antillean Guilder', 'invoicing'), |
|
| 22 | + 'AOA' => __('Angolan Kwanza', 'invoicing'), |
|
| 23 | + 'ARS' => __('Argentine Peso', 'invoicing'), |
|
| 24 | + 'AUD' => __('Australian Dollar', 'invoicing'), |
|
| 25 | + 'AWG' => __('Aruban Florin', 'invoicing'), |
|
| 26 | + 'AZN' => __('Azerbaijani Manat', 'invoicing'), |
|
| 27 | + 'BAM' => __('Bosnia and Herzegovina Convertible Marka', 'invoicing'), |
|
| 28 | + 'BBD' => __('Barbadian Dollar', 'invoicing'), |
|
| 29 | + 'BDT' => __('Bangladeshi Taka', 'invoicing'), |
|
| 30 | + 'BGN' => __('Bulgarian Lev', 'invoicing'), |
|
| 31 | + 'BHD' => __('Bahraini Dinar', 'invoicing'), |
|
| 32 | + 'BIF' => __('Burundian Franc', 'invoicing'), |
|
| 33 | + 'BMD' => __('Bermudian Dollar', 'invoicing'), |
|
| 34 | + 'BND' => __('Brunei Dollar', 'invoicing'), |
|
| 35 | + 'BOB' => __('Bolivian Boliviano', 'invoicing'), |
|
| 36 | + 'BRL' => __('Brazilian Real', 'invoicing'), |
|
| 37 | + 'BSD' => __('Bahamian Dollar', 'invoicing'), |
|
| 38 | + 'BTC' => __('Bitcoin', 'invoicing'), |
|
| 39 | + 'BTN' => __('Bhutanese Ngultrum', 'invoicing'), |
|
| 40 | + 'BWP' => __('Botswana Pula', 'invoicing'), |
|
| 41 | + 'BYN' => __('Belarusian Ruble', 'invoicing'), |
|
| 42 | + 'BZD' => __('Belize Dollar', 'invoicing'), |
|
| 43 | + 'CAD' => __('Canadian Dollar', 'invoicing'), |
|
| 44 | + 'CDF' => __('Congolese Franc', 'invoicing'), |
|
| 45 | + 'CHF' => __('Swiss Franc', 'invoicing'), |
|
| 46 | + 'CLP' => __('Chilean Peso', 'invoicing'), |
|
| 47 | + 'CNY' => __('Chinese Yuan', 'invoicing'), |
|
| 48 | + 'COP' => __('Colombian Peso', 'invoicing'), |
|
| 49 | + 'CRC' => __('Costa Rican Colon', 'invoicing'), |
|
| 50 | + 'CUC' => __('Cuban Convertible Peso', 'invoicing'), |
|
| 51 | + 'CUP' => __('Cuban Peso', 'invoicing'), |
|
| 52 | + 'CVE' => __('Cape Verdean escudo', 'invoicing'), |
|
| 53 | + 'CZK' => __('Czech Koruna', 'invoicing'), |
|
| 54 | + 'DJF' => __('Djiboutian Franc', 'invoicing'), |
|
| 55 | + 'DKK' => __('Danish Krone', 'invoicing'), |
|
| 56 | + 'DOP' => __('Dominican Peso', 'invoicing'), |
|
| 57 | + 'DZD' => __('Algerian Dinar', 'invoicing'), |
|
| 58 | + 'EGP' => __('Egyptian Pound', 'invoicing'), |
|
| 59 | + 'ERN' => __('Eritrean Nakfa', 'invoicing'), |
|
| 60 | + 'ETB' => __('Ethiopian Irr', 'invoicing'), |
|
| 61 | + 'FJD' => __('Fijian Dollar', 'invoicing'), |
|
| 62 | + 'FKP' => __('Falkland Islands Pound', 'invoicing'), |
|
| 63 | + 'GEL' => __('Georgian Lari', 'invoicing'), |
|
| 64 | + 'GGP' => __('Guernsey Pound', 'invoicing'), |
|
| 65 | + 'GHS' => __('Ghana Cedi', 'invoicing'), |
|
| 66 | + 'GIP' => __('Gibraltar Pound', 'invoicing'), |
|
| 67 | + 'GMD' => __('Gambian Dalasi', 'invoicing'), |
|
| 68 | + 'GNF' => __('Guinean Franc', 'invoicing'), |
|
| 69 | + 'GTQ' => __('Guatemalan Quetzal', 'invoicing'), |
|
| 70 | + 'GYD' => __('Guyanese Dollar', 'invoicing'), |
|
| 71 | + 'HKD' => __('Hong Kong Dollar', 'invoicing'), |
|
| 72 | + 'HNL' => __('Honduran Lempira', 'invoicing'), |
|
| 73 | + 'HRK' => __('Croatian Kuna', 'invoicing'), |
|
| 74 | + 'HTG' => __('Haitian Gourde', 'invoicing'), |
|
| 75 | + 'HUF' => __('Hungarian Forint', 'invoicing'), |
|
| 76 | + 'IDR' => __('Indonesian Rupiah', 'invoicing'), |
|
| 77 | + 'ILS' => __('Israeli New Shekel', 'invoicing'), |
|
| 78 | + 'IMP' => __('Manx Pound', 'invoicing'), |
|
| 79 | + 'INR' => __('Indian Rupee', 'invoicing'), |
|
| 80 | + 'IQD' => __('Iraqi Dinar', 'invoicing'), |
|
| 81 | + 'IRR' => __('Iranian Rial', 'invoicing'), |
|
| 82 | + 'IRT' => __('Iranian Toman', 'invoicing'), |
|
| 83 | + 'ISK' => __('Icelandic Krona', 'invoicing'), |
|
| 84 | + 'JEP' => __('Jersey Pound', 'invoicing'), |
|
| 85 | + 'JMD' => __('Jamaican Dollar', 'invoicing'), |
|
| 86 | + 'JOD' => __('Jordanian Dinar', 'invoicing'), |
|
| 87 | + 'JPY' => __('Japanese Yen', 'invoicing'), |
|
| 88 | + 'KES' => __('Kenyan Shilling', 'invoicing'), |
|
| 89 | + 'KGS' => __('Kyrgyzstani Som', 'invoicing'), |
|
| 90 | + 'KHR' => __('Cambodian Riel', 'invoicing'), |
|
| 91 | + 'KMF' => __('Comorian Franc', 'invoicing'), |
|
| 92 | + 'KPW' => __('North Korean Won', 'invoicing'), |
|
| 93 | + 'KRW' => __('South Korean Won', 'invoicing'), |
|
| 94 | + 'KWD' => __('Kuwaiti Dinar', 'invoicing'), |
|
| 95 | + 'KYD' => __('Cayman Islands Dollar', 'invoicing'), |
|
| 96 | + 'KZT' => __('Kazakhstani Tenge', 'invoicing'), |
|
| 97 | + 'LAK' => __('Lao Kip', 'invoicing'), |
|
| 98 | + 'LBP' => __('Lebanese Pound', 'invoicing'), |
|
| 99 | + 'LKR' => __('Sri Lankan Rupee', 'invoicing'), |
|
| 100 | + 'LRD' => __('Liberian Dollar', 'invoicing'), |
|
| 101 | + 'LSL' => __('Lesotho Loti', 'invoicing'), |
|
| 102 | + 'LYD' => __('Libyan Dinar', 'invoicing'), |
|
| 103 | + 'MAD' => __('Moroccan Dirham', 'invoicing'), |
|
| 104 | + 'MDL' => __('Moldovan Leu', 'invoicing'), |
|
| 105 | + 'MGA' => __('Malagasy Ariary', 'invoicing'), |
|
| 106 | + 'MKD' => __('Macedonian Denar', 'invoicing'), |
|
| 107 | + 'MMK' => __('Burmese Kyat', 'invoicing'), |
|
| 108 | + 'MNT' => __('Mongolian Tughrik', 'invoicing'), |
|
| 109 | + 'MOP' => __('Macanese Pataca', 'invoicing'), |
|
| 110 | + 'MRO' => __('Mauritanian Ouguiya', 'invoicing'), |
|
| 111 | + 'MUR' => __('Mauritian Rupee', 'invoicing'), |
|
| 112 | + 'MVR' => __('Maldivian Rufiyaa', 'invoicing'), |
|
| 113 | + 'MWK' => __('Malawian Kwacha', 'invoicing'), |
|
| 114 | + 'MXN' => __('Mexican Peso', 'invoicing'), |
|
| 115 | + 'MYR' => __('Malaysian Ringgit', 'invoicing'), |
|
| 116 | + 'MZN' => __('Mozambican Metical', 'invoicing'), |
|
| 117 | + 'NAD' => __('Namibian Dollar', 'invoicing'), |
|
| 118 | + 'NGN' => __('Nigerian Naira', 'invoicing'), |
|
| 119 | + 'NIO' => __('Nicaraguan Cordoba', 'invoicing'), |
|
| 120 | + 'NOK' => __('Norwegian Krone', 'invoicing'), |
|
| 121 | + 'NPR' => __('Nepalese Rupee', 'invoicing'), |
|
| 122 | + 'NZD' => __('New Zealand Dollar', 'invoicing'), |
|
| 123 | + 'OMR' => __('Omani Rial', 'invoicing'), |
|
| 124 | + 'PAB' => __('Panamanian Balboa', 'invoicing'), |
|
| 125 | + 'PEN' => __('Peruvian Nuevo Sol', 'invoicing'), |
|
| 126 | + 'PGK' => __('Papua New Guinean Kina', 'invoicing'), |
|
| 127 | + 'PHP' => __('Philippine Peso', 'invoicing'), |
|
| 128 | + 'PKR' => __('Pakistani Rupee', 'invoicing'), |
|
| 129 | + 'PLN' => __('Polish Zloty', 'invoicing'), |
|
| 130 | + 'PRB' => __('Transnistrian Ruble', 'invoicing'), |
|
| 131 | + 'PYG' => __('Paraguayan Guarani', 'invoicing'), |
|
| 132 | + 'QAR' => __('Qatari Riyal', 'invoicing'), |
|
| 133 | + 'RON' => __('Romanian Leu', 'invoicing'), |
|
| 134 | + 'RSD' => __('Serbian Dinar', 'invoicing'), |
|
| 135 | + 'RUB' => __('Russian Ruble', 'invoicing'), |
|
| 136 | + 'RWF' => __('Rwandan Franc', 'invoicing'), |
|
| 137 | + 'SAR' => __('Saudi Riyal', 'invoicing'), |
|
| 138 | + 'SBD' => __('Solomon Islands Dollar', 'invoicing'), |
|
| 139 | + 'SCR' => __('Seychellois Rupee', 'invoicing'), |
|
| 140 | + 'SDG' => __('Sudanese Pound', 'invoicing'), |
|
| 141 | + 'SEK' => __('Swedish Krona', 'invoicing'), |
|
| 142 | + 'SGD' => __('Singapore Dollar', 'invoicing'), |
|
| 143 | + 'SHP' => __('Saint Helena Pound', 'invoicing'), |
|
| 144 | + 'SLL' => __('Sierra Leonean Leone', 'invoicing'), |
|
| 145 | + 'SOS' => __('Somali Shilling', 'invoicing'), |
|
| 146 | + 'SRD' => __('Surinamese Dollar', 'invoicing'), |
|
| 147 | + 'SSP' => __('South Sudanese Pound', 'invoicing'), |
|
| 148 | + 'STD' => __('Sao Tomean Dobra', 'invoicing'), |
|
| 149 | + 'SYP' => __('Syrian Pound', 'invoicing'), |
|
| 150 | + 'SZL' => __('Swazi Lilangeni', 'invoicing'), |
|
| 151 | + 'THB' => __('Thai Baht', 'invoicing'), |
|
| 152 | + 'TJS' => __('Tajikistani Somoni', 'invoicing'), |
|
| 153 | + 'TMT' => __('Turkmenistan Manat', 'invoicing'), |
|
| 154 | + 'TND' => __('Tunisian Dinar', 'invoicing'), |
|
| 155 | + 'TOP' => __('Tongan Paʻanga', 'invoicing'), |
|
| 156 | + 'TRY' => __('Turkish Lira', 'invoicing'), |
|
| 157 | + 'TTD' => __('Trinidad and Tobago Dollar', 'invoicing'), |
|
| 158 | + 'TWD' => __('New Taiwan Dollar', 'invoicing'), |
|
| 159 | + 'TZS' => __('Tanzanian Shilling', 'invoicing'), |
|
| 160 | + 'UAH' => __('Ukrainian Hryvnia', 'invoicing'), |
|
| 161 | + 'UGX' => __('Ugandan Shilling', 'invoicing'), |
|
| 162 | + 'UYU' => __('Uruguayan Peso', 'invoicing'), |
|
| 163 | + 'UZS' => __('Uzbekistani Som', 'invoicing'), |
|
| 164 | + 'VEF' => __('Venezuelan Bolívar', 'invoicing'), |
|
| 165 | + 'VND' => __('Vietnamese Dong', 'invoicing'), |
|
| 166 | + 'VUV' => __('Vanuatu Vatu', 'invoicing'), |
|
| 167 | + 'WST' => __('Samoan Tala', 'invoicing'), |
|
| 168 | + 'XAF' => __('Central African CFA Franc', 'invoicing'), |
|
| 169 | + 'XCD' => __('East Caribbean Dollar', 'invoicing'), |
|
| 170 | + 'XOF' => __('West African CFA Franc', 'invoicing'), |
|
| 171 | + 'XPF' => __('CFP Franc', 'invoicing'), |
|
| 172 | + 'YER' => __('Yemeni Rial', 'invoicing'), |
|
| 173 | + 'ZAR' => __('South African Rand', 'invoicing'), |
|
| 174 | + 'ZMW' => __('Zambian Kwacha', 'invoicing'), |
|
| 175 | 175 | ); |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * @version 1.0.19 |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -defined( 'ABSPATH' ) || exit; |
|
| 8 | +defined('ABSPATH') || exit; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * REST API items controller class. |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @see register_rest_route() |
| 44 | 44 | */ |
| 45 | - public function register_namespace_routes( $namespace ) { |
|
| 45 | + public function register_namespace_routes($namespace) { |
|
| 46 | 46 | |
| 47 | - parent::register_namespace_routes( $namespace ); |
|
| 47 | + parent::register_namespace_routes($namespace); |
|
| 48 | 48 | |
| 49 | 49 | register_rest_route( |
| 50 | 50 | $this->namespace, |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | array( |
| 53 | 53 | array( |
| 54 | 54 | 'methods' => WP_REST_Server::READABLE, |
| 55 | - 'callback' => array( $this, 'get_item_types' ), |
|
| 56 | - 'permission_callback' => array( $this, 'get_items_permissions_check' ), |
|
| 55 | + 'callback' => array($this, 'get_item_types'), |
|
| 56 | + 'permission_callback' => array($this, 'get_items_permissions_check'), |
|
| 57 | 57 | ), |
| 58 | 58 | ) |
| 59 | 59 | ); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| 70 | 70 | */ |
| 71 | 71 | public function get_item_types() { |
| 72 | - return rest_ensure_response( wpinv_get_item_types() ); |
|
| 72 | + return rest_ensure_response(wpinv_get_item_types()); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // Item types |
| 91 | 91 | 'type' => array( |
| 92 | - 'description' => __( 'Type of items to fetch.', 'invoicing' ), |
|
| 93 | - 'type' => array( 'array', 'string' ), |
|
| 92 | + 'description' => __('Type of items to fetch.', 'invoicing'), |
|
| 93 | + 'type' => array('array', 'string'), |
|
| 94 | 94 | 'default' => 'any', |
| 95 | 95 | 'validate_callback' => 'rest_validate_request_arg', |
| 96 | 96 | 'sanitize_callback' => 'wpinv_parse_list', |
| 97 | 97 | 'items' => array( |
| 98 | - 'enum' => array_merge( array( 'any' ), wpinv_item_types() ), |
|
| 98 | + 'enum' => array_merge(array('any'), wpinv_item_types()), |
|
| 99 | 99 | 'type' => 'string', |
| 100 | 100 | ), |
| 101 | 101 | ), |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | ); |
| 105 | 105 | |
| 106 | 106 | // Filter collection parameters for the items controller. |
| 107 | - return apply_filters( 'getpaid_rest_items_collection_params', $params, $this ); |
|
| 107 | + return apply_filters('getpaid_rest_items_collection_params', $params, $this); |
|
| 108 | 108 | |
| 109 | 109 | } |
| 110 | 110 | |
@@ -116,26 +116,26 @@ discard block |
||
| 116 | 116 | * @param WP_REST_Request $request Request object. |
| 117 | 117 | * @return array $query_args |
| 118 | 118 | */ |
| 119 | - protected function prepare_items_query( $prepared_args = array(), $request = null ) { |
|
| 119 | + protected function prepare_items_query($prepared_args = array(), $request = null) { |
|
| 120 | 120 | |
| 121 | - $query_args = parent::prepare_items_query( $prepared_args ); |
|
| 121 | + $query_args = parent::prepare_items_query($prepared_args); |
|
| 122 | 122 | |
| 123 | 123 | // Retrieve items by type. |
| 124 | - if ( ! in_array( 'any', $request['type'] ) ) { |
|
| 124 | + if (!in_array('any', $request['type'])) { |
|
| 125 | 125 | |
| 126 | - if ( empty( $query_args['meta_query'] ) ) { |
|
| 126 | + if (empty($query_args['meta_query'])) { |
|
| 127 | 127 | $query_args['meta_query'] = array(); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $query_args['meta_query'][] = array( |
| 131 | 131 | 'key' => '_wpinv_type', |
| 132 | - 'value' => implode( ',', $request['type'] ), |
|
| 132 | + 'value' => implode(',', $request['type']), |
|
| 133 | 133 | 'compare' => 'IN', |
| 134 | 134 | ); |
| 135 | 135 | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - return apply_filters( 'getpaid_rest_items_prepare_items_query', $query_args, $request, $this ); |
|
| 138 | + return apply_filters('getpaid_rest_items_prepare_items_query', $query_args, $request, $this); |
|
| 139 | 139 | |
| 140 | 140 | } |
| 141 | 141 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @return array A list of registered item statuses. |
| 148 | 148 | */ |
| 149 | 149 | public function get_post_statuses() { |
| 150 | - return array( 'draft', 'pending', 'publish' ); |
|
| 150 | + return array('draft', 'pending', 'publish'); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -158,29 +158,29 @@ discard block |
||
| 158 | 158 | * @param string $field_key The key to check for. |
| 159 | 159 | * @return bool |
| 160 | 160 | */ |
| 161 | - public function object_supports_field( $item, $field_key ) { |
|
| 161 | + public function object_supports_field($item, $field_key) { |
|
| 162 | 162 | |
| 163 | - if ( 'minimum_price' == $field_key && ! $item->user_can_set_their_price() ) { |
|
| 163 | + if ('minimum_price' == $field_key && !$item->user_can_set_their_price()) { |
|
| 164 | 164 | return false; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - foreach( wpinv_parse_list( 'initial_price the_initial_price recurring_price the_recurring_price recurring_period recurring_interval recurring_limit is_free_trial trial_period trial_interval first_renewal_date' ) as $key ) { |
|
| 167 | + foreach (wpinv_parse_list('initial_price the_initial_price recurring_price the_recurring_price recurring_period recurring_interval recurring_limit is_free_trial trial_period trial_interval first_renewal_date') as $key) { |
|
| 168 | 168 | |
| 169 | - if ( $key == $field_key && ! $item->is_recurring() ) { |
|
| 169 | + if ($key == $field_key && !$item->is_recurring()) { |
|
| 170 | 170 | return false; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - foreach( wpinv_parse_list( 'trial_period trial_interval' ) as $key ) { |
|
| 175 | + foreach (wpinv_parse_list('trial_period trial_interval') as $key) { |
|
| 176 | 176 | |
| 177 | - if ( $key == $field_key && ! $item->has_free_trial() ) { |
|
| 177 | + if ($key == $field_key && !$item->has_free_trial()) { |
|
| 178 | 178 | return false; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - return parent::object_supports_field( $item, $field_key ); |
|
| 183 | + return parent::object_supports_field($item, $field_key); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * @version 1.0.19 |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -defined( 'ABSPATH' ) || exit; |
|
| 8 | +defined('ABSPATH') || exit; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * REST API discounts controller class. |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @see register_rest_route() |
| 44 | 44 | */ |
| 45 | - public function register_namespace_routes( $namespace ) { |
|
| 45 | + public function register_namespace_routes($namespace) { |
|
| 46 | 46 | |
| 47 | - parent::register_namespace_routes( $namespace ); |
|
| 47 | + parent::register_namespace_routes($namespace); |
|
| 48 | 48 | |
| 49 | 49 | register_rest_route( |
| 50 | 50 | $this->namespace, |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | array( |
| 53 | 53 | array( |
| 54 | 54 | 'methods' => WP_REST_Server::READABLE, |
| 55 | - 'callback' => array( $this, 'get_discount_types' ), |
|
| 56 | - 'permission_callback' => array( $this, 'get_items_permissions_check' ), |
|
| 55 | + 'callback' => array($this, 'get_discount_types'), |
|
| 56 | + 'permission_callback' => array($this, 'get_items_permissions_check'), |
|
| 57 | 57 | ), |
| 58 | 58 | ) |
| 59 | 59 | ); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| 70 | 70 | */ |
| 71 | 71 | public function get_discount_types() { |
| 72 | - return rest_ensure_response( wpinv_get_discount_types() ); |
|
| 72 | + return rest_ensure_response(wpinv_get_discount_types()); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // Discount types |
| 91 | 91 | 'type' => array( |
| 92 | - 'description' => __( 'Type of discounts to fetch.', 'invoicing' ), |
|
| 93 | - 'type' => array( 'array', 'string' ), |
|
| 92 | + 'description' => __('Type of discounts to fetch.', 'invoicing'), |
|
| 93 | + 'type' => array('array', 'string'), |
|
| 94 | 94 | 'default' => 'any', |
| 95 | 95 | 'validate_callback' => 'rest_validate_request_arg', |
| 96 | 96 | 'sanitize_callback' => 'wpinv_parse_list', |
| 97 | 97 | 'items' => array( |
| 98 | - 'enum' => array_merge( array( 'any' ), array_keys( wpinv_get_discount_types() ) ), |
|
| 98 | + 'enum' => array_merge(array('any'), array_keys(wpinv_get_discount_types())), |
|
| 99 | 99 | 'type' => 'string', |
| 100 | 100 | ), |
| 101 | 101 | ), |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | ); |
| 105 | 105 | |
| 106 | 106 | // Filter collection parameters for the discounts controller. |
| 107 | - return apply_filters( 'getpaid_rest_discounts_collection_params', $params, $this ); |
|
| 107 | + return apply_filters('getpaid_rest_discounts_collection_params', $params, $this); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -115,26 +115,26 @@ discard block |
||
| 115 | 115 | * @param WP_REST_Request $request Request object. |
| 116 | 116 | * @return array $query_args |
| 117 | 117 | */ |
| 118 | - protected function prepare_items_query( $prepared_args = array(), $request = null ) { |
|
| 118 | + protected function prepare_items_query($prepared_args = array(), $request = null) { |
|
| 119 | 119 | |
| 120 | - $query_args = parent::prepare_items_query( $prepared_args ); |
|
| 120 | + $query_args = parent::prepare_items_query($prepared_args); |
|
| 121 | 121 | |
| 122 | 122 | // Retrieve items by type. |
| 123 | - if ( ! in_array( 'any', $request['type'] ) ) { |
|
| 123 | + if (!in_array('any', $request['type'])) { |
|
| 124 | 124 | |
| 125 | - if ( empty( $query_args['meta_query'] ) ) { |
|
| 125 | + if (empty($query_args['meta_query'])) { |
|
| 126 | 126 | $query_args['meta_query'] = array(); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | $query_args['meta_query'][] = array( |
| 130 | 130 | 'key' => '_wpi_discount_type', |
| 131 | - 'value' => implode( ',', $request['type'] ), |
|
| 131 | + 'value' => implode(',', $request['type']), |
|
| 132 | 132 | 'compare' => 'IN', |
| 133 | 133 | ); |
| 134 | 134 | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - return apply_filters( 'getpaid_rest_discounts_prepare_items_query', $query_args, $request, $this ); |
|
| 137 | + return apply_filters('getpaid_rest_discounts_prepare_items_query', $query_args, $request, $this); |
|
| 138 | 138 | |
| 139 | 139 | } |
| 140 | 140 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @return array A list of registered item statuses. |
| 147 | 147 | */ |
| 148 | 148 | public function get_post_statuses() { |
| 149 | - return array( 'publish', 'pending', 'draft', 'expired' ); |
|
| 149 | + return array('publish', 'pending', 'draft', 'expired'); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | } |
@@ -9,172 +9,172 @@ |
||
| 9 | 9 | * @version 1.0.19 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -defined( 'ABSPATH' ) || exit; |
|
| 12 | +defined('ABSPATH') || exit; |
|
| 13 | 13 | |
| 14 | 14 | return array( |
| 15 | 15 | |
| 16 | 16 | 'id' => array( |
| 17 | - 'description' => __( 'Unique identifier for the discount.', 'invoicing' ), |
|
| 17 | + 'description' => __('Unique identifier for the discount.', 'invoicing'), |
|
| 18 | 18 | 'type' => 'integer', |
| 19 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
| 19 | + 'context' => array('view', 'edit', 'embed'), |
|
| 20 | 20 | 'readonly' => true, |
| 21 | 21 | ), |
| 22 | 22 | |
| 23 | 23 | 'status' => array( |
| 24 | - 'description' => __( 'A named status for the discount.', 'invoicing' ), |
|
| 24 | + 'description' => __('A named status for the discount.', 'invoicing'), |
|
| 25 | 25 | 'type' => 'string', |
| 26 | - 'enum' => array( 'publish', 'pending', 'draft', 'expired' ), |
|
| 26 | + 'enum' => array('publish', 'pending', 'draft', 'expired'), |
|
| 27 | 27 | 'default' => 'draft', |
| 28 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
| 28 | + 'context' => array('view', 'edit', 'embed'), |
|
| 29 | 29 | ), |
| 30 | 30 | |
| 31 | 31 | 'version' => array( |
| 32 | - 'description' => __( 'Plugin version when the discount was created.', 'invoicing' ), |
|
| 32 | + 'description' => __('Plugin version when the discount was created.', 'invoicing'), |
|
| 33 | 33 | 'type' => 'string', |
| 34 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
| 34 | + 'context' => array('view', 'edit', 'embed'), |
|
| 35 | 35 | 'readonly' => true, |
| 36 | 36 | ), |
| 37 | 37 | |
| 38 | 38 | 'date_created' => array( |
| 39 | - 'description' => __( "The date the discount was created, in the site's timezone.", 'invoicing' ), |
|
| 39 | + 'description' => __("The date the discount was created, in the site's timezone.", 'invoicing'), |
|
| 40 | 40 | 'type' => 'string', |
| 41 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
| 41 | + 'context' => array('view', 'edit', 'embed'), |
|
| 42 | 42 | ), |
| 43 | 43 | |
| 44 | 44 | 'date_created_gmt' => array( |
| 45 | - 'description' => __( 'The GMT date the discount was created.', 'invoicing' ), |
|
| 45 | + 'description' => __('The GMT date the discount was created.', 'invoicing'), |
|
| 46 | 46 | 'type' => 'string', |
| 47 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
| 47 | + 'context' => array('view', 'edit', 'embed'), |
|
| 48 | 48 | 'readonly' => true, |
| 49 | 49 | ), |
| 50 | 50 | |
| 51 | 51 | 'date_modified' => array( |
| 52 | - 'description' => __( "The date the discount was last modified, in the site's timezone.", 'invoicing' ), |
|
| 52 | + 'description' => __("The date the discount was last modified, in the site's timezone.", 'invoicing'), |
|
| 53 | 53 | 'type' => 'string', |
| 54 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
| 54 | + 'context' => array('view', 'edit', 'embed'), |
|
| 55 | 55 | 'readonly' => true, |
| 56 | 56 | ), |
| 57 | 57 | |
| 58 | 58 | 'date_modified_gmt' => array( |
| 59 | - 'description' => __( 'The GMT date the discount was last modified.', 'invoicing' ), |
|
| 59 | + 'description' => __('The GMT date the discount was last modified.', 'invoicing'), |
|
| 60 | 60 | 'type' => 'string', |
| 61 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
| 61 | + 'context' => array('view', 'edit', 'embed'), |
|
| 62 | 62 | 'readonly' => true, |
| 63 | 63 | ), |
| 64 | 64 | |
| 65 | 65 | 'name' => array( |
| 66 | - 'description' => __( 'The discount name.', 'invoicing' ), |
|
| 66 | + 'description' => __('The discount name.', 'invoicing'), |
|
| 67 | 67 | 'type' => 'string', |
| 68 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
| 68 | + 'context' => array('view', 'edit', 'embed'), |
|
| 69 | 69 | ), |
| 70 | 70 | |
| 71 | 71 | 'description' => array( |
| 72 | - 'description' => __( 'A description of what the discount is all about.', 'invoicing' ), |
|
| 72 | + 'description' => __('A description of what the discount is all about.', 'invoicing'), |
|
| 73 | 73 | 'type' => 'string', |
| 74 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
| 74 | + 'context' => array('view', 'edit', 'embed'), |
|
| 75 | 75 | ), |
| 76 | 76 | |
| 77 | 77 | 'code' => array( |
| 78 | - 'description' => __( 'The discount code.', 'invoicing' ), |
|
| 78 | + 'description' => __('The discount code.', 'invoicing'), |
|
| 79 | 79 | 'type' => 'string', |
| 80 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
| 80 | + 'context' => array('view', 'edit', 'embed'), |
|
| 81 | 81 | 'required' => true, |
| 82 | 82 | ), |
| 83 | 83 | |
| 84 | 84 | 'type' => array( |
| 85 | - 'description' => __( 'The type of discount.', 'invoicing' ), |
|
| 85 | + 'description' => __('The type of discount.', 'invoicing'), |
|
| 86 | 86 | 'type' => 'string', |
| 87 | - 'enum' => array_keys( wpinv_get_discount_types() ), |
|
| 88 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
| 87 | + 'enum' => array_keys(wpinv_get_discount_types()), |
|
| 88 | + 'context' => array('view', 'edit', 'embed'), |
|
| 89 | 89 | 'default' => 'percent', |
| 90 | 90 | ), |
| 91 | 91 | |
| 92 | 92 | 'amount' => array( |
| 93 | - 'description' => __( 'The discount value.', 'invoicing' ), |
|
| 93 | + 'description' => __('The discount value.', 'invoicing'), |
|
| 94 | 94 | 'type' => 'number', |
| 95 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
| 95 | + 'context' => array('view', 'edit', 'embed'), |
|
| 96 | 96 | 'required' => true, |
| 97 | 97 | ), |
| 98 | 98 | |
| 99 | 99 | 'formatted_amount' => array( |
| 100 | - 'description' => __( 'The formatted discount value.', 'invoicing' ), |
|
| 100 | + 'description' => __('The formatted discount value.', 'invoicing'), |
|
| 101 | 101 | 'type' => 'string', |
| 102 | - 'context' => array( 'view', 'edit', 'embed' ), |
|
| 102 | + 'context' => array('view', 'edit', 'embed'), |
|
| 103 | 103 | 'readonly' => true, |
| 104 | 104 | ), |
| 105 | 105 | |
| 106 | 106 | 'uses' => array( |
| 107 | - 'description' => __( 'The number of times the discount has been used.', 'invoicing' ), |
|
| 107 | + 'description' => __('The number of times the discount has been used.', 'invoicing'), |
|
| 108 | 108 | 'type' => 'integer', |
| 109 | - 'context' => array( 'view', 'embed' ), |
|
| 109 | + 'context' => array('view', 'embed'), |
|
| 110 | 110 | 'readonly' => true, |
| 111 | 111 | ), |
| 112 | 112 | |
| 113 | 113 | 'max_uses' => array( |
| 114 | - 'description' => __( 'The maximum number of times the discount can be used.', 'invoicing' ), |
|
| 114 | + 'description' => __('The maximum number of times the discount can be used.', 'invoicing'), |
|
| 115 | 115 | 'type' => 'integer', |
| 116 | - 'context' => array( 'view', 'edit' ), |
|
| 116 | + 'context' => array('view', 'edit'), |
|
| 117 | 117 | ), |
| 118 | 118 | |
| 119 | 119 | 'usage' => array( |
| 120 | - 'description' => __( "The discount's usage, i.e uses / max uses.", 'invoicing' ), |
|
| 120 | + 'description' => __("The discount's usage, i.e uses / max uses.", 'invoicing'), |
|
| 121 | 121 | 'type' => 'string', |
| 122 | - 'context' => array( 'view', 'embed' ), |
|
| 122 | + 'context' => array('view', 'embed'), |
|
| 123 | 123 | 'readonly' => true, |
| 124 | 124 | ), |
| 125 | 125 | |
| 126 | 126 | 'is_single_use' => array( |
| 127 | - 'description' => __( 'Whether or not the discount can only be used once per user.', 'invoicing' ), |
|
| 127 | + 'description' => __('Whether or not the discount can only be used once per user.', 'invoicing'), |
|
| 128 | 128 | 'type' => 'boolean', |
| 129 | - 'context' => array( 'view', 'edit' ), |
|
| 129 | + 'context' => array('view', 'edit'), |
|
| 130 | 130 | ), |
| 131 | 131 | |
| 132 | 132 | 'is_recurring' => array( |
| 133 | - 'description' => __( 'Whether or not the discount applies to the initial payment only or all recurring payments.', 'invoicing' ), |
|
| 133 | + 'description' => __('Whether or not the discount applies to the initial payment only or all recurring payments.', 'invoicing'), |
|
| 134 | 134 | 'type' => 'boolean', |
| 135 | - 'context' => array( 'view', 'edit' ), |
|
| 135 | + 'context' => array('view', 'edit'), |
|
| 136 | 136 | ), |
| 137 | 137 | |
| 138 | 138 | 'start_date' => array( |
| 139 | - 'description' => __( 'The start date for the discount in the format of yyyy-mm-dd hh:mm:ss. If provided, the discount can only be used after or on this date.', 'invoicing' ), |
|
| 139 | + 'description' => __('The start date for the discount in the format of yyyy-mm-dd hh:mm:ss. If provided, the discount can only be used after or on this date.', 'invoicing'), |
|
| 140 | 140 | 'type' => 'string', |
| 141 | - 'context' => array( 'view', 'edit' ), |
|
| 141 | + 'context' => array('view', 'edit'), |
|
| 142 | 142 | ), |
| 143 | 143 | |
| 144 | 144 | 'end_date' => array( |
| 145 | - 'description' => __( 'The expiration date for the discount.', 'invoicing' ), |
|
| 145 | + 'description' => __('The expiration date for the discount.', 'invoicing'), |
|
| 146 | 146 | 'type' => 'string', |
| 147 | - 'context' => array( 'view', 'edit' ), |
|
| 147 | + 'context' => array('view', 'edit'), |
|
| 148 | 148 | ), |
| 149 | 149 | |
| 150 | 150 | 'allowed_items' => array( |
| 151 | - 'description' => __( 'Items which are allowed to use this discount. Leave blank to enable for all items.', 'invoicing' ), |
|
| 151 | + 'description' => __('Items which are allowed to use this discount. Leave blank to enable for all items.', 'invoicing'), |
|
| 152 | 152 | 'type' => 'array', |
| 153 | - 'context' => array( 'view', 'edit' ), |
|
| 153 | + 'context' => array('view', 'edit'), |
|
| 154 | 154 | 'items' => array( |
| 155 | 155 | 'type' => 'integer' |
| 156 | 156 | ) |
| 157 | 157 | ), |
| 158 | 158 | |
| 159 | 159 | 'excluded_items' => array( |
| 160 | - 'description' => __( 'Items which are NOT allowed to use this discount.', 'invoicing' ), |
|
| 160 | + 'description' => __('Items which are NOT allowed to use this discount.', 'invoicing'), |
|
| 161 | 161 | 'type' => 'array', |
| 162 | - 'context' => array( 'view', 'edit' ), |
|
| 162 | + 'context' => array('view', 'edit'), |
|
| 163 | 163 | 'items' => array( |
| 164 | 164 | 'type' => 'integer' |
| 165 | 165 | ) |
| 166 | 166 | ), |
| 167 | 167 | |
| 168 | 168 | 'minimum_total' => array( |
| 169 | - 'description' => __( 'The minimum total needed to use this invoice.', 'invoicing' ), |
|
| 169 | + 'description' => __('The minimum total needed to use this invoice.', 'invoicing'), |
|
| 170 | 170 | 'type' => 'number', |
| 171 | - 'context' => array( 'view', 'edit' ), |
|
| 171 | + 'context' => array('view', 'edit'), |
|
| 172 | 172 | ), |
| 173 | 173 | |
| 174 | 174 | 'maximum_total' => array( |
| 175 | - 'description' => __( 'The maximum total needed to use this invoice.', 'invoicing' ), |
|
| 175 | + 'description' => __('The maximum total needed to use this invoice.', 'invoicing'), |
|
| 176 | 176 | 'type' => 'number', |
| 177 | - 'context' => array( 'view', 'edit' ), |
|
| 177 | + 'context' => array('view', 'edit'), |
|
| 178 | 178 | ), |
| 179 | 179 | |
| 180 | 180 | ); |
@@ -1,26 +1,26 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 3 | +if (!defined('WP_UNINSTALL_PLUGIN')) { |
|
| 4 | 4 | exit; |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | global $wpdb; |
| 8 | 8 | |
| 9 | -if ( get_option( 'wpinv_remove_data_on_invoice_unistall' ) ) { |
|
| 9 | +if (get_option('wpinv_remove_data_on_invoice_unistall')) { |
|
| 10 | 10 | |
| 11 | 11 | // Fetch settings. |
| 12 | - $settings = get_option( 'wpinv_settings' ); |
|
| 12 | + $settings = get_option('wpinv_settings'); |
|
| 13 | 13 | |
| 14 | 14 | // Delete pages. |
| 15 | - $pages = array( 'checkout_page', 'success_page', 'failure_page', 'invoice_history_page', 'quote_history_page', 'invoice_subscription_page' ); |
|
| 16 | - foreach ( $pages as $page ) { |
|
| 17 | - if ( is_array( $settings ) && ! empty( $settings[ $page ] ) ) { |
|
| 18 | - wp_delete_post( $settings[ $page ], true ); |
|
| 15 | + $pages = array('checkout_page', 'success_page', 'failure_page', 'invoice_history_page', 'quote_history_page', 'invoice_subscription_page'); |
|
| 16 | + foreach ($pages as $page) { |
|
| 17 | + if (is_array($settings) && !empty($settings[$page])) { |
|
| 18 | + wp_delete_post($settings[$page], true); |
|
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | // Delete options. |
| 23 | - $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'wpinv\_%';" ); |
|
| 23 | + $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE 'wpinv\_%';"); |
|
| 24 | 24 | |
| 25 | 25 | // Delete posts. |
| 26 | 26 | $wpdb->query( |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | 51 | // Cleanup Cron Schedule |
| 52 | - wp_clear_scheduled_hook( 'wp_session_garbage_collection' ); |
|
| 53 | - wp_clear_scheduled_hook( 'wpinv_register_schedule_event_twicedaily' ); |
|
| 54 | - wp_clear_scheduled_hook( 'wpinv_register_schedule_event_daily' ); |
|
| 52 | + wp_clear_scheduled_hook('wp_session_garbage_collection'); |
|
| 53 | + wp_clear_scheduled_hook('wpinv_register_schedule_event_twicedaily'); |
|
| 54 | + wp_clear_scheduled_hook('wpinv_register_schedule_event_daily'); |
|
| 55 | 55 | |
| 56 | 56 | // Clear any cached data that has been removed |
| 57 | 57 | wp_cache_flush(); |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | "{$wpdb->prefix}getpaid_invoice_items", |
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | - foreach ( $tables as $table ) { |
|
| 67 | - $wpdb->query( "DROP TABLE IF EXISTS {$table}" ); |
|
| 66 | + foreach ($tables as $table) { |
|
| 67 | + $wpdb->query("DROP TABLE IF EXISTS {$table}"); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @version 1.0.19 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -defined( 'ABSPATH' ) || exit; |
|
| 11 | +defined('ABSPATH') || exit; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Core class to access posts via the REST API. |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | // Register REST routes. |
| 67 | - add_action( 'rest_api_init', array( $this, 'register_routes' ) ); |
|
| 67 | + add_action('rest_api_init', array($this, 'register_routes')); |
|
| 68 | 68 | |
| 69 | 69 | } |
| 70 | 70 | |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function register_routes() { |
| 78 | 78 | |
| 79 | - foreach ( $this->namespaces as $namespace ) { |
|
| 80 | - $this->register_namespace_routes( $namespace ); |
|
| 79 | + foreach ($this->namespaces as $namespace) { |
|
| 80 | + $this->register_namespace_routes($namespace); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | } |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @param string $namespace |
| 91 | 91 | */ |
| 92 | - public function register_namespace_routes( /** @scrutinizer ignore-unused */ $namespace ) { |
|
| 92 | + public function register_namespace_routes(/** @scrutinizer ignore-unused */ $namespace) { |
|
| 93 | 93 | |
| 94 | 94 | getpaid_doing_it_wrong( |
| 95 | - __CLASS__ . '::' .__METHOD__, |
|
| 95 | + __CLASS__ . '::' . __METHOD__, |
|
| 96 | 96 | /* translators: %s: register_namespace_routes() */ |
| 97 | - sprintf( __( "Method '%s' must be overridden." ), __METHOD__ ), |
|
| 97 | + sprintf(__("Method '%s' must be overridden."), __METHOD__), |
|
| 98 | 98 | '1.0.19' |
| 99 | 99 | ); |
| 100 | 100 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @return string |
| 107 | 107 | */ |
| 108 | 108 | protected function get_normalized_rest_base() { |
| 109 | - return preg_replace( '/\(.*\)\//i', '', $this->rest_base ); |
|
| 109 | + return preg_replace('/\(.*\)\//i', '', $this->rest_base); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | * @param array array of request items. |
| 116 | 116 | * @return array |
| 117 | 117 | */ |
| 118 | - protected function fill_batch_keys( $items ) { |
|
| 118 | + protected function fill_batch_keys($items) { |
|
| 119 | 119 | |
| 120 | - $items['create'] = empty( $items['create'] ) ? array() : $items['create']; |
|
| 121 | - $items['update'] = empty( $items['update'] ) ? array() : $items['update']; |
|
| 122 | - $items['delete'] = empty( $items['delete'] ) ? array() : wp_parse_id_list( $items['delete'] ); |
|
| 120 | + $items['create'] = empty($items['create']) ? array() : $items['create']; |
|
| 121 | + $items['update'] = empty($items['update']) ? array() : $items['update']; |
|
| 122 | + $items['delete'] = empty($items['delete']) ? array() : wp_parse_id_list($items['delete']); |
|
| 123 | 123 | return $items; |
| 124 | 124 | |
| 125 | 125 | } |
@@ -130,13 +130,13 @@ discard block |
||
| 130 | 130 | * @param array $items Request items. |
| 131 | 131 | * @return bool|WP_Error |
| 132 | 132 | */ |
| 133 | - protected function check_batch_limit( $items ) { |
|
| 134 | - $limit = apply_filters( 'getpaid_rest_batch_items_limit', 100, $this->get_normalized_rest_base() ); |
|
| 135 | - $total = count( $items['create'] ) + count( $items['update'] ) + count( $items['delete'] ); |
|
| 133 | + protected function check_batch_limit($items) { |
|
| 134 | + $limit = apply_filters('getpaid_rest_batch_items_limit', 100, $this->get_normalized_rest_base()); |
|
| 135 | + $total = count($items['create']) + count($items['update']) + count($items['delete']); |
|
| 136 | 136 | |
| 137 | - if ( $total > $limit ) { |
|
| 137 | + if ($total > $limit) { |
|
| 138 | 138 | /* translators: %s: items limit */ |
| 139 | - return new WP_Error( 'getpaid_rest_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'invoicing' ), $limit ), array( 'status' => 413 ) ); |
|
| 139 | + return new WP_Error('getpaid_rest_request_entity_too_large', sprintf(__('Unable to accept more than %s items for this request.', 'invoicing'), $limit), array('status' => 413)); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | return true; |
@@ -150,37 +150,37 @@ discard block |
||
| 150 | 150 | * @param WP_REST_Server $wp_rest_server |
| 151 | 151 | * @return array() |
| 152 | 152 | */ |
| 153 | - protected function batch_create_items( $items, $request, $wp_rest_server ) { |
|
| 153 | + protected function batch_create_items($items, $request, $wp_rest_server) { |
|
| 154 | 154 | |
| 155 | 155 | $query = $request->get_query_params(); |
| 156 | 156 | $create = array(); |
| 157 | 157 | |
| 158 | - foreach ( $items as $item ) { |
|
| 159 | - $_item = new WP_REST_Request( 'POST' ); |
|
| 158 | + foreach ($items as $item) { |
|
| 159 | + $_item = new WP_REST_Request('POST'); |
|
| 160 | 160 | |
| 161 | 161 | // Default parameters. |
| 162 | 162 | $defaults = array(); |
| 163 | 163 | $schema = $this->get_public_item_schema(); |
| 164 | - foreach ( $schema['properties'] as $arg => $options ) { |
|
| 165 | - if ( isset( $options['default'] ) ) { |
|
| 166 | - $defaults[ $arg ] = $options['default']; |
|
| 164 | + foreach ($schema['properties'] as $arg => $options) { |
|
| 165 | + if (isset($options['default'])) { |
|
| 166 | + $defaults[$arg] = $options['default']; |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | - $_item->set_default_params( $defaults ); |
|
| 169 | + $_item->set_default_params($defaults); |
|
| 170 | 170 | |
| 171 | 171 | // Set request parameters. |
| 172 | - $_item->set_body_params( $item ); |
|
| 172 | + $_item->set_body_params($item); |
|
| 173 | 173 | |
| 174 | 174 | // Set query (GET) parameters. |
| 175 | - $_item->set_query_params( $query ); |
|
| 175 | + $_item->set_query_params($query); |
|
| 176 | 176 | |
| 177 | 177 | // Create the item. |
| 178 | - $_response = $this->create_item( $_item ); |
|
| 178 | + $_response = $this->create_item($_item); |
|
| 179 | 179 | |
| 180 | 180 | // If an error occured... |
| 181 | - if ( is_wp_error( $_response ) ) { |
|
| 181 | + if (is_wp_error($_response)) { |
|
| 182 | 182 | |
| 183 | - $create[] = array( |
|
| 183 | + $create[] = array( |
|
| 184 | 184 | 'id' => 0, |
| 185 | 185 | 'error' => array( |
| 186 | 186 | 'code' => $_response->get_error_code(), |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | continue; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $create[] = $wp_rest_server->response_to_data( /** @scrutinizer ignore-type */ $_response, false ); |
|
| 195 | + $create[] = $wp_rest_server->response_to_data(/** @scrutinizer ignore-type */ $_response, false); |
|
| 196 | 196 | |
| 197 | 197 | } |
| 198 | 198 | |
@@ -208,27 +208,27 @@ discard block |
||
| 208 | 208 | * @param WP_REST_Server $wp_rest_server |
| 209 | 209 | * @return array() |
| 210 | 210 | */ |
| 211 | - protected function batch_update_items( $items, $request, $wp_rest_server ) { |
|
| 211 | + protected function batch_update_items($items, $request, $wp_rest_server) { |
|
| 212 | 212 | |
| 213 | 213 | $query = $request->get_query_params(); |
| 214 | 214 | $update = array(); |
| 215 | 215 | |
| 216 | - foreach ( $items as $item ) { |
|
| 216 | + foreach ($items as $item) { |
|
| 217 | 217 | |
| 218 | 218 | // Create a dummy request. |
| 219 | - $_item = new WP_REST_Request( 'PUT' ); |
|
| 219 | + $_item = new WP_REST_Request('PUT'); |
|
| 220 | 220 | |
| 221 | 221 | // Add body params. |
| 222 | - $_item->set_body_params( $item ); |
|
| 222 | + $_item->set_body_params($item); |
|
| 223 | 223 | |
| 224 | 224 | // Set query (GET) parameters. |
| 225 | - $_item->set_query_params( $query ); |
|
| 225 | + $_item->set_query_params($query); |
|
| 226 | 226 | |
| 227 | 227 | // Update the item. |
| 228 | - $_response = $this->update_item( $_item ); |
|
| 228 | + $_response = $this->update_item($_item); |
|
| 229 | 229 | |
| 230 | 230 | // If an error occured... |
| 231 | - if ( is_wp_error( $_response ) ) { |
|
| 231 | + if (is_wp_error($_response)) { |
|
| 232 | 232 | |
| 233 | 233 | $update[] = array( |
| 234 | 234 | 'id' => $item['id'], |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $update[] = $wp_rest_server->response_to_data( /** @scrutinizer ignore-type */ $_response, false ); |
|
| 246 | + $update[] = $wp_rest_server->response_to_data(/** @scrutinizer ignore-type */ $_response, false); |
|
| 247 | 247 | |
| 248 | 248 | } |
| 249 | 249 | |
@@ -258,14 +258,14 @@ discard block |
||
| 258 | 258 | * @param WP_REST_Server $wp_rest_server |
| 259 | 259 | * @return array() |
| 260 | 260 | */ |
| 261 | - protected function batch_delete_items( $items, $wp_rest_server ) { |
|
| 261 | + protected function batch_delete_items($items, $wp_rest_server) { |
|
| 262 | 262 | |
| 263 | 263 | $delete = array(); |
| 264 | 264 | |
| 265 | - foreach ( array_filter( $items ) as $id ) { |
|
| 265 | + foreach (array_filter($items) as $id) { |
|
| 266 | 266 | |
| 267 | 267 | // Prepare the request. |
| 268 | - $_item = new WP_REST_Request( 'DELETE' ); |
|
| 268 | + $_item = new WP_REST_Request('DELETE'); |
|
| 269 | 269 | $_item->set_query_params( |
| 270 | 270 | array( |
| 271 | 271 | 'id' => $id, |
@@ -274,9 +274,9 @@ discard block |
||
| 274 | 274 | ); |
| 275 | 275 | |
| 276 | 276 | // Delete the item. |
| 277 | - $_response = $this->delete_item( $_item ); |
|
| 277 | + $_response = $this->delete_item($_item); |
|
| 278 | 278 | |
| 279 | - if ( is_wp_error( $_response ) ) { |
|
| 279 | + if (is_wp_error($_response)) { |
|
| 280 | 280 | |
| 281 | 281 | $delete[] = array( |
| 282 | 282 | 'id' => $id, |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | continue; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - $delete[] = $wp_rest_server->response_to_data( /** @scrutinizer ignore-type */ $_response, false ); |
|
| 293 | + $delete[] = $wp_rest_server->response_to_data(/** @scrutinizer ignore-type */ $_response, false); |
|
| 294 | 294 | |
| 295 | 295 | } |
| 296 | 296 | |
@@ -304,23 +304,23 @@ discard block |
||
| 304 | 304 | * @param WP_REST_Request $request Full details about the request. |
| 305 | 305 | * @return WP_Error|array. |
| 306 | 306 | */ |
| 307 | - public function batch_items( $request ) { |
|
| 307 | + public function batch_items($request) { |
|
| 308 | 308 | global $wp_rest_server; |
| 309 | 309 | |
| 310 | 310 | // Prepare the batch items. |
| 311 | - $items = $this->fill_batch_keys( array_filter( $request->get_params() ) ); |
|
| 311 | + $items = $this->fill_batch_keys(array_filter($request->get_params())); |
|
| 312 | 312 | |
| 313 | 313 | // Ensure that the batch has not exceeded the limit to prevent abuse. |
| 314 | - $limit = $this->check_batch_limit( $items ); |
|
| 315 | - if ( is_wp_error( $limit ) ) { |
|
| 314 | + $limit = $this->check_batch_limit($items); |
|
| 315 | + if (is_wp_error($limit)) { |
|
| 316 | 316 | return $limit; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | // Process the items. |
| 320 | 320 | return array( |
| 321 | - 'create' => $this->batch_create_items( $items['create'], $request, $wp_rest_server ), |
|
| 322 | - 'update' => $this->batch_update_items( $items['update'], $request, $wp_rest_server ), |
|
| 323 | - 'delete' => $this->batch_delete_items( $items['delete'], $wp_rest_server ), |
|
| 321 | + 'create' => $this->batch_create_items($items['create'], $request, $wp_rest_server), |
|
| 322 | + 'update' => $this->batch_update_items($items['update'], $request, $wp_rest_server), |
|
| 323 | + 'delete' => $this->batch_delete_items($items['delete'], $wp_rest_server), |
|
| 324 | 324 | ); |
| 325 | 325 | |
| 326 | 326 | } |
@@ -333,8 +333,8 @@ discard block |
||
| 333 | 333 | * @param array $meta_query Meta query. |
| 334 | 334 | * @return array |
| 335 | 335 | */ |
| 336 | - protected function add_meta_query( $args, $meta_query ) { |
|
| 337 | - if ( empty( $args['meta_query'] ) ) { |
|
| 336 | + protected function add_meta_query($args, $meta_query) { |
|
| 337 | + if (empty($args['meta_query'])) { |
|
| 338 | 338 | $args['meta_query'] = array(); |
| 339 | 339 | } |
| 340 | 340 | |
@@ -356,25 +356,25 @@ discard block |
||
| 356 | 356 | 'type' => 'object', |
| 357 | 357 | 'properties' => array( |
| 358 | 358 | 'create' => array( |
| 359 | - 'description' => __( 'List of created resources.', 'invoicing' ), |
|
| 359 | + 'description' => __('List of created resources.', 'invoicing'), |
|
| 360 | 360 | 'type' => 'array', |
| 361 | - 'context' => array( 'view', 'edit' ), |
|
| 361 | + 'context' => array('view', 'edit'), |
|
| 362 | 362 | 'items' => array( |
| 363 | 363 | 'type' => 'object', |
| 364 | 364 | ), |
| 365 | 365 | ), |
| 366 | 366 | 'update' => array( |
| 367 | - 'description' => __( 'List of updated resources.', 'invoicing' ), |
|
| 367 | + 'description' => __('List of updated resources.', 'invoicing'), |
|
| 368 | 368 | 'type' => 'array', |
| 369 | - 'context' => array( 'view', 'edit' ), |
|
| 369 | + 'context' => array('view', 'edit'), |
|
| 370 | 370 | 'items' => array( |
| 371 | 371 | 'type' => 'object', |
| 372 | 372 | ), |
| 373 | 373 | ), |
| 374 | 374 | 'delete' => array( |
| 375 | - 'description' => __( 'List of deleted resources.', 'invoicing' ), |
|
| 375 | + 'description' => __('List of deleted resources.', 'invoicing'), |
|
| 376 | 376 | 'type' => 'array', |
| 377 | - 'context' => array( 'view', 'edit' ), |
|
| 377 | + 'context' => array('view', 'edit'), |
|
| 378 | 378 | 'items' => array( |
| 379 | 379 | 'type' => 'integer', |
| 380 | 380 | ), |
@@ -395,13 +395,13 @@ discard block |
||
| 395 | 395 | protected function get_schema_properties() { |
| 396 | 396 | |
| 397 | 397 | $schema = $this->get_item_schema(); |
| 398 | - $properties = isset( $schema['properties'] ) ? $schema['properties'] : array(); |
|
| 398 | + $properties = isset($schema['properties']) ? $schema['properties'] : array(); |
|
| 399 | 399 | |
| 400 | 400 | // For back-compat, include any field with an empty schema |
| 401 | 401 | // because it won't be present in $this->get_item_schema(). |
| 402 | - foreach ( $this->get_additional_fields() as $field_name => $field_options ) { |
|
| 403 | - if ( is_null( $field_options['schema'] ) ) { |
|
| 404 | - $properties[ $field_name ] = $field_options; |
|
| 402 | + foreach ($this->get_additional_fields() as $field_name => $field_options) { |
|
| 403 | + if (is_null($field_options['schema'])) { |
|
| 404 | + $properties[$field_name] = $field_options; |
|
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | 407 | |
@@ -416,15 +416,15 @@ discard block |
||
| 416 | 416 | * @since 1.0.19 |
| 417 | 417 | * @return array |
| 418 | 418 | */ |
| 419 | - protected function filter_response_fields_by_context( $fields, $context ) { |
|
| 419 | + protected function filter_response_fields_by_context($fields, $context) { |
|
| 420 | 420 | |
| 421 | - if ( empty( $context ) ) { |
|
| 421 | + if (empty($context)) { |
|
| 422 | 422 | return $fields; |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - foreach ( $fields as $name => $options ) { |
|
| 426 | - if ( ! empty( $options['context'] ) && ! in_array( $context, $options['context'], true ) ) { |
|
| 427 | - unset( $fields[ $name ] ); |
|
| 425 | + foreach ($fields as $name => $options) { |
|
| 426 | + if (!empty($options['context']) && !in_array($context, $options['context'], true)) { |
|
| 427 | + unset($fields[$name]); |
|
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | 430 | |
@@ -440,35 +440,35 @@ discard block |
||
| 440 | 440 | * @since 1.0.19 |
| 441 | 441 | * @return array |
| 442 | 442 | */ |
| 443 | - protected function filter_response_fields_by_array( $fields, $requested ) { |
|
| 443 | + protected function filter_response_fields_by_array($fields, $requested) { |
|
| 444 | 444 | |
| 445 | 445 | // Trim off any whitespace from the list array. |
| 446 | - $requested = array_map( 'trim', $requested ); |
|
| 446 | + $requested = array_map('trim', $requested); |
|
| 447 | 447 | |
| 448 | 448 | // Always persist 'id', because it can be needed for add_additional_fields_to_object(). |
| 449 | - if ( in_array( 'id', $fields, true ) ) { |
|
| 449 | + if (in_array('id', $fields, true)) { |
|
| 450 | 450 | $requested[] = 'id'; |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | // Get rid of duplicate fields. |
| 454 | - $requested = array_unique( $requested ); |
|
| 454 | + $requested = array_unique($requested); |
|
| 455 | 455 | |
| 456 | 456 | // Return the list of all included fields which are available. |
| 457 | 457 | return array_reduce( |
| 458 | 458 | $requested, |
| 459 | - function( $response_fields, $field ) use ( $fields ) { |
|
| 459 | + function($response_fields, $field) use ($fields) { |
|
| 460 | 460 | |
| 461 | - if ( in_array( $field, $fields, true ) ) { |
|
| 461 | + if (in_array($field, $fields, true)) { |
|
| 462 | 462 | $response_fields[] = $field; |
| 463 | 463 | return $response_fields; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | // Check for nested fields if $field is not a direct match. |
| 467 | - $nested_fields = explode( '.', $field ); |
|
| 467 | + $nested_fields = explode('.', $field); |
|
| 468 | 468 | |
| 469 | 469 | // A nested field is included so long as its top-level property is |
| 470 | 470 | // present in the schema. |
| 471 | - if ( in_array( $nested_fields[0], $fields, true ) ) { |
|
| 471 | + if (in_array($nested_fields[0], $fields, true)) { |
|
| 472 | 472 | $response_fields[] = $field; |
| 473 | 473 | } |
| 474 | 474 | |
@@ -489,23 +489,23 @@ discard block |
||
| 489 | 489 | * @param WP_REST_Request $request Full details about the request. |
| 490 | 490 | * @return array Fields to be included in the response. |
| 491 | 491 | */ |
| 492 | - public function get_fields_for_response( $request ) { |
|
| 492 | + public function get_fields_for_response($request) { |
|
| 493 | 493 | |
| 494 | 494 | // Retrieve fields in the schema. |
| 495 | 495 | $properties = $this->get_schema_properties(); |
| 496 | 496 | |
| 497 | 497 | // Exclude fields that specify a different context than the request context. |
| 498 | - $properties = $this->filter_response_fields_by_context( $properties, $request['context'] ); |
|
| 498 | + $properties = $this->filter_response_fields_by_context($properties, $request['context']); |
|
| 499 | 499 | |
| 500 | 500 | // We only need the field keys. |
| 501 | - $fields = array_keys( $properties ); |
|
| 501 | + $fields = array_keys($properties); |
|
| 502 | 502 | |
| 503 | 503 | // Is the user filtering the response fields?? |
| 504 | - if ( empty( $request['_fields'] ) ) { |
|
| 504 | + if (empty($request['_fields'])) { |
|
| 505 | 505 | return $fields; |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | - return $this->filter_response_fields_by_array( $fields, wpinv_parse_list( $request['_fields'] ) ); |
|
| 508 | + return $this->filter_response_fields_by_array($fields, wpinv_parse_list($request['_fields'])); |
|
| 509 | 509 | |
| 510 | 510 | } |
| 511 | 511 | |
@@ -519,32 +519,32 @@ discard block |
||
| 519 | 519 | * @param array $fields Requested fields. |
| 520 | 520 | * @return array Fields to be included in the response. |
| 521 | 521 | */ |
| 522 | - public function limit_object_to_requested_fields( $data, $fields, $prefix = '' ) { |
|
| 522 | + public function limit_object_to_requested_fields($data, $fields, $prefix = '') { |
|
| 523 | 523 | |
| 524 | 524 | // Is the user filtering the response fields?? |
| 525 | - if ( empty( $fields ) ) { |
|
| 525 | + if (empty($fields)) { |
|
| 526 | 526 | return $data; |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | - foreach ( $data as $key => $value ) { |
|
| 529 | + foreach ($data as $key => $value) { |
|
| 530 | 530 | |
| 531 | 531 | // Numeric arrays. |
| 532 | - if ( is_numeric( $key ) && is_array( $value ) ) { |
|
| 533 | - $data[ $key ] = $this->limit_object_to_requested_fields( $value, $fields, $prefix ); |
|
| 532 | + if (is_numeric($key) && is_array($value)) { |
|
| 533 | + $data[$key] = $this->limit_object_to_requested_fields($value, $fields, $prefix); |
|
| 534 | 534 | continue; |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | // Generate a new prefix. |
| 538 | - $new_prefix = empty( $prefix ) ? $key : "$prefix.$key"; |
|
| 538 | + $new_prefix = empty($prefix) ? $key : "$prefix.$key"; |
|
| 539 | 539 | |
| 540 | 540 | // Check if it was requested. |
| 541 | - if ( ! empty( $key ) && ! $this->is_field_included( $new_prefix, $fields ) ) { |
|
| 542 | - unset( $data[ $key ] ); |
|
| 541 | + if (!empty($key) && !$this->is_field_included($new_prefix, $fields)) { |
|
| 542 | + unset($data[$key]); |
|
| 543 | 543 | continue; |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | - if ( $key != 'meta_data' && is_array( $value ) ) { |
|
| 547 | - $data[ $key ] = $this->limit_object_to_requested_fields( $value, $fields, $new_prefix ); |
|
| 546 | + if ($key != 'meta_data' && is_array($value)) { |
|
| 547 | + $data[$key] = $this->limit_object_to_requested_fields($value, $fields, $new_prefix); |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | } |
@@ -566,20 +566,20 @@ discard block |
||
| 566 | 566 | * @return bool Whether to include the field or not. |
| 567 | 567 | * @see rest_is_field_included() |
| 568 | 568 | */ |
| 569 | - public function is_field_included( $field, $fields ) { |
|
| 570 | - if ( in_array( $field, $fields, true ) ) { |
|
| 569 | + public function is_field_included($field, $fields) { |
|
| 570 | + if (in_array($field, $fields, true)) { |
|
| 571 | 571 | return true; |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | - foreach ( $fields as $accepted_field ) { |
|
| 574 | + foreach ($fields as $accepted_field) { |
|
| 575 | 575 | // Check to see if $field is the parent of any item in $fields. |
| 576 | 576 | // A field "parent" should be accepted if "parent.child" is accepted. |
| 577 | - if ( strpos( $accepted_field, "$field." ) === 0 ) { |
|
| 577 | + if (strpos($accepted_field, "$field.") === 0) { |
|
| 578 | 578 | return true; |
| 579 | 579 | } |
| 580 | 580 | // Conversely, if "parent" is accepted, all "parent.child" fields |
| 581 | 581 | // should also be accepted. |
| 582 | - if ( strpos( $field, "$accepted_field." ) === 0 ) { |
|
| 582 | + if (strpos($field, "$accepted_field.") === 0) { |
|
| 583 | 583 | return true; |
| 584 | 584 | } |
| 585 | 585 | } |