@@ -14,543 +14,543 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class WPInv_Plugin { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * GetPaid version. |
|
| 19 | - * |
|
| 20 | - * @var string |
|
| 21 | - */ |
|
| 22 | - public $version; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * Data container. |
|
| 26 | - * |
|
| 27 | - * @var array |
|
| 28 | - */ |
|
| 29 | - protected $data = array(); |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * Form elements instance. |
|
| 33 | - * |
|
| 34 | - * @var WPInv_Payment_Form_Elements |
|
| 35 | - */ |
|
| 36 | - public $form_elements; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * @param array An array of payment gateways. |
|
| 40 | - */ |
|
| 41 | - public $gateways; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Class constructor. |
|
| 45 | - */ |
|
| 46 | - public function __construct() { |
|
| 47 | - $this->define_constants(); |
|
| 48 | - $this->includes(); |
|
| 49 | - $this->init_hooks(); |
|
| 50 | - $this->set_properties(); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * Sets a custom data property. |
|
| 55 | - * |
|
| 56 | - * @param string $prop The prop to set. |
|
| 57 | - * @param mixed $value The value to retrieve. |
|
| 58 | - */ |
|
| 59 | - public function set( $prop, $value ) { |
|
| 60 | - $this->data[ $prop ] = $value; |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Gets a custom data property. |
|
| 65 | - * |
|
| 66 | - * @param string $prop The prop to set. |
|
| 67 | - * @return mixed The value. |
|
| 68 | - */ |
|
| 69 | - public function get( $prop ) { |
|
| 70 | - |
|
| 71 | - if ( isset( $this->data[ $prop ] ) ) { |
|
| 72 | - return $this->data[ $prop ]; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - return null; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Define class properties. |
|
| 80 | - */ |
|
| 81 | - public function set_properties() { |
|
| 82 | - |
|
| 83 | - // Sessions. |
|
| 84 | - $this->set( 'session', new WPInv_Session_Handler() ); |
|
| 85 | - $GLOBALS['wpi_session'] = $this->get( 'session' ); // Backwards compatibility. |
|
| 86 | - $GLOBALS['wpinv_euvat'] = new WPInv_EUVat(); // Backwards compatibility. |
|
| 87 | - |
|
| 88 | - // Init other objects. |
|
| 89 | - $this->set( 'session', new WPInv_Session_Handler() ); |
|
| 90 | - $this->set( 'notes', new WPInv_Notes() ); |
|
| 91 | - $this->set( 'api', new WPInv_API() ); |
|
| 92 | - $this->set( 'post_types', new GetPaid_Post_Types() ); |
|
| 93 | - $this->set( 'template', new GetPaid_Template() ); |
|
| 94 | - $this->set( 'admin', new GetPaid_Admin() ); |
|
| 95 | - $this->set( 'subscriptions', new WPInv_Subscriptions() ); |
|
| 96 | - $this->set( 'invoice_emails', new GetPaid_Invoice_Notification_Emails() ); |
|
| 97 | - $this->set( 'subscription_emails', new GetPaid_Subscription_Notification_Emails() ); |
|
| 98 | - $this->set( 'daily_maintenace', new GetPaid_Daily_Maintenance() ); |
|
| 99 | - $this->set( 'payment_forms', new GetPaid_Payment_Forms() ); |
|
| 100 | - $this->set( 'maxmind', new GetPaid_MaxMind_Geolocation() ); |
|
| 101 | - |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * Define plugin constants. |
|
| 106 | - */ |
|
| 107 | - public function define_constants() { |
|
| 108 | - define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) ); |
|
| 109 | - define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) ); |
|
| 110 | - $this->version = WPINV_VERSION; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Hook into actions and filters. |
|
| 115 | - * |
|
| 116 | - * @since 1.0.19 |
|
| 117 | - */ |
|
| 118 | - protected function init_hooks() { |
|
| 119 | - /* Internationalize the text strings used. */ |
|
| 120 | - add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) ); |
|
| 121 | - |
|
| 122 | - // Init the plugin after WordPress inits. |
|
| 123 | - add_action( 'init', array( $this, 'init' ), 1 ); |
|
| 124 | - add_action( 'init', array( $this, 'maybe_process_ipn' ), 10 ); |
|
| 125 | - add_action( 'init', array( $this, 'wpinv_actions' ) ); |
|
| 126 | - add_action( 'init', array( $this, 'maybe_do_authenticated_action' ), 100 ); |
|
| 127 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 11 ); |
|
| 128 | - add_action( 'wp_footer', array( $this, 'wp_footer' ) ); |
|
| 129 | - add_action( 'wp_head', array( $this, 'wp_head' ) ); |
|
| 130 | - add_action( 'widgets_init', array( &$this, 'register_widgets' ) ); |
|
| 131 | - add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) ); |
|
| 132 | - add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) ); |
|
| 133 | - |
|
| 134 | - // Fires after registering actions. |
|
| 135 | - do_action( 'wpinv_actions', $this ); |
|
| 136 | - do_action( 'getpaid_actions', $this ); |
|
| 137 | - |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - public function plugins_loaded() { |
|
| 141 | - /* Internationalize the text strings used. */ |
|
| 142 | - $this->load_textdomain(); |
|
| 143 | - |
|
| 144 | - do_action( 'wpinv_loaded' ); |
|
| 145 | - |
|
| 146 | - // Fix oxygen page builder conflict |
|
| 147 | - if ( function_exists( 'ct_css_output' ) ) { |
|
| 148 | - wpinv_oxygen_fix_conflict(); |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * Load the translation of the plugin. |
|
| 154 | - * |
|
| 155 | - * @since 1.0 |
|
| 156 | - */ |
|
| 157 | - public function load_textdomain( $locale = NULL ) { |
|
| 158 | - if ( empty( $locale ) ) { |
|
| 159 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' ); |
|
| 163 | - |
|
| 164 | - unload_textdomain( 'invoicing' ); |
|
| 165 | - load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' ); |
|
| 166 | - load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' ); |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * Define language constants. |
|
| 170 | - */ |
|
| 171 | - require_once( WPINV_PLUGIN_DIR . 'language.php' ); |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Include required core files used in admin and on the frontend. |
|
| 176 | - */ |
|
| 177 | - public function includes() { |
|
| 178 | - |
|
| 179 | - // Start with the settings. |
|
| 180 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' ); |
|
| 181 | - |
|
| 182 | - // Packages/libraries. |
|
| 183 | - require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' ); |
|
| 184 | - require_once( WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php' ); |
|
| 185 | - |
|
| 186 | - // Load functions. |
|
| 187 | - require_once( WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php' ); |
|
| 188 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' ); |
|
| 189 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' ); |
|
| 190 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' ); |
|
| 191 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' ); |
|
| 192 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' ); |
|
| 193 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' ); |
|
| 194 | - require_once( WPINV_PLUGIN_DIR . 'includes/invoice-functions.php' ); |
|
| 195 | - require_once( WPINV_PLUGIN_DIR . 'includes/subscription-functions.php' ); |
|
| 196 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' ); |
|
| 197 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' ); |
|
| 198 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' ); |
|
| 199 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' ); |
|
| 200 | - require_once( WPINV_PLUGIN_DIR . 'includes/user-functions.php' ); |
|
| 201 | - require_once( WPINV_PLUGIN_DIR . 'includes/error-functions.php' ); |
|
| 202 | - |
|
| 203 | - // Register autoloader. |
|
| 204 | - try { |
|
| 205 | - spl_autoload_register( array( $this, 'autoload' ), true ); |
|
| 206 | - } catch ( Exception $e ) { |
|
| 207 | - wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true ); |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' ); |
|
| 211 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' ); |
|
| 212 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' ); |
|
| 213 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' ); |
|
| 214 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' ); |
|
| 215 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' ); |
|
| 216 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' ); |
|
| 217 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' ); |
|
| 218 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' ); |
|
| 219 | - require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' ); |
|
| 220 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' ); |
|
| 221 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' ); |
|
| 222 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' ); |
|
| 223 | - require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' ); |
|
| 224 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' ); |
|
| 225 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' ); |
|
| 226 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' ); |
|
| 227 | - require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' ); |
|
| 228 | - require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' ); |
|
| 229 | - require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' ); |
|
| 230 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' ); |
|
| 231 | - |
|
| 232 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
| 233 | - GetPaid_Post_Types_Admin::init(); |
|
| 234 | - |
|
| 235 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' ); |
|
| 236 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' ); |
|
| 237 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' ); |
|
| 238 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' ); |
|
| 239 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' ); |
|
| 240 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php' ); |
|
| 241 | - // load the user class only on the users.php page |
|
| 242 | - global $pagenow; |
|
| 243 | - if($pagenow=='users.php'){ |
|
| 244 | - new WPInv_Admin_Users(); |
|
| 245 | - } |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - // Register cli commands |
|
| 249 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
| 250 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' ); |
|
| 251 | - WP_CLI::add_command( 'invoicing', 'WPInv_CLI' ); |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - } |
|
| 255 | - |
|
| 256 | - /** |
|
| 257 | - * Class autoloader |
|
| 258 | - * |
|
| 259 | - * @param string $class_name The name of the class to load. |
|
| 260 | - * @access public |
|
| 261 | - * @since 1.0.19 |
|
| 262 | - * @return void |
|
| 263 | - */ |
|
| 264 | - public function autoload( $class_name ) { |
|
| 265 | - |
|
| 266 | - // Normalize the class name... |
|
| 267 | - $class_name = strtolower( $class_name ); |
|
| 268 | - |
|
| 269 | - // ... and make sure it is our class. |
|
| 270 | - if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) { |
|
| 271 | - return; |
|
| 272 | - } |
|
| 273 | - |
|
| 274 | - // Next, prepare the file name from the class. |
|
| 275 | - $file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php'; |
|
| 276 | - |
|
| 277 | - // Base path of the classes. |
|
| 278 | - $plugin_path = untrailingslashit( WPINV_PLUGIN_DIR ); |
|
| 279 | - |
|
| 280 | - // And an array of possible locations in order of importance. |
|
| 281 | - $locations = array( |
|
| 282 | - "$plugin_path/includes", |
|
| 283 | - "$plugin_path/includes/data-stores", |
|
| 284 | - "$plugin_path/includes/gateways", |
|
| 285 | - "$plugin_path/includes/payments", |
|
| 286 | - "$plugin_path/includes/geolocation", |
|
| 287 | - "$plugin_path/includes/reports", |
|
| 288 | - "$plugin_path/includes/api", |
|
| 289 | - "$plugin_path/includes/admin", |
|
| 290 | - "$plugin_path/includes/admin/meta-boxes", |
|
| 291 | - ); |
|
| 292 | - |
|
| 293 | - foreach ( apply_filters( 'getpaid_autoload_locations', $locations ) as $location ) { |
|
| 294 | - |
|
| 295 | - if ( file_exists( trailingslashit( $location ) . $file_name ) ) { |
|
| 296 | - include trailingslashit( $location ) . $file_name; |
|
| 297 | - break; |
|
| 298 | - } |
|
| 299 | - |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - } |
|
| 303 | - |
|
| 304 | - /** |
|
| 305 | - * Inits hooks etc. |
|
| 306 | - */ |
|
| 307 | - public function init() { |
|
| 308 | - |
|
| 309 | - // Fires before getpaid inits. |
|
| 310 | - do_action( 'before_getpaid_init', $this ); |
|
| 311 | - |
|
| 312 | - // Maybe upgrade. |
|
| 313 | - $this->maybe_upgrade_database(); |
|
| 314 | - |
|
| 315 | - // Load default gateways. |
|
| 316 | - $gateways = apply_filters( |
|
| 317 | - 'getpaid_default_gateways', |
|
| 318 | - array( |
|
| 319 | - 'manual' => 'GetPaid_Manual_Gateway', |
|
| 320 | - 'paypal' => 'GetPaid_Paypal_Gateway', |
|
| 321 | - 'worldpay' => 'GetPaid_Worldpay_Gateway', |
|
| 322 | - 'bank_transfer' => 'GetPaid_Bank_Transfer_Gateway', |
|
| 323 | - 'authorizenet' => 'GetPaid_Authorize_Net_Gateway', |
|
| 324 | - ) |
|
| 325 | - ); |
|
| 326 | - |
|
| 327 | - foreach ( $gateways as $id => $class ) { |
|
| 328 | - $this->gateways[ $id ] = new $class(); |
|
| 329 | - } |
|
| 330 | - |
|
| 331 | - if ( 'yes' != get_option( 'wpinv_renamed_gateways' ) ) { |
|
| 332 | - GetPaid_Installer::rename_gateways_label(); |
|
| 333 | - update_option( 'wpinv_renamed_gateways', 'yes' ); |
|
| 334 | - } |
|
| 335 | - |
|
| 336 | - // Fires after getpaid inits. |
|
| 337 | - do_action( 'getpaid_init', $this ); |
|
| 338 | - |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * Checks if this is an IPN request and processes it. |
|
| 343 | - */ |
|
| 344 | - public function maybe_process_ipn() { |
|
| 345 | - |
|
| 346 | - // Ensure that this is an IPN request. |
|
| 347 | - if ( empty( $_GET['wpi-listener'] ) || 'IPN' !== $_GET['wpi-listener'] || empty( $_GET['wpi-gateway'] ) ) { |
|
| 348 | - return; |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - $gateway = wpinv_clean( $_GET['wpi-gateway'] ); |
|
| 352 | - |
|
| 353 | - do_action( 'wpinv_verify_payment_ipn', $gateway ); |
|
| 354 | - do_action( "wpinv_verify_{$gateway}_ipn" ); |
|
| 355 | - exit; |
|
| 356 | - |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - public function enqueue_scripts() { |
|
| 360 | - |
|
| 361 | - // Fires before adding scripts. |
|
| 362 | - do_action( 'getpaid_enqueue_scripts' ); |
|
| 363 | - |
|
| 364 | - $localize = array(); |
|
| 365 | - $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
| 366 | - $localize['nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
| 367 | - $localize['txtComplete'] = __( 'Continue', 'invoicing' ); |
|
| 368 | - $localize['UseTaxes'] = wpinv_use_taxes(); |
|
| 369 | - $localize['formNonce'] = wp_create_nonce( 'getpaid_form_nonce' ); |
|
| 370 | - $localize['loading'] = __( 'Loading...', 'invoicing' ); |
|
| 371 | - $localize['connectionError'] = __( 'Could not establish a connection to the server.', 'invoicing' ); |
|
| 372 | - |
|
| 373 | - $localize = apply_filters( 'wpinv_front_js_localize', $localize ); |
|
| 374 | - |
|
| 375 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' ); |
|
| 376 | - wp_enqueue_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'jquery' ), $version, true ); |
|
| 377 | - wp_localize_script( 'wpinv-front-script', 'WPInv', $localize ); |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - public function wpinv_actions() { |
|
| 381 | - if ( isset( $_REQUEST['wpi_action'] ) ) { |
|
| 382 | - do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST ); |
|
| 383 | - } |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - /** |
|
| 17 | + /** |
|
| 18 | + * GetPaid version. |
|
| 19 | + * |
|
| 20 | + * @var string |
|
| 21 | + */ |
|
| 22 | + public $version; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * Data container. |
|
| 26 | + * |
|
| 27 | + * @var array |
|
| 28 | + */ |
|
| 29 | + protected $data = array(); |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * Form elements instance. |
|
| 33 | + * |
|
| 34 | + * @var WPInv_Payment_Form_Elements |
|
| 35 | + */ |
|
| 36 | + public $form_elements; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * @param array An array of payment gateways. |
|
| 40 | + */ |
|
| 41 | + public $gateways; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Class constructor. |
|
| 45 | + */ |
|
| 46 | + public function __construct() { |
|
| 47 | + $this->define_constants(); |
|
| 48 | + $this->includes(); |
|
| 49 | + $this->init_hooks(); |
|
| 50 | + $this->set_properties(); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * Sets a custom data property. |
|
| 55 | + * |
|
| 56 | + * @param string $prop The prop to set. |
|
| 57 | + * @param mixed $value The value to retrieve. |
|
| 58 | + */ |
|
| 59 | + public function set( $prop, $value ) { |
|
| 60 | + $this->data[ $prop ] = $value; |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Gets a custom data property. |
|
| 65 | + * |
|
| 66 | + * @param string $prop The prop to set. |
|
| 67 | + * @return mixed The value. |
|
| 68 | + */ |
|
| 69 | + public function get( $prop ) { |
|
| 70 | + |
|
| 71 | + if ( isset( $this->data[ $prop ] ) ) { |
|
| 72 | + return $this->data[ $prop ]; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + return null; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Define class properties. |
|
| 80 | + */ |
|
| 81 | + public function set_properties() { |
|
| 82 | + |
|
| 83 | + // Sessions. |
|
| 84 | + $this->set( 'session', new WPInv_Session_Handler() ); |
|
| 85 | + $GLOBALS['wpi_session'] = $this->get( 'session' ); // Backwards compatibility. |
|
| 86 | + $GLOBALS['wpinv_euvat'] = new WPInv_EUVat(); // Backwards compatibility. |
|
| 87 | + |
|
| 88 | + // Init other objects. |
|
| 89 | + $this->set( 'session', new WPInv_Session_Handler() ); |
|
| 90 | + $this->set( 'notes', new WPInv_Notes() ); |
|
| 91 | + $this->set( 'api', new WPInv_API() ); |
|
| 92 | + $this->set( 'post_types', new GetPaid_Post_Types() ); |
|
| 93 | + $this->set( 'template', new GetPaid_Template() ); |
|
| 94 | + $this->set( 'admin', new GetPaid_Admin() ); |
|
| 95 | + $this->set( 'subscriptions', new WPInv_Subscriptions() ); |
|
| 96 | + $this->set( 'invoice_emails', new GetPaid_Invoice_Notification_Emails() ); |
|
| 97 | + $this->set( 'subscription_emails', new GetPaid_Subscription_Notification_Emails() ); |
|
| 98 | + $this->set( 'daily_maintenace', new GetPaid_Daily_Maintenance() ); |
|
| 99 | + $this->set( 'payment_forms', new GetPaid_Payment_Forms() ); |
|
| 100 | + $this->set( 'maxmind', new GetPaid_MaxMind_Geolocation() ); |
|
| 101 | + |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * Define plugin constants. |
|
| 106 | + */ |
|
| 107 | + public function define_constants() { |
|
| 108 | + define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) ); |
|
| 109 | + define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) ); |
|
| 110 | + $this->version = WPINV_VERSION; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Hook into actions and filters. |
|
| 115 | + * |
|
| 116 | + * @since 1.0.19 |
|
| 117 | + */ |
|
| 118 | + protected function init_hooks() { |
|
| 119 | + /* Internationalize the text strings used. */ |
|
| 120 | + add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) ); |
|
| 121 | + |
|
| 122 | + // Init the plugin after WordPress inits. |
|
| 123 | + add_action( 'init', array( $this, 'init' ), 1 ); |
|
| 124 | + add_action( 'init', array( $this, 'maybe_process_ipn' ), 10 ); |
|
| 125 | + add_action( 'init', array( $this, 'wpinv_actions' ) ); |
|
| 126 | + add_action( 'init', array( $this, 'maybe_do_authenticated_action' ), 100 ); |
|
| 127 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 11 ); |
|
| 128 | + add_action( 'wp_footer', array( $this, 'wp_footer' ) ); |
|
| 129 | + add_action( 'wp_head', array( $this, 'wp_head' ) ); |
|
| 130 | + add_action( 'widgets_init', array( &$this, 'register_widgets' ) ); |
|
| 131 | + add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) ); |
|
| 132 | + add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) ); |
|
| 133 | + |
|
| 134 | + // Fires after registering actions. |
|
| 135 | + do_action( 'wpinv_actions', $this ); |
|
| 136 | + do_action( 'getpaid_actions', $this ); |
|
| 137 | + |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + public function plugins_loaded() { |
|
| 141 | + /* Internationalize the text strings used. */ |
|
| 142 | + $this->load_textdomain(); |
|
| 143 | + |
|
| 144 | + do_action( 'wpinv_loaded' ); |
|
| 145 | + |
|
| 146 | + // Fix oxygen page builder conflict |
|
| 147 | + if ( function_exists( 'ct_css_output' ) ) { |
|
| 148 | + wpinv_oxygen_fix_conflict(); |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * Load the translation of the plugin. |
|
| 154 | + * |
|
| 155 | + * @since 1.0 |
|
| 156 | + */ |
|
| 157 | + public function load_textdomain( $locale = NULL ) { |
|
| 158 | + if ( empty( $locale ) ) { |
|
| 159 | + $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' ); |
|
| 163 | + |
|
| 164 | + unload_textdomain( 'invoicing' ); |
|
| 165 | + load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' ); |
|
| 166 | + load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' ); |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * Define language constants. |
|
| 170 | + */ |
|
| 171 | + require_once( WPINV_PLUGIN_DIR . 'language.php' ); |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Include required core files used in admin and on the frontend. |
|
| 176 | + */ |
|
| 177 | + public function includes() { |
|
| 178 | + |
|
| 179 | + // Start with the settings. |
|
| 180 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' ); |
|
| 181 | + |
|
| 182 | + // Packages/libraries. |
|
| 183 | + require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' ); |
|
| 184 | + require_once( WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php' ); |
|
| 185 | + |
|
| 186 | + // Load functions. |
|
| 187 | + require_once( WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php' ); |
|
| 188 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' ); |
|
| 189 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' ); |
|
| 190 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' ); |
|
| 191 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' ); |
|
| 192 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' ); |
|
| 193 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' ); |
|
| 194 | + require_once( WPINV_PLUGIN_DIR . 'includes/invoice-functions.php' ); |
|
| 195 | + require_once( WPINV_PLUGIN_DIR . 'includes/subscription-functions.php' ); |
|
| 196 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' ); |
|
| 197 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' ); |
|
| 198 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' ); |
|
| 199 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' ); |
|
| 200 | + require_once( WPINV_PLUGIN_DIR . 'includes/user-functions.php' ); |
|
| 201 | + require_once( WPINV_PLUGIN_DIR . 'includes/error-functions.php' ); |
|
| 202 | + |
|
| 203 | + // Register autoloader. |
|
| 204 | + try { |
|
| 205 | + spl_autoload_register( array( $this, 'autoload' ), true ); |
|
| 206 | + } catch ( Exception $e ) { |
|
| 207 | + wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true ); |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' ); |
|
| 211 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' ); |
|
| 212 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' ); |
|
| 213 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' ); |
|
| 214 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' ); |
|
| 215 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' ); |
|
| 216 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' ); |
|
| 217 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' ); |
|
| 218 | + require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' ); |
|
| 219 | + require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' ); |
|
| 220 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' ); |
|
| 221 | + require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' ); |
|
| 222 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' ); |
|
| 223 | + require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' ); |
|
| 224 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' ); |
|
| 225 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' ); |
|
| 226 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' ); |
|
| 227 | + require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' ); |
|
| 228 | + require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' ); |
|
| 229 | + require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' ); |
|
| 230 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' ); |
|
| 231 | + |
|
| 232 | + if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
| 233 | + GetPaid_Post_Types_Admin::init(); |
|
| 234 | + |
|
| 235 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' ); |
|
| 236 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' ); |
|
| 237 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' ); |
|
| 238 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' ); |
|
| 239 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' ); |
|
| 240 | + require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php' ); |
|
| 241 | + // load the user class only on the users.php page |
|
| 242 | + global $pagenow; |
|
| 243 | + if($pagenow=='users.php'){ |
|
| 244 | + new WPInv_Admin_Users(); |
|
| 245 | + } |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + // Register cli commands |
|
| 249 | + if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
| 250 | + require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' ); |
|
| 251 | + WP_CLI::add_command( 'invoicing', 'WPInv_CLI' ); |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + } |
|
| 255 | + |
|
| 256 | + /** |
|
| 257 | + * Class autoloader |
|
| 258 | + * |
|
| 259 | + * @param string $class_name The name of the class to load. |
|
| 260 | + * @access public |
|
| 261 | + * @since 1.0.19 |
|
| 262 | + * @return void |
|
| 263 | + */ |
|
| 264 | + public function autoload( $class_name ) { |
|
| 265 | + |
|
| 266 | + // Normalize the class name... |
|
| 267 | + $class_name = strtolower( $class_name ); |
|
| 268 | + |
|
| 269 | + // ... and make sure it is our class. |
|
| 270 | + if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) { |
|
| 271 | + return; |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + // Next, prepare the file name from the class. |
|
| 275 | + $file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php'; |
|
| 276 | + |
|
| 277 | + // Base path of the classes. |
|
| 278 | + $plugin_path = untrailingslashit( WPINV_PLUGIN_DIR ); |
|
| 279 | + |
|
| 280 | + // And an array of possible locations in order of importance. |
|
| 281 | + $locations = array( |
|
| 282 | + "$plugin_path/includes", |
|
| 283 | + "$plugin_path/includes/data-stores", |
|
| 284 | + "$plugin_path/includes/gateways", |
|
| 285 | + "$plugin_path/includes/payments", |
|
| 286 | + "$plugin_path/includes/geolocation", |
|
| 287 | + "$plugin_path/includes/reports", |
|
| 288 | + "$plugin_path/includes/api", |
|
| 289 | + "$plugin_path/includes/admin", |
|
| 290 | + "$plugin_path/includes/admin/meta-boxes", |
|
| 291 | + ); |
|
| 292 | + |
|
| 293 | + foreach ( apply_filters( 'getpaid_autoload_locations', $locations ) as $location ) { |
|
| 294 | + |
|
| 295 | + if ( file_exists( trailingslashit( $location ) . $file_name ) ) { |
|
| 296 | + include trailingslashit( $location ) . $file_name; |
|
| 297 | + break; |
|
| 298 | + } |
|
| 299 | + |
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + } |
|
| 303 | + |
|
| 304 | + /** |
|
| 305 | + * Inits hooks etc. |
|
| 306 | + */ |
|
| 307 | + public function init() { |
|
| 308 | + |
|
| 309 | + // Fires before getpaid inits. |
|
| 310 | + do_action( 'before_getpaid_init', $this ); |
|
| 311 | + |
|
| 312 | + // Maybe upgrade. |
|
| 313 | + $this->maybe_upgrade_database(); |
|
| 314 | + |
|
| 315 | + // Load default gateways. |
|
| 316 | + $gateways = apply_filters( |
|
| 317 | + 'getpaid_default_gateways', |
|
| 318 | + array( |
|
| 319 | + 'manual' => 'GetPaid_Manual_Gateway', |
|
| 320 | + 'paypal' => 'GetPaid_Paypal_Gateway', |
|
| 321 | + 'worldpay' => 'GetPaid_Worldpay_Gateway', |
|
| 322 | + 'bank_transfer' => 'GetPaid_Bank_Transfer_Gateway', |
|
| 323 | + 'authorizenet' => 'GetPaid_Authorize_Net_Gateway', |
|
| 324 | + ) |
|
| 325 | + ); |
|
| 326 | + |
|
| 327 | + foreach ( $gateways as $id => $class ) { |
|
| 328 | + $this->gateways[ $id ] = new $class(); |
|
| 329 | + } |
|
| 330 | + |
|
| 331 | + if ( 'yes' != get_option( 'wpinv_renamed_gateways' ) ) { |
|
| 332 | + GetPaid_Installer::rename_gateways_label(); |
|
| 333 | + update_option( 'wpinv_renamed_gateways', 'yes' ); |
|
| 334 | + } |
|
| 335 | + |
|
| 336 | + // Fires after getpaid inits. |
|
| 337 | + do_action( 'getpaid_init', $this ); |
|
| 338 | + |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * Checks if this is an IPN request and processes it. |
|
| 343 | + */ |
|
| 344 | + public function maybe_process_ipn() { |
|
| 345 | + |
|
| 346 | + // Ensure that this is an IPN request. |
|
| 347 | + if ( empty( $_GET['wpi-listener'] ) || 'IPN' !== $_GET['wpi-listener'] || empty( $_GET['wpi-gateway'] ) ) { |
|
| 348 | + return; |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + $gateway = wpinv_clean( $_GET['wpi-gateway'] ); |
|
| 352 | + |
|
| 353 | + do_action( 'wpinv_verify_payment_ipn', $gateway ); |
|
| 354 | + do_action( "wpinv_verify_{$gateway}_ipn" ); |
|
| 355 | + exit; |
|
| 356 | + |
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + public function enqueue_scripts() { |
|
| 360 | + |
|
| 361 | + // Fires before adding scripts. |
|
| 362 | + do_action( 'getpaid_enqueue_scripts' ); |
|
| 363 | + |
|
| 364 | + $localize = array(); |
|
| 365 | + $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
| 366 | + $localize['nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
| 367 | + $localize['txtComplete'] = __( 'Continue', 'invoicing' ); |
|
| 368 | + $localize['UseTaxes'] = wpinv_use_taxes(); |
|
| 369 | + $localize['formNonce'] = wp_create_nonce( 'getpaid_form_nonce' ); |
|
| 370 | + $localize['loading'] = __( 'Loading...', 'invoicing' ); |
|
| 371 | + $localize['connectionError'] = __( 'Could not establish a connection to the server.', 'invoicing' ); |
|
| 372 | + |
|
| 373 | + $localize = apply_filters( 'wpinv_front_js_localize', $localize ); |
|
| 374 | + |
|
| 375 | + $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' ); |
|
| 376 | + wp_enqueue_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'jquery' ), $version, true ); |
|
| 377 | + wp_localize_script( 'wpinv-front-script', 'WPInv', $localize ); |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + public function wpinv_actions() { |
|
| 381 | + if ( isset( $_REQUEST['wpi_action'] ) ) { |
|
| 382 | + do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST ); |
|
| 383 | + } |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + /** |
|
| 387 | 387 | * Fires an action after verifying that a user can fire them. |
| 388 | - * |
|
| 389 | - * Note: If the action is on an invoice, subscription etc, esure that the |
|
| 390 | - * current user owns the invoice/subscription. |
|
| 388 | + * |
|
| 389 | + * Note: If the action is on an invoice, subscription etc, esure that the |
|
| 390 | + * current user owns the invoice/subscription. |
|
| 391 | 391 | */ |
| 392 | 392 | public function maybe_do_authenticated_action() { |
| 393 | 393 | |
| 394 | - if ( isset( $_REQUEST['getpaid-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) { |
|
| 394 | + if ( isset( $_REQUEST['getpaid-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) { |
|
| 395 | 395 | |
| 396 | - $key = sanitize_key( $_REQUEST['getpaid-action'] ); |
|
| 397 | - $data = wp_unslash( $_REQUEST ); |
|
| 398 | - if ( is_user_logged_in() ) { |
|
| 399 | - do_action( "getpaid_authenticated_action_$key", $data ); |
|
| 400 | - } |
|
| 396 | + $key = sanitize_key( $_REQUEST['getpaid-action'] ); |
|
| 397 | + $data = wp_unslash( $_REQUEST ); |
|
| 398 | + if ( is_user_logged_in() ) { |
|
| 399 | + do_action( "getpaid_authenticated_action_$key", $data ); |
|
| 400 | + } |
|
| 401 | 401 | |
| 402 | - do_action( "getpaid_unauthenticated_action_$key", $data ); |
|
| 402 | + do_action( "getpaid_unauthenticated_action_$key", $data ); |
|
| 403 | 403 | |
| 404 | - } |
|
| 404 | + } |
|
| 405 | 405 | |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | - public function pre_get_posts( $wp_query ) { |
|
| 409 | - |
|
| 410 | - if ( ! is_admin() && ! empty( $wp_query->query_vars['post_type'] ) && getpaid_is_invoice_post_type( $wp_query->query_vars['post_type'] ) && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) { |
|
| 411 | - $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses( false, false, $wp_query->query_vars['post_type'] ) ); |
|
| 412 | - } |
|
| 413 | - |
|
| 414 | - return $wp_query; |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - /** |
|
| 418 | - * Register widgets |
|
| 419 | - * |
|
| 420 | - */ |
|
| 421 | - public function register_widgets() { |
|
| 422 | - |
|
| 423 | - // Currently, UX Builder does not work particulaly well with SuperDuper. |
|
| 424 | - // So we disable our widgets when editing a page with UX Builder. |
|
| 425 | - if ( function_exists( 'ux_builder_is_active' ) && ux_builder_is_active() ) { |
|
| 426 | - return; |
|
| 427 | - } |
|
| 428 | - |
|
| 429 | - $widgets = apply_filters( |
|
| 430 | - 'getpaid_widget_classes', |
|
| 431 | - array( |
|
| 432 | - 'WPInv_Checkout_Widget', |
|
| 433 | - 'WPInv_History_Widget', |
|
| 434 | - 'WPInv_Receipt_Widget', |
|
| 435 | - 'WPInv_Subscriptions_Widget', |
|
| 436 | - 'WPInv_Buy_Item_Widget', |
|
| 437 | - 'WPInv_Messages_Widget', |
|
| 438 | - 'WPInv_GetPaid_Widget' |
|
| 439 | - ) |
|
| 440 | - ); |
|
| 441 | - |
|
| 442 | - foreach ( $widgets as $widget ) { |
|
| 443 | - register_widget( $widget ); |
|
| 444 | - } |
|
| 408 | + public function pre_get_posts( $wp_query ) { |
|
| 409 | + |
|
| 410 | + if ( ! is_admin() && ! empty( $wp_query->query_vars['post_type'] ) && getpaid_is_invoice_post_type( $wp_query->query_vars['post_type'] ) && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) { |
|
| 411 | + $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses( false, false, $wp_query->query_vars['post_type'] ) ); |
|
| 412 | + } |
|
| 413 | + |
|
| 414 | + return $wp_query; |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + /** |
|
| 418 | + * Register widgets |
|
| 419 | + * |
|
| 420 | + */ |
|
| 421 | + public function register_widgets() { |
|
| 422 | + |
|
| 423 | + // Currently, UX Builder does not work particulaly well with SuperDuper. |
|
| 424 | + // So we disable our widgets when editing a page with UX Builder. |
|
| 425 | + if ( function_exists( 'ux_builder_is_active' ) && ux_builder_is_active() ) { |
|
| 426 | + return; |
|
| 427 | + } |
|
| 428 | + |
|
| 429 | + $widgets = apply_filters( |
|
| 430 | + 'getpaid_widget_classes', |
|
| 431 | + array( |
|
| 432 | + 'WPInv_Checkout_Widget', |
|
| 433 | + 'WPInv_History_Widget', |
|
| 434 | + 'WPInv_Receipt_Widget', |
|
| 435 | + 'WPInv_Subscriptions_Widget', |
|
| 436 | + 'WPInv_Buy_Item_Widget', |
|
| 437 | + 'WPInv_Messages_Widget', |
|
| 438 | + 'WPInv_GetPaid_Widget' |
|
| 439 | + ) |
|
| 440 | + ); |
|
| 441 | + |
|
| 442 | + foreach ( $widgets as $widget ) { |
|
| 443 | + register_widget( $widget ); |
|
| 444 | + } |
|
| 445 | 445 | |
| 446 | - } |
|
| 446 | + } |
|
| 447 | 447 | |
| 448 | - /** |
|
| 449 | - * Upgrades the database. |
|
| 450 | - * |
|
| 451 | - * @since 2.0.2 |
|
| 452 | - */ |
|
| 453 | - public function maybe_upgrade_database() { |
|
| 448 | + /** |
|
| 449 | + * Upgrades the database. |
|
| 450 | + * |
|
| 451 | + * @since 2.0.2 |
|
| 452 | + */ |
|
| 453 | + public function maybe_upgrade_database() { |
|
| 454 | 454 | |
| 455 | - $wpi_version = get_option( 'wpinv_version', 0 ); |
|
| 455 | + $wpi_version = get_option( 'wpinv_version', 0 ); |
|
| 456 | 456 | |
| 457 | - if ( $wpi_version == WPINV_VERSION ) { |
|
| 458 | - return; |
|
| 459 | - } |
|
| 457 | + if ( $wpi_version == WPINV_VERSION ) { |
|
| 458 | + return; |
|
| 459 | + } |
|
| 460 | 460 | |
| 461 | - $installer = new GetPaid_Installer(); |
|
| 461 | + $installer = new GetPaid_Installer(); |
|
| 462 | 462 | |
| 463 | - if ( empty( $wpi_version ) ) { |
|
| 464 | - return $installer->upgrade_db( 0 ); |
|
| 465 | - } |
|
| 463 | + if ( empty( $wpi_version ) ) { |
|
| 464 | + return $installer->upgrade_db( 0 ); |
|
| 465 | + } |
|
| 466 | 466 | |
| 467 | - $upgrades = array( |
|
| 468 | - '0.0.5' => '004', |
|
| 469 | - '1.0.3' => '102', |
|
| 470 | - '2.0.0' => '118', |
|
| 471 | - '2.0.8' => '207', |
|
| 472 | - ); |
|
| 467 | + $upgrades = array( |
|
| 468 | + '0.0.5' => '004', |
|
| 469 | + '1.0.3' => '102', |
|
| 470 | + '2.0.0' => '118', |
|
| 471 | + '2.0.8' => '207', |
|
| 472 | + ); |
|
| 473 | 473 | |
| 474 | - foreach ( $upgrades as $key => $method ) { |
|
| 474 | + foreach ( $upgrades as $key => $method ) { |
|
| 475 | 475 | |
| 476 | - if ( version_compare( $wpi_version, $key, '<' ) ) { |
|
| 477 | - return $installer->upgrade_db( $method ); |
|
| 478 | - } |
|
| 476 | + if ( version_compare( $wpi_version, $key, '<' ) ) { |
|
| 477 | + return $installer->upgrade_db( $method ); |
|
| 478 | + } |
|
| 479 | 479 | |
| 480 | - } |
|
| 480 | + } |
|
| 481 | 481 | |
| 482 | - } |
|
| 482 | + } |
|
| 483 | 483 | |
| 484 | - /** |
|
| 485 | - * Flushes the permalinks if needed. |
|
| 486 | - * |
|
| 487 | - * @since 2.0.8 |
|
| 488 | - */ |
|
| 489 | - public function maybe_flush_permalinks() { |
|
| 484 | + /** |
|
| 485 | + * Flushes the permalinks if needed. |
|
| 486 | + * |
|
| 487 | + * @since 2.0.8 |
|
| 488 | + */ |
|
| 489 | + public function maybe_flush_permalinks() { |
|
| 490 | 490 | |
| 491 | - $flush = get_option( 'wpinv_flush_permalinks', 0 ); |
|
| 491 | + $flush = get_option( 'wpinv_flush_permalinks', 0 ); |
|
| 492 | 492 | |
| 493 | - if ( ! empty( $flush ) ) { |
|
| 494 | - flush_rewrite_rules(); |
|
| 495 | - delete_option( 'wpinv_flush_permalinks' ); |
|
| 496 | - } |
|
| 493 | + if ( ! empty( $flush ) ) { |
|
| 494 | + flush_rewrite_rules(); |
|
| 495 | + delete_option( 'wpinv_flush_permalinks' ); |
|
| 496 | + } |
|
| 497 | 497 | |
| 498 | - } |
|
| 498 | + } |
|
| 499 | 499 | |
| 500 | - /** |
|
| 501 | - * Remove our pages from yoast sitemaps. |
|
| 502 | - * |
|
| 503 | - * @since 1.0.19 |
|
| 504 | - * @param int[] $excluded_posts_ids |
|
| 505 | - */ |
|
| 506 | - public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){ |
|
| 500 | + /** |
|
| 501 | + * Remove our pages from yoast sitemaps. |
|
| 502 | + * |
|
| 503 | + * @since 1.0.19 |
|
| 504 | + * @param int[] $excluded_posts_ids |
|
| 505 | + */ |
|
| 506 | + public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){ |
|
| 507 | 507 | |
| 508 | - // Ensure that we have an array. |
|
| 509 | - if ( ! is_array( $excluded_posts_ids ) ) { |
|
| 510 | - $excluded_posts_ids = array(); |
|
| 511 | - } |
|
| 508 | + // Ensure that we have an array. |
|
| 509 | + if ( ! is_array( $excluded_posts_ids ) ) { |
|
| 510 | + $excluded_posts_ids = array(); |
|
| 511 | + } |
|
| 512 | 512 | |
| 513 | - // Prepare our pages. |
|
| 514 | - $our_pages = array(); |
|
| 513 | + // Prepare our pages. |
|
| 514 | + $our_pages = array(); |
|
| 515 | 515 | |
| 516 | - // Checkout page. |
|
| 517 | - $our_pages[] = wpinv_get_option( 'checkout_page', false ); |
|
| 516 | + // Checkout page. |
|
| 517 | + $our_pages[] = wpinv_get_option( 'checkout_page', false ); |
|
| 518 | 518 | |
| 519 | - // Success page. |
|
| 520 | - $our_pages[] = wpinv_get_option( 'success_page', false ); |
|
| 519 | + // Success page. |
|
| 520 | + $our_pages[] = wpinv_get_option( 'success_page', false ); |
|
| 521 | 521 | |
| 522 | - // Failure page. |
|
| 523 | - $our_pages[] = wpinv_get_option( 'failure_page', false ); |
|
| 522 | + // Failure page. |
|
| 523 | + $our_pages[] = wpinv_get_option( 'failure_page', false ); |
|
| 524 | 524 | |
| 525 | - // History page. |
|
| 526 | - $our_pages[] = wpinv_get_option( 'invoice_history_page', false ); |
|
| 525 | + // History page. |
|
| 526 | + $our_pages[] = wpinv_get_option( 'invoice_history_page', false ); |
|
| 527 | 527 | |
| 528 | - // Subscriptions page. |
|
| 529 | - $our_pages[] = wpinv_get_option( 'invoice_subscription_page', false ); |
|
| 528 | + // Subscriptions page. |
|
| 529 | + $our_pages[] = wpinv_get_option( 'invoice_subscription_page', false ); |
|
| 530 | 530 | |
| 531 | - $our_pages = array_map( 'intval', array_filter( $our_pages ) ); |
|
| 531 | + $our_pages = array_map( 'intval', array_filter( $our_pages ) ); |
|
| 532 | 532 | |
| 533 | - $excluded_posts_ids = $excluded_posts_ids + $our_pages; |
|
| 534 | - return array_unique( $excluded_posts_ids ); |
|
| 533 | + $excluded_posts_ids = $excluded_posts_ids + $our_pages; |
|
| 534 | + return array_unique( $excluded_posts_ids ); |
|
| 535 | 535 | |
| 536 | - } |
|
| 536 | + } |
|
| 537 | 537 | |
| 538 | - /** |
|
| 539 | - * Displays additional footer code. |
|
| 540 | - * |
|
| 541 | - * @since 2.0.0 |
|
| 542 | - */ |
|
| 543 | - public function wp_footer() { |
|
| 544 | - wpinv_get_template( 'frontend-footer.php' ); |
|
| 545 | - } |
|
| 538 | + /** |
|
| 539 | + * Displays additional footer code. |
|
| 540 | + * |
|
| 541 | + * @since 2.0.0 |
|
| 542 | + */ |
|
| 543 | + public function wp_footer() { |
|
| 544 | + wpinv_get_template( 'frontend-footer.php' ); |
|
| 545 | + } |
|
| 546 | 546 | |
| 547 | - /** |
|
| 548 | - * Displays additional header code. |
|
| 549 | - * |
|
| 550 | - * @since 2.0.0 |
|
| 551 | - */ |
|
| 552 | - public function wp_head() { |
|
| 553 | - wpinv_get_template( 'frontend-head.php' ); |
|
| 554 | - } |
|
| 547 | + /** |
|
| 548 | + * Displays additional header code. |
|
| 549 | + * |
|
| 550 | + * @since 2.0.0 |
|
| 551 | + */ |
|
| 552 | + public function wp_head() { |
|
| 553 | + wpinv_get_template( 'frontend-head.php' ); |
|
| 554 | + } |
|
| 555 | 555 | |
| 556 | 556 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @since 1.0.0 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -defined( 'ABSPATH' ) || exit; |
|
| 9 | +defined('ABSPATH') || exit; |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Main Invoicing class. |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | * @param string $prop The prop to set. |
| 57 | 57 | * @param mixed $value The value to retrieve. |
| 58 | 58 | */ |
| 59 | - public function set( $prop, $value ) { |
|
| 60 | - $this->data[ $prop ] = $value; |
|
| 59 | + public function set($prop, $value) { |
|
| 60 | + $this->data[$prop] = $value; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | * @param string $prop The prop to set. |
| 67 | 67 | * @return mixed The value. |
| 68 | 68 | */ |
| 69 | - public function get( $prop ) { |
|
| 69 | + public function get($prop) { |
|
| 70 | 70 | |
| 71 | - if ( isset( $this->data[ $prop ] ) ) { |
|
| 72 | - return $this->data[ $prop ]; |
|
| 71 | + if (isset($this->data[$prop])) { |
|
| 72 | + return $this->data[$prop]; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return null; |
@@ -81,23 +81,23 @@ discard block |
||
| 81 | 81 | public function set_properties() { |
| 82 | 82 | |
| 83 | 83 | // Sessions. |
| 84 | - $this->set( 'session', new WPInv_Session_Handler() ); |
|
| 85 | - $GLOBALS['wpi_session'] = $this->get( 'session' ); // Backwards compatibility. |
|
| 84 | + $this->set('session', new WPInv_Session_Handler()); |
|
| 85 | + $GLOBALS['wpi_session'] = $this->get('session'); // Backwards compatibility. |
|
| 86 | 86 | $GLOBALS['wpinv_euvat'] = new WPInv_EUVat(); // Backwards compatibility. |
| 87 | 87 | |
| 88 | 88 | // Init other objects. |
| 89 | - $this->set( 'session', new WPInv_Session_Handler() ); |
|
| 90 | - $this->set( 'notes', new WPInv_Notes() ); |
|
| 91 | - $this->set( 'api', new WPInv_API() ); |
|
| 92 | - $this->set( 'post_types', new GetPaid_Post_Types() ); |
|
| 93 | - $this->set( 'template', new GetPaid_Template() ); |
|
| 94 | - $this->set( 'admin', new GetPaid_Admin() ); |
|
| 95 | - $this->set( 'subscriptions', new WPInv_Subscriptions() ); |
|
| 96 | - $this->set( 'invoice_emails', new GetPaid_Invoice_Notification_Emails() ); |
|
| 97 | - $this->set( 'subscription_emails', new GetPaid_Subscription_Notification_Emails() ); |
|
| 98 | - $this->set( 'daily_maintenace', new GetPaid_Daily_Maintenance() ); |
|
| 99 | - $this->set( 'payment_forms', new GetPaid_Payment_Forms() ); |
|
| 100 | - $this->set( 'maxmind', new GetPaid_MaxMind_Geolocation() ); |
|
| 89 | + $this->set('session', new WPInv_Session_Handler()); |
|
| 90 | + $this->set('notes', new WPInv_Notes()); |
|
| 91 | + $this->set('api', new WPInv_API()); |
|
| 92 | + $this->set('post_types', new GetPaid_Post_Types()); |
|
| 93 | + $this->set('template', new GetPaid_Template()); |
|
| 94 | + $this->set('admin', new GetPaid_Admin()); |
|
| 95 | + $this->set('subscriptions', new WPInv_Subscriptions()); |
|
| 96 | + $this->set('invoice_emails', new GetPaid_Invoice_Notification_Emails()); |
|
| 97 | + $this->set('subscription_emails', new GetPaid_Subscription_Notification_Emails()); |
|
| 98 | + $this->set('daily_maintenace', new GetPaid_Daily_Maintenance()); |
|
| 99 | + $this->set('payment_forms', new GetPaid_Payment_Forms()); |
|
| 100 | + $this->set('maxmind', new GetPaid_MaxMind_Geolocation()); |
|
| 101 | 101 | |
| 102 | 102 | } |
| 103 | 103 | |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | * Define plugin constants. |
| 106 | 106 | */ |
| 107 | 107 | public function define_constants() { |
| 108 | - define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) ); |
|
| 109 | - define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) ); |
|
| 108 | + define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE)); |
|
| 109 | + define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE)); |
|
| 110 | 110 | $this->version = WPINV_VERSION; |
| 111 | 111 | } |
| 112 | 112 | |
@@ -117,23 +117,23 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | protected function init_hooks() { |
| 119 | 119 | /* Internationalize the text strings used. */ |
| 120 | - add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) ); |
|
| 120 | + add_action('plugins_loaded', array(&$this, 'plugins_loaded')); |
|
| 121 | 121 | |
| 122 | 122 | // Init the plugin after WordPress inits. |
| 123 | - add_action( 'init', array( $this, 'init' ), 1 ); |
|
| 124 | - add_action( 'init', array( $this, 'maybe_process_ipn' ), 10 ); |
|
| 125 | - add_action( 'init', array( $this, 'wpinv_actions' ) ); |
|
| 126 | - add_action( 'init', array( $this, 'maybe_do_authenticated_action' ), 100 ); |
|
| 127 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 11 ); |
|
| 128 | - add_action( 'wp_footer', array( $this, 'wp_footer' ) ); |
|
| 129 | - add_action( 'wp_head', array( $this, 'wp_head' ) ); |
|
| 130 | - add_action( 'widgets_init', array( &$this, 'register_widgets' ) ); |
|
| 131 | - add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) ); |
|
| 132 | - add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) ); |
|
| 123 | + add_action('init', array($this, 'init'), 1); |
|
| 124 | + add_action('init', array($this, 'maybe_process_ipn'), 10); |
|
| 125 | + add_action('init', array($this, 'wpinv_actions')); |
|
| 126 | + add_action('init', array($this, 'maybe_do_authenticated_action'), 100); |
|
| 127 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 11); |
|
| 128 | + add_action('wp_footer', array($this, 'wp_footer')); |
|
| 129 | + add_action('wp_head', array($this, 'wp_head')); |
|
| 130 | + add_action('widgets_init', array(&$this, 'register_widgets')); |
|
| 131 | + add_filter('wpseo_exclude_from_sitemap_by_post_ids', array($this, 'wpseo_exclude_from_sitemap_by_post_ids')); |
|
| 132 | + add_filter('pre_get_posts', array(&$this, 'pre_get_posts')); |
|
| 133 | 133 | |
| 134 | 134 | // Fires after registering actions. |
| 135 | - do_action( 'wpinv_actions', $this ); |
|
| 136 | - do_action( 'getpaid_actions', $this ); |
|
| 135 | + do_action('wpinv_actions', $this); |
|
| 136 | + do_action('getpaid_actions', $this); |
|
| 137 | 137 | |
| 138 | 138 | } |
| 139 | 139 | |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | /* Internationalize the text strings used. */ |
| 142 | 142 | $this->load_textdomain(); |
| 143 | 143 | |
| 144 | - do_action( 'wpinv_loaded' ); |
|
| 144 | + do_action('wpinv_loaded'); |
|
| 145 | 145 | |
| 146 | 146 | // Fix oxygen page builder conflict |
| 147 | - if ( function_exists( 'ct_css_output' ) ) { |
|
| 147 | + if (function_exists('ct_css_output')) { |
|
| 148 | 148 | wpinv_oxygen_fix_conflict(); |
| 149 | 149 | } |
| 150 | 150 | } |
@@ -154,21 +154,21 @@ discard block |
||
| 154 | 154 | * |
| 155 | 155 | * @since 1.0 |
| 156 | 156 | */ |
| 157 | - public function load_textdomain( $locale = NULL ) { |
|
| 158 | - if ( empty( $locale ) ) { |
|
| 159 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
| 157 | + public function load_textdomain($locale = NULL) { |
|
| 158 | + if (empty($locale)) { |
|
| 159 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' ); |
|
| 162 | + $locale = apply_filters('plugin_locale', $locale, 'invoicing'); |
|
| 163 | 163 | |
| 164 | - unload_textdomain( 'invoicing' ); |
|
| 165 | - load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' ); |
|
| 166 | - load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' ); |
|
| 164 | + unload_textdomain('invoicing'); |
|
| 165 | + load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo'); |
|
| 166 | + load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages'); |
|
| 167 | 167 | |
| 168 | 168 | /** |
| 169 | 169 | * Define language constants. |
| 170 | 170 | */ |
| 171 | - require_once( WPINV_PLUGIN_DIR . 'language.php' ); |
|
| 171 | + require_once(WPINV_PLUGIN_DIR . 'language.php'); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -177,78 +177,78 @@ discard block |
||
| 177 | 177 | public function includes() { |
| 178 | 178 | |
| 179 | 179 | // Start with the settings. |
| 180 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' ); |
|
| 180 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php'); |
|
| 181 | 181 | |
| 182 | 182 | // Packages/libraries. |
| 183 | - require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' ); |
|
| 184 | - require_once( WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php' ); |
|
| 183 | + require_once(WPINV_PLUGIN_DIR . 'vendor/autoload.php'); |
|
| 184 | + require_once(WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php'); |
|
| 185 | 185 | |
| 186 | 186 | // Load functions. |
| 187 | - require_once( WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php' ); |
|
| 188 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' ); |
|
| 189 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' ); |
|
| 190 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' ); |
|
| 191 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' ); |
|
| 192 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' ); |
|
| 193 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' ); |
|
| 194 | - require_once( WPINV_PLUGIN_DIR . 'includes/invoice-functions.php' ); |
|
| 195 | - require_once( WPINV_PLUGIN_DIR . 'includes/subscription-functions.php' ); |
|
| 196 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' ); |
|
| 197 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' ); |
|
| 198 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' ); |
|
| 199 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' ); |
|
| 200 | - require_once( WPINV_PLUGIN_DIR . 'includes/user-functions.php' ); |
|
| 201 | - require_once( WPINV_PLUGIN_DIR . 'includes/error-functions.php' ); |
|
| 187 | + require_once(WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php'); |
|
| 188 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php'); |
|
| 189 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php'); |
|
| 190 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php'); |
|
| 191 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php'); |
|
| 192 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php'); |
|
| 193 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php'); |
|
| 194 | + require_once(WPINV_PLUGIN_DIR . 'includes/invoice-functions.php'); |
|
| 195 | + require_once(WPINV_PLUGIN_DIR . 'includes/subscription-functions.php'); |
|
| 196 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php'); |
|
| 197 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php'); |
|
| 198 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php'); |
|
| 199 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php'); |
|
| 200 | + require_once(WPINV_PLUGIN_DIR . 'includes/user-functions.php'); |
|
| 201 | + require_once(WPINV_PLUGIN_DIR . 'includes/error-functions.php'); |
|
| 202 | 202 | |
| 203 | 203 | // Register autoloader. |
| 204 | 204 | try { |
| 205 | - spl_autoload_register( array( $this, 'autoload' ), true ); |
|
| 206 | - } catch ( Exception $e ) { |
|
| 207 | - wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true ); |
|
| 205 | + spl_autoload_register(array($this, 'autoload'), true); |
|
| 206 | + } catch (Exception $e) { |
|
| 207 | + wpinv_error_log($e->getMessage(), '', __FILE__, 149, true); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' ); |
|
| 211 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' ); |
|
| 212 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' ); |
|
| 213 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' ); |
|
| 214 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' ); |
|
| 215 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' ); |
|
| 216 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' ); |
|
| 217 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' ); |
|
| 218 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' ); |
|
| 219 | - require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' ); |
|
| 220 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' ); |
|
| 221 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' ); |
|
| 222 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' ); |
|
| 223 | - require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' ); |
|
| 224 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' ); |
|
| 225 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' ); |
|
| 226 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' ); |
|
| 227 | - require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' ); |
|
| 228 | - require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' ); |
|
| 229 | - require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' ); |
|
| 230 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' ); |
|
| 231 | - |
|
| 232 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
| 210 | + require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php'); |
|
| 211 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php'); |
|
| 212 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php'); |
|
| 213 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php'); |
|
| 214 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php'); |
|
| 215 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php'); |
|
| 216 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php'); |
|
| 217 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php'); |
|
| 218 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php'); |
|
| 219 | + require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php'); |
|
| 220 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php'); |
|
| 221 | + require_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php'); |
|
| 222 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php'); |
|
| 223 | + require_once(WPINV_PLUGIN_DIR . 'widgets/checkout.php'); |
|
| 224 | + require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-history.php'); |
|
| 225 | + require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php'); |
|
| 226 | + require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php'); |
|
| 227 | + require_once(WPINV_PLUGIN_DIR . 'widgets/subscriptions.php'); |
|
| 228 | + require_once(WPINV_PLUGIN_DIR . 'widgets/buy-item.php'); |
|
| 229 | + require_once(WPINV_PLUGIN_DIR . 'widgets/getpaid.php'); |
|
| 230 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php'); |
|
| 231 | + |
|
| 232 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
| 233 | 233 | GetPaid_Post_Types_Admin::init(); |
| 234 | 234 | |
| 235 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' ); |
|
| 236 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' ); |
|
| 237 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' ); |
|
| 238 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' ); |
|
| 239 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' ); |
|
| 240 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php' ); |
|
| 235 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php'); |
|
| 236 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php'); |
|
| 237 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php'); |
|
| 238 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php'); |
|
| 239 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php'); |
|
| 240 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php'); |
|
| 241 | 241 | // load the user class only on the users.php page |
| 242 | 242 | global $pagenow; |
| 243 | - if($pagenow=='users.php'){ |
|
| 243 | + if ($pagenow == 'users.php') { |
|
| 244 | 244 | new WPInv_Admin_Users(); |
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | // Register cli commands |
| 249 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
| 250 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' ); |
|
| 251 | - WP_CLI::add_command( 'invoicing', 'WPInv_CLI' ); |
|
| 249 | + if (defined('WP_CLI') && WP_CLI) { |
|
| 250 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php'); |
|
| 251 | + WP_CLI::add_command('invoicing', 'WPInv_CLI'); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | } |
@@ -261,21 +261,21 @@ discard block |
||
| 261 | 261 | * @since 1.0.19 |
| 262 | 262 | * @return void |
| 263 | 263 | */ |
| 264 | - public function autoload( $class_name ) { |
|
| 264 | + public function autoload($class_name) { |
|
| 265 | 265 | |
| 266 | 266 | // Normalize the class name... |
| 267 | - $class_name = strtolower( $class_name ); |
|
| 267 | + $class_name = strtolower($class_name); |
|
| 268 | 268 | |
| 269 | 269 | // ... and make sure it is our class. |
| 270 | - if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) { |
|
| 270 | + if (false === strpos($class_name, 'getpaid_') && false === strpos($class_name, 'wpinv_')) { |
|
| 271 | 271 | return; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | // Next, prepare the file name from the class. |
| 275 | - $file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php'; |
|
| 275 | + $file_name = 'class-' . str_replace('_', '-', $class_name) . '.php'; |
|
| 276 | 276 | |
| 277 | 277 | // Base path of the classes. |
| 278 | - $plugin_path = untrailingslashit( WPINV_PLUGIN_DIR ); |
|
| 278 | + $plugin_path = untrailingslashit(WPINV_PLUGIN_DIR); |
|
| 279 | 279 | |
| 280 | 280 | // And an array of possible locations in order of importance. |
| 281 | 281 | $locations = array( |
@@ -290,10 +290,10 @@ discard block |
||
| 290 | 290 | "$plugin_path/includes/admin/meta-boxes", |
| 291 | 291 | ); |
| 292 | 292 | |
| 293 | - foreach ( apply_filters( 'getpaid_autoload_locations', $locations ) as $location ) { |
|
| 293 | + foreach (apply_filters('getpaid_autoload_locations', $locations) as $location) { |
|
| 294 | 294 | |
| 295 | - if ( file_exists( trailingslashit( $location ) . $file_name ) ) { |
|
| 296 | - include trailingslashit( $location ) . $file_name; |
|
| 295 | + if (file_exists(trailingslashit($location) . $file_name)) { |
|
| 296 | + include trailingslashit($location) . $file_name; |
|
| 297 | 297 | break; |
| 298 | 298 | } |
| 299 | 299 | |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | public function init() { |
| 308 | 308 | |
| 309 | 309 | // Fires before getpaid inits. |
| 310 | - do_action( 'before_getpaid_init', $this ); |
|
| 310 | + do_action('before_getpaid_init', $this); |
|
| 311 | 311 | |
| 312 | 312 | // Maybe upgrade. |
| 313 | 313 | $this->maybe_upgrade_database(); |
@@ -324,17 +324,17 @@ discard block |
||
| 324 | 324 | ) |
| 325 | 325 | ); |
| 326 | 326 | |
| 327 | - foreach ( $gateways as $id => $class ) { |
|
| 328 | - $this->gateways[ $id ] = new $class(); |
|
| 327 | + foreach ($gateways as $id => $class) { |
|
| 328 | + $this->gateways[$id] = new $class(); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | - if ( 'yes' != get_option( 'wpinv_renamed_gateways' ) ) { |
|
| 331 | + if ('yes' != get_option('wpinv_renamed_gateways')) { |
|
| 332 | 332 | GetPaid_Installer::rename_gateways_label(); |
| 333 | - update_option( 'wpinv_renamed_gateways', 'yes' ); |
|
| 333 | + update_option('wpinv_renamed_gateways', 'yes'); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | // Fires after getpaid inits. |
| 337 | - do_action( 'getpaid_init', $this ); |
|
| 337 | + do_action('getpaid_init', $this); |
|
| 338 | 338 | |
| 339 | 339 | } |
| 340 | 340 | |
@@ -344,14 +344,14 @@ discard block |
||
| 344 | 344 | public function maybe_process_ipn() { |
| 345 | 345 | |
| 346 | 346 | // Ensure that this is an IPN request. |
| 347 | - if ( empty( $_GET['wpi-listener'] ) || 'IPN' !== $_GET['wpi-listener'] || empty( $_GET['wpi-gateway'] ) ) { |
|
| 347 | + if (empty($_GET['wpi-listener']) || 'IPN' !== $_GET['wpi-listener'] || empty($_GET['wpi-gateway'])) { |
|
| 348 | 348 | return; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - $gateway = wpinv_clean( $_GET['wpi-gateway'] ); |
|
| 351 | + $gateway = wpinv_clean($_GET['wpi-gateway']); |
|
| 352 | 352 | |
| 353 | - do_action( 'wpinv_verify_payment_ipn', $gateway ); |
|
| 354 | - do_action( "wpinv_verify_{$gateway}_ipn" ); |
|
| 353 | + do_action('wpinv_verify_payment_ipn', $gateway); |
|
| 354 | + do_action("wpinv_verify_{$gateway}_ipn"); |
|
| 355 | 355 | exit; |
| 356 | 356 | |
| 357 | 357 | } |
@@ -359,27 +359,27 @@ discard block |
||
| 359 | 359 | public function enqueue_scripts() { |
| 360 | 360 | |
| 361 | 361 | // Fires before adding scripts. |
| 362 | - do_action( 'getpaid_enqueue_scripts' ); |
|
| 362 | + do_action('getpaid_enqueue_scripts'); |
|
| 363 | 363 | |
| 364 | 364 | $localize = array(); |
| 365 | - $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
| 366 | - $localize['nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
| 367 | - $localize['txtComplete'] = __( 'Continue', 'invoicing' ); |
|
| 365 | + $localize['ajax_url'] = admin_url('admin-ajax.php'); |
|
| 366 | + $localize['nonce'] = wp_create_nonce('wpinv-nonce'); |
|
| 367 | + $localize['txtComplete'] = __('Continue', 'invoicing'); |
|
| 368 | 368 | $localize['UseTaxes'] = wpinv_use_taxes(); |
| 369 | - $localize['formNonce'] = wp_create_nonce( 'getpaid_form_nonce' ); |
|
| 370 | - $localize['loading'] = __( 'Loading...', 'invoicing' ); |
|
| 371 | - $localize['connectionError'] = __( 'Could not establish a connection to the server.', 'invoicing' ); |
|
| 369 | + $localize['formNonce'] = wp_create_nonce('getpaid_form_nonce'); |
|
| 370 | + $localize['loading'] = __('Loading...', 'invoicing'); |
|
| 371 | + $localize['connectionError'] = __('Could not establish a connection to the server.', 'invoicing'); |
|
| 372 | 372 | |
| 373 | - $localize = apply_filters( 'wpinv_front_js_localize', $localize ); |
|
| 373 | + $localize = apply_filters('wpinv_front_js_localize', $localize); |
|
| 374 | 374 | |
| 375 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' ); |
|
| 376 | - wp_enqueue_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'jquery' ), $version, true ); |
|
| 377 | - wp_localize_script( 'wpinv-front-script', 'WPInv', $localize ); |
|
| 375 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js'); |
|
| 376 | + wp_enqueue_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array('jquery'), $version, true); |
|
| 377 | + wp_localize_script('wpinv-front-script', 'WPInv', $localize); |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | public function wpinv_actions() { |
| 381 | - if ( isset( $_REQUEST['wpi_action'] ) ) { |
|
| 382 | - do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST ); |
|
| 381 | + if (isset($_REQUEST['wpi_action'])) { |
|
| 382 | + do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST); |
|
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | |
@@ -391,24 +391,24 @@ discard block |
||
| 391 | 391 | */ |
| 392 | 392 | public function maybe_do_authenticated_action() { |
| 393 | 393 | |
| 394 | - if ( isset( $_REQUEST['getpaid-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) { |
|
| 394 | + if (isset($_REQUEST['getpaid-action']) && isset($_REQUEST['getpaid-nonce']) && wp_verify_nonce($_REQUEST['getpaid-nonce'], 'getpaid-nonce')) { |
|
| 395 | 395 | |
| 396 | - $key = sanitize_key( $_REQUEST['getpaid-action'] ); |
|
| 397 | - $data = wp_unslash( $_REQUEST ); |
|
| 398 | - if ( is_user_logged_in() ) { |
|
| 399 | - do_action( "getpaid_authenticated_action_$key", $data ); |
|
| 396 | + $key = sanitize_key($_REQUEST['getpaid-action']); |
|
| 397 | + $data = wp_unslash($_REQUEST); |
|
| 398 | + if (is_user_logged_in()) { |
|
| 399 | + do_action("getpaid_authenticated_action_$key", $data); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - do_action( "getpaid_unauthenticated_action_$key", $data ); |
|
| 402 | + do_action("getpaid_unauthenticated_action_$key", $data); |
|
| 403 | 403 | |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | - public function pre_get_posts( $wp_query ) { |
|
| 408 | + public function pre_get_posts($wp_query) { |
|
| 409 | 409 | |
| 410 | - if ( ! is_admin() && ! empty( $wp_query->query_vars['post_type'] ) && getpaid_is_invoice_post_type( $wp_query->query_vars['post_type'] ) && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) { |
|
| 411 | - $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses( false, false, $wp_query->query_vars['post_type'] ) ); |
|
| 410 | + if (!is_admin() && !empty($wp_query->query_vars['post_type']) && getpaid_is_invoice_post_type($wp_query->query_vars['post_type']) && is_user_logged_in() && is_single() && $wp_query->is_main_query()) { |
|
| 411 | + $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses(false, false, $wp_query->query_vars['post_type'])); |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | return $wp_query; |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | // Currently, UX Builder does not work particulaly well with SuperDuper. |
| 424 | 424 | // So we disable our widgets when editing a page with UX Builder. |
| 425 | - if ( function_exists( 'ux_builder_is_active' ) && ux_builder_is_active() ) { |
|
| 425 | + if (function_exists('ux_builder_is_active') && ux_builder_is_active()) { |
|
| 426 | 426 | return; |
| 427 | 427 | } |
| 428 | 428 | |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | ) |
| 440 | 440 | ); |
| 441 | 441 | |
| 442 | - foreach ( $widgets as $widget ) { |
|
| 443 | - register_widget( $widget ); |
|
| 442 | + foreach ($widgets as $widget) { |
|
| 443 | + register_widget($widget); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | } |
@@ -452,29 +452,29 @@ discard block |
||
| 452 | 452 | */ |
| 453 | 453 | public function maybe_upgrade_database() { |
| 454 | 454 | |
| 455 | - $wpi_version = get_option( 'wpinv_version', 0 ); |
|
| 455 | + $wpi_version = get_option('wpinv_version', 0); |
|
| 456 | 456 | |
| 457 | - if ( $wpi_version == WPINV_VERSION ) { |
|
| 457 | + if ($wpi_version == WPINV_VERSION) { |
|
| 458 | 458 | return; |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | $installer = new GetPaid_Installer(); |
| 462 | 462 | |
| 463 | - if ( empty( $wpi_version ) ) { |
|
| 464 | - return $installer->upgrade_db( 0 ); |
|
| 463 | + if (empty($wpi_version)) { |
|
| 464 | + return $installer->upgrade_db(0); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - $upgrades = array( |
|
| 467 | + $upgrades = array( |
|
| 468 | 468 | '0.0.5' => '004', |
| 469 | 469 | '1.0.3' => '102', |
| 470 | 470 | '2.0.0' => '118', |
| 471 | 471 | '2.0.8' => '207', |
| 472 | 472 | ); |
| 473 | 473 | |
| 474 | - foreach ( $upgrades as $key => $method ) { |
|
| 474 | + foreach ($upgrades as $key => $method) { |
|
| 475 | 475 | |
| 476 | - if ( version_compare( $wpi_version, $key, '<' ) ) { |
|
| 477 | - return $installer->upgrade_db( $method ); |
|
| 476 | + if (version_compare($wpi_version, $key, '<')) { |
|
| 477 | + return $installer->upgrade_db($method); |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | } |
@@ -488,11 +488,11 @@ discard block |
||
| 488 | 488 | */ |
| 489 | 489 | public function maybe_flush_permalinks() { |
| 490 | 490 | |
| 491 | - $flush = get_option( 'wpinv_flush_permalinks', 0 ); |
|
| 491 | + $flush = get_option('wpinv_flush_permalinks', 0); |
|
| 492 | 492 | |
| 493 | - if ( ! empty( $flush ) ) { |
|
| 493 | + if (!empty($flush)) { |
|
| 494 | 494 | flush_rewrite_rules(); |
| 495 | - delete_option( 'wpinv_flush_permalinks' ); |
|
| 495 | + delete_option('wpinv_flush_permalinks'); |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | } |
@@ -503,10 +503,10 @@ discard block |
||
| 503 | 503 | * @since 1.0.19 |
| 504 | 504 | * @param int[] $excluded_posts_ids |
| 505 | 505 | */ |
| 506 | - public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){ |
|
| 506 | + public function wpseo_exclude_from_sitemap_by_post_ids($excluded_posts_ids) { |
|
| 507 | 507 | |
| 508 | 508 | // Ensure that we have an array. |
| 509 | - if ( ! is_array( $excluded_posts_ids ) ) { |
|
| 509 | + if (!is_array($excluded_posts_ids)) { |
|
| 510 | 510 | $excluded_posts_ids = array(); |
| 511 | 511 | } |
| 512 | 512 | |
@@ -514,24 +514,24 @@ discard block |
||
| 514 | 514 | $our_pages = array(); |
| 515 | 515 | |
| 516 | 516 | // Checkout page. |
| 517 | - $our_pages[] = wpinv_get_option( 'checkout_page', false ); |
|
| 517 | + $our_pages[] = wpinv_get_option('checkout_page', false); |
|
| 518 | 518 | |
| 519 | 519 | // Success page. |
| 520 | - $our_pages[] = wpinv_get_option( 'success_page', false ); |
|
| 520 | + $our_pages[] = wpinv_get_option('success_page', false); |
|
| 521 | 521 | |
| 522 | 522 | // Failure page. |
| 523 | - $our_pages[] = wpinv_get_option( 'failure_page', false ); |
|
| 523 | + $our_pages[] = wpinv_get_option('failure_page', false); |
|
| 524 | 524 | |
| 525 | 525 | // History page. |
| 526 | - $our_pages[] = wpinv_get_option( 'invoice_history_page', false ); |
|
| 526 | + $our_pages[] = wpinv_get_option('invoice_history_page', false); |
|
| 527 | 527 | |
| 528 | 528 | // Subscriptions page. |
| 529 | - $our_pages[] = wpinv_get_option( 'invoice_subscription_page', false ); |
|
| 529 | + $our_pages[] = wpinv_get_option('invoice_subscription_page', false); |
|
| 530 | 530 | |
| 531 | - $our_pages = array_map( 'intval', array_filter( $our_pages ) ); |
|
| 531 | + $our_pages = array_map('intval', array_filter($our_pages)); |
|
| 532 | 532 | |
| 533 | 533 | $excluded_posts_ids = $excluded_posts_ids + $our_pages; |
| 534 | - return array_unique( $excluded_posts_ids ); |
|
| 534 | + return array_unique($excluded_posts_ids); |
|
| 535 | 535 | |
| 536 | 536 | } |
| 537 | 537 | |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | * @since 2.0.0 |
| 542 | 542 | */ |
| 543 | 543 | public function wp_footer() { |
| 544 | - wpinv_get_template( 'frontend-footer.php' ); |
|
| 544 | + wpinv_get_template('frontend-footer.php'); |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | /** |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | * @since 2.0.0 |
| 551 | 551 | */ |
| 552 | 552 | public function wp_head() { |
| 553 | - wpinv_get_template( 'frontend-head.php' ); |
|
| 553 | + wpinv_get_template('frontend-head.php'); |
|
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | } |
@@ -13,94 +13,94 @@ discard block |
||
| 13 | 13 | class GetPaid_Paypal_Gateway extends GetPaid_Payment_Gateway { |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * Payment method id. |
|
| 17 | - * |
|
| 18 | - * @var string |
|
| 19 | - */ |
|
| 16 | + * Payment method id. |
|
| 17 | + * |
|
| 18 | + * @var string |
|
| 19 | + */ |
|
| 20 | 20 | public $id = 'paypal'; |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * An array of features that this gateway supports. |
|
| 24 | - * |
|
| 25 | - * @var array |
|
| 26 | - */ |
|
| 23 | + * An array of features that this gateway supports. |
|
| 24 | + * |
|
| 25 | + * @var array |
|
| 26 | + */ |
|
| 27 | 27 | protected $supports = array( 'subscription', 'sandbox' ); |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | - * Payment method order. |
|
| 31 | - * |
|
| 32 | - * @var int |
|
| 33 | - */ |
|
| 30 | + * Payment method order. |
|
| 31 | + * |
|
| 32 | + * @var int |
|
| 33 | + */ |
|
| 34 | 34 | public $order = 1; |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * Stores line items to send to PayPal. |
|
| 38 | - * |
|
| 39 | - * @var array |
|
| 40 | - */ |
|
| 37 | + * Stores line items to send to PayPal. |
|
| 38 | + * |
|
| 39 | + * @var array |
|
| 40 | + */ |
|
| 41 | 41 | protected $line_items = array(); |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * Endpoint for requests from PayPal. |
|
| 45 | - * |
|
| 46 | - * @var string |
|
| 47 | - */ |
|
| 48 | - protected $notify_url; |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * Endpoint for requests to PayPal. |
|
| 52 | - * |
|
| 53 | - * @var string |
|
| 54 | - */ |
|
| 44 | + * Endpoint for requests from PayPal. |
|
| 45 | + * |
|
| 46 | + * @var string |
|
| 47 | + */ |
|
| 48 | + protected $notify_url; |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * Endpoint for requests to PayPal. |
|
| 52 | + * |
|
| 53 | + * @var string |
|
| 54 | + */ |
|
| 55 | 55 | protected $endpoint; |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * Currencies this gateway is allowed for. |
|
| 59 | - * |
|
| 60 | - * @var array |
|
| 61 | - */ |
|
| 62 | - public $currencies = array( 'AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB', 'RUB', 'INR' ); |
|
| 58 | + * Currencies this gateway is allowed for. |
|
| 59 | + * |
|
| 60 | + * @var array |
|
| 61 | + */ |
|
| 62 | + public $currencies = array( 'AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB', 'RUB', 'INR' ); |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | - * URL to view a transaction. |
|
| 66 | - * |
|
| 67 | - * @var string |
|
| 68 | - */ |
|
| 65 | + * URL to view a transaction. |
|
| 66 | + * |
|
| 67 | + * @var string |
|
| 68 | + */ |
|
| 69 | 69 | public $view_transaction_url = 'https://www.{sandbox}paypal.com/activity/payment/%s'; |
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | - * URL to view a subscription. |
|
| 73 | - * |
|
| 74 | - * @var string |
|
| 75 | - */ |
|
| 76 | - public $view_subscription_url = 'https://www.{sandbox}paypal.com/cgi-bin/webscr?cmd=_profile-recurring-payments&encrypted_profile_id=%s'; |
|
| 72 | + * URL to view a subscription. |
|
| 73 | + * |
|
| 74 | + * @var string |
|
| 75 | + */ |
|
| 76 | + public $view_subscription_url = 'https://www.{sandbox}paypal.com/cgi-bin/webscr?cmd=_profile-recurring-payments&encrypted_profile_id=%s'; |
|
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | - * Class constructor. |
|
| 80 | - */ |
|
| 81 | - public function __construct() { |
|
| 79 | + * Class constructor. |
|
| 80 | + */ |
|
| 81 | + public function __construct() { |
|
| 82 | 82 | |
| 83 | 83 | $this->title = __( 'PayPal Standard', 'invoicing' ); |
| 84 | 84 | $this->method_title = __( 'PayPal Standard', 'invoicing' ); |
| 85 | 85 | $this->checkout_button_text = __( 'Proceed to PayPal', 'invoicing' ); |
| 86 | 86 | $this->notify_url = wpinv_get_ipn_url( $this->id ); |
| 87 | 87 | |
| 88 | - add_filter( 'getpaid_paypal_args', array( $this, 'process_subscription' ), 10, 2 ); |
|
| 88 | + add_filter( 'getpaid_paypal_args', array( $this, 'process_subscription' ), 10, 2 ); |
|
| 89 | 89 | add_filter( 'getpaid_paypal_sandbox_notice', array( $this, 'sandbox_notice' ) ); |
| 90 | 90 | |
| 91 | 91 | parent::__construct(); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | - * Process Payment. |
|
| 96 | - * |
|
| 97 | - * |
|
| 98 | - * @param WPInv_Invoice $invoice Invoice. |
|
| 99 | - * @param array $submission_data Posted checkout fields. |
|
| 100 | - * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
|
| 101 | - * @return array |
|
| 102 | - */ |
|
| 103 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
| 95 | + * Process Payment. |
|
| 96 | + * |
|
| 97 | + * |
|
| 98 | + * @param WPInv_Invoice $invoice Invoice. |
|
| 99 | + * @param array $submission_data Posted checkout fields. |
|
| 100 | + * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
|
| 101 | + * @return array |
|
| 102 | + */ |
|
| 103 | + public function process_payment( $invoice, $submission_data, $submission ) { |
|
| 104 | 104 | |
| 105 | 105 | // Get redirect url. |
| 106 | 106 | $paypal_redirect = $this->get_request_url( $invoice ); |
@@ -123,15 +123,15 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | - * Get the PayPal request URL for an invoice. |
|
| 127 | - * |
|
| 128 | - * @param WPInv_Invoice $invoice Invoice object. |
|
| 129 | - * @return string |
|
| 130 | - */ |
|
| 131 | - public function get_request_url( $invoice ) { |
|
| 126 | + * Get the PayPal request URL for an invoice. |
|
| 127 | + * |
|
| 128 | + * @param WPInv_Invoice $invoice Invoice object. |
|
| 129 | + * @return string |
|
| 130 | + */ |
|
| 131 | + public function get_request_url( $invoice ) { |
|
| 132 | 132 | |
| 133 | 133 | // Endpoint for this request |
| 134 | - $this->endpoint = $this->is_sandbox( $invoice ) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr?test_ipn=1&' : 'https://www.paypal.com/cgi-bin/webscr?'; |
|
| 134 | + $this->endpoint = $this->is_sandbox( $invoice ) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr?test_ipn=1&' : 'https://www.paypal.com/cgi-bin/webscr?'; |
|
| 135 | 135 | |
| 136 | 136 | // Retrieve paypal args. |
| 137 | 137 | $paypal_args = map_deep( $this->get_paypal_args( $invoice ), 'urlencode' ); |
@@ -144,44 +144,44 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | return add_query_arg( $paypal_args, $this->endpoint ); |
| 146 | 146 | |
| 147 | - } |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | - * Get PayPal Args for passing to PP. |
|
| 151 | - * |
|
| 152 | - * @param WPInv_Invoice $invoice Invoice object. |
|
| 153 | - * @return array |
|
| 154 | - */ |
|
| 155 | - protected function get_paypal_args( $invoice ) { |
|
| 150 | + * Get PayPal Args for passing to PP. |
|
| 151 | + * |
|
| 152 | + * @param WPInv_Invoice $invoice Invoice object. |
|
| 153 | + * @return array |
|
| 154 | + */ |
|
| 155 | + protected function get_paypal_args( $invoice ) { |
|
| 156 | 156 | |
| 157 | 157 | // Whether or not to send the line items as one item. |
| 158 | - $force_one_line_item = apply_filters( 'getpaid_paypal_force_one_line_item', false, $invoice ); |
|
| 159 | - |
|
| 160 | - if ( $invoice->is_recurring() || ( wpinv_use_taxes() && wpinv_prices_include_tax() ) ) { |
|
| 161 | - $force_one_line_item = true; |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - $paypal_args = apply_filters( |
|
| 165 | - 'getpaid_paypal_args', |
|
| 166 | - array_merge( |
|
| 167 | - $this->get_transaction_args( $invoice ), |
|
| 168 | - $this->get_line_item_args( $invoice, $force_one_line_item ) |
|
| 169 | - ), |
|
| 170 | - $invoice |
|
| 171 | - ); |
|
| 172 | - |
|
| 173 | - return $this->fix_request_length( $invoice, $paypal_args ); |
|
| 158 | + $force_one_line_item = apply_filters( 'getpaid_paypal_force_one_line_item', false, $invoice ); |
|
| 159 | + |
|
| 160 | + if ( $invoice->is_recurring() || ( wpinv_use_taxes() && wpinv_prices_include_tax() ) ) { |
|
| 161 | + $force_one_line_item = true; |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + $paypal_args = apply_filters( |
|
| 165 | + 'getpaid_paypal_args', |
|
| 166 | + array_merge( |
|
| 167 | + $this->get_transaction_args( $invoice ), |
|
| 168 | + $this->get_line_item_args( $invoice, $force_one_line_item ) |
|
| 169 | + ), |
|
| 170 | + $invoice |
|
| 171 | + ); |
|
| 172 | + |
|
| 173 | + return $this->fix_request_length( $invoice, $paypal_args ); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | - * Get transaction args for paypal request. |
|
| 178 | - * |
|
| 179 | - * @param WPInv_Invoice $invoice Invoice object. |
|
| 180 | - * @return array |
|
| 181 | - */ |
|
| 182 | - protected function get_transaction_args( $invoice ) { |
|
| 183 | - |
|
| 184 | - return array( |
|
| 177 | + * Get transaction args for paypal request. |
|
| 178 | + * |
|
| 179 | + * @param WPInv_Invoice $invoice Invoice object. |
|
| 180 | + * @return array |
|
| 181 | + */ |
|
| 182 | + protected function get_transaction_args( $invoice ) { |
|
| 183 | + |
|
| 184 | + return array( |
|
| 185 | 185 | 'cmd' => '_cart', |
| 186 | 186 | 'business' => wpinv_get_option( 'paypal_email', false ), |
| 187 | 187 | 'no_shipping' => '1', |
@@ -206,16 +206,16 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | - * Get line item args for paypal request. |
|
| 210 | - * |
|
| 211 | - * @param WPInv_Invoice $invoice Invoice object. |
|
| 212 | - * @param bool $force_one_line_item Create only one item for this invoice. |
|
| 213 | - * @return array |
|
| 214 | - */ |
|
| 215 | - protected function get_line_item_args( $invoice, $force_one_line_item = false ) { |
|
| 209 | + * Get line item args for paypal request. |
|
| 210 | + * |
|
| 211 | + * @param WPInv_Invoice $invoice Invoice object. |
|
| 212 | + * @param bool $force_one_line_item Create only one item for this invoice. |
|
| 213 | + * @return array |
|
| 214 | + */ |
|
| 215 | + protected function get_line_item_args( $invoice, $force_one_line_item = false ) { |
|
| 216 | 216 | |
| 217 | 217 | // Maybe send invoice as a single item. |
| 218 | - if ( $force_one_line_item ) { |
|
| 218 | + if ( $force_one_line_item ) { |
|
| 219 | 219 | return $this->get_line_item_args_single_item( $invoice ); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -235,129 +235,129 @@ discard block |
||
| 235 | 235 | $line_item_args['discount_amount_cart'] = wpinv_sanitize_amount( (float) $invoice->get_total_discount(), 2 ); |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - return array_merge( $line_item_args, $this->get_line_items() ); |
|
| 238 | + return array_merge( $line_item_args, $this->get_line_items() ); |
|
| 239 | 239 | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
| 243 | - * Get line item args for paypal request as a single line item. |
|
| 244 | - * |
|
| 245 | - * @param WPInv_Invoice $invoice Invoice object. |
|
| 246 | - * @return array |
|
| 247 | - */ |
|
| 248 | - protected function get_line_item_args_single_item( $invoice ) { |
|
| 249 | - $this->delete_line_items(); |
|
| 243 | + * Get line item args for paypal request as a single line item. |
|
| 244 | + * |
|
| 245 | + * @param WPInv_Invoice $invoice Invoice object. |
|
| 246 | + * @return array |
|
| 247 | + */ |
|
| 248 | + protected function get_line_item_args_single_item( $invoice ) { |
|
| 249 | + $this->delete_line_items(); |
|
| 250 | 250 | |
| 251 | 251 | $item_name = sprintf( __( 'Invoice #%s', 'invoicing' ), $invoice->get_number() ); |
| 252 | - $this->add_line_item( $item_name, 1, wpinv_sanitize_amount( (float) $invoice->get_total(), 2 ), $invoice->get_id() ); |
|
| 252 | + $this->add_line_item( $item_name, 1, wpinv_sanitize_amount( (float) $invoice->get_total(), 2 ), $invoice->get_id() ); |
|
| 253 | 253 | |
| 254 | - return $this->get_line_items(); |
|
| 254 | + return $this->get_line_items(); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
| 258 | - * Return all line items. |
|
| 259 | - */ |
|
| 260 | - protected function get_line_items() { |
|
| 261 | - return $this->line_items; |
|
| 262 | - } |
|
| 258 | + * Return all line items. |
|
| 259 | + */ |
|
| 260 | + protected function get_line_items() { |
|
| 261 | + return $this->line_items; |
|
| 262 | + } |
|
| 263 | 263 | |
| 264 | 264 | /** |
| 265 | - * Remove all line items. |
|
| 266 | - */ |
|
| 267 | - protected function delete_line_items() { |
|
| 268 | - $this->line_items = array(); |
|
| 265 | + * Remove all line items. |
|
| 266 | + */ |
|
| 267 | + protected function delete_line_items() { |
|
| 268 | + $this->line_items = array(); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | - * Prepare line items to send to paypal. |
|
| 273 | - * |
|
| 274 | - * @param WPInv_Invoice $invoice Invoice object. |
|
| 275 | - */ |
|
| 276 | - protected function prepare_line_items( $invoice ) { |
|
| 277 | - $this->delete_line_items(); |
|
| 278 | - |
|
| 279 | - // Items. |
|
| 280 | - foreach ( $invoice->get_items() as $item ) { |
|
| 281 | - $amount = $item->get_price(); |
|
| 282 | - $quantity = $invoice->get_template() == 'amount' ? 1 : $item->get_quantity(); |
|
| 283 | - $this->add_line_item( $item->get_raw_name(), $quantity, $amount, $item->get_id() ); |
|
| 272 | + * Prepare line items to send to paypal. |
|
| 273 | + * |
|
| 274 | + * @param WPInv_Invoice $invoice Invoice object. |
|
| 275 | + */ |
|
| 276 | + protected function prepare_line_items( $invoice ) { |
|
| 277 | + $this->delete_line_items(); |
|
| 278 | + |
|
| 279 | + // Items. |
|
| 280 | + foreach ( $invoice->get_items() as $item ) { |
|
| 281 | + $amount = $item->get_price(); |
|
| 282 | + $quantity = $invoice->get_template() == 'amount' ? 1 : $item->get_quantity(); |
|
| 283 | + $this->add_line_item( $item->get_raw_name(), $quantity, $amount, $item->get_id() ); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // Fees. |
| 287 | - foreach ( $invoice->get_fees() as $fee => $data ) { |
|
| 287 | + foreach ( $invoice->get_fees() as $fee => $data ) { |
|
| 288 | 288 | $this->add_line_item( $fee, 1, wpinv_sanitize_amount( $data['initial_fee'] ) ); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
| 294 | - * Add PayPal Line Item. |
|
| 295 | - * |
|
| 296 | - * @param string $item_name Item name. |
|
| 297 | - * @param int $quantity Item quantity. |
|
| 298 | - * @param float $amount Amount. |
|
| 299 | - * @param string $item_number Item number. |
|
| 300 | - */ |
|
| 301 | - protected function add_line_item( $item_name, $quantity = 1, $amount = 0.0, $item_number = '' ) { |
|
| 302 | - $index = ( count( $this->line_items ) / 4 ) + 1; |
|
| 303 | - |
|
| 304 | - $item = apply_filters( |
|
| 305 | - 'getpaid_paypal_line_item', |
|
| 306 | - array( |
|
| 307 | - 'item_name' => html_entity_decode( getpaid_limit_length( $item_name ? wp_strip_all_tags( $item_name ) : __( 'Item', 'invoicing' ), 127 ), ENT_NOQUOTES, 'UTF-8' ), |
|
| 308 | - 'quantity' => (float) $quantity, |
|
| 309 | - 'amount' => wpinv_sanitize_amount( (float) $amount, 2 ), |
|
| 310 | - 'item_number' => $item_number, |
|
| 311 | - ), |
|
| 312 | - $item_name, |
|
| 313 | - $quantity, |
|
| 314 | - $amount, |
|
| 315 | - $item_number |
|
| 316 | - ); |
|
| 317 | - |
|
| 318 | - $this->line_items[ 'item_name_' . $index ] = getpaid_limit_length( $item['item_name'], 127 ); |
|
| 294 | + * Add PayPal Line Item. |
|
| 295 | + * |
|
| 296 | + * @param string $item_name Item name. |
|
| 297 | + * @param int $quantity Item quantity. |
|
| 298 | + * @param float $amount Amount. |
|
| 299 | + * @param string $item_number Item number. |
|
| 300 | + */ |
|
| 301 | + protected function add_line_item( $item_name, $quantity = 1, $amount = 0.0, $item_number = '' ) { |
|
| 302 | + $index = ( count( $this->line_items ) / 4 ) + 1; |
|
| 303 | + |
|
| 304 | + $item = apply_filters( |
|
| 305 | + 'getpaid_paypal_line_item', |
|
| 306 | + array( |
|
| 307 | + 'item_name' => html_entity_decode( getpaid_limit_length( $item_name ? wp_strip_all_tags( $item_name ) : __( 'Item', 'invoicing' ), 127 ), ENT_NOQUOTES, 'UTF-8' ), |
|
| 308 | + 'quantity' => (float) $quantity, |
|
| 309 | + 'amount' => wpinv_sanitize_amount( (float) $amount, 2 ), |
|
| 310 | + 'item_number' => $item_number, |
|
| 311 | + ), |
|
| 312 | + $item_name, |
|
| 313 | + $quantity, |
|
| 314 | + $amount, |
|
| 315 | + $item_number |
|
| 316 | + ); |
|
| 317 | + |
|
| 318 | + $this->line_items[ 'item_name_' . $index ] = getpaid_limit_length( $item['item_name'], 127 ); |
|
| 319 | 319 | $this->line_items[ 'quantity_' . $index ] = $item['quantity']; |
| 320 | 320 | |
| 321 | 321 | // The price or amount of the product, service, or contribution, not including shipping, handling, or tax. |
| 322 | - $this->line_items[ 'amount_' . $index ] = $item['amount']; |
|
| 323 | - $this->line_items[ 'item_number_' . $index ] = getpaid_limit_length( $item['item_number'], 127 ); |
|
| 322 | + $this->line_items[ 'amount_' . $index ] = $item['amount']; |
|
| 323 | + $this->line_items[ 'item_number_' . $index ] = getpaid_limit_length( $item['item_number'], 127 ); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
| 327 | - * If the default request with line items is too long, generate a new one with only one line item. |
|
| 328 | - * |
|
| 329 | - * https://support.microsoft.com/en-us/help/208427/maximum-url-length-is-2-083-characters-in-internet-explorer. |
|
| 330 | - * |
|
| 331 | - * @param WPInv_Invoice $invoice Invoice to be sent to Paypal. |
|
| 332 | - * @param array $paypal_args Arguments sent to Paypal in the request. |
|
| 333 | - * @return array |
|
| 334 | - */ |
|
| 335 | - protected function fix_request_length( $invoice, $paypal_args ) { |
|
| 336 | - $max_paypal_length = 2083; |
|
| 337 | - $query_candidate = http_build_query( $paypal_args, '', '&' ); |
|
| 338 | - |
|
| 339 | - if ( strlen( $this->endpoint . $query_candidate ) <= $max_paypal_length ) { |
|
| 340 | - return $paypal_args; |
|
| 341 | - } |
|
| 342 | - |
|
| 343 | - return apply_filters( |
|
| 344 | - 'getpaid_paypal_args', |
|
| 345 | - array_merge( |
|
| 346 | - $this->get_transaction_args( $invoice ), |
|
| 347 | - $this->get_line_item_args( $invoice, true ) |
|
| 348 | - ), |
|
| 349 | - $invoice |
|
| 350 | - ); |
|
| 327 | + * If the default request with line items is too long, generate a new one with only one line item. |
|
| 328 | + * |
|
| 329 | + * https://support.microsoft.com/en-us/help/208427/maximum-url-length-is-2-083-characters-in-internet-explorer. |
|
| 330 | + * |
|
| 331 | + * @param WPInv_Invoice $invoice Invoice to be sent to Paypal. |
|
| 332 | + * @param array $paypal_args Arguments sent to Paypal in the request. |
|
| 333 | + * @return array |
|
| 334 | + */ |
|
| 335 | + protected function fix_request_length( $invoice, $paypal_args ) { |
|
| 336 | + $max_paypal_length = 2083; |
|
| 337 | + $query_candidate = http_build_query( $paypal_args, '', '&' ); |
|
| 338 | + |
|
| 339 | + if ( strlen( $this->endpoint . $query_candidate ) <= $max_paypal_length ) { |
|
| 340 | + return $paypal_args; |
|
| 341 | + } |
|
| 342 | + |
|
| 343 | + return apply_filters( |
|
| 344 | + 'getpaid_paypal_args', |
|
| 345 | + array_merge( |
|
| 346 | + $this->get_transaction_args( $invoice ), |
|
| 347 | + $this->get_line_item_args( $invoice, true ) |
|
| 348 | + ), |
|
| 349 | + $invoice |
|
| 350 | + ); |
|
| 351 | 351 | |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | /** |
| 355 | - * Processes recurring invoices. |
|
| 356 | - * |
|
| 357 | - * @param array $paypal_args PayPal args. |
|
| 358 | - * @param WPInv_Invoice $invoice Invoice object. |
|
| 359 | - */ |
|
| 360 | - public function process_subscription( $paypal_args, $invoice ) { |
|
| 355 | + * Processes recurring invoices. |
|
| 356 | + * |
|
| 357 | + * @param array $paypal_args PayPal args. |
|
| 358 | + * @param WPInv_Invoice $invoice Invoice object. |
|
| 359 | + */ |
|
| 360 | + public function process_subscription( $paypal_args, $invoice ) { |
|
| 361 | 361 | |
| 362 | 362 | // Make sure this is a subscription. |
| 363 | 363 | if ( ! $invoice->is_recurring() || ! $subscription = wpinv_get_subscription( $invoice ) ) { |
@@ -382,11 +382,11 @@ discard block |
||
| 382 | 382 | |
| 383 | 383 | $paypal_args['a1'] = 0 == $initial_amount ? 0 : $initial_amount; |
| 384 | 384 | |
| 385 | - // Trial period length. |
|
| 386 | - $paypal_args['p1'] = $subscription_item->get_trial_interval(); |
|
| 385 | + // Trial period length. |
|
| 386 | + $paypal_args['p1'] = $subscription_item->get_trial_interval(); |
|
| 387 | 387 | |
| 388 | - // Trial period. |
|
| 389 | - $paypal_args['t1'] = $subscription_item->get_trial_period(); |
|
| 388 | + // Trial period. |
|
| 389 | + $paypal_args['t1'] = $subscription_item->get_trial_period(); |
|
| 390 | 390 | |
| 391 | 391 | } else if ( $initial_amount != $recurring_amount ) { |
| 392 | 392 | |
@@ -409,40 +409,40 @@ discard block |
||
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | // We have a recurring payment |
| 412 | - if ( ! isset( $param_number ) || 1 == $param_number ) { |
|
| 412 | + if ( ! isset( $param_number ) || 1 == $param_number ) { |
|
| 413 | 413 | |
| 414 | - // Subscription price |
|
| 415 | - $paypal_args['a3'] = $recurring_amount; |
|
| 414 | + // Subscription price |
|
| 415 | + $paypal_args['a3'] = $recurring_amount; |
|
| 416 | 416 | |
| 417 | - // Subscription duration |
|
| 418 | - $paypal_args['p3'] = $interval; |
|
| 417 | + // Subscription duration |
|
| 418 | + $paypal_args['p3'] = $interval; |
|
| 419 | 419 | |
| 420 | - // Subscription period |
|
| 421 | - $paypal_args['t3'] = $period; |
|
| 420 | + // Subscription period |
|
| 421 | + $paypal_args['t3'] = $period; |
|
| 422 | 422 | |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | // Recurring payments |
| 426 | - if ( 1 == $bill_times || ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() && 2 == $bill_times ) ) { |
|
| 426 | + if ( 1 == $bill_times || ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() && 2 == $bill_times ) ) { |
|
| 427 | 427 | |
| 428 | - // Non-recurring payments |
|
| 429 | - $paypal_args['src'] = 0; |
|
| 428 | + // Non-recurring payments |
|
| 429 | + $paypal_args['src'] = 0; |
|
| 430 | 430 | |
| 431 | - } else { |
|
| 431 | + } else { |
|
| 432 | 432 | |
| 433 | - $paypal_args['src'] = 1; |
|
| 433 | + $paypal_args['src'] = 1; |
|
| 434 | 434 | |
| 435 | - if ( $bill_times > 0 ) { |
|
| 435 | + if ( $bill_times > 0 ) { |
|
| 436 | 436 | |
| 437 | - // An initial period is being used to charge a sign-up fee |
|
| 438 | - if ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() ) { |
|
| 439 | - $bill_times--; |
|
| 440 | - } |
|
| 437 | + // An initial period is being used to charge a sign-up fee |
|
| 438 | + if ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() ) { |
|
| 439 | + $bill_times--; |
|
| 440 | + } |
|
| 441 | 441 | |
| 442 | 442 | // Make sure it's not over the max of 52 |
| 443 | 443 | $paypal_args['srt'] = ( $bill_times <= 52 ? absint( $bill_times ) : 52 ); |
| 444 | 444 | |
| 445 | - } |
|
| 445 | + } |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | // Force return URL so that order description & instructions display |
@@ -458,19 +458,19 @@ discard block |
||
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | return apply_filters( |
| 461 | - 'getpaid_paypal_subscription_args', |
|
| 462 | - $paypal_args, |
|
| 463 | - $invoice |
|
| 461 | + 'getpaid_paypal_subscription_args', |
|
| 462 | + $paypal_args, |
|
| 463 | + $invoice |
|
| 464 | 464 | ); |
| 465 | 465 | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
| 469 | - * Processes ipns and marks payments as complete. |
|
| 470 | - * |
|
| 471 | - * @return void |
|
| 472 | - */ |
|
| 473 | - public function verify_ipn() { |
|
| 469 | + * Processes ipns and marks payments as complete. |
|
| 470 | + * |
|
| 471 | + * @return void |
|
| 472 | + */ |
|
| 473 | + public function verify_ipn() { |
|
| 474 | 474 | new GetPaid_Paypal_Gateway_IPN_Handler( $this ); |
| 475 | 475 | } |
| 476 | 476 | |
@@ -480,10 +480,10 @@ discard block |
||
| 480 | 480 | public function sandbox_notice() { |
| 481 | 481 | |
| 482 | 482 | return sprintf( |
| 483 | - __( 'SANDBOX ENABLED. You can use sandbox testing accounts only. See the %sPayPal Sandbox Testing Guide%s for more details.', 'invoicing' ), |
|
| 484 | - '<a href="https://developer.paypal.com/docs/classic/lifecycle/ug_sandbox/">', |
|
| 485 | - '</a>' |
|
| 486 | - ); |
|
| 483 | + __( 'SANDBOX ENABLED. You can use sandbox testing accounts only. See the %sPayPal Sandbox Testing Guide%s for more details.', 'invoicing' ), |
|
| 484 | + '<a href="https://developer.paypal.com/docs/classic/lifecycle/ug_sandbox/">', |
|
| 485 | + '</a>' |
|
| 486 | + ); |
|
| 487 | 487 | |
| 488 | 488 | } |
| 489 | 489 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -defined( 'ABSPATH' ) || exit; |
|
| 7 | +defined('ABSPATH') || exit; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Paypal Payment Gateway class. |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @var array |
| 26 | 26 | */ |
| 27 | - protected $supports = array( 'subscription', 'sandbox' ); |
|
| 27 | + protected $supports = array('subscription', 'sandbox'); |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Payment method order. |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @var array |
| 61 | 61 | */ |
| 62 | - public $currencies = array( 'AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB', 'RUB', 'INR' ); |
|
| 62 | + public $currencies = array('AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB', 'RUB', 'INR'); |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * URL to view a transaction. |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function __construct() { |
| 82 | 82 | |
| 83 | - $this->title = __( 'PayPal Standard', 'invoicing' ); |
|
| 84 | - $this->method_title = __( 'PayPal Standard', 'invoicing' ); |
|
| 85 | - $this->checkout_button_text = __( 'Proceed to PayPal', 'invoicing' ); |
|
| 86 | - $this->notify_url = wpinv_get_ipn_url( $this->id ); |
|
| 83 | + $this->title = __('PayPal Standard', 'invoicing'); |
|
| 84 | + $this->method_title = __('PayPal Standard', 'invoicing'); |
|
| 85 | + $this->checkout_button_text = __('Proceed to PayPal', 'invoicing'); |
|
| 86 | + $this->notify_url = wpinv_get_ipn_url($this->id); |
|
| 87 | 87 | |
| 88 | - add_filter( 'getpaid_paypal_args', array( $this, 'process_subscription' ), 10, 2 ); |
|
| 89 | - add_filter( 'getpaid_paypal_sandbox_notice', array( $this, 'sandbox_notice' ) ); |
|
| 88 | + add_filter('getpaid_paypal_args', array($this, 'process_subscription'), 10, 2); |
|
| 89 | + add_filter('getpaid_paypal_sandbox_notice', array($this, 'sandbox_notice')); |
|
| 90 | 90 | |
| 91 | 91 | parent::__construct(); |
| 92 | 92 | } |
@@ -100,16 +100,16 @@ discard block |
||
| 100 | 100 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
| 101 | 101 | * @return array |
| 102 | 102 | */ |
| 103 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
| 103 | + public function process_payment($invoice, $submission_data, $submission) { |
|
| 104 | 104 | |
| 105 | 105 | // Get redirect url. |
| 106 | - $paypal_redirect = $this->get_request_url( $invoice ); |
|
| 106 | + $paypal_redirect = $this->get_request_url($invoice); |
|
| 107 | 107 | |
| 108 | 108 | // Add a note about the request url. |
| 109 | 109 | $invoice->add_note( |
| 110 | 110 | sprintf( |
| 111 | - __( 'Redirecting to PayPal: %s', 'invoicing' ), |
|
| 112 | - esc_url( $paypal_redirect ) |
|
| 111 | + __('Redirecting to PayPal: %s', 'invoicing'), |
|
| 112 | + esc_url($paypal_redirect) |
|
| 113 | 113 | ), |
| 114 | 114 | false, |
| 115 | 115 | false, |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | ); |
| 118 | 118 | |
| 119 | 119 | // Redirect to PayPal |
| 120 | - wp_redirect( $paypal_redirect ); |
|
| 120 | + wp_redirect($paypal_redirect); |
|
| 121 | 121 | exit; |
| 122 | 122 | |
| 123 | 123 | } |
@@ -128,21 +128,21 @@ discard block |
||
| 128 | 128 | * @param WPInv_Invoice $invoice Invoice object. |
| 129 | 129 | * @return string |
| 130 | 130 | */ |
| 131 | - public function get_request_url( $invoice ) { |
|
| 131 | + public function get_request_url($invoice) { |
|
| 132 | 132 | |
| 133 | 133 | // Endpoint for this request |
| 134 | - $this->endpoint = $this->is_sandbox( $invoice ) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr?test_ipn=1&' : 'https://www.paypal.com/cgi-bin/webscr?'; |
|
| 134 | + $this->endpoint = $this->is_sandbox($invoice) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr?test_ipn=1&' : 'https://www.paypal.com/cgi-bin/webscr?'; |
|
| 135 | 135 | |
| 136 | 136 | // Retrieve paypal args. |
| 137 | - $paypal_args = map_deep( $this->get_paypal_args( $invoice ), 'urlencode' ); |
|
| 137 | + $paypal_args = map_deep($this->get_paypal_args($invoice), 'urlencode'); |
|
| 138 | 138 | |
| 139 | - if ( $invoice->is_recurring() ) { |
|
| 139 | + if ($invoice->is_recurring()) { |
|
| 140 | 140 | $paypal_args['bn'] = 'GetPaid_Subscribe_WPS_US'; |
| 141 | 141 | } else { |
| 142 | 142 | $paypal_args['bn'] = 'GetPaid_ShoppingCart_WPS_US'; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - return add_query_arg( $paypal_args, $this->endpoint ); |
|
| 145 | + return add_query_arg($paypal_args, $this->endpoint); |
|
| 146 | 146 | |
| 147 | 147 | } |
| 148 | 148 | |
@@ -152,25 +152,25 @@ discard block |
||
| 152 | 152 | * @param WPInv_Invoice $invoice Invoice object. |
| 153 | 153 | * @return array |
| 154 | 154 | */ |
| 155 | - protected function get_paypal_args( $invoice ) { |
|
| 155 | + protected function get_paypal_args($invoice) { |
|
| 156 | 156 | |
| 157 | 157 | // Whether or not to send the line items as one item. |
| 158 | - $force_one_line_item = apply_filters( 'getpaid_paypal_force_one_line_item', false, $invoice ); |
|
| 158 | + $force_one_line_item = apply_filters('getpaid_paypal_force_one_line_item', false, $invoice); |
|
| 159 | 159 | |
| 160 | - if ( $invoice->is_recurring() || ( wpinv_use_taxes() && wpinv_prices_include_tax() ) ) { |
|
| 160 | + if ($invoice->is_recurring() || (wpinv_use_taxes() && wpinv_prices_include_tax())) { |
|
| 161 | 161 | $force_one_line_item = true; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $paypal_args = apply_filters( |
| 165 | 165 | 'getpaid_paypal_args', |
| 166 | 166 | array_merge( |
| 167 | - $this->get_transaction_args( $invoice ), |
|
| 168 | - $this->get_line_item_args( $invoice, $force_one_line_item ) |
|
| 167 | + $this->get_transaction_args($invoice), |
|
| 168 | + $this->get_line_item_args($invoice, $force_one_line_item) |
|
| 169 | 169 | ), |
| 170 | 170 | $invoice |
| 171 | 171 | ); |
| 172 | 172 | |
| 173 | - return $this->fix_request_length( $invoice, $paypal_args ); |
|
| 173 | + return $this->fix_request_length($invoice, $paypal_args); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -179,11 +179,11 @@ discard block |
||
| 179 | 179 | * @param WPInv_Invoice $invoice Invoice object. |
| 180 | 180 | * @return array |
| 181 | 181 | */ |
| 182 | - protected function get_transaction_args( $invoice ) { |
|
| 182 | + protected function get_transaction_args($invoice) { |
|
| 183 | 183 | |
| 184 | 184 | return array( |
| 185 | 185 | 'cmd' => '_cart', |
| 186 | - 'business' => wpinv_get_option( 'paypal_email', false ), |
|
| 186 | + 'business' => wpinv_get_option('paypal_email', false), |
|
| 187 | 187 | 'no_shipping' => '1', |
| 188 | 188 | 'shipping' => '0', |
| 189 | 189 | 'no_note' => '1', |
@@ -191,16 +191,16 @@ discard block |
||
| 191 | 191 | 'rm' => is_ssl() ? 2 : 1, |
| 192 | 192 | 'upload' => 1, |
| 193 | 193 | 'currency_code' => $invoice->get_currency(), // https://developer.paypal.com/docs/nvp-soap-api/currency-codes/#paypal |
| 194 | - 'return' => esc_url_raw( $this->get_return_url( $invoice ) ), |
|
| 195 | - 'cancel_return' => esc_url_raw( $invoice->get_checkout_payment_url() ), |
|
| 196 | - 'notify_url' => getpaid_limit_length( $this->notify_url, 255 ), |
|
| 197 | - 'invoice' => getpaid_limit_length( $invoice->get_number(), 127 ), |
|
| 194 | + 'return' => esc_url_raw($this->get_return_url($invoice)), |
|
| 195 | + 'cancel_return' => esc_url_raw($invoice->get_checkout_payment_url()), |
|
| 196 | + 'notify_url' => getpaid_limit_length($this->notify_url, 255), |
|
| 197 | + 'invoice' => getpaid_limit_length($invoice->get_number(), 127), |
|
| 198 | 198 | 'custom' => $invoice->get_id(), |
| 199 | - 'first_name' => getpaid_limit_length( $invoice->get_first_name(), 32 ), |
|
| 200 | - 'last_name' => getpaid_limit_length( $invoice->get_last_name(), 64 ), |
|
| 201 | - 'country' => getpaid_limit_length( $invoice->get_country(), 2 ), |
|
| 202 | - 'email' => getpaid_limit_length( $invoice->get_email(), 127 ), |
|
| 203 | - 'cbt' => get_bloginfo( 'name' ) |
|
| 199 | + 'first_name' => getpaid_limit_length($invoice->get_first_name(), 32), |
|
| 200 | + 'last_name' => getpaid_limit_length($invoice->get_last_name(), 64), |
|
| 201 | + 'country' => getpaid_limit_length($invoice->get_country(), 2), |
|
| 202 | + 'email' => getpaid_limit_length($invoice->get_email(), 127), |
|
| 203 | + 'cbt' => get_bloginfo('name') |
|
| 204 | 204 | ); |
| 205 | 205 | |
| 206 | 206 | } |
@@ -212,30 +212,30 @@ discard block |
||
| 212 | 212 | * @param bool $force_one_line_item Create only one item for this invoice. |
| 213 | 213 | * @return array |
| 214 | 214 | */ |
| 215 | - protected function get_line_item_args( $invoice, $force_one_line_item = false ) { |
|
| 215 | + protected function get_line_item_args($invoice, $force_one_line_item = false) { |
|
| 216 | 216 | |
| 217 | 217 | // Maybe send invoice as a single item. |
| 218 | - if ( $force_one_line_item ) { |
|
| 219 | - return $this->get_line_item_args_single_item( $invoice ); |
|
| 218 | + if ($force_one_line_item) { |
|
| 219 | + return $this->get_line_item_args_single_item($invoice); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | // Send each line item individually. |
| 223 | 223 | $line_item_args = array(); |
| 224 | 224 | |
| 225 | 225 | // Prepare line items. |
| 226 | - $this->prepare_line_items( $invoice ); |
|
| 226 | + $this->prepare_line_items($invoice); |
|
| 227 | 227 | |
| 228 | 228 | // Add taxes to the cart |
| 229 | - if ( wpinv_use_taxes() && $invoice->is_taxable() ) { |
|
| 230 | - $line_item_args['tax_cart'] = wpinv_sanitize_amount( (float) $invoice->get_total_tax(), 2 ); |
|
| 229 | + if (wpinv_use_taxes() && $invoice->is_taxable()) { |
|
| 230 | + $line_item_args['tax_cart'] = wpinv_sanitize_amount((float) $invoice->get_total_tax(), 2); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | // Add discount. |
| 234 | - if ( $invoice->get_total_discount() > 0 ) { |
|
| 235 | - $line_item_args['discount_amount_cart'] = wpinv_sanitize_amount( (float) $invoice->get_total_discount(), 2 ); |
|
| 234 | + if ($invoice->get_total_discount() > 0) { |
|
| 235 | + $line_item_args['discount_amount_cart'] = wpinv_sanitize_amount((float) $invoice->get_total_discount(), 2); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - return array_merge( $line_item_args, $this->get_line_items() ); |
|
| 238 | + return array_merge($line_item_args, $this->get_line_items()); |
|
| 239 | 239 | |
| 240 | 240 | } |
| 241 | 241 | |
@@ -245,11 +245,11 @@ discard block |
||
| 245 | 245 | * @param WPInv_Invoice $invoice Invoice object. |
| 246 | 246 | * @return array |
| 247 | 247 | */ |
| 248 | - protected function get_line_item_args_single_item( $invoice ) { |
|
| 248 | + protected function get_line_item_args_single_item($invoice) { |
|
| 249 | 249 | $this->delete_line_items(); |
| 250 | 250 | |
| 251 | - $item_name = sprintf( __( 'Invoice #%s', 'invoicing' ), $invoice->get_number() ); |
|
| 252 | - $this->add_line_item( $item_name, 1, wpinv_sanitize_amount( (float) $invoice->get_total(), 2 ), $invoice->get_id() ); |
|
| 251 | + $item_name = sprintf(__('Invoice #%s', 'invoicing'), $invoice->get_number()); |
|
| 252 | + $this->add_line_item($item_name, 1, wpinv_sanitize_amount((float) $invoice->get_total(), 2), $invoice->get_id()); |
|
| 253 | 253 | |
| 254 | 254 | return $this->get_line_items(); |
| 255 | 255 | } |
@@ -273,19 +273,19 @@ discard block |
||
| 273 | 273 | * |
| 274 | 274 | * @param WPInv_Invoice $invoice Invoice object. |
| 275 | 275 | */ |
| 276 | - protected function prepare_line_items( $invoice ) { |
|
| 276 | + protected function prepare_line_items($invoice) { |
|
| 277 | 277 | $this->delete_line_items(); |
| 278 | 278 | |
| 279 | 279 | // Items. |
| 280 | - foreach ( $invoice->get_items() as $item ) { |
|
| 280 | + foreach ($invoice->get_items() as $item) { |
|
| 281 | 281 | $amount = $item->get_price(); |
| 282 | 282 | $quantity = $invoice->get_template() == 'amount' ? 1 : $item->get_quantity(); |
| 283 | - $this->add_line_item( $item->get_raw_name(), $quantity, $amount, $item->get_id() ); |
|
| 283 | + $this->add_line_item($item->get_raw_name(), $quantity, $amount, $item->get_id()); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // Fees. |
| 287 | - foreach ( $invoice->get_fees() as $fee => $data ) { |
|
| 288 | - $this->add_line_item( $fee, 1, wpinv_sanitize_amount( $data['initial_fee'] ) ); |
|
| 287 | + foreach ($invoice->get_fees() as $fee => $data) { |
|
| 288 | + $this->add_line_item($fee, 1, wpinv_sanitize_amount($data['initial_fee'])); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | } |
@@ -298,15 +298,15 @@ discard block |
||
| 298 | 298 | * @param float $amount Amount. |
| 299 | 299 | * @param string $item_number Item number. |
| 300 | 300 | */ |
| 301 | - protected function add_line_item( $item_name, $quantity = 1, $amount = 0.0, $item_number = '' ) { |
|
| 302 | - $index = ( count( $this->line_items ) / 4 ) + 1; |
|
| 301 | + protected function add_line_item($item_name, $quantity = 1, $amount = 0.0, $item_number = '') { |
|
| 302 | + $index = (count($this->line_items) / 4) + 1; |
|
| 303 | 303 | |
| 304 | 304 | $item = apply_filters( |
| 305 | 305 | 'getpaid_paypal_line_item', |
| 306 | 306 | array( |
| 307 | - 'item_name' => html_entity_decode( getpaid_limit_length( $item_name ? wp_strip_all_tags( $item_name ) : __( 'Item', 'invoicing' ), 127 ), ENT_NOQUOTES, 'UTF-8' ), |
|
| 307 | + 'item_name' => html_entity_decode(getpaid_limit_length($item_name ? wp_strip_all_tags($item_name) : __('Item', 'invoicing'), 127), ENT_NOQUOTES, 'UTF-8'), |
|
| 308 | 308 | 'quantity' => (float) $quantity, |
| 309 | - 'amount' => wpinv_sanitize_amount( (float) $amount, 2 ), |
|
| 309 | + 'amount' => wpinv_sanitize_amount((float) $amount, 2), |
|
| 310 | 310 | 'item_number' => $item_number, |
| 311 | 311 | ), |
| 312 | 312 | $item_name, |
@@ -315,12 +315,12 @@ discard block |
||
| 315 | 315 | $item_number |
| 316 | 316 | ); |
| 317 | 317 | |
| 318 | - $this->line_items[ 'item_name_' . $index ] = getpaid_limit_length( $item['item_name'], 127 ); |
|
| 319 | - $this->line_items[ 'quantity_' . $index ] = $item['quantity']; |
|
| 318 | + $this->line_items['item_name_' . $index] = getpaid_limit_length($item['item_name'], 127); |
|
| 319 | + $this->line_items['quantity_' . $index] = $item['quantity']; |
|
| 320 | 320 | |
| 321 | 321 | // The price or amount of the product, service, or contribution, not including shipping, handling, or tax. |
| 322 | - $this->line_items[ 'amount_' . $index ] = $item['amount']; |
|
| 323 | - $this->line_items[ 'item_number_' . $index ] = getpaid_limit_length( $item['item_number'], 127 ); |
|
| 322 | + $this->line_items['amount_' . $index] = $item['amount']; |
|
| 323 | + $this->line_items['item_number_' . $index] = getpaid_limit_length($item['item_number'], 127); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -332,19 +332,19 @@ discard block |
||
| 332 | 332 | * @param array $paypal_args Arguments sent to Paypal in the request. |
| 333 | 333 | * @return array |
| 334 | 334 | */ |
| 335 | - protected function fix_request_length( $invoice, $paypal_args ) { |
|
| 335 | + protected function fix_request_length($invoice, $paypal_args) { |
|
| 336 | 336 | $max_paypal_length = 2083; |
| 337 | - $query_candidate = http_build_query( $paypal_args, '', '&' ); |
|
| 337 | + $query_candidate = http_build_query($paypal_args, '', '&'); |
|
| 338 | 338 | |
| 339 | - if ( strlen( $this->endpoint . $query_candidate ) <= $max_paypal_length ) { |
|
| 339 | + if (strlen($this->endpoint . $query_candidate) <= $max_paypal_length) { |
|
| 340 | 340 | return $paypal_args; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | return apply_filters( |
| 344 | 344 | 'getpaid_paypal_args', |
| 345 | 345 | array_merge( |
| 346 | - $this->get_transaction_args( $invoice ), |
|
| 347 | - $this->get_line_item_args( $invoice, true ) |
|
| 346 | + $this->get_transaction_args($invoice), |
|
| 347 | + $this->get_line_item_args($invoice, true) |
|
| 348 | 348 | ), |
| 349 | 349 | $invoice |
| 350 | 350 | ); |
@@ -357,10 +357,10 @@ discard block |
||
| 357 | 357 | * @param array $paypal_args PayPal args. |
| 358 | 358 | * @param WPInv_Invoice $invoice Invoice object. |
| 359 | 359 | */ |
| 360 | - public function process_subscription( $paypal_args, $invoice ) { |
|
| 360 | + public function process_subscription($paypal_args, $invoice) { |
|
| 361 | 361 | |
| 362 | 362 | // Make sure this is a subscription. |
| 363 | - if ( ! $invoice->is_recurring() || ! $subscription = wpinv_get_subscription( $invoice ) ) { |
|
| 363 | + if (!$invoice->is_recurring() || !$subscription = wpinv_get_subscription($invoice)) { |
|
| 364 | 364 | return $paypal_args; |
| 365 | 365 | } |
| 366 | 366 | |
@@ -368,17 +368,17 @@ discard block |
||
| 368 | 368 | $paypal_args['cmd'] = '_xclick-subscriptions'; |
| 369 | 369 | |
| 370 | 370 | // Subscription name. |
| 371 | - $paypal_args['item_name'] = sprintf( __( 'Invoice #%s', 'invoicing' ), $invoice->get_number() ); |
|
| 371 | + $paypal_args['item_name'] = sprintf(__('Invoice #%s', 'invoicing'), $invoice->get_number()); |
|
| 372 | 372 | |
| 373 | 373 | // Get subscription args. |
| 374 | - $period = strtoupper( substr( $subscription->get_period(), 0, 1) ); |
|
| 374 | + $period = strtoupper(substr($subscription->get_period(), 0, 1)); |
|
| 375 | 375 | $interval = (int) $subscription->get_frequency(); |
| 376 | 376 | $bill_times = (int) $subscription->get_bill_times(); |
| 377 | - $initial_amount = (float) wpinv_sanitize_amount( $invoice->get_initial_total(), 2 ); |
|
| 378 | - $recurring_amount = (float) wpinv_sanitize_amount( $invoice->get_recurring_total(), 2 ); |
|
| 379 | - $subscription_item = $invoice->get_recurring( true ); |
|
| 377 | + $initial_amount = (float) wpinv_sanitize_amount($invoice->get_initial_total(), 2); |
|
| 378 | + $recurring_amount = (float) wpinv_sanitize_amount($invoice->get_recurring_total(), 2); |
|
| 379 | + $subscription_item = $invoice->get_recurring(true); |
|
| 380 | 380 | |
| 381 | - if ( $subscription_item->has_free_trial() ) { |
|
| 381 | + if ($subscription_item->has_free_trial()) { |
|
| 382 | 382 | |
| 383 | 383 | $paypal_args['a1'] = 0 == $initial_amount ? 0 : $initial_amount; |
| 384 | 384 | |
@@ -388,28 +388,28 @@ discard block |
||
| 388 | 388 | // Trial period. |
| 389 | 389 | $paypal_args['t1'] = $subscription_item->get_trial_period(); |
| 390 | 390 | |
| 391 | - } else if ( $initial_amount != $recurring_amount ) { |
|
| 391 | + } else if ($initial_amount != $recurring_amount) { |
|
| 392 | 392 | |
| 393 | 393 | // No trial period, but initial amount includes a sign-up fee and/or other items, so charge it as a separate period. |
| 394 | 394 | |
| 395 | - if ( 1 == $bill_times ) { |
|
| 395 | + if (1 == $bill_times) { |
|
| 396 | 396 | $param_number = 3; |
| 397 | 397 | } else { |
| 398 | 398 | $param_number = 1; |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | - $paypal_args[ 'a' . $param_number ] = $initial_amount ? $initial_amount : 0; |
|
| 401 | + $paypal_args['a' . $param_number] = $initial_amount ? $initial_amount : 0; |
|
| 402 | 402 | |
| 403 | 403 | // Sign Up interval |
| 404 | - $paypal_args[ 'p' . $param_number ] = $interval; |
|
| 404 | + $paypal_args['p' . $param_number] = $interval; |
|
| 405 | 405 | |
| 406 | 406 | // Sign Up unit of duration |
| 407 | - $paypal_args[ 't' . $param_number ] = $period; |
|
| 407 | + $paypal_args['t' . $param_number] = $period; |
|
| 408 | 408 | |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | // We have a recurring payment |
| 412 | - if ( ! isset( $param_number ) || 1 == $param_number ) { |
|
| 412 | + if (!isset($param_number) || 1 == $param_number) { |
|
| 413 | 413 | |
| 414 | 414 | // Subscription price |
| 415 | 415 | $paypal_args['a3'] = $recurring_amount; |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | // Recurring payments |
| 426 | - if ( 1 == $bill_times || ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() && 2 == $bill_times ) ) { |
|
| 426 | + if (1 == $bill_times || ($initial_amount != $recurring_amount && !$subscription_item->has_free_trial() && 2 == $bill_times)) { |
|
| 427 | 427 | |
| 428 | 428 | // Non-recurring payments |
| 429 | 429 | $paypal_args['src'] = 0; |
@@ -432,15 +432,15 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | $paypal_args['src'] = 1; |
| 434 | 434 | |
| 435 | - if ( $bill_times > 0 ) { |
|
| 435 | + if ($bill_times > 0) { |
|
| 436 | 436 | |
| 437 | 437 | // An initial period is being used to charge a sign-up fee |
| 438 | - if ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() ) { |
|
| 438 | + if ($initial_amount != $recurring_amount && !$subscription_item->has_free_trial()) { |
|
| 439 | 439 | $bill_times--; |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | // Make sure it's not over the max of 52 |
| 443 | - $paypal_args['srt'] = ( $bill_times <= 52 ? absint( $bill_times ) : 52 ); |
|
| 443 | + $paypal_args['srt'] = ($bill_times <= 52 ? absint($bill_times) : 52); |
|
| 444 | 444 | |
| 445 | 445 | } |
| 446 | 446 | } |
@@ -449,10 +449,10 @@ discard block |
||
| 449 | 449 | $paypal_args['rm'] = 2; |
| 450 | 450 | |
| 451 | 451 | // Get rid of redudant items. |
| 452 | - foreach ( array( 'item_name_1', 'quantity_1', 'amount_1', 'item_number_1' ) as $arg ) { |
|
| 452 | + foreach (array('item_name_1', 'quantity_1', 'amount_1', 'item_number_1') as $arg) { |
|
| 453 | 453 | |
| 454 | - if ( isset( $paypal_args[ $arg ] ) ) { |
|
| 455 | - unset( $paypal_args[ $arg ] ); |
|
| 454 | + if (isset($paypal_args[$arg])) { |
|
| 455 | + unset($paypal_args[$arg]); |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | } |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | * @return void |
| 472 | 472 | */ |
| 473 | 473 | public function verify_ipn() { |
| 474 | - new GetPaid_Paypal_Gateway_IPN_Handler( $this ); |
|
| 474 | + new GetPaid_Paypal_Gateway_IPN_Handler($this); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | /** |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | public function sandbox_notice() { |
| 481 | 481 | |
| 482 | 482 | return sprintf( |
| 483 | - __( 'SANDBOX ENABLED. You can use sandbox testing accounts only. See the %sPayPal Sandbox Testing Guide%s for more details.', 'invoicing' ), |
|
| 483 | + __('SANDBOX ENABLED. You can use sandbox testing accounts only. See the %sPayPal Sandbox Testing Guide%s for more details.', 'invoicing'), |
|
| 484 | 484 | '<a href="https://developer.paypal.com/docs/classic/lifecycle/ug_sandbox/">', |
| 485 | 485 | '</a>' |
| 486 | 486 | ); |
@@ -8,20 +8,20 @@ |
||
| 8 | 8 | * @var GetPaid_Payment_Form $form The current payment form |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -defined( 'ABSPATH' ) || exit; |
|
| 11 | +defined('ABSPATH') || exit; |
|
| 12 | 12 | |
| 13 | -$placeholder = esc_attr( $input_label ); |
|
| 14 | -$label = sanitize_text_field( $button_label ); |
|
| 13 | +$placeholder = esc_attr($input_label); |
|
| 14 | +$label = sanitize_text_field($button_label); |
|
| 15 | 15 | |
| 16 | -if ( ! empty( $description ) ) { |
|
| 16 | +if (!empty($description)) { |
|
| 17 | 17 | $description = "<small class='form-text text-muted'>$description</small>"; |
| 18 | 18 | } else { |
| 19 | 19 | $description = ''; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | $discount_code = ''; |
| 23 | -if ( ! empty( $form->invoice ) ) { |
|
| 24 | - $discount_code = esc_attr( $form->invoice->get_discount_code() ); |
|
| 23 | +if (!empty($form->invoice)) { |
|
| 24 | + $discount_code = esc_attr($form->invoice->get_discount_code()); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | ?> |
@@ -7,40 +7,40 @@ |
||
| 7 | 7 | * Bail if we are not in WP. |
| 8 | 8 | */ |
| 9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | - exit; |
|
| 10 | + exit; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Set the version only if its the current newest while loading. |
| 15 | 15 | */ |
| 16 | 16 | add_action('after_setup_theme', function () { |
| 17 | - global $ayecode_ui_version,$ayecode_ui_file_key; |
|
| 18 | - $this_version = "0.1.45"; |
|
| 19 | - if(version_compare($this_version , $ayecode_ui_version, '>')){ |
|
| 20 | - $ayecode_ui_version = $this_version ; |
|
| 21 | - $ayecode_ui_file_key = wp_hash( __FILE__ ); |
|
| 22 | - } |
|
| 17 | + global $ayecode_ui_version,$ayecode_ui_file_key; |
|
| 18 | + $this_version = "0.1.45"; |
|
| 19 | + if(version_compare($this_version , $ayecode_ui_version, '>')){ |
|
| 20 | + $ayecode_ui_version = $this_version ; |
|
| 21 | + $ayecode_ui_file_key = wp_hash( __FILE__ ); |
|
| 22 | + } |
|
| 23 | 23 | },0); |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Load this version of WP Bootstrap Settings only if the file hash is the current one. |
| 27 | 27 | */ |
| 28 | 28 | add_action('after_setup_theme', function () { |
| 29 | - global $ayecode_ui_file_key; |
|
| 30 | - if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){ |
|
| 31 | - include_once( dirname( __FILE__ ) . '/includes/class-aui.php' ); |
|
| 32 | - include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' ); |
|
| 33 | - } |
|
| 29 | + global $ayecode_ui_file_key; |
|
| 30 | + if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){ |
|
| 31 | + include_once( dirname( __FILE__ ) . '/includes/class-aui.php' ); |
|
| 32 | + include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' ); |
|
| 33 | + } |
|
| 34 | 34 | },1); |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Add the function that calls the class. |
| 38 | 38 | */ |
| 39 | 39 | if(!function_exists('aui')){ |
| 40 | - function aui(){ |
|
| 41 | - if(!class_exists("AUI",false)){ |
|
| 42 | - return false; |
|
| 43 | - } |
|
| 44 | - return AUI::instance(); |
|
| 45 | - } |
|
| 40 | + function aui(){ |
|
| 41 | + if(!class_exists("AUI",false)){ |
|
| 42 | + return false; |
|
| 43 | + } |
|
| 44 | + return AUI::instance(); |
|
| 45 | + } |
|
| 46 | 46 | } |
| 47 | 47 | \ No newline at end of file |
@@ -6,39 +6,39 @@ |
||
| 6 | 6 | /** |
| 7 | 7 | * Bail if we are not in WP. |
| 8 | 8 | */ |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if (!defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Set the version only if its the current newest while loading. |
| 15 | 15 | */ |
| 16 | -add_action('after_setup_theme', function () { |
|
| 17 | - global $ayecode_ui_version,$ayecode_ui_file_key; |
|
| 16 | +add_action('after_setup_theme', function() { |
|
| 17 | + global $ayecode_ui_version, $ayecode_ui_file_key; |
|
| 18 | 18 | $this_version = "0.1.45"; |
| 19 | - if(version_compare($this_version , $ayecode_ui_version, '>')){ |
|
| 20 | - $ayecode_ui_version = $this_version ; |
|
| 21 | - $ayecode_ui_file_key = wp_hash( __FILE__ ); |
|
| 19 | + if (version_compare($this_version, $ayecode_ui_version, '>')) { |
|
| 20 | + $ayecode_ui_version = $this_version; |
|
| 21 | + $ayecode_ui_file_key = wp_hash(__FILE__); |
|
| 22 | 22 | } |
| 23 | 23 | },0); |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Load this version of WP Bootstrap Settings only if the file hash is the current one. |
| 27 | 27 | */ |
| 28 | -add_action('after_setup_theme', function () { |
|
| 28 | +add_action('after_setup_theme', function() { |
|
| 29 | 29 | global $ayecode_ui_file_key; |
| 30 | - if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){ |
|
| 31 | - include_once( dirname( __FILE__ ) . '/includes/class-aui.php' ); |
|
| 32 | - include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' ); |
|
| 30 | + if ($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash(__FILE__)) { |
|
| 31 | + include_once(dirname(__FILE__) . '/includes/class-aui.php'); |
|
| 32 | + include_once(dirname(__FILE__) . '/includes/ayecode-ui-settings.php'); |
|
| 33 | 33 | } |
| 34 | 34 | },1); |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Add the function that calls the class. |
| 38 | 38 | */ |
| 39 | -if(!function_exists('aui')){ |
|
| 40 | - function aui(){ |
|
| 41 | - if(!class_exists("AUI",false)){ |
|
| 39 | +if (!function_exists('aui')) { |
|
| 40 | + function aui() { |
|
| 41 | + if (!class_exists("AUI", false)) { |
|
| 42 | 42 | return false; |
| 43 | 43 | } |
| 44 | 44 | return AUI::instance(); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php return array ( |
| 2 | - 'root' => |
|
| 3 | - array ( |
|
| 2 | + 'root' => |
|
| 3 | + array ( |
|
| 4 | 4 | 'pretty_version' => 'dev-master', |
| 5 | 5 | 'version' => 'dev-master', |
| 6 | 6 | 'aliases' => |
@@ -8,85 +8,85 @@ discard block |
||
| 8 | 8 | ), |
| 9 | 9 | 'reference' => '30e6738f2073aa51f1c360079453e76cfcfb9854', |
| 10 | 10 | 'name' => 'ayecode/invoicing', |
| 11 | - ), |
|
| 12 | - 'versions' => |
|
| 13 | - array ( |
|
| 11 | + ), |
|
| 12 | + 'versions' => |
|
| 13 | + array ( |
|
| 14 | 14 | 'ayecode/ayecode-connect-helper' => |
| 15 | 15 | array ( |
| 16 | - 'pretty_version' => '1.0.3', |
|
| 17 | - 'version' => '1.0.3.0', |
|
| 18 | - 'aliases' => |
|
| 19 | - array ( |
|
| 20 | - ), |
|
| 21 | - 'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4', |
|
| 16 | + 'pretty_version' => '1.0.3', |
|
| 17 | + 'version' => '1.0.3.0', |
|
| 18 | + 'aliases' => |
|
| 19 | + array ( |
|
| 20 | + ), |
|
| 21 | + 'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4', |
|
| 22 | 22 | ), |
| 23 | 23 | 'ayecode/invoicing' => |
| 24 | 24 | array ( |
| 25 | - 'pretty_version' => 'dev-master', |
|
| 26 | - 'version' => 'dev-master', |
|
| 27 | - 'aliases' => |
|
| 28 | - array ( |
|
| 29 | - ), |
|
| 30 | - 'reference' => '30e6738f2073aa51f1c360079453e76cfcfb9854', |
|
| 25 | + 'pretty_version' => 'dev-master', |
|
| 26 | + 'version' => 'dev-master', |
|
| 27 | + 'aliases' => |
|
| 28 | + array ( |
|
| 29 | + ), |
|
| 30 | + 'reference' => '30e6738f2073aa51f1c360079453e76cfcfb9854', |
|
| 31 | 31 | ), |
| 32 | 32 | 'ayecode/wp-ayecode-ui' => |
| 33 | 33 | array ( |
| 34 | - 'pretty_version' => '0.1.45', |
|
| 35 | - 'version' => '0.1.45.0', |
|
| 36 | - 'aliases' => |
|
| 37 | - array ( |
|
| 38 | - ), |
|
| 39 | - 'reference' => 'a8f19cac8310de825ae5fec71d57184ebb2d78d0', |
|
| 34 | + 'pretty_version' => '0.1.45', |
|
| 35 | + 'version' => '0.1.45.0', |
|
| 36 | + 'aliases' => |
|
| 37 | + array ( |
|
| 38 | + ), |
|
| 39 | + 'reference' => 'a8f19cac8310de825ae5fec71d57184ebb2d78d0', |
|
| 40 | 40 | ), |
| 41 | 41 | 'ayecode/wp-font-awesome-settings' => |
| 42 | 42 | array ( |
| 43 | - 'pretty_version' => '1.0.12', |
|
| 44 | - 'version' => '1.0.12.0', |
|
| 45 | - 'aliases' => |
|
| 46 | - array ( |
|
| 47 | - ), |
|
| 48 | - 'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288', |
|
| 43 | + 'pretty_version' => '1.0.12', |
|
| 44 | + 'version' => '1.0.12.0', |
|
| 45 | + 'aliases' => |
|
| 46 | + array ( |
|
| 47 | + ), |
|
| 48 | + 'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288', |
|
| 49 | 49 | ), |
| 50 | 50 | 'ayecode/wp-super-duper' => |
| 51 | 51 | array ( |
| 52 | - 'pretty_version' => '1.0.24', |
|
| 53 | - 'version' => '1.0.24.0', |
|
| 54 | - 'aliases' => |
|
| 55 | - array ( |
|
| 56 | - ), |
|
| 57 | - 'reference' => '4eaa2f6f6e1a29ff71f7fdbd694892d7479ef754', |
|
| 52 | + 'pretty_version' => '1.0.24', |
|
| 53 | + 'version' => '1.0.24.0', |
|
| 54 | + 'aliases' => |
|
| 55 | + array ( |
|
| 56 | + ), |
|
| 57 | + 'reference' => '4eaa2f6f6e1a29ff71f7fdbd694892d7479ef754', |
|
| 58 | 58 | ), |
| 59 | 59 | 'composer/installers' => |
| 60 | 60 | array ( |
| 61 | - 'pretty_version' => 'v1.10.0', |
|
| 62 | - 'version' => '1.10.0.0', |
|
| 63 | - 'aliases' => |
|
| 64 | - array ( |
|
| 65 | - ), |
|
| 66 | - 'reference' => '1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d', |
|
| 61 | + 'pretty_version' => 'v1.10.0', |
|
| 62 | + 'version' => '1.10.0.0', |
|
| 63 | + 'aliases' => |
|
| 64 | + array ( |
|
| 65 | + ), |
|
| 66 | + 'reference' => '1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d', |
|
| 67 | 67 | ), |
| 68 | 68 | 'maxmind-db/reader' => |
| 69 | 69 | array ( |
| 70 | - 'pretty_version' => 'v1.6.0', |
|
| 71 | - 'version' => '1.6.0.0', |
|
| 72 | - 'aliases' => |
|
| 73 | - array ( |
|
| 74 | - ), |
|
| 75 | - 'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4', |
|
| 70 | + 'pretty_version' => 'v1.6.0', |
|
| 71 | + 'version' => '1.6.0.0', |
|
| 72 | + 'aliases' => |
|
| 73 | + array ( |
|
| 74 | + ), |
|
| 75 | + 'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4', |
|
| 76 | 76 | ), |
| 77 | 77 | 'roundcube/plugin-installer' => |
| 78 | 78 | array ( |
| 79 | - 'replaced' => |
|
| 80 | - array ( |
|
| 79 | + 'replaced' => |
|
| 80 | + array ( |
|
| 81 | 81 | 0 => '*', |
| 82 | - ), |
|
| 82 | + ), |
|
| 83 | 83 | ), |
| 84 | 84 | 'shama/baton' => |
| 85 | 85 | array ( |
| 86 | - 'replaced' => |
|
| 87 | - array ( |
|
| 86 | + 'replaced' => |
|
| 87 | + array ( |
|
| 88 | 88 | 0 => '*', |
| 89 | - ), |
|
| 89 | + ), |
|
| 90 | + ), |
|
| 90 | 91 | ), |
| 91 | - ), |
|
| 92 | 92 | ); |
@@ -1,90 +1,90 @@ |
||
| 1 | -<?php return array ( |
|
| 1 | +<?php return array( |
|
| 2 | 2 | 'root' => |
| 3 | - array ( |
|
| 3 | + array( |
|
| 4 | 4 | 'pretty_version' => 'dev-master', |
| 5 | 5 | 'version' => 'dev-master', |
| 6 | 6 | 'aliases' => |
| 7 | - array ( |
|
| 7 | + array( |
|
| 8 | 8 | ), |
| 9 | 9 | 'reference' => '30e6738f2073aa51f1c360079453e76cfcfb9854', |
| 10 | 10 | 'name' => 'ayecode/invoicing', |
| 11 | 11 | ), |
| 12 | 12 | 'versions' => |
| 13 | - array ( |
|
| 13 | + array( |
|
| 14 | 14 | 'ayecode/ayecode-connect-helper' => |
| 15 | - array ( |
|
| 15 | + array( |
|
| 16 | 16 | 'pretty_version' => '1.0.3', |
| 17 | 17 | 'version' => '1.0.3.0', |
| 18 | 18 | 'aliases' => |
| 19 | - array ( |
|
| 19 | + array( |
|
| 20 | 20 | ), |
| 21 | 21 | 'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4', |
| 22 | 22 | ), |
| 23 | 23 | 'ayecode/invoicing' => |
| 24 | - array ( |
|
| 24 | + array( |
|
| 25 | 25 | 'pretty_version' => 'dev-master', |
| 26 | 26 | 'version' => 'dev-master', |
| 27 | 27 | 'aliases' => |
| 28 | - array ( |
|
| 28 | + array( |
|
| 29 | 29 | ), |
| 30 | 30 | 'reference' => '30e6738f2073aa51f1c360079453e76cfcfb9854', |
| 31 | 31 | ), |
| 32 | 32 | 'ayecode/wp-ayecode-ui' => |
| 33 | - array ( |
|
| 33 | + array( |
|
| 34 | 34 | 'pretty_version' => '0.1.45', |
| 35 | 35 | 'version' => '0.1.45.0', |
| 36 | 36 | 'aliases' => |
| 37 | - array ( |
|
| 37 | + array( |
|
| 38 | 38 | ), |
| 39 | 39 | 'reference' => 'a8f19cac8310de825ae5fec71d57184ebb2d78d0', |
| 40 | 40 | ), |
| 41 | 41 | 'ayecode/wp-font-awesome-settings' => |
| 42 | - array ( |
|
| 42 | + array( |
|
| 43 | 43 | 'pretty_version' => '1.0.12', |
| 44 | 44 | 'version' => '1.0.12.0', |
| 45 | 45 | 'aliases' => |
| 46 | - array ( |
|
| 46 | + array( |
|
| 47 | 47 | ), |
| 48 | 48 | 'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288', |
| 49 | 49 | ), |
| 50 | 50 | 'ayecode/wp-super-duper' => |
| 51 | - array ( |
|
| 51 | + array( |
|
| 52 | 52 | 'pretty_version' => '1.0.24', |
| 53 | 53 | 'version' => '1.0.24.0', |
| 54 | 54 | 'aliases' => |
| 55 | - array ( |
|
| 55 | + array( |
|
| 56 | 56 | ), |
| 57 | 57 | 'reference' => '4eaa2f6f6e1a29ff71f7fdbd694892d7479ef754', |
| 58 | 58 | ), |
| 59 | 59 | 'composer/installers' => |
| 60 | - array ( |
|
| 60 | + array( |
|
| 61 | 61 | 'pretty_version' => 'v1.10.0', |
| 62 | 62 | 'version' => '1.10.0.0', |
| 63 | 63 | 'aliases' => |
| 64 | - array ( |
|
| 64 | + array( |
|
| 65 | 65 | ), |
| 66 | 66 | 'reference' => '1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d', |
| 67 | 67 | ), |
| 68 | 68 | 'maxmind-db/reader' => |
| 69 | - array ( |
|
| 69 | + array( |
|
| 70 | 70 | 'pretty_version' => 'v1.6.0', |
| 71 | 71 | 'version' => '1.6.0.0', |
| 72 | 72 | 'aliases' => |
| 73 | - array ( |
|
| 73 | + array( |
|
| 74 | 74 | ), |
| 75 | 75 | 'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4', |
| 76 | 76 | ), |
| 77 | 77 | 'roundcube/plugin-installer' => |
| 78 | - array ( |
|
| 78 | + array( |
|
| 79 | 79 | 'replaced' => |
| 80 | - array ( |
|
| 80 | + array( |
|
| 81 | 81 | 0 => '*', |
| 82 | 82 | ), |
| 83 | 83 | ), |
| 84 | 84 | 'shama/baton' => |
| 85 | - array ( |
|
| 85 | + array( |
|
| 86 | 86 | 'replaced' => |
| 87 | - array ( |
|
| 87 | + array( |
|
| 88 | 88 | 0 => '*', |
| 89 | 89 | ), |
| 90 | 90 | ), |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | class InstalledVersions |
| 13 | 13 | { |
| 14 | 14 | private static $installed = array ( |
| 15 | - 'root' => |
|
| 16 | - array ( |
|
| 15 | + 'root' => |
|
| 16 | + array ( |
|
| 17 | 17 | 'pretty_version' => 'dev-master', |
| 18 | 18 | 'version' => 'dev-master', |
| 19 | 19 | 'aliases' => |
@@ -21,87 +21,87 @@ discard block |
||
| 21 | 21 | ), |
| 22 | 22 | 'reference' => '30e6738f2073aa51f1c360079453e76cfcfb9854', |
| 23 | 23 | 'name' => 'ayecode/invoicing', |
| 24 | - ), |
|
| 25 | - 'versions' => |
|
| 26 | - array ( |
|
| 24 | + ), |
|
| 25 | + 'versions' => |
|
| 26 | + array ( |
|
| 27 | 27 | 'ayecode/ayecode-connect-helper' => |
| 28 | 28 | array ( |
| 29 | - 'pretty_version' => '1.0.3', |
|
| 30 | - 'version' => '1.0.3.0', |
|
| 31 | - 'aliases' => |
|
| 32 | - array ( |
|
| 33 | - ), |
|
| 34 | - 'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4', |
|
| 29 | + 'pretty_version' => '1.0.3', |
|
| 30 | + 'version' => '1.0.3.0', |
|
| 31 | + 'aliases' => |
|
| 32 | + array ( |
|
| 33 | + ), |
|
| 34 | + 'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4', |
|
| 35 | 35 | ), |
| 36 | 36 | 'ayecode/invoicing' => |
| 37 | 37 | array ( |
| 38 | - 'pretty_version' => 'dev-master', |
|
| 39 | - 'version' => 'dev-master', |
|
| 40 | - 'aliases' => |
|
| 41 | - array ( |
|
| 42 | - ), |
|
| 43 | - 'reference' => '30e6738f2073aa51f1c360079453e76cfcfb9854', |
|
| 38 | + 'pretty_version' => 'dev-master', |
|
| 39 | + 'version' => 'dev-master', |
|
| 40 | + 'aliases' => |
|
| 41 | + array ( |
|
| 42 | + ), |
|
| 43 | + 'reference' => '30e6738f2073aa51f1c360079453e76cfcfb9854', |
|
| 44 | 44 | ), |
| 45 | 45 | 'ayecode/wp-ayecode-ui' => |
| 46 | 46 | array ( |
| 47 | - 'pretty_version' => '0.1.45', |
|
| 48 | - 'version' => '0.1.45.0', |
|
| 49 | - 'aliases' => |
|
| 50 | - array ( |
|
| 51 | - ), |
|
| 52 | - 'reference' => 'a8f19cac8310de825ae5fec71d57184ebb2d78d0', |
|
| 47 | + 'pretty_version' => '0.1.45', |
|
| 48 | + 'version' => '0.1.45.0', |
|
| 49 | + 'aliases' => |
|
| 50 | + array ( |
|
| 51 | + ), |
|
| 52 | + 'reference' => 'a8f19cac8310de825ae5fec71d57184ebb2d78d0', |
|
| 53 | 53 | ), |
| 54 | 54 | 'ayecode/wp-font-awesome-settings' => |
| 55 | 55 | array ( |
| 56 | - 'pretty_version' => '1.0.12', |
|
| 57 | - 'version' => '1.0.12.0', |
|
| 58 | - 'aliases' => |
|
| 59 | - array ( |
|
| 60 | - ), |
|
| 61 | - 'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288', |
|
| 56 | + 'pretty_version' => '1.0.12', |
|
| 57 | + 'version' => '1.0.12.0', |
|
| 58 | + 'aliases' => |
|
| 59 | + array ( |
|
| 60 | + ), |
|
| 61 | + 'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288', |
|
| 62 | 62 | ), |
| 63 | 63 | 'ayecode/wp-super-duper' => |
| 64 | 64 | array ( |
| 65 | - 'pretty_version' => '1.0.24', |
|
| 66 | - 'version' => '1.0.24.0', |
|
| 67 | - 'aliases' => |
|
| 68 | - array ( |
|
| 69 | - ), |
|
| 70 | - 'reference' => '4eaa2f6f6e1a29ff71f7fdbd694892d7479ef754', |
|
| 65 | + 'pretty_version' => '1.0.24', |
|
| 66 | + 'version' => '1.0.24.0', |
|
| 67 | + 'aliases' => |
|
| 68 | + array ( |
|
| 69 | + ), |
|
| 70 | + 'reference' => '4eaa2f6f6e1a29ff71f7fdbd694892d7479ef754', |
|
| 71 | 71 | ), |
| 72 | 72 | 'composer/installers' => |
| 73 | 73 | array ( |
| 74 | - 'pretty_version' => 'v1.10.0', |
|
| 75 | - 'version' => '1.10.0.0', |
|
| 76 | - 'aliases' => |
|
| 77 | - array ( |
|
| 78 | - ), |
|
| 79 | - 'reference' => '1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d', |
|
| 74 | + 'pretty_version' => 'v1.10.0', |
|
| 75 | + 'version' => '1.10.0.0', |
|
| 76 | + 'aliases' => |
|
| 77 | + array ( |
|
| 78 | + ), |
|
| 79 | + 'reference' => '1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d', |
|
| 80 | 80 | ), |
| 81 | 81 | 'maxmind-db/reader' => |
| 82 | 82 | array ( |
| 83 | - 'pretty_version' => 'v1.6.0', |
|
| 84 | - 'version' => '1.6.0.0', |
|
| 85 | - 'aliases' => |
|
| 86 | - array ( |
|
| 87 | - ), |
|
| 88 | - 'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4', |
|
| 83 | + 'pretty_version' => 'v1.6.0', |
|
| 84 | + 'version' => '1.6.0.0', |
|
| 85 | + 'aliases' => |
|
| 86 | + array ( |
|
| 87 | + ), |
|
| 88 | + 'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4', |
|
| 89 | 89 | ), |
| 90 | 90 | 'roundcube/plugin-installer' => |
| 91 | 91 | array ( |
| 92 | - 'replaced' => |
|
| 93 | - array ( |
|
| 92 | + 'replaced' => |
|
| 93 | + array ( |
|
| 94 | 94 | 0 => '*', |
| 95 | - ), |
|
| 95 | + ), |
|
| 96 | 96 | ), |
| 97 | 97 | 'shama/baton' => |
| 98 | 98 | array ( |
| 99 | - 'replaced' => |
|
| 100 | - array ( |
|
| 99 | + 'replaced' => |
|
| 100 | + array ( |
|
| 101 | 101 | 0 => '*', |
| 102 | - ), |
|
| 102 | + ), |
|
| 103 | + ), |
|
| 103 | 104 | ), |
| 104 | - ), |
|
| 105 | 105 | ); |
| 106 | 106 | |
| 107 | 107 | |
@@ -11,93 +11,93 @@ |
||
| 11 | 11 | |
| 12 | 12 | class InstalledVersions |
| 13 | 13 | { |
| 14 | -private static $installed = array ( |
|
| 14 | +private static $installed = array( |
|
| 15 | 15 | 'root' => |
| 16 | - array ( |
|
| 16 | + array( |
|
| 17 | 17 | 'pretty_version' => 'dev-master', |
| 18 | 18 | 'version' => 'dev-master', |
| 19 | 19 | 'aliases' => |
| 20 | - array ( |
|
| 20 | + array( |
|
| 21 | 21 | ), |
| 22 | 22 | 'reference' => '30e6738f2073aa51f1c360079453e76cfcfb9854', |
| 23 | 23 | 'name' => 'ayecode/invoicing', |
| 24 | 24 | ), |
| 25 | 25 | 'versions' => |
| 26 | - array ( |
|
| 26 | + array( |
|
| 27 | 27 | 'ayecode/ayecode-connect-helper' => |
| 28 | - array ( |
|
| 28 | + array( |
|
| 29 | 29 | 'pretty_version' => '1.0.3', |
| 30 | 30 | 'version' => '1.0.3.0', |
| 31 | 31 | 'aliases' => |
| 32 | - array ( |
|
| 32 | + array( |
|
| 33 | 33 | ), |
| 34 | 34 | 'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4', |
| 35 | 35 | ), |
| 36 | 36 | 'ayecode/invoicing' => |
| 37 | - array ( |
|
| 37 | + array( |
|
| 38 | 38 | 'pretty_version' => 'dev-master', |
| 39 | 39 | 'version' => 'dev-master', |
| 40 | 40 | 'aliases' => |
| 41 | - array ( |
|
| 41 | + array( |
|
| 42 | 42 | ), |
| 43 | 43 | 'reference' => '30e6738f2073aa51f1c360079453e76cfcfb9854', |
| 44 | 44 | ), |
| 45 | 45 | 'ayecode/wp-ayecode-ui' => |
| 46 | - array ( |
|
| 46 | + array( |
|
| 47 | 47 | 'pretty_version' => '0.1.45', |
| 48 | 48 | 'version' => '0.1.45.0', |
| 49 | 49 | 'aliases' => |
| 50 | - array ( |
|
| 50 | + array( |
|
| 51 | 51 | ), |
| 52 | 52 | 'reference' => 'a8f19cac8310de825ae5fec71d57184ebb2d78d0', |
| 53 | 53 | ), |
| 54 | 54 | 'ayecode/wp-font-awesome-settings' => |
| 55 | - array ( |
|
| 55 | + array( |
|
| 56 | 56 | 'pretty_version' => '1.0.12', |
| 57 | 57 | 'version' => '1.0.12.0', |
| 58 | 58 | 'aliases' => |
| 59 | - array ( |
|
| 59 | + array( |
|
| 60 | 60 | ), |
| 61 | 61 | 'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288', |
| 62 | 62 | ), |
| 63 | 63 | 'ayecode/wp-super-duper' => |
| 64 | - array ( |
|
| 64 | + array( |
|
| 65 | 65 | 'pretty_version' => '1.0.24', |
| 66 | 66 | 'version' => '1.0.24.0', |
| 67 | 67 | 'aliases' => |
| 68 | - array ( |
|
| 68 | + array( |
|
| 69 | 69 | ), |
| 70 | 70 | 'reference' => '4eaa2f6f6e1a29ff71f7fdbd694892d7479ef754', |
| 71 | 71 | ), |
| 72 | 72 | 'composer/installers' => |
| 73 | - array ( |
|
| 73 | + array( |
|
| 74 | 74 | 'pretty_version' => 'v1.10.0', |
| 75 | 75 | 'version' => '1.10.0.0', |
| 76 | 76 | 'aliases' => |
| 77 | - array ( |
|
| 77 | + array( |
|
| 78 | 78 | ), |
| 79 | 79 | 'reference' => '1a0357fccad9d1cc1ea0c9a05b8847fbccccb78d', |
| 80 | 80 | ), |
| 81 | 81 | 'maxmind-db/reader' => |
| 82 | - array ( |
|
| 82 | + array( |
|
| 83 | 83 | 'pretty_version' => 'v1.6.0', |
| 84 | 84 | 'version' => '1.6.0.0', |
| 85 | 85 | 'aliases' => |
| 86 | - array ( |
|
| 86 | + array( |
|
| 87 | 87 | ), |
| 88 | 88 | 'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4', |
| 89 | 89 | ), |
| 90 | 90 | 'roundcube/plugin-installer' => |
| 91 | - array ( |
|
| 91 | + array( |
|
| 92 | 92 | 'replaced' => |
| 93 | - array ( |
|
| 93 | + array( |
|
| 94 | 94 | 0 => '*', |
| 95 | 95 | ), |
| 96 | 96 | ), |
| 97 | 97 | 'shama/baton' => |
| 98 | - array ( |
|
| 98 | + array( |
|
| 99 | 99 | 'replaced' => |
| 100 | - array ( |
|
| 100 | + array( |
|
| 101 | 101 | 0 => '*', |
| 102 | 102 | ), |
| 103 | 103 | ), |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | - exit; |
|
| 3 | + exit; |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -20,29 +20,29 @@ discard block |
||
| 20 | 20 | public $templates_url; |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * Class constructor. |
|
| 24 | - * |
|
| 25 | - * @since 1.0.19 |
|
| 26 | - */ |
|
| 27 | - public function __construct() { |
|
| 23 | + * Class constructor. |
|
| 24 | + * |
|
| 25 | + * @since 1.0.19 |
|
| 26 | + */ |
|
| 27 | + public function __construct() { |
|
| 28 | 28 | |
| 29 | 29 | $this->templates_dir = apply_filters( 'getpaid_default_templates_dir', WPINV_PLUGIN_DIR . 'templates' ); |
| 30 | 30 | $this->templates_url = apply_filters( 'getpaid_default_templates_url', WPINV_PLUGIN_URL . 'templates' ); |
| 31 | 31 | |
| 32 | 32 | // Oxygen plugin |
| 33 | - if ( defined( 'CT_VERSION' ) ) { |
|
| 34 | - add_filter( 'wpinv_locate_template', array( $this, 'oxygen_override_template' ), 11, 4 ); |
|
| 35 | - } |
|
| 33 | + if ( defined( 'CT_VERSION' ) ) { |
|
| 34 | + add_filter( 'wpinv_locate_template', array( $this, 'oxygen_override_template' ), 11, 4 ); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * Checks if this is a preview page |
|
| 41 | - * |
|
| 42 | - * @since 1.0.19 |
|
| 43 | - * @return bool |
|
| 44 | - */ |
|
| 45 | - public function is_preview() { |
|
| 40 | + * Checks if this is a preview page |
|
| 41 | + * |
|
| 42 | + * @since 1.0.19 |
|
| 43 | + * @return bool |
|
| 44 | + */ |
|
| 45 | + public function is_preview() { |
|
| 46 | 46 | return |
| 47 | 47 | $this->is_divi_preview() || |
| 48 | 48 | $this->is_elementor_preview() || |
@@ -54,73 +54,73 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * Checks if this is an elementor preview page |
|
| 58 | - * |
|
| 59 | - * @since 1.0.19 |
|
| 60 | - * @return bool |
|
| 61 | - */ |
|
| 62 | - public function is_elementor_preview() { |
|
| 63 | - return isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ); |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * Checks if this is a DIVI preview page |
|
| 68 | - * |
|
| 69 | - * @since 1.0.19 |
|
| 70 | - * @return bool |
|
| 71 | - */ |
|
| 72 | - public function is_divi_preview() { |
|
| 73 | - return isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'et_pb' ); |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Checks if this is a beaver builder preview page |
|
| 78 | - * |
|
| 79 | - * @since 1.0.19 |
|
| 80 | - * @return bool |
|
| 81 | - */ |
|
| 82 | - public function is_beaver_preview() { |
|
| 83 | - return isset( $_REQUEST['fl_builder'] ); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * Checks if this is a siteorigin builder preview page |
|
| 88 | - * |
|
| 89 | - * @since 1.0.19 |
|
| 90 | - * @return bool |
|
| 91 | - */ |
|
| 92 | - public function is_siteorigin_preview() { |
|
| 93 | - return ! empty( $_REQUEST['siteorigin_panels_live_editor'] ); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * Checks if this is a cornerstone builder preview page |
|
| 98 | - * |
|
| 99 | - * @since 1.0.19 |
|
| 100 | - * @return bool |
|
| 101 | - */ |
|
| 102 | - public function is_cornerstone_preview() { |
|
| 103 | - return ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint'; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Checks if this is a fusion builder preview page |
|
| 108 | - * |
|
| 109 | - * @since 1.0.19 |
|
| 110 | - * @return bool |
|
| 111 | - */ |
|
| 112 | - public function is_fusion_preview() { |
|
| 113 | - return ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * Checks if this is an oxygen builder preview page |
|
| 118 | - * |
|
| 119 | - * @since 1.0.19 |
|
| 120 | - * @return bool |
|
| 121 | - */ |
|
| 122 | - public function is_oxygen_preview() { |
|
| 123 | - return ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ); |
|
| 57 | + * Checks if this is an elementor preview page |
|
| 58 | + * |
|
| 59 | + * @since 1.0.19 |
|
| 60 | + * @return bool |
|
| 61 | + */ |
|
| 62 | + public function is_elementor_preview() { |
|
| 63 | + return isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ); |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * Checks if this is a DIVI preview page |
|
| 68 | + * |
|
| 69 | + * @since 1.0.19 |
|
| 70 | + * @return bool |
|
| 71 | + */ |
|
| 72 | + public function is_divi_preview() { |
|
| 73 | + return isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'et_pb' ); |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Checks if this is a beaver builder preview page |
|
| 78 | + * |
|
| 79 | + * @since 1.0.19 |
|
| 80 | + * @return bool |
|
| 81 | + */ |
|
| 82 | + public function is_beaver_preview() { |
|
| 83 | + return isset( $_REQUEST['fl_builder'] ); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * Checks if this is a siteorigin builder preview page |
|
| 88 | + * |
|
| 89 | + * @since 1.0.19 |
|
| 90 | + * @return bool |
|
| 91 | + */ |
|
| 92 | + public function is_siteorigin_preview() { |
|
| 93 | + return ! empty( $_REQUEST['siteorigin_panels_live_editor'] ); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * Checks if this is a cornerstone builder preview page |
|
| 98 | + * |
|
| 99 | + * @since 1.0.19 |
|
| 100 | + * @return bool |
|
| 101 | + */ |
|
| 102 | + public function is_cornerstone_preview() { |
|
| 103 | + return ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint'; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Checks if this is a fusion builder preview page |
|
| 108 | + * |
|
| 109 | + * @since 1.0.19 |
|
| 110 | + * @return bool |
|
| 111 | + */ |
|
| 112 | + public function is_fusion_preview() { |
|
| 113 | + return ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * Checks if this is an oxygen builder preview page |
|
| 118 | + * |
|
| 119 | + * @since 1.0.19 |
|
| 120 | + * @return bool |
|
| 121 | + */ |
|
| 122 | + public function is_oxygen_preview() { |
|
| 123 | + return ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @param string $template_path The template path relative to the theme's root dir. Defaults to 'invoicing'. |
| 131 | 131 | * @param string $default_path The root path to the default template. Defaults to invoicing/templates |
| 132 | 132 | */ |
| 133 | - public function locate_template( $template_name, $template_path = '', $default_path = '' ) { |
|
| 133 | + public function locate_template( $template_name, $template_path = '', $default_path = '' ) { |
|
| 134 | 134 | |
| 135 | 135 | // Load the defaults for the template path and default path. |
| 136 | 136 | $template_path = empty( $template_path ) ? 'invoicing' : $template_path; |
@@ -151,22 +151,22 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | - * Loads a template |
|
| 155 | - * |
|
| 156 | - * @since 1.0.19 |
|
| 157 | - * @return bool |
|
| 158 | - */ |
|
| 159 | - protected function load_template( $template_name, $template_path, $args ) { |
|
| 154 | + * Loads a template |
|
| 155 | + * |
|
| 156 | + * @since 1.0.19 |
|
| 157 | + * @return bool |
|
| 158 | + */ |
|
| 159 | + protected function load_template( $template_name, $template_path, $args ) { |
|
| 160 | 160 | |
| 161 | 161 | if ( is_array( $args ) ){ |
| 162 | 162 | extract( $args ); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Fires before loading a template. |
| 166 | - do_action( 'wpinv_before_template_part', $template_name, $template_path, $args ); |
|
| 166 | + do_action( 'wpinv_before_template_part', $template_name, $template_path, $args ); |
|
| 167 | 167 | |
| 168 | 168 | // Load the template. |
| 169 | - include( $template_path ); |
|
| 169 | + include( $template_path ); |
|
| 170 | 170 | |
| 171 | 171 | // Fires after loading a template. |
| 172 | 172 | do_action( 'wpinv_after_template_part', $template_name, $template_path, $args ); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * @param string $template_path The templates directory relative to the theme's root dir. Defaults to 'invoicing'. |
| 184 | 184 | * @param string $default_path The root path to the default template. Defaults to invoicing/templates |
| 185 | 185 | */ |
| 186 | - public function display_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
| 186 | + public function display_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
| 187 | 187 | |
| 188 | 188 | // Locate the template. |
| 189 | 189 | $located = $this->locate_template( $template_name, $template_path, $default_path ); |
@@ -208,74 +208,74 @@ discard block |
||
| 208 | 208 | * @param string $template_path The templates directory relative to the theme's root dir. Defaults to 'invoicing'. |
| 209 | 209 | * @param string $default_path The root path to the default template. Defaults to invoicing/templates |
| 210 | 210 | */ |
| 211 | - public function get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
| 211 | + public function get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
| 212 | 212 | ob_start(); |
| 213 | 213 | $this->display_template( $template_name, $args, $template_path, $default_path ); |
| 214 | 214 | return ob_get_clean(); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
| 218 | - * Get the geodirectory templates theme path. |
|
| 219 | - * |
|
| 220 | - * |
|
| 221 | - * @return string Template path. |
|
| 222 | - */ |
|
| 223 | - public static function get_theme_template_path() { |
|
| 224 | - $template = get_template(); |
|
| 225 | - $theme_root = get_theme_root( $template ); |
|
| 226 | - |
|
| 227 | - return $theme_root . '/' . $template . '/' . untrailingslashit( wpinv_get_theme_template_dir_name() ); |
|
| 228 | - |
|
| 229 | - } |
|
| 230 | - |
|
| 231 | - /** |
|
| 232 | - * Oxygen locate theme template. |
|
| 233 | - * |
|
| 234 | - * @param string $template The template. |
|
| 235 | - * @return string The theme template. |
|
| 236 | - */ |
|
| 237 | - public static function oxygen_locate_template( $template ) { |
|
| 238 | - |
|
| 239 | - if ( empty( $template ) ) { |
|
| 240 | - return ''; |
|
| 241 | - } |
|
| 242 | - |
|
| 243 | - $has_filter = has_filter( 'template', 'ct_oxygen_template_name' ); |
|
| 244 | - |
|
| 245 | - // Remove template filter |
|
| 246 | - if ( $has_filter ) { |
|
| 247 | - remove_filter( 'template', 'ct_oxygen_template_name' ); |
|
| 248 | - } |
|
| 249 | - |
|
| 250 | - $template = self::get_theme_template_path() . '/' . $template; |
|
| 251 | - |
|
| 252 | - if ( ! file_exists( $template ) ) { |
|
| 253 | - $template = ''; |
|
| 254 | - } |
|
| 255 | - |
|
| 256 | - // Add template filter |
|
| 257 | - if ( $has_filter ) { |
|
| 258 | - add_filter( 'template', 'ct_oxygen_template_name' ); |
|
| 259 | - } |
|
| 260 | - |
|
| 261 | - return $template; |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - /** |
|
| 265 | - * Oxygen override theme template. |
|
| 266 | - * |
|
| 267 | - * @param string $located Located template. |
|
| 268 | - * @param string $template_name Template name. |
|
| 269 | - * @return string Located template. |
|
| 270 | - */ |
|
| 271 | - public function oxygen_override_template( $located, $template_name ) { |
|
| 218 | + * Get the geodirectory templates theme path. |
|
| 219 | + * |
|
| 220 | + * |
|
| 221 | + * @return string Template path. |
|
| 222 | + */ |
|
| 223 | + public static function get_theme_template_path() { |
|
| 224 | + $template = get_template(); |
|
| 225 | + $theme_root = get_theme_root( $template ); |
|
| 226 | + |
|
| 227 | + return $theme_root . '/' . $template . '/' . untrailingslashit( wpinv_get_theme_template_dir_name() ); |
|
| 228 | + |
|
| 229 | + } |
|
| 230 | + |
|
| 231 | + /** |
|
| 232 | + * Oxygen locate theme template. |
|
| 233 | + * |
|
| 234 | + * @param string $template The template. |
|
| 235 | + * @return string The theme template. |
|
| 236 | + */ |
|
| 237 | + public static function oxygen_locate_template( $template ) { |
|
| 238 | + |
|
| 239 | + if ( empty( $template ) ) { |
|
| 240 | + return ''; |
|
| 241 | + } |
|
| 242 | + |
|
| 243 | + $has_filter = has_filter( 'template', 'ct_oxygen_template_name' ); |
|
| 244 | + |
|
| 245 | + // Remove template filter |
|
| 246 | + if ( $has_filter ) { |
|
| 247 | + remove_filter( 'template', 'ct_oxygen_template_name' ); |
|
| 248 | + } |
|
| 249 | + |
|
| 250 | + $template = self::get_theme_template_path() . '/' . $template; |
|
| 251 | + |
|
| 252 | + if ( ! file_exists( $template ) ) { |
|
| 253 | + $template = ''; |
|
| 254 | + } |
|
| 255 | + |
|
| 256 | + // Add template filter |
|
| 257 | + if ( $has_filter ) { |
|
| 258 | + add_filter( 'template', 'ct_oxygen_template_name' ); |
|
| 259 | + } |
|
| 260 | + |
|
| 261 | + return $template; |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + /** |
|
| 265 | + * Oxygen override theme template. |
|
| 266 | + * |
|
| 267 | + * @param string $located Located template. |
|
| 268 | + * @param string $template_name Template name. |
|
| 269 | + * @return string Located template. |
|
| 270 | + */ |
|
| 271 | + public function oxygen_override_template( $located, $template_name ) { |
|
| 272 | 272 | |
| 273 | 273 | $oxygen_overide = self::oxygen_locate_template( $template_name ); |
| 274 | - if ( ! empty( $oxygen_overide ) ) { |
|
| 275 | - return $oxygen_overide; |
|
| 276 | - } |
|
| 274 | + if ( ! empty( $oxygen_overide ) ) { |
|
| 275 | + return $oxygen_overide; |
|
| 276 | + } |
|
| 277 | 277 | |
| 278 | - return $located; |
|
| 279 | - } |
|
| 278 | + return $located; |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | 281 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if (!defined('ABSPATH')) { |
|
| 3 | 3 | exit; |
| 4 | 4 | } |
| 5 | 5 | |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function __construct() { |
| 28 | 28 | |
| 29 | - $this->templates_dir = apply_filters( 'getpaid_default_templates_dir', WPINV_PLUGIN_DIR . 'templates' ); |
|
| 30 | - $this->templates_url = apply_filters( 'getpaid_default_templates_url', WPINV_PLUGIN_URL . 'templates' ); |
|
| 29 | + $this->templates_dir = apply_filters('getpaid_default_templates_dir', WPINV_PLUGIN_DIR . 'templates'); |
|
| 30 | + $this->templates_url = apply_filters('getpaid_default_templates_url', WPINV_PLUGIN_URL . 'templates'); |
|
| 31 | 31 | |
| 32 | 32 | // Oxygen plugin |
| 33 | - if ( defined( 'CT_VERSION' ) ) { |
|
| 34 | - add_filter( 'wpinv_locate_template', array( $this, 'oxygen_override_template' ), 11, 4 ); |
|
| 33 | + if (defined('CT_VERSION')) { |
|
| 34 | + add_filter('wpinv_locate_template', array($this, 'oxygen_override_template'), 11, 4); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @return bool |
| 61 | 61 | */ |
| 62 | 62 | public function is_elementor_preview() { |
| 63 | - return isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ); |
|
| 63 | + return isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax'); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return bool |
| 71 | 71 | */ |
| 72 | 72 | public function is_divi_preview() { |
| 73 | - return isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'et_pb' ); |
|
| 73 | + return isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'et_pb'); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @return bool |
| 81 | 81 | */ |
| 82 | 82 | public function is_beaver_preview() { |
| 83 | - return isset( $_REQUEST['fl_builder'] ); |
|
| 83 | + return isset($_REQUEST['fl_builder']); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @return bool |
| 91 | 91 | */ |
| 92 | 92 | public function is_siteorigin_preview() { |
| 93 | - return ! empty( $_REQUEST['siteorigin_panels_live_editor'] ); |
|
| 93 | + return !empty($_REQUEST['siteorigin_panels_live_editor']); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @return bool |
| 101 | 101 | */ |
| 102 | 102 | public function is_cornerstone_preview() { |
| 103 | - return ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint'; |
|
| 103 | + return !empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint'; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @return bool |
| 111 | 111 | */ |
| 112 | 112 | public function is_fusion_preview() { |
| 113 | - return ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ); |
|
| 113 | + return !empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce']); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * @return bool |
| 121 | 121 | */ |
| 122 | 122 | public function is_oxygen_preview() { |
| 123 | - return ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ); |
|
| 123 | + return !empty($_REQUEST['ct_builder']) || (!empty($_REQUEST['action']) && (substr($_REQUEST['action'], 0, 11) === "oxy_render_" || substr($_REQUEST['action'], 0, 10) === "ct_render_")); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -130,24 +130,24 @@ discard block |
||
| 130 | 130 | * @param string $template_path The template path relative to the theme's root dir. Defaults to 'invoicing'. |
| 131 | 131 | * @param string $default_path The root path to the default template. Defaults to invoicing/templates |
| 132 | 132 | */ |
| 133 | - public function locate_template( $template_name, $template_path = '', $default_path = '' ) { |
|
| 133 | + public function locate_template($template_name, $template_path = '', $default_path = '') { |
|
| 134 | 134 | |
| 135 | 135 | // Load the defaults for the template path and default path. |
| 136 | - $template_path = empty( $template_path ) ? 'invoicing' : $template_path; |
|
| 137 | - $default_path = empty( $default_path ) ? $this->templates_dir : $default_path; |
|
| 138 | - $default_path = apply_filters( 'getpaid_template_default_template_path', $default_path, $template_name ); |
|
| 136 | + $template_path = empty($template_path) ? 'invoicing' : $template_path; |
|
| 137 | + $default_path = empty($default_path) ? $this->templates_dir : $default_path; |
|
| 138 | + $default_path = apply_filters('getpaid_template_default_template_path', $default_path, $template_name); |
|
| 139 | 139 | |
| 140 | 140 | // Is it overidden? |
| 141 | 141 | $template = locate_template( |
| 142 | - array( trailingslashit( $template_path ) . $template_name, 'wpinv-' . $template_name ) |
|
| 142 | + array(trailingslashit($template_path) . $template_name, 'wpinv-' . $template_name) |
|
| 143 | 143 | ); |
| 144 | 144 | |
| 145 | 145 | // If not, load the default template. |
| 146 | - if ( empty( $template ) ) { |
|
| 147 | - $template = trailingslashit( $default_path ) . $template_name; |
|
| 146 | + if (empty($template)) { |
|
| 147 | + $template = trailingslashit($default_path) . $template_name; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - return apply_filters( 'wpinv_locate_template', $template, $template_name, $template_path, $default_path ); |
|
| 150 | + return apply_filters('wpinv_locate_template', $template, $template_name, $template_path, $default_path); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -156,20 +156,20 @@ discard block |
||
| 156 | 156 | * @since 1.0.19 |
| 157 | 157 | * @return bool |
| 158 | 158 | */ |
| 159 | - protected function load_template( $template_name, $template_path, $args ) { |
|
| 159 | + protected function load_template($template_name, $template_path, $args) { |
|
| 160 | 160 | |
| 161 | - if ( is_array( $args ) ){ |
|
| 162 | - extract( $args ); |
|
| 161 | + if (is_array($args)) { |
|
| 162 | + extract($args); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Fires before loading a template. |
| 166 | - do_action( 'wpinv_before_template_part', $template_name, $template_path, $args ); |
|
| 166 | + do_action('wpinv_before_template_part', $template_name, $template_path, $args); |
|
| 167 | 167 | |
| 168 | 168 | // Load the template. |
| 169 | - include( $template_path ); |
|
| 169 | + include($template_path); |
|
| 170 | 170 | |
| 171 | 171 | // Fires after loading a template. |
| 172 | - do_action( 'wpinv_after_template_part', $template_name, $template_path, $args ); |
|
| 172 | + do_action('wpinv_after_template_part', $template_name, $template_path, $args); |
|
| 173 | 173 | |
| 174 | 174 | } |
| 175 | 175 | |
@@ -183,18 +183,18 @@ discard block |
||
| 183 | 183 | * @param string $template_path The templates directory relative to the theme's root dir. Defaults to 'invoicing'. |
| 184 | 184 | * @param string $default_path The root path to the default template. Defaults to invoicing/templates |
| 185 | 185 | */ |
| 186 | - public function display_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
| 186 | + public function display_template($template_name, $args = array(), $template_path = '', $default_path = '') { |
|
| 187 | 187 | |
| 188 | 188 | // Locate the template. |
| 189 | - $located = $this->locate_template( $template_name, $template_path, $default_path ); |
|
| 189 | + $located = $this->locate_template($template_name, $template_path, $default_path); |
|
| 190 | 190 | |
| 191 | 191 | // Abort if the file does not exist. |
| 192 | - if ( ! file_exists( $located ) ) { |
|
| 193 | - getpaid_doing_it_wrong( __METHOD__, sprintf( '<code>%s</code> does not exist.', $located ), '2.0.0' ); |
|
| 192 | + if (!file_exists($located)) { |
|
| 193 | + getpaid_doing_it_wrong(__METHOD__, sprintf('<code>%s</code> does not exist.', $located), '2.0.0'); |
|
| 194 | 194 | return; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - $this->load_template( $template_name, $located, $args ); |
|
| 197 | + $this->load_template($template_name, $located, $args); |
|
| 198 | 198 | |
| 199 | 199 | } |
| 200 | 200 | |
@@ -208,9 +208,9 @@ discard block |
||
| 208 | 208 | * @param string $template_path The templates directory relative to the theme's root dir. Defaults to 'invoicing'. |
| 209 | 209 | * @param string $default_path The root path to the default template. Defaults to invoicing/templates |
| 210 | 210 | */ |
| 211 | - public function get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
| 211 | + public function get_template($template_name, $args = array(), $template_path = '', $default_path = '') { |
|
| 212 | 212 | ob_start(); |
| 213 | - $this->display_template( $template_name, $args, $template_path, $default_path ); |
|
| 213 | + $this->display_template($template_name, $args, $template_path, $default_path); |
|
| 214 | 214 | return ob_get_clean(); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public static function get_theme_template_path() { |
| 224 | 224 | $template = get_template(); |
| 225 | - $theme_root = get_theme_root( $template ); |
|
| 225 | + $theme_root = get_theme_root($template); |
|
| 226 | 226 | |
| 227 | - return $theme_root . '/' . $template . '/' . untrailingslashit( wpinv_get_theme_template_dir_name() ); |
|
| 227 | + return $theme_root . '/' . $template . '/' . untrailingslashit(wpinv_get_theme_template_dir_name()); |
|
| 228 | 228 | |
| 229 | 229 | } |
| 230 | 230 | |
@@ -234,28 +234,28 @@ discard block |
||
| 234 | 234 | * @param string $template The template. |
| 235 | 235 | * @return string The theme template. |
| 236 | 236 | */ |
| 237 | - public static function oxygen_locate_template( $template ) { |
|
| 237 | + public static function oxygen_locate_template($template) { |
|
| 238 | 238 | |
| 239 | - if ( empty( $template ) ) { |
|
| 239 | + if (empty($template)) { |
|
| 240 | 240 | return ''; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - $has_filter = has_filter( 'template', 'ct_oxygen_template_name' ); |
|
| 243 | + $has_filter = has_filter('template', 'ct_oxygen_template_name'); |
|
| 244 | 244 | |
| 245 | 245 | // Remove template filter |
| 246 | - if ( $has_filter ) { |
|
| 247 | - remove_filter( 'template', 'ct_oxygen_template_name' ); |
|
| 246 | + if ($has_filter) { |
|
| 247 | + remove_filter('template', 'ct_oxygen_template_name'); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | $template = self::get_theme_template_path() . '/' . $template; |
| 251 | 251 | |
| 252 | - if ( ! file_exists( $template ) ) { |
|
| 252 | + if (!file_exists($template)) { |
|
| 253 | 253 | $template = ''; |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | // Add template filter |
| 257 | - if ( $has_filter ) { |
|
| 258 | - add_filter( 'template', 'ct_oxygen_template_name' ); |
|
| 257 | + if ($has_filter) { |
|
| 258 | + add_filter('template', 'ct_oxygen_template_name'); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | return $template; |
@@ -268,10 +268,10 @@ discard block |
||
| 268 | 268 | * @param string $template_name Template name. |
| 269 | 269 | * @return string Located template. |
| 270 | 270 | */ |
| 271 | - public function oxygen_override_template( $located, $template_name ) { |
|
| 271 | + public function oxygen_override_template($located, $template_name) { |
|
| 272 | 272 | |
| 273 | - $oxygen_overide = self::oxygen_locate_template( $template_name ); |
|
| 274 | - if ( ! empty( $oxygen_overide ) ) { |
|
| 273 | + $oxygen_overide = self::oxygen_locate_template($template_name); |
|
| 274 | + if (!empty($oxygen_overide)) { |
|
| 275 | 275 | return $oxygen_overide; |
| 276 | 276 | } |
| 277 | 277 | |
@@ -8,205 +8,205 @@ discard block |
||
| 8 | 8 | * @version 1.0.19 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -defined( 'ABSPATH' ) || exit; |
|
| 11 | +defined('ABSPATH') || exit; |
|
| 12 | 12 | |
| 13 | -$pages = wpinv_get_pages( true ); |
|
| 13 | +$pages = wpinv_get_pages(true); |
|
| 14 | 14 | |
| 15 | 15 | $currencies = wpinv_get_currencies(); |
| 16 | 16 | |
| 17 | 17 | $currency_code_options = array(); |
| 18 | -foreach ( $currencies as $code => $name ) { |
|
| 19 | - $currency_code_options[ $code ] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol( $code ) . ')'; |
|
| 18 | +foreach ($currencies as $code => $name) { |
|
| 19 | + $currency_code_options[$code] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol($code) . ')'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | $invoice_number_padd_options = array(); |
| 23 | -for ( $i = 0; $i <= 20; $i++ ) { |
|
| 23 | +for ($i = 0; $i <= 20; $i++) { |
|
| 24 | 24 | $invoice_number_padd_options[$i] = $i; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $currency_symbol = wpinv_currency_symbol(); |
| 28 | 28 | |
| 29 | 29 | $last_number = $reset_number = ''; |
| 30 | -if ( $last_invoice_number = get_option( 'wpinv_last_invoice_number' ) ) { |
|
| 31 | - $last_invoice_number = preg_replace( '/[^0-9]/', '', $last_invoice_number ); |
|
| 30 | +if ($last_invoice_number = get_option('wpinv_last_invoice_number')) { |
|
| 31 | + $last_invoice_number = preg_replace('/[^0-9]/', '', $last_invoice_number); |
|
| 32 | 32 | |
| 33 | - if ( !empty( $last_invoice_number ) ) { |
|
| 34 | - $last_number = ' ' . wp_sprintf( __( "( Last Invoice's sequential number: <b>%s</b> )", 'invoicing' ), $last_invoice_number ); |
|
| 33 | + if (!empty($last_invoice_number)) { |
|
| 34 | + $last_number = ' ' . wp_sprintf(__("( Last Invoice's sequential number: <b>%s</b> )", 'invoicing'), $last_invoice_number); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $nonce = wp_create_nonce('reset_invoice_count'); |
| 38 | - $reset_number = '<a href="'.add_query_arg(array('reset_invoice_count' => 1, '_nonce' => $nonce)).'" class="btn button">'.__('Force Reset Sequence', 'invoicing' ). '</a>'; |
|
| 38 | + $reset_number = '<a href="' . add_query_arg(array('reset_invoice_count' => 1, '_nonce' => $nonce)) . '" class="btn button">' . __('Force Reset Sequence', 'invoicing') . '</a>'; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $alert_wrapper_start = '<p style="color: #F00">'; |
| 42 | 42 | $alert_wrapper_close = '</p>'; |
| 43 | 43 | |
| 44 | 44 | return array( |
| 45 | - 'general' => apply_filters( 'wpinv_settings_general', |
|
| 45 | + 'general' => apply_filters('wpinv_settings_general', |
|
| 46 | 46 | array( |
| 47 | 47 | 'main' => array( |
| 48 | 48 | 'location_settings' => array( |
| 49 | 49 | 'id' => 'location_settings', |
| 50 | - 'name' => '<h3>' . __( 'Default Location', 'invoicing' ) . '</h3>', |
|
| 50 | + 'name' => '<h3>' . __('Default Location', 'invoicing') . '</h3>', |
|
| 51 | 51 | 'desc' => '', |
| 52 | 52 | 'type' => 'header', |
| 53 | 53 | ), |
| 54 | 54 | 'default_country' => array( |
| 55 | 55 | 'id' => 'default_country', |
| 56 | - 'name' => __( 'Default Country', 'invoicing' ), |
|
| 57 | - 'desc' => __( 'Where does your store operate from?', 'invoicing' ), |
|
| 56 | + 'name' => __('Default Country', 'invoicing'), |
|
| 57 | + 'desc' => __('Where does your store operate from?', 'invoicing'), |
|
| 58 | 58 | 'type' => 'select', |
| 59 | 59 | 'options' => wpinv_get_country_list(), |
| 60 | 60 | 'std' => 'GB', |
| 61 | 61 | 'class' => 'wpi_select2', |
| 62 | - 'placeholder' => __( 'Select a country', 'invoicing' ), |
|
| 62 | + 'placeholder' => __('Select a country', 'invoicing'), |
|
| 63 | 63 | ), |
| 64 | 64 | 'default_state' => array( |
| 65 | 65 | 'id' => 'default_state', |
| 66 | - 'name' => __( 'Default State / Province', 'invoicing' ), |
|
| 67 | - 'desc' => __( 'What state / province does your store operate from?', 'invoicing' ), |
|
| 66 | + 'name' => __('Default State / Province', 'invoicing'), |
|
| 67 | + 'desc' => __('What state / province does your store operate from?', 'invoicing'), |
|
| 68 | 68 | 'type' => 'country_states', |
| 69 | 69 | 'class' => 'wpi_select2', |
| 70 | - 'placeholder' => __( 'Select a state', 'invoicing' ), |
|
| 70 | + 'placeholder' => __('Select a state', 'invoicing'), |
|
| 71 | 71 | ), |
| 72 | 72 | 'store_name' => array( |
| 73 | 73 | 'id' => 'store_name', |
| 74 | - 'name' => __( 'Store Name', 'invoicing' ), |
|
| 75 | - 'desc' => __( 'Store name to print on invoices.', 'invoicing' ), |
|
| 74 | + 'name' => __('Store Name', 'invoicing'), |
|
| 75 | + 'desc' => __('Store name to print on invoices.', 'invoicing'), |
|
| 76 | 76 | 'std' => get_option('blogname'), |
| 77 | 77 | 'type' => 'text', |
| 78 | 78 | ), |
| 79 | 79 | 'logo' => array( |
| 80 | 80 | 'id' => 'logo', |
| 81 | - 'name' => __( 'Logo URL', 'invoicing' ), |
|
| 82 | - 'desc' => __( 'Store logo to print on invoices.', 'invoicing' ), |
|
| 81 | + 'name' => __('Logo URL', 'invoicing'), |
|
| 82 | + 'desc' => __('Store logo to print on invoices.', 'invoicing'), |
|
| 83 | 83 | 'type' => 'text', |
| 84 | 84 | ), |
| 85 | 85 | 'logo_width' => array( |
| 86 | 86 | 'id' => 'logo_width', |
| 87 | - 'name' => __( 'Logo width', 'invoicing' ), |
|
| 88 | - 'desc' => __( 'Logo width to use in invoice image.', 'invoicing' ), |
|
| 87 | + 'name' => __('Logo width', 'invoicing'), |
|
| 88 | + 'desc' => __('Logo width to use in invoice image.', 'invoicing'), |
|
| 89 | 89 | 'type' => 'number', |
| 90 | - 'placeholder' => __( 'Auto', 'invoicing' ), |
|
| 90 | + 'placeholder' => __('Auto', 'invoicing'), |
|
| 91 | 91 | ), |
| 92 | 92 | 'logo_height' => array( |
| 93 | 93 | 'id' => 'logo_height', |
| 94 | - 'name' => __( 'Logo height', 'invoicing' ), |
|
| 95 | - 'desc' => __( 'Logo height to use in invoice image.', 'invoicing' ), |
|
| 94 | + 'name' => __('Logo height', 'invoicing'), |
|
| 95 | + 'desc' => __('Logo height to use in invoice image.', 'invoicing'), |
|
| 96 | 96 | 'type' => 'number', |
| 97 | - 'placeholder' => __( 'Auto', 'invoicing' ), |
|
| 97 | + 'placeholder' => __('Auto', 'invoicing'), |
|
| 98 | 98 | ), |
| 99 | 99 | 'store_address' => array( |
| 100 | 100 | 'id' => 'store_address', |
| 101 | - 'name' => __( 'Store Address', 'invoicing' ), |
|
| 102 | - 'desc' => __( 'Enter the store address to display on invoice', 'invoicing' ), |
|
| 101 | + 'name' => __('Store Address', 'invoicing'), |
|
| 102 | + 'desc' => __('Enter the store address to display on invoice', 'invoicing'), |
|
| 103 | 103 | 'type' => 'textarea', |
| 104 | 104 | ), |
| 105 | 105 | 'page_settings' => array( |
| 106 | 106 | 'id' => 'page_settings', |
| 107 | - 'name' => '<h3>' . __( 'Page Settings', 'invoicing' ) . '</h3>', |
|
| 107 | + 'name' => '<h3>' . __('Page Settings', 'invoicing') . '</h3>', |
|
| 108 | 108 | 'desc' => '', |
| 109 | 109 | 'type' => 'header', |
| 110 | 110 | ), |
| 111 | 111 | 'checkout_page' => array( |
| 112 | 112 | 'id' => 'checkout_page', |
| 113 | - 'name' => __( 'Checkout Page', 'invoicing' ), |
|
| 114 | - 'desc' => __( 'This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing' ), |
|
| 113 | + 'name' => __('Checkout Page', 'invoicing'), |
|
| 114 | + 'desc' => __('This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing'), |
|
| 115 | 115 | 'type' => 'select', |
| 116 | 116 | 'options' => $pages, |
| 117 | 117 | 'class' => 'wpi_select2', |
| 118 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
| 118 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
| 119 | 119 | 'help-tip' => true, |
| 120 | 120 | ), |
| 121 | 121 | 'success_page' => array( |
| 122 | 122 | 'id' => 'success_page', |
| 123 | - 'name' => __( 'Success Page', 'invoicing' ), |
|
| 124 | - 'desc' => __( 'This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing' ), |
|
| 123 | + 'name' => __('Success Page', 'invoicing'), |
|
| 124 | + 'desc' => __('This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing'), |
|
| 125 | 125 | 'type' => 'select', |
| 126 | 126 | 'options' => $pages, |
| 127 | 127 | 'class' => 'wpi_select2', |
| 128 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
| 128 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
| 129 | 129 | 'help-tip' => true, |
| 130 | 130 | ), |
| 131 | 131 | 'failure_page' => array( |
| 132 | 132 | 'id' => 'failure_page', |
| 133 | - 'name' => __( 'Failed Transaction Page', 'invoicing' ), |
|
| 134 | - 'desc' => __( 'This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing' ), |
|
| 133 | + 'name' => __('Failed Transaction Page', 'invoicing'), |
|
| 134 | + 'desc' => __('This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing'), |
|
| 135 | 135 | 'type' => 'select', |
| 136 | 136 | 'options' => $pages, |
| 137 | 137 | 'class' => 'wpi_select2', |
| 138 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
| 138 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
| 139 | 139 | 'help-tip' => true, |
| 140 | 140 | ), |
| 141 | 141 | 'invoice_history_page' => array( |
| 142 | 142 | 'id' => 'invoice_history_page', |
| 143 | - 'name' => __( 'Invoice History Page', 'invoicing' ), |
|
| 144 | - 'desc' => __( 'This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing' ), |
|
| 143 | + 'name' => __('Invoice History Page', 'invoicing'), |
|
| 144 | + 'desc' => __('This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing'), |
|
| 145 | 145 | 'type' => 'select', |
| 146 | 146 | 'options' => $pages, |
| 147 | 147 | 'class' => 'wpi_select2', |
| 148 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
| 148 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
| 149 | 149 | 'help-tip' => true, |
| 150 | 150 | ), |
| 151 | 151 | 'invoice_subscription_page' => array( |
| 152 | 152 | 'id' => 'invoice_subscription_page', |
| 153 | - 'name' => __( 'Invoice Subscriptions Page', 'invoicing' ), |
|
| 154 | - 'desc' => __( 'This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing' ), |
|
| 153 | + 'name' => __('Invoice Subscriptions Page', 'invoicing'), |
|
| 154 | + 'desc' => __('This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing'), |
|
| 155 | 155 | 'type' => 'select', |
| 156 | 156 | 'options' => $pages, |
| 157 | 157 | 'class' => 'wpi_select2', |
| 158 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
| 158 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
| 159 | 159 | 'help-tip' => true, |
| 160 | 160 | ), |
| 161 | 161 | ), |
| 162 | 162 | 'currency_section' => array( |
| 163 | 163 | 'currency_settings' => array( |
| 164 | 164 | 'id' => 'currency_settings', |
| 165 | - 'name' => '<h3>' . __( 'Currency Settings', 'invoicing' ) . '</h3>', |
|
| 165 | + 'name' => '<h3>' . __('Currency Settings', 'invoicing') . '</h3>', |
|
| 166 | 166 | 'desc' => '', |
| 167 | 167 | 'type' => 'header', |
| 168 | 168 | ), |
| 169 | 169 | 'currency' => array( |
| 170 | 170 | 'id' => 'currency', |
| 171 | - 'name' => __( 'Currency', 'invoicing' ), |
|
| 172 | - 'desc' => __( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing' ), |
|
| 171 | + 'name' => __('Currency', 'invoicing'), |
|
| 172 | + 'desc' => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing'), |
|
| 173 | 173 | 'type' => 'select', |
| 174 | 174 | 'class' => 'wpi_select2', |
| 175 | 175 | 'options' => $currency_code_options, |
| 176 | 176 | ), |
| 177 | 177 | 'currency_position' => array( |
| 178 | 178 | 'id' => 'currency_position', |
| 179 | - 'name' => __( 'Currency Position', 'invoicing' ), |
|
| 180 | - 'desc' => __( 'Choose the location of the currency sign.', 'invoicing' ), |
|
| 179 | + 'name' => __('Currency Position', 'invoicing'), |
|
| 180 | + 'desc' => __('Choose the location of the currency sign.', 'invoicing'), |
|
| 181 | 181 | 'type' => 'select', |
| 182 | 182 | 'class' => 'wpi_select2', |
| 183 | 183 | 'options' => array( |
| 184 | - 'left' => __( 'Left', 'invoicing' ) . ' (' . $currency_symbol . wpinv_format_amount( '99.99' ) . ')', |
|
| 185 | - 'right' => __( 'Right', 'invoicing' ) . ' ('. wpinv_format_amount( '99.99' ) . $currency_symbol . ')', |
|
| 186 | - 'left_space' => __( 'Left with space', 'invoicing' ) . ' (' . $currency_symbol . ' ' . wpinv_format_amount( '99.99' ) . ')', |
|
| 187 | - 'right_space' => __( 'Right with space', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . ' ' . $currency_symbol . ')' |
|
| 184 | + 'left' => __('Left', 'invoicing') . ' (' . $currency_symbol . wpinv_format_amount('99.99') . ')', |
|
| 185 | + 'right' => __('Right', 'invoicing') . ' (' . wpinv_format_amount('99.99') . $currency_symbol . ')', |
|
| 186 | + 'left_space' => __('Left with space', 'invoicing') . ' (' . $currency_symbol . ' ' . wpinv_format_amount('99.99') . ')', |
|
| 187 | + 'right_space' => __('Right with space', 'invoicing') . ' (' . wpinv_format_amount('99.99') . ' ' . $currency_symbol . ')' |
|
| 188 | 188 | ) |
| 189 | 189 | ), |
| 190 | 190 | 'thousands_separator' => array( |
| 191 | 191 | 'id' => 'thousands_separator', |
| 192 | - 'name' => __( 'Thousands Separator', 'invoicing' ), |
|
| 193 | - 'desc' => __( 'The symbol (usually , or .) to separate thousands', 'invoicing' ), |
|
| 192 | + 'name' => __('Thousands Separator', 'invoicing'), |
|
| 193 | + 'desc' => __('The symbol (usually , or .) to separate thousands', 'invoicing'), |
|
| 194 | 194 | 'type' => 'text', |
| 195 | 195 | 'size' => 'small', |
| 196 | 196 | 'std' => ',', |
| 197 | 197 | ), |
| 198 | 198 | 'decimal_separator' => array( |
| 199 | 199 | 'id' => 'decimal_separator', |
| 200 | - 'name' => __( 'Decimal Separator', 'invoicing' ), |
|
| 201 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'invoicing' ), |
|
| 200 | + 'name' => __('Decimal Separator', 'invoicing'), |
|
| 201 | + 'desc' => __('The symbol (usually , or .) to separate decimal points', 'invoicing'), |
|
| 202 | 202 | 'type' => 'text', |
| 203 | 203 | 'size' => 'small', |
| 204 | 204 | 'std' => '.', |
| 205 | 205 | ), |
| 206 | 206 | 'decimals' => array( |
| 207 | 207 | 'id' => 'decimals', |
| 208 | - 'name' => __( 'Number of Decimals', 'invoicing' ), |
|
| 209 | - 'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'invoicing' ), |
|
| 208 | + 'name' => __('Number of Decimals', 'invoicing'), |
|
| 209 | + 'desc' => __('This sets the number of decimal points shown in displayed prices.', 'invoicing'), |
|
| 210 | 210 | 'type' => 'number', |
| 211 | 211 | 'size' => 'small', |
| 212 | 212 | 'std' => '2', |
@@ -218,21 +218,21 @@ discard block |
||
| 218 | 218 | 'labels' => array( |
| 219 | 219 | 'labels' => array( |
| 220 | 220 | 'id' => 'labels_settings', |
| 221 | - 'name' => '<h3>' . __( 'Invoice Labels', 'invoicing' ) . '</h3>', |
|
| 221 | + 'name' => '<h3>' . __('Invoice Labels', 'invoicing') . '</h3>', |
|
| 222 | 222 | 'desc' => '', |
| 223 | 223 | 'type' => 'header', |
| 224 | 224 | ), |
| 225 | 225 | 'vat_invoice_notice_label' => array( |
| 226 | 226 | 'id' => 'vat_invoice_notice_label', |
| 227 | - 'name' => __( 'Invoice Notice Label', 'invoicing' ), |
|
| 228 | - 'desc' => __( 'Use this to add an invoice notice section (label) to your invoices', 'invoicing' ), |
|
| 227 | + 'name' => __('Invoice Notice Label', 'invoicing'), |
|
| 228 | + 'desc' => __('Use this to add an invoice notice section (label) to your invoices', 'invoicing'), |
|
| 229 | 229 | 'type' => 'text', |
| 230 | 230 | 'size' => 'regular', |
| 231 | 231 | ), |
| 232 | 232 | 'vat_invoice_notice' => array( |
| 233 | 233 | 'id' => 'vat_invoice_notice', |
| 234 | - 'name' => __( 'Invoice notice', 'invoicing' ), |
|
| 235 | - 'desc' => __( 'Use this to add an invoice notice section (description) to your invoices', 'invoicing' ), |
|
| 234 | + 'name' => __('Invoice notice', 'invoicing'), |
|
| 235 | + 'desc' => __('Use this to add an invoice notice section (description) to your invoices', 'invoicing'), |
|
| 236 | 236 | 'type' => 'text', |
| 237 | 237 | 'size' => 'regular', |
| 238 | 238 | ), |
@@ -244,22 +244,22 @@ discard block |
||
| 244 | 244 | 'main' => array( |
| 245 | 245 | 'gateway_settings' => array( |
| 246 | 246 | 'id' => 'api_header', |
| 247 | - 'name' => '<h3>' . __( 'Gateway Settings', 'invoicing' ) . '</h3>', |
|
| 247 | + 'name' => '<h3>' . __('Gateway Settings', 'invoicing') . '</h3>', |
|
| 248 | 248 | 'desc' => '', |
| 249 | 249 | 'type' => 'header', |
| 250 | 250 | ), |
| 251 | 251 | 'gateways' => array( |
| 252 | 252 | 'id' => 'gateways', |
| 253 | - 'name' => __( 'Payment Gateways', 'invoicing' ), |
|
| 254 | - 'desc' => __( 'Choose the payment gateways you want to enable.', 'invoicing' ), |
|
| 253 | + 'name' => __('Payment Gateways', 'invoicing'), |
|
| 254 | + 'desc' => __('Choose the payment gateways you want to enable.', 'invoicing'), |
|
| 255 | 255 | 'type' => 'gateways', |
| 256 | - 'std' => array( 'manual'=>1 ), |
|
| 256 | + 'std' => array('manual'=>1), |
|
| 257 | 257 | 'options' => wpinv_get_payment_gateways(), |
| 258 | 258 | ), |
| 259 | 259 | 'default_gateway' => array( |
| 260 | 260 | 'id' => 'default_gateway', |
| 261 | - 'name' => __( 'Default Gateway', 'invoicing' ), |
|
| 262 | - 'desc' => __( 'This gateway will be loaded automatically with the checkout page.', 'invoicing' ), |
|
| 261 | + 'name' => __('Default Gateway', 'invoicing'), |
|
| 262 | + 'desc' => __('This gateway will be loaded automatically with the checkout page.', 'invoicing'), |
|
| 263 | 263 | 'type' => 'gateway_select', |
| 264 | 264 | 'std' => 'manual', |
| 265 | 265 | 'class' => 'wpi_select2', |
@@ -274,32 +274,32 @@ discard block |
||
| 274 | 274 | 'main' => array( |
| 275 | 275 | 'tax_settings' => array( |
| 276 | 276 | 'id' => 'tax_settings', |
| 277 | - 'name' => '<h3>' . __( 'Tax Settings', 'invoicing' ) . '</h3>', |
|
| 277 | + 'name' => '<h3>' . __('Tax Settings', 'invoicing') . '</h3>', |
|
| 278 | 278 | 'type' => 'header', |
| 279 | 279 | ), |
| 280 | 280 | |
| 281 | 281 | 'enable_taxes' => array( |
| 282 | 282 | 'id' => 'enable_taxes', |
| 283 | - 'name' => __( 'Enable Taxes', 'invoicing' ), |
|
| 284 | - 'desc' => __( 'Enable tax rates and calculations.', 'invoicing' ), |
|
| 283 | + 'name' => __('Enable Taxes', 'invoicing'), |
|
| 284 | + 'desc' => __('Enable tax rates and calculations.', 'invoicing'), |
|
| 285 | 285 | 'type' => 'checkbox', |
| 286 | 286 | 'std' => 0, |
| 287 | 287 | ), |
| 288 | 288 | |
| 289 | 289 | 'tax_subtotal_rounding' => array( |
| 290 | 290 | 'id' => 'tax_subtotal_rounding', |
| 291 | - 'name' => __( 'Rounding', 'invoicing' ), |
|
| 292 | - 'desc' => __( 'Round tax at subtotal level, instead of rounding per tax rate', 'invoicing' ), |
|
| 291 | + 'name' => __('Rounding', 'invoicing'), |
|
| 292 | + 'desc' => __('Round tax at subtotal level, instead of rounding per tax rate', 'invoicing'), |
|
| 293 | 293 | 'type' => 'checkbox', |
| 294 | 294 | 'std' => 1, |
| 295 | 295 | ), |
| 296 | 296 | |
| 297 | 297 | 'prices_include_tax' => array( |
| 298 | 298 | 'id' => 'prices_include_tax', |
| 299 | - 'name' => __( 'Prices entered with tax', 'invoicing' ), |
|
| 299 | + 'name' => __('Prices entered with tax', 'invoicing'), |
|
| 300 | 300 | 'options' => array( |
| 301 | - 'yes' => __( 'Yes, I will enter prices inclusive of tax', 'invoicing' ), |
|
| 302 | - 'no' => __( 'No, I will enter prices exclusive of tax', 'invoicing' ), |
|
| 301 | + 'yes' => __('Yes, I will enter prices inclusive of tax', 'invoicing'), |
|
| 302 | + 'no' => __('No, I will enter prices exclusive of tax', 'invoicing'), |
|
| 303 | 303 | ), |
| 304 | 304 | 'type' => 'select', |
| 305 | 305 | 'std' => 'no', |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | |
| 308 | 308 | 'tax_base' => array( |
| 309 | 309 | 'id' => 'tax_base', |
| 310 | - 'name' => __( 'Calculate tax based on', 'invoicing' ), |
|
| 310 | + 'name' => __('Calculate tax based on', 'invoicing'), |
|
| 311 | 311 | 'options' => array( |
| 312 | - 'billing' => __( 'Customer billing address', 'invoicing' ), |
|
| 313 | - 'base' => __( 'Shop base address', 'invoicing' ), |
|
| 312 | + 'billing' => __('Customer billing address', 'invoicing'), |
|
| 313 | + 'base' => __('Shop base address', 'invoicing'), |
|
| 314 | 314 | ), |
| 315 | 315 | 'type' => 'select', |
| 316 | 316 | 'std' => 'billing', |
@@ -318,10 +318,10 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | 'tax_display_totals' => array( |
| 320 | 320 | 'id' => 'tax_display_totals', |
| 321 | - 'name' => __( 'Display tax totals', 'invoicing' ), |
|
| 321 | + 'name' => __('Display tax totals', 'invoicing'), |
|
| 322 | 322 | 'options' => array( |
| 323 | - 'single' => __( 'As a single total', 'invoicing' ), |
|
| 324 | - 'individual' => __( 'As individual tax rates', 'invoicing' ), |
|
| 323 | + 'single' => __('As a single total', 'invoicing'), |
|
| 324 | + 'individual' => __('As individual tax rates', 'invoicing'), |
|
| 325 | 325 | ), |
| 326 | 326 | 'type' => 'select', |
| 327 | 327 | 'std' => 'individual', |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | |
| 330 | 330 | 'tax_rate' => array( |
| 331 | 331 | 'id' => 'tax_rate', |
| 332 | - 'name' => __( 'Fallback Tax Rate', 'invoicing' ), |
|
| 333 | - 'desc' => __( 'Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing' ), |
|
| 332 | + 'name' => __('Fallback Tax Rate', 'invoicing'), |
|
| 333 | + 'desc' => __('Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing'), |
|
| 334 | 334 | 'type' => 'number', |
| 335 | 335 | 'size' => 'small', |
| 336 | 336 | 'min' => '0', |
@@ -342,8 +342,8 @@ discard block |
||
| 342 | 342 | 'rates' => array( |
| 343 | 343 | 'tax_rates' => array( |
| 344 | 344 | 'id' => 'tax_rates', |
| 345 | - 'name' => '<h3>' . __( 'Tax Rates', 'invoicing' ) . '</h3>', |
|
| 346 | - 'desc' => __( 'Enter tax rates for specific regions.', 'invoicing' ), |
|
| 345 | + 'name' => '<h3>' . __('Tax Rates', 'invoicing') . '</h3>', |
|
| 346 | + 'desc' => __('Enter tax rates for specific regions.', 'invoicing'), |
|
| 347 | 347 | 'type' => 'tax_rates', |
| 348 | 348 | ), |
| 349 | 349 | ), |
@@ -352,45 +352,45 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | 'vat_company_name' => array( |
| 354 | 354 | 'id' => 'vat_company_name', |
| 355 | - 'name' => __( 'Company Name', 'invoicing' ), |
|
| 356 | - 'desc' => wp_sprintf(__( 'Verify your company name and VAT number on the %sEU VIES System.%s', 'invoicing' ), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>' ), |
|
| 355 | + 'name' => __('Company Name', 'invoicing'), |
|
| 356 | + 'desc' => wp_sprintf(__('Verify your company name and VAT number on the %sEU VIES System.%s', 'invoicing'), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>'), |
|
| 357 | 357 | 'type' => 'text', |
| 358 | 358 | 'size' => 'regular', |
| 359 | 359 | ), |
| 360 | 360 | |
| 361 | 361 | 'vat_number' => array( |
| 362 | 362 | 'id' => 'vat_number', |
| 363 | - 'name' => __( 'VAT Number', 'invoicing' ), |
|
| 364 | - 'desc' => __( 'Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing' ), |
|
| 363 | + 'name' => __('VAT Number', 'invoicing'), |
|
| 364 | + 'desc' => __('Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing'), |
|
| 365 | 365 | 'type' => 'text', |
| 366 | 366 | 'size' => 'regular', |
| 367 | 367 | ), |
| 368 | 368 | |
| 369 | 369 | 'vat_prevent_b2c_purchase' => array( |
| 370 | 370 | 'id' => 'vat_prevent_b2c_purchase', |
| 371 | - 'name' => __( 'Prevent B2C Sales', 'invoicing' ), |
|
| 372 | - 'desc' => __( 'Require everyone in the EU to provide a VAT number.', 'invoicing' ), |
|
| 371 | + 'name' => __('Prevent B2C Sales', 'invoicing'), |
|
| 372 | + 'desc' => __('Require everyone in the EU to provide a VAT number.', 'invoicing'), |
|
| 373 | 373 | 'type' => 'checkbox' |
| 374 | 374 | ), |
| 375 | 375 | |
| 376 | 376 | 'validate_vat_number' => array( |
| 377 | 377 | 'id' => 'validate_vat_number', |
| 378 | - 'name' => __( 'Validate VAT Number', 'invoicing' ), |
|
| 379 | - 'desc' => __( 'Validate VAT numbers with VIES.', 'invoicing' ), |
|
| 378 | + 'name' => __('Validate VAT Number', 'invoicing'), |
|
| 379 | + 'desc' => __('Validate VAT numbers with VIES.', 'invoicing'), |
|
| 380 | 380 | 'type' => 'checkbox' |
| 381 | 381 | ), |
| 382 | 382 | |
| 383 | 383 | 'vat_same_country_rule' => array( |
| 384 | 384 | 'id' => 'vat_same_country_rule', |
| 385 | - 'name' => __( 'Same Country Rule', 'invoicing' ), |
|
| 386 | - 'desc' => __( 'What should happen if a customer is from the same country as your business?', 'invoicing' ), |
|
| 385 | + 'name' => __('Same Country Rule', 'invoicing'), |
|
| 386 | + 'desc' => __('What should happen if a customer is from the same country as your business?', 'invoicing'), |
|
| 387 | 387 | 'type' => 'select', |
| 388 | 388 | 'options' => array( |
| 389 | - 'no' => __( 'Do not charge tax', 'invoicing' ), |
|
| 390 | - 'always' => __( 'Charge tax unless vat number is validated', 'invoicing' ), |
|
| 391 | - 'vat_too' => __( 'Charge tax even if vat number is validated', 'invoicing' ) |
|
| 389 | + 'no' => __('Do not charge tax', 'invoicing'), |
|
| 390 | + 'always' => __('Charge tax unless vat number is validated', 'invoicing'), |
|
| 391 | + 'vat_too' => __('Charge tax even if vat number is validated', 'invoicing') |
|
| 392 | 392 | ), |
| 393 | - 'placeholder' => __( 'Select an option', 'invoicing' ), |
|
| 393 | + 'placeholder' => __('Select an option', 'invoicing'), |
|
| 394 | 394 | 'std' => 'vat_too', |
| 395 | 395 | ), |
| 396 | 396 | |
@@ -404,59 +404,59 @@ discard block |
||
| 404 | 404 | 'main' => array( |
| 405 | 405 | 'email_settings_header' => array( |
| 406 | 406 | 'id' => 'email_settings_header', |
| 407 | - 'name' => '<h3>' . __( 'Email Sender Options', 'invoicing' ) . '</h3>', |
|
| 407 | + 'name' => '<h3>' . __('Email Sender Options', 'invoicing') . '</h3>', |
|
| 408 | 408 | 'type' => 'header', |
| 409 | 409 | ), |
| 410 | 410 | 'email_from_name' => array( |
| 411 | 411 | 'id' => 'email_from_name', |
| 412 | - 'name' => __( 'From Name', 'invoicing' ), |
|
| 413 | - 'desc' => __( 'Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing' ), |
|
| 414 | - 'std' => esc_attr( get_bloginfo( 'name', 'display' ) ), |
|
| 412 | + 'name' => __('From Name', 'invoicing'), |
|
| 413 | + 'desc' => __('Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing'), |
|
| 414 | + 'std' => esc_attr(get_bloginfo('name', 'display')), |
|
| 415 | 415 | 'type' => 'text', |
| 416 | 416 | ), |
| 417 | 417 | 'email_from' => array( |
| 418 | 418 | 'id' => 'email_from', |
| 419 | - 'name' => __( 'From Email', 'invoicing' ), |
|
| 420 | - 'desc' => sprintf (__( 'Email address to send invoice emails from. This will act as the "from" and "reply-to" address. %s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%s', 'invoicing' ), $alert_wrapper_start, $alert_wrapper_close), |
|
| 421 | - 'std' => get_option( 'admin_email' ), |
|
| 419 | + 'name' => __('From Email', 'invoicing'), |
|
| 420 | + 'desc' => sprintf(__('Email address to send invoice emails from. This will act as the "from" and "reply-to" address. %s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%s', 'invoicing'), $alert_wrapper_start, $alert_wrapper_close), |
|
| 421 | + 'std' => get_option('admin_email'), |
|
| 422 | 422 | 'type' => 'text', |
| 423 | 423 | ), |
| 424 | 424 | 'admin_email' => array( |
| 425 | 425 | 'id' => 'admin_email', |
| 426 | - 'name' => __( 'Admin Email', 'invoicing' ), |
|
| 427 | - 'desc' => __( 'Where should we send admin notifications?', 'invoicing' ), |
|
| 428 | - 'std' => get_option( 'admin_email' ), |
|
| 426 | + 'name' => __('Admin Email', 'invoicing'), |
|
| 427 | + 'desc' => __('Where should we send admin notifications?', 'invoicing'), |
|
| 428 | + 'std' => get_option('admin_email'), |
|
| 429 | 429 | 'type' => 'text', |
| 430 | 430 | ), |
| 431 | 431 | 'overdue_settings_header' => array( |
| 432 | 432 | 'id' => 'overdue_settings_header', |
| 433 | - 'name' => '<h3>' . __( 'Due Date Settings', 'invoicing' ) . '</h3>', |
|
| 433 | + 'name' => '<h3>' . __('Due Date Settings', 'invoicing') . '</h3>', |
|
| 434 | 434 | 'type' => 'header', |
| 435 | 435 | ), |
| 436 | 436 | 'overdue_active' => array( |
| 437 | 437 | 'id' => 'overdue_active', |
| 438 | - 'name' => __( 'Enable Due Date', 'invoicing' ), |
|
| 439 | - 'desc' => __( 'Check this to enable due date option for invoices.', 'invoicing' ), |
|
| 438 | + 'name' => __('Enable Due Date', 'invoicing'), |
|
| 439 | + 'desc' => __('Check this to enable due date option for invoices.', 'invoicing'), |
|
| 440 | 440 | 'type' => 'checkbox', |
| 441 | 441 | 'std' => false, |
| 442 | 442 | ), |
| 443 | 443 | 'email_template_header' => array( |
| 444 | 444 | 'id' => 'email_template_header', |
| 445 | - 'name' => '<h3>' . __( 'Email Template', 'invoicing' ) . '</h3>', |
|
| 445 | + 'name' => '<h3>' . __('Email Template', 'invoicing') . '</h3>', |
|
| 446 | 446 | 'type' => 'header', |
| 447 | 447 | ), |
| 448 | 448 | 'email_header_image' => array( |
| 449 | 449 | 'id' => 'email_header_image', |
| 450 | - 'name' => __( 'Header Image', 'invoicing' ), |
|
| 451 | - 'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing' ), |
|
| 450 | + 'name' => __('Header Image', 'invoicing'), |
|
| 451 | + 'desc' => __('URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing'), |
|
| 452 | 452 | 'std' => '', |
| 453 | 453 | 'type' => 'text', |
| 454 | 454 | ), |
| 455 | 455 | 'email_footer_text' => array( |
| 456 | 456 | 'id' => 'email_footer_text', |
| 457 | - 'name' => __( 'Footer Text', 'invoicing' ), |
|
| 458 | - 'desc' => __( 'The text to appear in the footer of all invoice emails.', 'invoicing' ), |
|
| 459 | - 'std' => get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GetPaid', 'invoicing' ), |
|
| 457 | + 'name' => __('Footer Text', 'invoicing'), |
|
| 458 | + 'desc' => __('The text to appear in the footer of all invoice emails.', 'invoicing'), |
|
| 459 | + 'std' => get_bloginfo('name', 'display') . ' - ' . __('Powered by GetPaid', 'invoicing'), |
|
| 460 | 460 | 'type' => 'textarea', |
| 461 | 461 | 'class' => 'regular-text', |
| 462 | 462 | 'rows' => 2, |
@@ -464,29 +464,29 @@ discard block |
||
| 464 | 464 | ), |
| 465 | 465 | 'email_base_color' => array( |
| 466 | 466 | 'id' => 'email_base_color', |
| 467 | - 'name' => __( 'Base Color', 'invoicing' ), |
|
| 468 | - 'desc' => __( 'The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing' ), |
|
| 467 | + 'name' => __('Base Color', 'invoicing'), |
|
| 468 | + 'desc' => __('The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing'), |
|
| 469 | 469 | 'std' => '#557da2', |
| 470 | 470 | 'type' => 'color', |
| 471 | 471 | ), |
| 472 | 472 | 'email_background_color' => array( |
| 473 | 473 | 'id' => 'email_background_color', |
| 474 | - 'name' => __( 'Background Color', 'invoicing' ), |
|
| 475 | - 'desc' => __( 'The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing' ), |
|
| 474 | + 'name' => __('Background Color', 'invoicing'), |
|
| 475 | + 'desc' => __('The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing'), |
|
| 476 | 476 | 'std' => '#f5f5f5', |
| 477 | 477 | 'type' => 'color', |
| 478 | 478 | ), |
| 479 | 479 | 'email_body_background_color' => array( |
| 480 | 480 | 'id' => 'email_body_background_color', |
| 481 | - 'name' => __( 'Body Background Color', 'invoicing' ), |
|
| 482 | - 'desc' => __( 'The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing' ), |
|
| 481 | + 'name' => __('Body Background Color', 'invoicing'), |
|
| 482 | + 'desc' => __('The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing'), |
|
| 483 | 483 | 'std' => '#fdfdfd', |
| 484 | 484 | 'type' => 'color', |
| 485 | 485 | ), |
| 486 | 486 | 'email_text_color' => array( |
| 487 | 487 | 'id' => 'email_text_color', |
| 488 | - 'name' => __( 'Body Text Color', 'invoicing' ), |
|
| 489 | - 'desc' => __( 'The main body text color. Default <code>#505050</code>.', 'invoicing' ), |
|
| 488 | + 'name' => __('Body Text Color', 'invoicing'), |
|
| 489 | + 'desc' => __('The main body text color. Default <code>#505050</code>.', 'invoicing'), |
|
| 490 | 490 | 'std' => '#505050', |
| 491 | 491 | 'type' => 'color', |
| 492 | 492 | ), |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | ), |
| 502 | 502 | |
| 503 | 503 | // Integrations. |
| 504 | - 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'settings', 'id' ), |
|
| 504 | + 'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'settings', 'id'), |
|
| 505 | 505 | |
| 506 | 506 | /** Privacy Settings */ |
| 507 | 507 | 'privacy' => apply_filters('wpinv_settings_privacy', |
@@ -509,17 +509,17 @@ discard block |
||
| 509 | 509 | 'main' => array( |
| 510 | 510 | 'invoicing_privacy_policy_settings' => array( |
| 511 | 511 | 'id' => 'invoicing_privacy_policy_settings', |
| 512 | - 'name' => '<h3>' . __( 'Privacy Policy', 'invoicing' ) . '</h3>', |
|
| 512 | + 'name' => '<h3>' . __('Privacy Policy', 'invoicing') . '</h3>', |
|
| 513 | 513 | 'type' => 'header', |
| 514 | 514 | ), |
| 515 | 515 | 'privacy_page' => array( |
| 516 | 516 | 'id' => 'privacy_page', |
| 517 | - 'name' => __( 'Privacy Page', 'invoicing' ), |
|
| 518 | - 'desc' => __( 'If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing' ), |
|
| 517 | + 'name' => __('Privacy Page', 'invoicing'), |
|
| 518 | + 'desc' => __('If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing'), |
|
| 519 | 519 | 'type' => 'select', |
| 520 | - 'options' => wpinv_get_pages( true, __( 'Select a page', 'invoicing' )), |
|
| 520 | + 'options' => wpinv_get_pages(true, __('Select a page', 'invoicing')), |
|
| 521 | 521 | 'class' => 'wpi_select2', |
| 522 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
| 522 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
| 523 | 523 | ), |
| 524 | 524 | ), |
| 525 | 525 | ) |
@@ -530,19 +530,19 @@ discard block |
||
| 530 | 530 | 'main' => array( |
| 531 | 531 | 'invoice_number_format_settings' => array( |
| 532 | 532 | 'id' => 'invoice_number_format_settings', |
| 533 | - 'name' => '<h3>' . __( 'Invoice Number', 'invoicing' ) . '</h3>', |
|
| 533 | + 'name' => '<h3>' . __('Invoice Number', 'invoicing') . '</h3>', |
|
| 534 | 534 | 'type' => 'header', |
| 535 | 535 | ), |
| 536 | 536 | 'sequential_invoice_number' => array( |
| 537 | 537 | 'id' => 'sequential_invoice_number', |
| 538 | - 'name' => __( 'Sequential Invoice Numbers', 'invoicing' ), |
|
| 539 | - 'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing' ) . $reset_number, |
|
| 538 | + 'name' => __('Sequential Invoice Numbers', 'invoicing'), |
|
| 539 | + 'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing') . $reset_number, |
|
| 540 | 540 | 'type' => 'checkbox', |
| 541 | 541 | ), |
| 542 | 542 | 'invoice_sequence_start' => array( |
| 543 | 543 | 'id' => 'invoice_sequence_start', |
| 544 | - 'name' => __( 'Sequential Starting Number', 'invoicing' ), |
|
| 545 | - 'desc' => __( 'The number at which the invoice number sequence should begin.', 'invoicing' ) . $last_number, |
|
| 544 | + 'name' => __('Sequential Starting Number', 'invoicing'), |
|
| 545 | + 'desc' => __('The number at which the invoice number sequence should begin.', 'invoicing') . $last_number, |
|
| 546 | 546 | 'type' => 'number', |
| 547 | 547 | 'size' => 'small', |
| 548 | 548 | 'std' => '1', |
@@ -550,8 +550,8 @@ discard block |
||
| 550 | 550 | ), |
| 551 | 551 | 'invoice_number_padd' => array( |
| 552 | 552 | 'id' => 'invoice_number_padd', |
| 553 | - 'name' => __( 'Minimum Digits', 'invoicing' ), |
|
| 554 | - 'desc' => __( 'If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing' ), |
|
| 553 | + 'name' => __('Minimum Digits', 'invoicing'), |
|
| 554 | + 'desc' => __('If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing'), |
|
| 555 | 555 | 'type' => 'select', |
| 556 | 556 | 'options' => $invoice_number_padd_options, |
| 557 | 557 | 'std' => 5, |
@@ -559,8 +559,8 @@ discard block |
||
| 559 | 559 | ), |
| 560 | 560 | 'invoice_number_prefix' => array( |
| 561 | 561 | 'id' => 'invoice_number_prefix', |
| 562 | - 'name' => __( 'Invoice Number Prefix', 'invoicing' ), |
|
| 563 | - 'desc' => __( 'Prefix for all invoice numbers. Ex: INV-', 'invoicing' ), |
|
| 562 | + 'name' => __('Invoice Number Prefix', 'invoicing'), |
|
| 563 | + 'desc' => __('Prefix for all invoice numbers. Ex: INV-', 'invoicing'), |
|
| 564 | 564 | 'type' => 'text', |
| 565 | 565 | 'size' => 'regular', |
| 566 | 566 | 'std' => 'INV-', |
@@ -568,41 +568,41 @@ discard block |
||
| 568 | 568 | ), |
| 569 | 569 | 'invoice_number_postfix' => array( |
| 570 | 570 | 'id' => 'invoice_number_postfix', |
| 571 | - 'name' => __( 'Invoice Number Postfix', 'invoicing' ), |
|
| 572 | - 'desc' => __( 'Postfix for all invoice numbers.', 'invoicing' ), |
|
| 571 | + 'name' => __('Invoice Number Postfix', 'invoicing'), |
|
| 572 | + 'desc' => __('Postfix for all invoice numbers.', 'invoicing'), |
|
| 573 | 573 | 'type' => 'text', |
| 574 | 574 | 'size' => 'regular', |
| 575 | 575 | 'std' => '' |
| 576 | 576 | ), |
| 577 | 577 | 'checkout_settings' => array( |
| 578 | 578 | 'id' => 'checkout_settings', |
| 579 | - 'name' => '<h3>' . __( 'Checkout Settings', 'invoicing' ) . '</h3>', |
|
| 579 | + 'name' => '<h3>' . __('Checkout Settings', 'invoicing') . '</h3>', |
|
| 580 | 580 | 'type' => 'header', |
| 581 | 581 | ), |
| 582 | 582 | 'login_to_checkout' => array( |
| 583 | 583 | 'id' => 'login_to_checkout', |
| 584 | - 'name' => __( 'Require Login To Checkout', 'invoicing' ), |
|
| 585 | - 'desc' => __( 'If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing' ), |
|
| 584 | + 'name' => __('Require Login To Checkout', 'invoicing'), |
|
| 585 | + 'desc' => __('If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing'), |
|
| 586 | 586 | 'type' => 'checkbox', |
| 587 | 587 | ), |
| 588 | 588 | |
| 589 | 589 | 'maxmind_license_key' => array( |
| 590 | 590 | 'id' => 'maxmind_license_key', |
| 591 | - 'name' => __( 'MaxMind License Key', 'invoicing' ), |
|
| 591 | + 'name' => __('MaxMind License Key', 'invoicing'), |
|
| 592 | 592 | 'type' => 'text', |
| 593 | 593 | 'size' => 'regular', |
| 594 | - 'desc' => __( "Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing' ) . ' <a href="https://support.maxmind.com/account-faq/license-keys/how-do-i-generate-a-license-key/">' . __( 'How to generate a free license key.', 'invoicing' ) . '</a>', |
|
| 594 | + 'desc' => __("Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing') . ' <a href="https://support.maxmind.com/account-faq/license-keys/how-do-i-generate-a-license-key/">' . __('How to generate a free license key.', 'invoicing') . '</a>', |
|
| 595 | 595 | ), |
| 596 | 596 | |
| 597 | 597 | 'uninstall_settings' => array( |
| 598 | 598 | 'id' => 'uninstall_settings', |
| 599 | - 'name' => '<h3>' . __( 'Uninstall Settings', 'invoicing' ) . '</h3>', |
|
| 599 | + 'name' => '<h3>' . __('Uninstall Settings', 'invoicing') . '</h3>', |
|
| 600 | 600 | 'type' => 'header', |
| 601 | 601 | ), |
| 602 | 602 | 'remove_data_on_unistall' => array( |
| 603 | 603 | 'id' => 'remove_data_on_unistall', |
| 604 | - 'name' => __( 'Remove Data on Uninstall?', 'invoicing' ), |
|
| 605 | - 'desc' => __( 'Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing' ), |
|
| 604 | + 'name' => __('Remove Data on Uninstall?', 'invoicing'), |
|
| 605 | + 'desc' => __('Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing'), |
|
| 606 | 606 | 'type' => 'checkbox', |
| 607 | 607 | 'std' => '' |
| 608 | 608 | ), |
@@ -611,13 +611,13 @@ discard block |
||
| 611 | 611 | 'custom-css' => array( |
| 612 | 612 | 'css_settings' => array( |
| 613 | 613 | 'id' => 'css_settings', |
| 614 | - 'name' => '<h3>' . __( 'Custom CSS', 'invoicing' ) . '</h3>', |
|
| 614 | + 'name' => '<h3>' . __('Custom CSS', 'invoicing') . '</h3>', |
|
| 615 | 615 | 'type' => 'header', |
| 616 | 616 | ), |
| 617 | 617 | 'template_custom_css' => array( |
| 618 | 618 | 'id' => 'template_custom_css', |
| 619 | - 'name' => __( 'Invoice Template CSS', 'invoicing' ), |
|
| 620 | - 'desc' => __( 'Add CSS to modify appearance of the print invoice page.', 'invoicing' ), |
|
| 619 | + 'name' => __('Invoice Template CSS', 'invoicing'), |
|
| 620 | + 'desc' => __('Add CSS to modify appearance of the print invoice page.', 'invoicing'), |
|
| 621 | 621 | 'type' => 'textarea', |
| 622 | 622 | 'class'=> 'regular-text', |
| 623 | 623 | 'rows' => 10, |
@@ -631,8 +631,8 @@ discard block |
||
| 631 | 631 | 'main' => array( |
| 632 | 632 | 'tool_settings' => array( |
| 633 | 633 | 'id' => 'tool_settings', |
| 634 | - 'name' => '<h3>' . __( 'Diagnostic Tools', 'invoicing' ) . '</h3>', |
|
| 635 | - 'desc' => __( 'Invoicing diagnostic tools', 'invoicing' ), |
|
| 634 | + 'name' => '<h3>' . __('Diagnostic Tools', 'invoicing') . '</h3>', |
|
| 635 | + 'desc' => __('Invoicing diagnostic tools', 'invoicing'), |
|
| 636 | 636 | 'type' => 'tools', |
| 637 | 637 | ), |
| 638 | 638 | ), |
@@ -7,24 +7,24 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$logo_width = wpinv_get_option( 'logo_width' ); |
|
| 13 | -$logo_height = wpinv_get_option( 'logo_height' ); |
|
| 12 | +$logo_width = wpinv_get_option('logo_width'); |
|
| 13 | +$logo_height = wpinv_get_option('logo_height'); |
|
| 14 | 14 | |
| 15 | 15 | ?> |
| 16 | -<a target="_blank" class="logo-link text-dark" href="<?php echo esc_url( wpinv_get_business_website() ); ?>"> |
|
| 16 | +<a target="_blank" class="logo-link text-dark" href="<?php echo esc_url(wpinv_get_business_website()); ?>"> |
|
| 17 | 17 | |
| 18 | - <?php if ( $logo = wpinv_get_business_logo() ) : ?> |
|
| 18 | + <?php if ($logo = wpinv_get_business_logo()) : ?> |
|
| 19 | 19 | |
| 20 | - <?php if ( ! empty( $logo_width ) && ! empty( $logo_height ) ) : ?> |
|
| 21 | - <img class="logo" style="max-width:100%; width:<?php echo absint( $logo_width ); ?>px; height:<?php echo absint( $logo_height ); ?>px;" src="<?php echo esc_url( $logo ); ?>"> |
|
| 20 | + <?php if (!empty($logo_width) && !empty($logo_height)) : ?> |
|
| 21 | + <img class="logo" style="max-width:100%; width:<?php echo absint($logo_width); ?>px; height:<?php echo absint($logo_height); ?>px;" src="<?php echo esc_url($logo); ?>"> |
|
| 22 | 22 | <?php else: ?> |
| 23 | - <img class="logo" style="max-width:100%;" src="<?php echo esc_url( $logo ); ?>"> |
|
| 23 | + <img class="logo" style="max-width:100%;" src="<?php echo esc_url($logo); ?>"> |
|
| 24 | 24 | <?php endif; ?> |
| 25 | 25 | |
| 26 | 26 | <?php else: ?> |
| 27 | - <h1 class="h3"><?php echo esc_html( wpinv_get_business_name() ); ?></h1> |
|
| 27 | + <h1 class="h3"><?php echo esc_html(wpinv_get_business_name()); ?></h1> |
|
| 28 | 28 | <?php endif; ?> |
| 29 | 29 | |
| 30 | 30 | </a> |
@@ -19,12 +19,18 @@ |
||
| 19 | 19 | |
| 20 | 20 | <?php if ( ! empty( $logo_width ) && ! empty( $logo_height ) ) : ?> |
| 21 | 21 | <img class="logo" style="max-width:100%; width:<?php echo absint( $logo_width ); ?>px; height:<?php echo absint( $logo_height ); ?>px;" src="<?php echo esc_url( $logo ); ?>"> |
| 22 | - <?php else: ?> |
|
| 23 | - <img class="logo" style="max-width:100%;" src="<?php echo esc_url( $logo ); ?>"> |
|
| 22 | + <?php else { |
|
| 23 | + : ?> |
|
| 24 | + <img class="logo" style="max-width:100%;" src="<?php echo esc_url( $logo ); |
|
| 25 | +} |
|
| 26 | +?>"> |
|
| 24 | 27 | <?php endif; ?> |
| 25 | 28 | |
| 26 | - <?php else: ?> |
|
| 27 | - <h1 class="h3"><?php echo esc_html( wpinv_get_business_name() ); ?></h1> |
|
| 29 | + <?php else { |
|
| 30 | + : ?> |
|
| 31 | + <h1 class="h3"><?php echo esc_html( wpinv_get_business_name() ); |
|
| 32 | +} |
|
| 33 | +?></h1> |
|
| 28 | 34 | <?php endif; ?> |
| 29 | 35 | |
| 30 | 36 | </a> |