@@ -37,7 +37,7 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | private function correctPluginName($vars) |
| 39 | 39 | { |
| 40 | - $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) { |
|
| 40 | + $camelCasedName = preg_replace_callback('/(-[a-z])/', function($matches) { |
|
| 41 | 41 | return strtoupper($matches[0][1]); |
| 42 | 42 | }, $vars['name']); |
| 43 | 43 | |
@@ -6,8 +6,8 @@ |
||
| 6 | 6 | } |
| 7 | 7 | } |
| 8 | 8 | if ((!$loader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__ . '/../../../autoload.php'))) { |
| 9 | - die('You must set up the project dependencies, run the following commands:'.PHP_EOL. |
|
| 10 | - 'curl -s http://getcomposer.org/installer | php'.PHP_EOL. |
|
| 11 | - 'php composer.phar install'.PHP_EOL); |
|
| 9 | + die('You must set up the project dependencies, run the following commands:' . PHP_EOL . |
|
| 10 | + 'curl -s http://getcomposer.org/installer | php' . PHP_EOL . |
|
| 11 | + 'php composer.phar install' . PHP_EOL); |
|
| 12 | 12 | } |
| 13 | 13 | return $loader; |
@@ -45,8 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | if($section_id=='recommended_plugins'){ |
| 47 | 47 | $section_data->products = self::get_recommend_wp_plugins_edd_formatted(); |
| 48 | - } |
|
| 49 | - elseif ( ! empty( $section ) ) { |
|
| 48 | + } elseif ( ! empty( $section ) ) { |
|
| 50 | 49 | if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing |
| 51 | 50 | //if ( 1==1) { |
| 52 | 51 | |
@@ -121,13 +120,13 @@ discard block |
||
| 121 | 120 | $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
| 122 | 121 | if(isset($status['status'])){$button_args['install_status'] = $status['status'];} |
| 123 | 122 | $button_args['update_url'] = "https://wpinvoicing.com"; |
| 124 | - }elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) { |
|
| 123 | + } elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) { |
|
| 125 | 124 | if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;} |
| 126 | 125 | $button_args['installed'] = self::is_theme_installed($addon); |
| 127 | 126 | if(!in_array($button_args['slug'],$wp_org_themes)){ |
| 128 | 127 | $button_args['update_url'] = "https://wpinvoicing.com"; |
| 129 | 128 | } |
| 130 | - }elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){ |
|
| 129 | + } elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){ |
|
| 131 | 130 | include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
| 132 | 131 | $status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>"")); |
| 133 | 132 | $button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install'; |
@@ -139,7 +138,7 @@ discard block |
||
| 139 | 138 | if(is_object($addon->pricing)){ |
| 140 | 139 | $prices = (Array)$addon->pricing; |
| 141 | 140 | $button_args['price'] = reset($prices); |
| 142 | - }elseif(isset($addon->pricing)){ |
|
| 141 | + } elseif(isset($addon->pricing)){ |
|
| 143 | 142 | $button_args['price'] = $addon->pricing; |
| 144 | 143 | } |
| 145 | 144 | } |
@@ -160,7 +159,7 @@ discard block |
||
| 160 | 159 | if($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')){ |
| 161 | 160 | if($button_args['type'] != 'themes'){ |
| 162 | 161 | $button_args['active'] = is_plugin_active($button_args['file']); |
| 163 | - }else{ |
|
| 162 | + } else{ |
|
| 164 | 163 | $button_args['active'] = self::is_theme_active($addon); |
| 165 | 164 | } |
| 166 | 165 | } |
@@ -169,27 +168,27 @@ discard block |
||
| 169 | 168 | if($button_args['active']){ |
| 170 | 169 | $button_args['button_text'] = __('Active','invoicing'); |
| 171 | 170 | $button_args['class'] = ' button-secondary disabled '; |
| 172 | - }elseif($button_args['installed']){ |
|
| 171 | + } elseif($button_args['installed']){ |
|
| 173 | 172 | $button_args['button_text'] = __('Activate','invoicing'); |
| 174 | 173 | |
| 175 | 174 | if($button_args['type'] != 'themes'){ |
| 176 | 175 | if ( current_user_can( 'manage_options' ) ) { |
| 177 | 176 | $button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$button_args['file']), 'activate-plugin_' . $button_args['file']); |
| 178 | - }else{ |
|
| 177 | + } else{ |
|
| 179 | 178 | $button_args['url'] = '#'; |
| 180 | 179 | } |
| 181 | - }else{ |
|
| 180 | + } else{ |
|
| 182 | 181 | if ( current_user_can( 'switch_themes' ) ) { |
| 183 | 182 | $button_args['url'] = self::get_theme_activation_url($addon); |
| 184 | - }else{ |
|
| 183 | + } else{ |
|
| 185 | 184 | $button_args['url'] = '#'; |
| 186 | 185 | } |
| 187 | 186 | } |
| 188 | 187 | |
| 189 | - }else{ |
|
| 188 | + } else{ |
|
| 190 | 189 | if($button_args['type'] == 'recommended_plugins'){ |
| 191 | 190 | $button_args['button_text'] = __('Install','invoicing'); |
| 192 | - }else{ |
|
| 191 | + } else{ |
|
| 193 | 192 | $button_args['button_text'] = __('Get it','invoicing'); |
| 194 | 193 | |
| 195 | 194 | /*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){ |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * |
| 7 | 7 | */ |
| 8 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | - exit; |
|
| 9 | + exit; |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | /** |
@@ -15,71 +15,71 @@ discard block |
||
| 15 | 15 | class WPInv_Admin_Addons extends Ayecode_Addons { |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Get the extensions page tabs. |
|
| 20 | - * |
|
| 21 | - * @return array of tabs. |
|
| 22 | - */ |
|
| 23 | - public function get_tabs(){ |
|
| 24 | - $tabs = array( |
|
| 25 | - 'addons' => __("Addons", "invoicing"), |
|
| 18 | + /** |
|
| 19 | + * Get the extensions page tabs. |
|
| 20 | + * |
|
| 21 | + * @return array of tabs. |
|
| 22 | + */ |
|
| 23 | + public function get_tabs(){ |
|
| 24 | + $tabs = array( |
|
| 25 | + 'addons' => __("Addons", "invoicing"), |
|
| 26 | 26 | 'gateways' => __("Payment Gateways", "invoicing"), |
| 27 | 27 | 'recommended_plugins' => __("Recommended plugins", "invoicing"), |
| 28 | 28 | 'membership' => __("Membership", "invoicing"), |
| 29 | - ); |
|
| 30 | - |
|
| 31 | - return $tabs; |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * Get section content for the addons screen. |
|
| 36 | - * |
|
| 37 | - * @param string $section_id |
|
| 38 | - * |
|
| 39 | - * @return array |
|
| 40 | - */ |
|
| 41 | - public function get_section_data( $section_id ) { |
|
| 42 | - $section = self::get_tab( $section_id ); |
|
| 43 | - $api_url = "https://wpinvoicing.com/edd-api/v2/products/"; |
|
| 44 | - $section_data = new stdClass(); |
|
| 45 | - |
|
| 46 | - if($section_id=='recommended_plugins'){ |
|
| 47 | - $section_data->products = self::get_recommend_wp_plugins_edd_formatted(); |
|
| 48 | - } |
|
| 49 | - elseif ( ! empty( $section ) ) { |
|
| 50 | - if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing |
|
| 51 | - //if ( 1==1) { |
|
| 52 | - |
|
| 53 | - $query_args = array( 'category' => $section_id, 'number' => 100); |
|
| 54 | - $query_args = apply_filters('wpeu_edd_api_query_args',$query_args,$api_url,$section_id); |
|
| 55 | - |
|
| 56 | - $raw_section = wp_safe_remote_get( esc_url_raw( add_query_arg($query_args ,$api_url) ), array( 'user-agent' => 'Invoicing Addons Page','timeout' => 15, ) ); |
|
| 57 | - |
|
| 58 | - if ( ! is_wp_error( $raw_section ) ) { |
|
| 59 | - $section_data = json_decode( wp_remote_retrieve_body( $raw_section ) ); |
|
| 60 | - |
|
| 61 | - if ( ! empty( $section_data->products ) ) { |
|
| 62 | - set_transient( 'wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS ); |
|
| 63 | - } |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - $products = isset($section_data->products) ? $section_data->products : ''; |
|
| 69 | - |
|
| 70 | - return apply_filters( 'wpi_addons_section_data', $products, $section_id ); |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * Outputs a button. |
|
| 75 | - *ccc |
|
| 76 | - * @param string $url |
|
| 77 | - * @param string $text |
|
| 78 | - * @param string $theme |
|
| 79 | - * @param string $plugin |
|
| 80 | - */ |
|
| 81 | - public function output_button( $addon ) { |
|
| 82 | - $current_tab = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] ); |
|
| 29 | + ); |
|
| 30 | + |
|
| 31 | + return $tabs; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * Get section content for the addons screen. |
|
| 36 | + * |
|
| 37 | + * @param string $section_id |
|
| 38 | + * |
|
| 39 | + * @return array |
|
| 40 | + */ |
|
| 41 | + public function get_section_data( $section_id ) { |
|
| 42 | + $section = self::get_tab( $section_id ); |
|
| 43 | + $api_url = "https://wpinvoicing.com/edd-api/v2/products/"; |
|
| 44 | + $section_data = new stdClass(); |
|
| 45 | + |
|
| 46 | + if($section_id=='recommended_plugins'){ |
|
| 47 | + $section_data->products = self::get_recommend_wp_plugins_edd_formatted(); |
|
| 48 | + } |
|
| 49 | + elseif ( ! empty( $section ) ) { |
|
| 50 | + if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing |
|
| 51 | + //if ( 1==1) { |
|
| 52 | + |
|
| 53 | + $query_args = array( 'category' => $section_id, 'number' => 100); |
|
| 54 | + $query_args = apply_filters('wpeu_edd_api_query_args',$query_args,$api_url,$section_id); |
|
| 55 | + |
|
| 56 | + $raw_section = wp_safe_remote_get( esc_url_raw( add_query_arg($query_args ,$api_url) ), array( 'user-agent' => 'Invoicing Addons Page','timeout' => 15, ) ); |
|
| 57 | + |
|
| 58 | + if ( ! is_wp_error( $raw_section ) ) { |
|
| 59 | + $section_data = json_decode( wp_remote_retrieve_body( $raw_section ) ); |
|
| 60 | + |
|
| 61 | + if ( ! empty( $section_data->products ) ) { |
|
| 62 | + set_transient( 'wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS ); |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + $products = isset($section_data->products) ? $section_data->products : ''; |
|
| 69 | + |
|
| 70 | + return apply_filters( 'wpi_addons_section_data', $products, $section_id ); |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * Outputs a button. |
|
| 75 | + *ccc |
|
| 76 | + * @param string $url |
|
| 77 | + * @param string $text |
|
| 78 | + * @param string $theme |
|
| 79 | + * @param string $plugin |
|
| 80 | + */ |
|
| 81 | + public function output_button( $addon ) { |
|
| 82 | + $current_tab = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] ); |
|
| 83 | 83 | // $button_text = __('Free','invoicing'); |
| 84 | 84 | // $licensing = false; |
| 85 | 85 | // $installed = false; |
@@ -91,123 +91,123 @@ discard block |
||
| 91 | 91 | // $install_status = 'get'; |
| 92 | 92 | // $onclick = ''; |
| 93 | 93 | |
| 94 | - $wp_org_themes = array('supreme-directory','directory-starter'); |
|
| 95 | - |
|
| 96 | - $button_args = array( |
|
| 97 | - 'type' => ($current_tab == 'addons' || $current_tab =='gateways') ? 'addons' : $current_tab, |
|
| 98 | - 'id' => isset($addon->info->id) ? absint($addon->info->id) : '', |
|
| 99 | - 'title' => isset($addon->info->title) ? $addon->info->title : '', |
|
| 100 | - 'button_text' => __('Free','invoicing'), |
|
| 101 | - 'price_text' => __('Free','invoicing'), |
|
| 102 | - 'link' => isset($addon->info->link) ? $addon->info->link : '', // link to product |
|
| 103 | - 'url' => isset($addon->info->link) ? $addon->info->link : '', // button url |
|
| 104 | - 'class' => 'button-primary', |
|
| 105 | - 'install_status' => 'get', |
|
| 106 | - 'installed' => false, |
|
| 107 | - 'price' => '', |
|
| 108 | - 'licensing' => isset($addon->licensing->enabled) && $addon->licensing->enabled ? true : false, |
|
| 109 | - 'license' => isset($addon->licensing->license) && $addon->licensing->license ? $addon->licensing->license : '', |
|
| 110 | - 'onclick' => '', |
|
| 111 | - 'slug' => isset($addon->info->slug) ? $addon->info->slug : '', |
|
| 112 | - 'active' => false, |
|
| 113 | - 'file' => '', |
|
| 114 | - 'update_url' => '', |
|
| 115 | - ); |
|
| 116 | - |
|
| 117 | - if( ($current_tab == 'addons' || $current_tab =='gateways') && isset($addon->info->id) && $addon->info->id){ |
|
| 118 | - include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
|
| 119 | - if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;} |
|
| 120 | - $status = self::install_plugin_install_status($addon); |
|
| 121 | - $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
|
| 122 | - if(isset($status['status'])){$button_args['install_status'] = $status['status'];} |
|
| 123 | - $button_args['update_url'] = "https://wpinvoicing.com"; |
|
| 124 | - }elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) { |
|
| 125 | - if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;} |
|
| 126 | - $button_args['installed'] = self::is_theme_installed($addon); |
|
| 127 | - if(!in_array($button_args['slug'],$wp_org_themes)){ |
|
| 128 | - $button_args['update_url'] = "https://wpinvoicing.com"; |
|
| 129 | - } |
|
| 130 | - }elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){ |
|
| 131 | - include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
|
| 132 | - $status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>"")); |
|
| 133 | - $button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install'; |
|
| 134 | - $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - // set price |
|
| 138 | - if(isset($addon->pricing) && !empty($addon->pricing)){ |
|
| 139 | - if(is_object($addon->pricing)){ |
|
| 140 | - $prices = (Array)$addon->pricing; |
|
| 141 | - $button_args['price'] = reset($prices); |
|
| 142 | - }elseif(isset($addon->pricing)){ |
|
| 143 | - $button_args['price'] = $addon->pricing; |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - // set price text |
|
| 148 | - if( $button_args['price'] && $button_args['price'] != '0.00' ){ |
|
| 149 | - $button_args['price_text'] = sprintf( __('From: $%d', 'invoicing'), $button_args['price']); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - // set if installed |
|
| 154 | - if(in_array($button_args['install_status'], array('installed','latest_installed','update_available','newer_installed'))){ |
|
| 155 | - $button_args['installed'] = true; |
|
| 156 | - } |
|
| 94 | + $wp_org_themes = array('supreme-directory','directory-starter'); |
|
| 95 | + |
|
| 96 | + $button_args = array( |
|
| 97 | + 'type' => ($current_tab == 'addons' || $current_tab =='gateways') ? 'addons' : $current_tab, |
|
| 98 | + 'id' => isset($addon->info->id) ? absint($addon->info->id) : '', |
|
| 99 | + 'title' => isset($addon->info->title) ? $addon->info->title : '', |
|
| 100 | + 'button_text' => __('Free','invoicing'), |
|
| 101 | + 'price_text' => __('Free','invoicing'), |
|
| 102 | + 'link' => isset($addon->info->link) ? $addon->info->link : '', // link to product |
|
| 103 | + 'url' => isset($addon->info->link) ? $addon->info->link : '', // button url |
|
| 104 | + 'class' => 'button-primary', |
|
| 105 | + 'install_status' => 'get', |
|
| 106 | + 'installed' => false, |
|
| 107 | + 'price' => '', |
|
| 108 | + 'licensing' => isset($addon->licensing->enabled) && $addon->licensing->enabled ? true : false, |
|
| 109 | + 'license' => isset($addon->licensing->license) && $addon->licensing->license ? $addon->licensing->license : '', |
|
| 110 | + 'onclick' => '', |
|
| 111 | + 'slug' => isset($addon->info->slug) ? $addon->info->slug : '', |
|
| 112 | + 'active' => false, |
|
| 113 | + 'file' => '', |
|
| 114 | + 'update_url' => '', |
|
| 115 | + ); |
|
| 116 | + |
|
| 117 | + if( ($current_tab == 'addons' || $current_tab =='gateways') && isset($addon->info->id) && $addon->info->id){ |
|
| 118 | + include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
|
| 119 | + if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;} |
|
| 120 | + $status = self::install_plugin_install_status($addon); |
|
| 121 | + $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
|
| 122 | + if(isset($status['status'])){$button_args['install_status'] = $status['status'];} |
|
| 123 | + $button_args['update_url'] = "https://wpinvoicing.com"; |
|
| 124 | + }elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) { |
|
| 125 | + if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;} |
|
| 126 | + $button_args['installed'] = self::is_theme_installed($addon); |
|
| 127 | + if(!in_array($button_args['slug'],$wp_org_themes)){ |
|
| 128 | + $button_args['update_url'] = "https://wpinvoicing.com"; |
|
| 129 | + } |
|
| 130 | + }elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){ |
|
| 131 | + include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
|
| 132 | + $status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>"")); |
|
| 133 | + $button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install'; |
|
| 134 | + $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + // set price |
|
| 138 | + if(isset($addon->pricing) && !empty($addon->pricing)){ |
|
| 139 | + if(is_object($addon->pricing)){ |
|
| 140 | + $prices = (Array)$addon->pricing; |
|
| 141 | + $button_args['price'] = reset($prices); |
|
| 142 | + }elseif(isset($addon->pricing)){ |
|
| 143 | + $button_args['price'] = $addon->pricing; |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + // set price text |
|
| 148 | + if( $button_args['price'] && $button_args['price'] != '0.00' ){ |
|
| 149 | + $button_args['price_text'] = sprintf( __('From: $%d', 'invoicing'), $button_args['price']); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + // set if installed |
|
| 154 | + if(in_array($button_args['install_status'], array('installed','latest_installed','update_available','newer_installed'))){ |
|
| 155 | + $button_args['installed'] = true; |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | 158 | // print_r($button_args); |
| 159 | - // set if active |
|
| 160 | - if($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')){ |
|
| 161 | - if($button_args['type'] != 'themes'){ |
|
| 162 | - $button_args['active'] = is_plugin_active($button_args['file']); |
|
| 163 | - }else{ |
|
| 164 | - $button_args['active'] = self::is_theme_active($addon); |
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - // set button text and class |
|
| 169 | - if($button_args['active']){ |
|
| 170 | - $button_args['button_text'] = __('Active','invoicing'); |
|
| 171 | - $button_args['class'] = ' button-secondary disabled '; |
|
| 172 | - }elseif($button_args['installed']){ |
|
| 173 | - $button_args['button_text'] = __('Activate','invoicing'); |
|
| 174 | - |
|
| 175 | - if($button_args['type'] != 'themes'){ |
|
| 176 | - if ( current_user_can( 'manage_options' ) ) { |
|
| 177 | - $button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$button_args['file']), 'activate-plugin_' . $button_args['file']); |
|
| 178 | - }else{ |
|
| 179 | - $button_args['url'] = '#'; |
|
| 180 | - } |
|
| 181 | - }else{ |
|
| 182 | - if ( current_user_can( 'switch_themes' ) ) { |
|
| 183 | - $button_args['url'] = self::get_theme_activation_url($addon); |
|
| 184 | - }else{ |
|
| 185 | - $button_args['url'] = '#'; |
|
| 186 | - } |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - }else{ |
|
| 190 | - if($button_args['type'] == 'recommended_plugins'){ |
|
| 191 | - $button_args['button_text'] = __('Install','invoicing'); |
|
| 192 | - }else{ |
|
| 193 | - $button_args['button_text'] = __('Get it','invoicing'); |
|
| 194 | - |
|
| 195 | - /*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){ |
|
| 159 | + // set if active |
|
| 160 | + if($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')){ |
|
| 161 | + if($button_args['type'] != 'themes'){ |
|
| 162 | + $button_args['active'] = is_plugin_active($button_args['file']); |
|
| 163 | + }else{ |
|
| 164 | + $button_args['active'] = self::is_theme_active($addon); |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + // set button text and class |
|
| 169 | + if($button_args['active']){ |
|
| 170 | + $button_args['button_text'] = __('Active','invoicing'); |
|
| 171 | + $button_args['class'] = ' button-secondary disabled '; |
|
| 172 | + }elseif($button_args['installed']){ |
|
| 173 | + $button_args['button_text'] = __('Activate','invoicing'); |
|
| 174 | + |
|
| 175 | + if($button_args['type'] != 'themes'){ |
|
| 176 | + if ( current_user_can( 'manage_options' ) ) { |
|
| 177 | + $button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$button_args['file']), 'activate-plugin_' . $button_args['file']); |
|
| 178 | + }else{ |
|
| 179 | + $button_args['url'] = '#'; |
|
| 180 | + } |
|
| 181 | + }else{ |
|
| 182 | + if ( current_user_can( 'switch_themes' ) ) { |
|
| 183 | + $button_args['url'] = self::get_theme_activation_url($addon); |
|
| 184 | + }else{ |
|
| 185 | + $button_args['url'] = '#'; |
|
| 186 | + } |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + }else{ |
|
| 190 | + if($button_args['type'] == 'recommended_plugins'){ |
|
| 191 | + $button_args['button_text'] = __('Install','invoicing'); |
|
| 192 | + }else{ |
|
| 193 | + $button_args['button_text'] = __('Get it','invoicing'); |
|
| 194 | + |
|
| 195 | + /*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){ |
|
| 196 | 196 | $button_args['button_text'] = __('Install','invoicing'); |
| 197 | 197 | $button_args['url'] = self::get_theme_install_url($button_args['slug']); |
| 198 | 198 | $button_args['onclick'] = 'gd_set_button_installing(this);'; |
| 199 | 199 | }*/ |
| 200 | 200 | |
| 201 | - } |
|
| 202 | - } |
|
| 201 | + } |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | 204 | |
| 205 | - // filter the button arguments |
|
| 206 | - $button_args = apply_filters('edd_api_button_args',$button_args); |
|
| 205 | + // filter the button arguments |
|
| 206 | + $button_args = apply_filters('edd_api_button_args',$button_args); |
|
| 207 | 207 | // print_r($button_args); |
| 208 | - // set price text |
|
| 209 | - if(isset($button_args['price_text'])){ |
|
| 210 | - ?> |
|
| 208 | + // set price text |
|
| 209 | + if(isset($button_args['price_text'])){ |
|
| 210 | + ?> |
|
| 211 | 211 | <a |
| 212 | 212 | target="_blank" |
| 213 | 213 | class="addons-price-text" |
@@ -215,15 +215,15 @@ discard block |
||
| 215 | 215 | <?php echo esc_html( $button_args['price_text'] ); ?> |
| 216 | 216 | </a> |
| 217 | 217 | <?php |
| 218 | - } |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | 220 | |
| 221 | - $target = ''; |
|
| 222 | - if ( ! empty( $button_args['url'] ) ) { |
|
| 223 | - $target = strpos($button_args['url'], get_site_url()) !== false ? '' : ' target="_blank" '; |
|
| 224 | - } |
|
| 221 | + $target = ''; |
|
| 222 | + if ( ! empty( $button_args['url'] ) ) { |
|
| 223 | + $target = strpos($button_args['url'], get_site_url()) !== false ? '' : ' target="_blank" '; |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | - ?> |
|
| 226 | + ?> |
|
| 227 | 227 | <a |
| 228 | 228 | data-licence="<?php echo esc_attr($button_args['license']);?>" |
| 229 | 229 | data-licensing="<?php echo $button_args['licensing'] ? 1 : 0;?>" |
@@ -246,33 +246,33 @@ discard block |
||
| 246 | 246 | <?php |
| 247 | 247 | |
| 248 | 248 | |
| 249 | - } |
|
| 250 | - |
|
| 251 | - |
|
| 252 | - /** |
|
| 253 | - * Handles output of the addons page in admin. |
|
| 254 | - */ |
|
| 255 | - public function output() { |
|
| 256 | - $tabs = self::get_tabs(); |
|
| 257 | - $sections = self::get_sections(); |
|
| 258 | - $theme = wp_get_theme(); |
|
| 259 | - $section_keys = array_keys( $sections ); |
|
| 260 | - $current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys ); |
|
| 261 | - $current_tab = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] ); |
|
| 262 | - include_once( WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php' ); |
|
| 263 | - } |
|
| 264 | - |
|
| 265 | - /** |
|
| 266 | - * A list of recommended wp.org plugins. |
|
| 267 | - * @return array |
|
| 268 | - */ |
|
| 269 | - public function get_recommend_wp_plugins(){ |
|
| 270 | - $plugins = array( |
|
| 249 | + } |
|
| 250 | + |
|
| 251 | + |
|
| 252 | + /** |
|
| 253 | + * Handles output of the addons page in admin. |
|
| 254 | + */ |
|
| 255 | + public function output() { |
|
| 256 | + $tabs = self::get_tabs(); |
|
| 257 | + $sections = self::get_sections(); |
|
| 258 | + $theme = wp_get_theme(); |
|
| 259 | + $section_keys = array_keys( $sections ); |
|
| 260 | + $current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys ); |
|
| 261 | + $current_tab = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] ); |
|
| 262 | + include_once( WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php' ); |
|
| 263 | + } |
|
| 264 | + |
|
| 265 | + /** |
|
| 266 | + * A list of recommended wp.org plugins. |
|
| 267 | + * @return array |
|
| 268 | + */ |
|
| 269 | + public function get_recommend_wp_plugins(){ |
|
| 270 | + $plugins = array( |
|
| 271 | 271 | 'invoicing-quotes' => array( |
| 272 | 272 | 'url' => 'https://wordpress.org/plugins/invoicing-quotes/', |
| 273 | 273 | 'slug' => 'invoicing-quotes', |
| 274 | - 'name' => 'Quotes', |
|
| 275 | - 'thumbnail' => 'https://ps.w.org/invoicing-quotes/assets/banner-772x250.jpg', |
|
| 274 | + 'name' => 'Quotes', |
|
| 275 | + 'thumbnail' => 'https://ps.w.org/invoicing-quotes/assets/banner-772x250.jpg', |
|
| 276 | 276 | 'desc' => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.','invoicing'), |
| 277 | 277 | ), |
| 278 | 278 | 'geodirectory' => array( |
@@ -287,8 +287,8 @@ discard block |
||
| 287 | 287 | 'name' => 'UsersWP', |
| 288 | 288 | 'desc' => __('Allow frontend user login and registration as well as have slick profile pages.','invoicing'), |
| 289 | 289 | ), |
| 290 | - ); |
|
| 290 | + ); |
|
| 291 | 291 | |
| 292 | - return $plugins; |
|
| 293 | - } |
|
| 292 | + return $plugins; |
|
| 293 | + } |
|
| 294 | 294 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * All Invoicing extensions screen related functions can be found here. |
| 6 | 6 | * |
| 7 | 7 | */ |
| 8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 8 | +if (!defined('ABSPATH')) { |
|
| 9 | 9 | exit; |
| 10 | 10 | } |
| 11 | 11 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @return array of tabs. |
| 22 | 22 | */ |
| 23 | - public function get_tabs(){ |
|
| 23 | + public function get_tabs() { |
|
| 24 | 24 | $tabs = array( |
| 25 | 25 | 'addons' => __("Addons", "invoicing"), |
| 26 | 26 | 'gateways' => __("Payment Gateways", "invoicing"), |
@@ -38,28 +38,28 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return array |
| 40 | 40 | */ |
| 41 | - public function get_section_data( $section_id ) { |
|
| 42 | - $section = self::get_tab( $section_id ); |
|
| 41 | + public function get_section_data($section_id) { |
|
| 42 | + $section = self::get_tab($section_id); |
|
| 43 | 43 | $api_url = "https://wpinvoicing.com/edd-api/v2/products/"; |
| 44 | 44 | $section_data = new stdClass(); |
| 45 | 45 | |
| 46 | - if($section_id=='recommended_plugins'){ |
|
| 46 | + if ($section_id == 'recommended_plugins') { |
|
| 47 | 47 | $section_data->products = self::get_recommend_wp_plugins_edd_formatted(); |
| 48 | 48 | } |
| 49 | - elseif ( ! empty( $section ) ) { |
|
| 50 | - if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing |
|
| 49 | + elseif (!empty($section)) { |
|
| 50 | + if (false === ($section_data = get_transient('wpi_addons_section_' . $section_id))) { //@todo restore after testing |
|
| 51 | 51 | //if ( 1==1) { |
| 52 | 52 | |
| 53 | - $query_args = array( 'category' => $section_id, 'number' => 100); |
|
| 54 | - $query_args = apply_filters('wpeu_edd_api_query_args',$query_args,$api_url,$section_id); |
|
| 53 | + $query_args = array('category' => $section_id, 'number' => 100); |
|
| 54 | + $query_args = apply_filters('wpeu_edd_api_query_args', $query_args, $api_url, $section_id); |
|
| 55 | 55 | |
| 56 | - $raw_section = wp_safe_remote_get( esc_url_raw( add_query_arg($query_args ,$api_url) ), array( 'user-agent' => 'Invoicing Addons Page','timeout' => 15, ) ); |
|
| 56 | + $raw_section = wp_safe_remote_get(esc_url_raw(add_query_arg($query_args, $api_url)), array('user-agent' => 'Invoicing Addons Page', 'timeout' => 15,)); |
|
| 57 | 57 | |
| 58 | - if ( ! is_wp_error( $raw_section ) ) { |
|
| 59 | - $section_data = json_decode( wp_remote_retrieve_body( $raw_section ) ); |
|
| 58 | + if (!is_wp_error($raw_section)) { |
|
| 59 | + $section_data = json_decode(wp_remote_retrieve_body($raw_section)); |
|
| 60 | 60 | |
| 61 | - if ( ! empty( $section_data->products ) ) { |
|
| 62 | - set_transient( 'wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS ); |
|
| 61 | + if (!empty($section_data->products)) { |
|
| 62 | + set_transient('wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | $products = isset($section_data->products) ? $section_data->products : ''; |
| 69 | 69 | |
| 70 | - return apply_filters( 'wpi_addons_section_data', $products, $section_id ); |
|
| 70 | + return apply_filters('wpi_addons_section_data', $products, $section_id); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | * @param string $theme |
| 79 | 79 | * @param string $plugin |
| 80 | 80 | */ |
| 81 | - public function output_button( $addon ) { |
|
| 82 | - $current_tab = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] ); |
|
| 81 | + public function output_button($addon) { |
|
| 82 | + $current_tab = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']); |
|
| 83 | 83 | // $button_text = __('Free','invoicing'); |
| 84 | 84 | // $licensing = false; |
| 85 | 85 | // $installed = false; |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | // $install_status = 'get'; |
| 92 | 92 | // $onclick = ''; |
| 93 | 93 | |
| 94 | - $wp_org_themes = array('supreme-directory','directory-starter'); |
|
| 94 | + $wp_org_themes = array('supreme-directory', 'directory-starter'); |
|
| 95 | 95 | |
| 96 | 96 | $button_args = array( |
| 97 | - 'type' => ($current_tab == 'addons' || $current_tab =='gateways') ? 'addons' : $current_tab, |
|
| 97 | + 'type' => ($current_tab == 'addons' || $current_tab == 'gateways') ? 'addons' : $current_tab, |
|
| 98 | 98 | 'id' => isset($addon->info->id) ? absint($addon->info->id) : '', |
| 99 | 99 | 'title' => isset($addon->info->title) ? $addon->info->title : '', |
| 100 | - 'button_text' => __('Free','invoicing'), |
|
| 101 | - 'price_text' => __('Free','invoicing'), |
|
| 100 | + 'button_text' => __('Free', 'invoicing'), |
|
| 101 | + 'price_text' => __('Free', 'invoicing'), |
|
| 102 | 102 | 'link' => isset($addon->info->link) ? $addon->info->link : '', // link to product |
| 103 | 103 | 'url' => isset($addon->info->link) ? $addon->info->link : '', // button url |
| 104 | 104 | 'class' => 'button-primary', |
@@ -114,83 +114,83 @@ discard block |
||
| 114 | 114 | 'update_url' => '', |
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | - if( ($current_tab == 'addons' || $current_tab =='gateways') && isset($addon->info->id) && $addon->info->id){ |
|
| 118 | - include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
|
| 119 | - if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;} |
|
| 117 | + if (($current_tab == 'addons' || $current_tab == 'gateways') && isset($addon->info->id) && $addon->info->id) { |
|
| 118 | + include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); //for plugins_api.. |
|
| 119 | + if (!empty($addon->licensing->edd_slug)) {$button_args['slug'] = $addon->licensing->edd_slug; } |
|
| 120 | 120 | $status = self::install_plugin_install_status($addon); |
| 121 | 121 | $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
| 122 | - if(isset($status['status'])){$button_args['install_status'] = $status['status'];} |
|
| 122 | + if (isset($status['status'])) {$button_args['install_status'] = $status['status']; } |
|
| 123 | 123 | $button_args['update_url'] = "https://wpinvoicing.com"; |
| 124 | - }elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) { |
|
| 125 | - if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;} |
|
| 124 | + }elseif ($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) { |
|
| 125 | + if (!empty($addon->licensing->edd_slug)) {$button_args['slug'] = $addon->licensing->edd_slug; } |
|
| 126 | 126 | $button_args['installed'] = self::is_theme_installed($addon); |
| 127 | - if(!in_array($button_args['slug'],$wp_org_themes)){ |
|
| 127 | + if (!in_array($button_args['slug'], $wp_org_themes)) { |
|
| 128 | 128 | $button_args['update_url'] = "https://wpinvoicing.com"; |
| 129 | 129 | } |
| 130 | - }elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){ |
|
| 131 | - include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
|
| 132 | - $status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>"")); |
|
| 130 | + }elseif ($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug) { |
|
| 131 | + include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); //for plugins_api.. |
|
| 132 | + $status = install_plugin_install_status(array("slug"=>$button_args['slug'], "version"=>"")); |
|
| 133 | 133 | $button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install'; |
| 134 | 134 | $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // set price |
| 138 | - if(isset($addon->pricing) && !empty($addon->pricing)){ |
|
| 139 | - if(is_object($addon->pricing)){ |
|
| 140 | - $prices = (Array)$addon->pricing; |
|
| 138 | + if (isset($addon->pricing) && !empty($addon->pricing)) { |
|
| 139 | + if (is_object($addon->pricing)) { |
|
| 140 | + $prices = (Array) $addon->pricing; |
|
| 141 | 141 | $button_args['price'] = reset($prices); |
| 142 | - }elseif(isset($addon->pricing)){ |
|
| 142 | + }elseif (isset($addon->pricing)) { |
|
| 143 | 143 | $button_args['price'] = $addon->pricing; |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // set price text |
| 148 | - if( $button_args['price'] && $button_args['price'] != '0.00' ){ |
|
| 149 | - $button_args['price_text'] = sprintf( __('From: $%d', 'invoicing'), $button_args['price']); |
|
| 148 | + if ($button_args['price'] && $button_args['price'] != '0.00') { |
|
| 149 | + $button_args['price_text'] = sprintf(__('From: $%d', 'invoicing'), $button_args['price']); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
| 153 | 153 | // set if installed |
| 154 | - if(in_array($button_args['install_status'], array('installed','latest_installed','update_available','newer_installed'))){ |
|
| 154 | + if (in_array($button_args['install_status'], array('installed', 'latest_installed', 'update_available', 'newer_installed'))) { |
|
| 155 | 155 | $button_args['installed'] = true; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // print_r($button_args); |
| 159 | 159 | // set if active |
| 160 | - if($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')){ |
|
| 161 | - if($button_args['type'] != 'themes'){ |
|
| 160 | + if ($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')) { |
|
| 161 | + if ($button_args['type'] != 'themes') { |
|
| 162 | 162 | $button_args['active'] = is_plugin_active($button_args['file']); |
| 163 | - }else{ |
|
| 163 | + } else { |
|
| 164 | 164 | $button_args['active'] = self::is_theme_active($addon); |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // set button text and class |
| 169 | - if($button_args['active']){ |
|
| 170 | - $button_args['button_text'] = __('Active','invoicing'); |
|
| 169 | + if ($button_args['active']) { |
|
| 170 | + $button_args['button_text'] = __('Active', 'invoicing'); |
|
| 171 | 171 | $button_args['class'] = ' button-secondary disabled '; |
| 172 | - }elseif($button_args['installed']){ |
|
| 173 | - $button_args['button_text'] = __('Activate','invoicing'); |
|
| 172 | + }elseif ($button_args['installed']) { |
|
| 173 | + $button_args['button_text'] = __('Activate', 'invoicing'); |
|
| 174 | 174 | |
| 175 | - if($button_args['type'] != 'themes'){ |
|
| 176 | - if ( current_user_can( 'manage_options' ) ) { |
|
| 177 | - $button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$button_args['file']), 'activate-plugin_' . $button_args['file']); |
|
| 178 | - }else{ |
|
| 175 | + if ($button_args['type'] != 'themes') { |
|
| 176 | + if (current_user_can('manage_options')) { |
|
| 177 | + $button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $button_args['file']), 'activate-plugin_' . $button_args['file']); |
|
| 178 | + } else { |
|
| 179 | 179 | $button_args['url'] = '#'; |
| 180 | 180 | } |
| 181 | - }else{ |
|
| 182 | - if ( current_user_can( 'switch_themes' ) ) { |
|
| 181 | + } else { |
|
| 182 | + if (current_user_can('switch_themes')) { |
|
| 183 | 183 | $button_args['url'] = self::get_theme_activation_url($addon); |
| 184 | - }else{ |
|
| 184 | + } else { |
|
| 185 | 185 | $button_args['url'] = '#'; |
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - }else{ |
|
| 190 | - if($button_args['type'] == 'recommended_plugins'){ |
|
| 191 | - $button_args['button_text'] = __('Install','invoicing'); |
|
| 192 | - }else{ |
|
| 193 | - $button_args['button_text'] = __('Get it','invoicing'); |
|
| 189 | + } else { |
|
| 190 | + if ($button_args['type'] == 'recommended_plugins') { |
|
| 191 | + $button_args['button_text'] = __('Install', 'invoicing'); |
|
| 192 | + } else { |
|
| 193 | + $button_args['button_text'] = __('Get it', 'invoicing'); |
|
| 194 | 194 | |
| 195 | 195 | /*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){ |
| 196 | 196 | $button_args['button_text'] = __('Install','invoicing'); |
@@ -203,45 +203,45 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | |
| 205 | 205 | // filter the button arguments |
| 206 | - $button_args = apply_filters('edd_api_button_args',$button_args); |
|
| 206 | + $button_args = apply_filters('edd_api_button_args', $button_args); |
|
| 207 | 207 | // print_r($button_args); |
| 208 | 208 | // set price text |
| 209 | - if(isset($button_args['price_text'])){ |
|
| 209 | + if (isset($button_args['price_text'])) { |
|
| 210 | 210 | ?> |
| 211 | 211 | <a |
| 212 | 212 | target="_blank" |
| 213 | 213 | class="addons-price-text" |
| 214 | - href="<?php echo esc_url( $button_args['link'] ); ?>"> |
|
| 215 | - <?php echo esc_html( $button_args['price_text'] ); ?> |
|
| 214 | + href="<?php echo esc_url($button_args['link']); ?>"> |
|
| 215 | + <?php echo esc_html($button_args['price_text']); ?> |
|
| 216 | 216 | </a> |
| 217 | 217 | <?php |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | |
| 221 | 221 | $target = ''; |
| 222 | - if ( ! empty( $button_args['url'] ) ) { |
|
| 222 | + if (!empty($button_args['url'])) { |
|
| 223 | 223 | $target = strpos($button_args['url'], get_site_url()) !== false ? '' : ' target="_blank" '; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | ?> |
| 227 | 227 | <a |
| 228 | - data-licence="<?php echo esc_attr($button_args['license']);?>" |
|
| 229 | - data-licensing="<?php echo $button_args['licensing'] ? 1 : 0;?>" |
|
| 230 | - data-title="<?php echo esc_attr($button_args['title']);?>" |
|
| 231 | - data-type="<?php echo esc_attr($button_args['type']);?>" |
|
| 232 | - data-text-error-message="<?php _e('Something went wrong!','invoicing');?>" |
|
| 233 | - data-text-activate="<?php _e('Activate','invoicing');?>" |
|
| 234 | - data-text-activating="<?php _e('Activating','invoicing');?>" |
|
| 235 | - data-text-deactivate="<?php _e('Deactivate','invoicing');?>" |
|
| 236 | - data-text-installed="<?php _e('Installed','invoicing');?>" |
|
| 237 | - data-text-install="<?php _e('Install','invoicing');?>" |
|
| 238 | - data-text-installing="<?php _e('Installing','invoicing');?>" |
|
| 239 | - data-text-error="<?php _e('Error','invoicing');?>" |
|
| 240 | - <?php if(!empty($button_args['onclick'])){echo " onclick='".$button_args['onclick']."' ";}?> |
|
| 241 | - <?php echo $target;?> |
|
| 242 | - class="addons-button <?php echo esc_attr( $button_args['class'] ); ?>" |
|
| 243 | - href="<?php echo esc_url( $button_args['url'] ); ?>"> |
|
| 244 | - <?php echo esc_html( $button_args['button_text'] ); ?> |
|
| 228 | + data-licence="<?php echo esc_attr($button_args['license']); ?>" |
|
| 229 | + data-licensing="<?php echo $button_args['licensing'] ? 1 : 0; ?>" |
|
| 230 | + data-title="<?php echo esc_attr($button_args['title']); ?>" |
|
| 231 | + data-type="<?php echo esc_attr($button_args['type']); ?>" |
|
| 232 | + data-text-error-message="<?php _e('Something went wrong!', 'invoicing'); ?>" |
|
| 233 | + data-text-activate="<?php _e('Activate', 'invoicing'); ?>" |
|
| 234 | + data-text-activating="<?php _e('Activating', 'invoicing'); ?>" |
|
| 235 | + data-text-deactivate="<?php _e('Deactivate', 'invoicing'); ?>" |
|
| 236 | + data-text-installed="<?php _e('Installed', 'invoicing'); ?>" |
|
| 237 | + data-text-install="<?php _e('Install', 'invoicing'); ?>" |
|
| 238 | + data-text-installing="<?php _e('Installing', 'invoicing'); ?>" |
|
| 239 | + data-text-error="<?php _e('Error', 'invoicing'); ?>" |
|
| 240 | + <?php if (!empty($button_args['onclick'])) {echo " onclick='" . $button_args['onclick'] . "' "; }?> |
|
| 241 | + <?php echo $target; ?> |
|
| 242 | + class="addons-button <?php echo esc_attr($button_args['class']); ?>" |
|
| 243 | + href="<?php echo esc_url($button_args['url']); ?>"> |
|
| 244 | + <?php echo esc_html($button_args['button_text']); ?> |
|
| 245 | 245 | </a> |
| 246 | 246 | <?php |
| 247 | 247 | |
@@ -256,36 +256,36 @@ discard block |
||
| 256 | 256 | $tabs = self::get_tabs(); |
| 257 | 257 | $sections = self::get_sections(); |
| 258 | 258 | $theme = wp_get_theme(); |
| 259 | - $section_keys = array_keys( $sections ); |
|
| 260 | - $current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys ); |
|
| 261 | - $current_tab = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] ); |
|
| 262 | - include_once( WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php' ); |
|
| 259 | + $section_keys = array_keys($sections); |
|
| 260 | + $current_section = isset($_GET['section']) ? sanitize_text_field($_GET['section']) : current($section_keys); |
|
| 261 | + $current_tab = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']); |
|
| 262 | + include_once(WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php'); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | 266 | * A list of recommended wp.org plugins. |
| 267 | 267 | * @return array |
| 268 | 268 | */ |
| 269 | - public function get_recommend_wp_plugins(){ |
|
| 269 | + public function get_recommend_wp_plugins() { |
|
| 270 | 270 | $plugins = array( |
| 271 | 271 | 'invoicing-quotes' => array( |
| 272 | 272 | 'url' => 'https://wordpress.org/plugins/invoicing-quotes/', |
| 273 | 273 | 'slug' => 'invoicing-quotes', |
| 274 | 274 | 'name' => 'Quotes', |
| 275 | 275 | 'thumbnail' => 'https://ps.w.org/invoicing-quotes/assets/banner-772x250.jpg', |
| 276 | - 'desc' => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.','invoicing'), |
|
| 276 | + 'desc' => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.', 'invoicing'), |
|
| 277 | 277 | ), |
| 278 | 278 | 'geodirectory' => array( |
| 279 | 279 | 'url' => 'https://wordpress.org/plugins/geodirectory/', |
| 280 | 280 | 'slug' => 'geodirectory', |
| 281 | 281 | 'name' => 'GeoDirectory', |
| 282 | - 'desc' => __('Turn any WordPress theme into a global business directory portal.','invoicing'), |
|
| 282 | + 'desc' => __('Turn any WordPress theme into a global business directory portal.', 'invoicing'), |
|
| 283 | 283 | ), |
| 284 | 284 | 'userswp' => array( |
| 285 | 285 | 'url' => 'https://wordpress.org/plugins/userswp/', |
| 286 | 286 | 'slug' => 'userswp', |
| 287 | 287 | 'name' => 'UsersWP', |
| 288 | - 'desc' => __('Allow frontend user login and registration as well as have slick profile pages.','invoicing'), |
|
| 288 | + 'desc' => __('Allow frontend user login and registration as well as have slick profile pages.', 'invoicing'), |
|
| 289 | 289 | ), |
| 290 | 290 | ); |
| 291 | 291 | |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // Exit if accessed directly |
| 3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 4 | -if(!class_exists('Ayecode_Addons')) { |
|
| 3 | +if (!defined('ABSPATH')) exit; |
|
| 4 | +if (!class_exists('Ayecode_Addons')) { |
|
| 5 | 5 | |
| 6 | 6 | abstract class Ayecode_Addons |
| 7 | 7 | { |
@@ -1,6 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // Exit if accessed directly |
| 3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | + exit; |
|
| 5 | +} |
|
| 4 | 6 | if(!class_exists('Ayecode_Addons')) { |
| 5 | 7 | |
| 6 | 8 | abstract class Ayecode_Addons |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * Abstract privacy class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -defined( 'ABSPATH' ) || exit; |
|
| 6 | +defined('ABSPATH') || exit; |
|
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * Abstract class that is intended to be extended by |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @param string $name Plugin identifier. |
| 40 | 40 | */ |
| 41 | - public function __construct( $name = '' ) { |
|
| 41 | + public function __construct($name = '') { |
|
| 42 | 42 | $this->name = $name; |
| 43 | 43 | $this->init(); |
| 44 | 44 | } |
@@ -47,22 +47,22 @@ discard block |
||
| 47 | 47 | * Hook in events. |
| 48 | 48 | */ |
| 49 | 49 | protected function init() { |
| 50 | - add_action( 'admin_init', array( $this, 'add_privacy_message' ) ); |
|
| 50 | + add_action('admin_init', array($this, 'add_privacy_message')); |
|
| 51 | 51 | // Register data exporters |
| 52 | - add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_exporters' ), 10 ); |
|
| 52 | + add_filter('wp_privacy_personal_data_exporters', array($this, 'register_exporters'), 10); |
|
| 53 | 53 | // Register data erasers |
| 54 | - add_filter( 'wp_privacy_personal_data_erasers', array( $this, 'register_erasers' ) ); |
|
| 54 | + add_filter('wp_privacy_personal_data_erasers', array($this, 'register_erasers')); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * Adds the privacy message on invoicing privacy page. |
| 59 | 59 | */ |
| 60 | 60 | public function add_privacy_message() { |
| 61 | - if ( function_exists( 'wp_add_privacy_policy_content' ) ) { |
|
| 61 | + if (function_exists('wp_add_privacy_policy_content')) { |
|
| 62 | 62 | $content = $this->get_privacy_message(); |
| 63 | 63 | |
| 64 | - if ( $content ) { |
|
| 65 | - wp_add_privacy_policy_content( $this->name, $this->get_privacy_message() ); |
|
| 64 | + if ($content) { |
|
| 65 | + wp_add_privacy_policy_content($this->name, $this->get_privacy_message()); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -83,9 +83,9 @@ discard block |
||
| 83 | 83 | * @param array $exporters List of exporter callbacks. |
| 84 | 84 | * @return array |
| 85 | 85 | */ |
| 86 | - public function register_exporters( $exporters = array() ) { |
|
| 87 | - foreach ( $this->exporters as $id => $exporter ) { |
|
| 88 | - $exporters[ $id ] = $exporter; |
|
| 86 | + public function register_exporters($exporters = array()) { |
|
| 87 | + foreach ($this->exporters as $id => $exporter) { |
|
| 88 | + $exporters[$id] = $exporter; |
|
| 89 | 89 | } |
| 90 | 90 | return $exporters; |
| 91 | 91 | } |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | * @param array $erasers List of eraser callbacks. |
| 97 | 97 | * @return array |
| 98 | 98 | */ |
| 99 | - public function register_erasers( $erasers = array() ) { |
|
| 100 | - foreach ( $this->erasers as $id => $eraser ) { |
|
| 101 | - $erasers[ $id ] = $eraser; |
|
| 99 | + public function register_erasers($erasers = array()) { |
|
| 100 | + foreach ($this->erasers as $id => $eraser) { |
|
| 101 | + $erasers[$id] = $eraser; |
|
| 102 | 102 | } |
| 103 | 103 | return $erasers; |
| 104 | 104 | } |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @return array |
| 114 | 114 | */ |
| 115 | - public function add_exporter( $id, $name, $callback ) { |
|
| 116 | - $this->exporters[ $id ] = array( |
|
| 115 | + public function add_exporter($id, $name, $callback) { |
|
| 116 | + $this->exporters[$id] = array( |
|
| 117 | 117 | 'exporter_friendly_name' => $name, |
| 118 | 118 | 'callback' => $callback, |
| 119 | 119 | ); |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @return array |
| 131 | 131 | */ |
| 132 | - public function add_eraser( $id, $name, $callback ) { |
|
| 133 | - $this->erasers[ $id ] = array( |
|
| 132 | + public function add_eraser($id, $name, $callback) { |
|
| 133 | + $this->erasers[$id] = array( |
|
| 134 | 134 | 'eraser_friendly_name' => $name, |
| 135 | 135 | 'callback' => $callback, |
| 136 | 136 | ); |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | - exit; |
|
| 7 | + exit; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | /** |
@@ -12,112 +12,112 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | abstract class WPInv_Session { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Customer ID. |
|
| 17 | - * |
|
| 18 | - * @var int $_customer_id Customer ID. |
|
| 19 | - */ |
|
| 20 | - protected $_customer_id; |
|
| 15 | + /** |
|
| 16 | + * Customer ID. |
|
| 17 | + * |
|
| 18 | + * @var int $_customer_id Customer ID. |
|
| 19 | + */ |
|
| 20 | + protected $_customer_id; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Session Data. |
|
| 24 | - * |
|
| 25 | - * @var array $_data Data array. |
|
| 26 | - */ |
|
| 27 | - protected $_data = array(); |
|
| 22 | + /** |
|
| 23 | + * Session Data. |
|
| 24 | + * |
|
| 25 | + * @var array $_data Data array. |
|
| 26 | + */ |
|
| 27 | + protected $_data = array(); |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Dirty when the session needs saving. |
|
| 31 | - * |
|
| 32 | - * @var bool $_dirty When something changes |
|
| 33 | - */ |
|
| 34 | - protected $_dirty = false; |
|
| 29 | + /** |
|
| 30 | + * Dirty when the session needs saving. |
|
| 31 | + * |
|
| 32 | + * @var bool $_dirty When something changes |
|
| 33 | + */ |
|
| 34 | + protected $_dirty = false; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Init hooks and session data. Extended by child classes. |
|
| 38 | - * |
|
| 39 | - * @since 3.3.0 |
|
| 40 | - */ |
|
| 41 | - public function init() {} |
|
| 36 | + /** |
|
| 37 | + * Init hooks and session data. Extended by child classes. |
|
| 38 | + * |
|
| 39 | + * @since 3.3.0 |
|
| 40 | + */ |
|
| 41 | + public function init() {} |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Cleanup session data. Extended by child classes. |
|
| 45 | - */ |
|
| 46 | - public function cleanup_sessions() {} |
|
| 43 | + /** |
|
| 44 | + * Cleanup session data. Extended by child classes. |
|
| 45 | + */ |
|
| 46 | + public function cleanup_sessions() {} |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Magic get method. |
|
| 50 | - * |
|
| 51 | - * @param mixed $key Key to get. |
|
| 52 | - * @return mixed |
|
| 53 | - */ |
|
| 54 | - public function __get( $key ) { |
|
| 55 | - return $this->get( $key ); |
|
| 56 | - } |
|
| 48 | + /** |
|
| 49 | + * Magic get method. |
|
| 50 | + * |
|
| 51 | + * @param mixed $key Key to get. |
|
| 52 | + * @return mixed |
|
| 53 | + */ |
|
| 54 | + public function __get( $key ) { |
|
| 55 | + return $this->get( $key ); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * Magic set method. |
|
| 60 | - * |
|
| 61 | - * @param mixed $key Key to set. |
|
| 62 | - * @param mixed $value Value to set. |
|
| 63 | - */ |
|
| 64 | - public function __set( $key, $value ) { |
|
| 65 | - $this->set( $key, $value ); |
|
| 66 | - } |
|
| 58 | + /** |
|
| 59 | + * Magic set method. |
|
| 60 | + * |
|
| 61 | + * @param mixed $key Key to set. |
|
| 62 | + * @param mixed $value Value to set. |
|
| 63 | + */ |
|
| 64 | + public function __set( $key, $value ) { |
|
| 65 | + $this->set( $key, $value ); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Magic isset method. |
|
| 70 | - * |
|
| 71 | - * @param mixed $key Key to check. |
|
| 72 | - * @return bool |
|
| 73 | - */ |
|
| 74 | - public function __isset( $key ) { |
|
| 75 | - return isset( $this->_data[ sanitize_title( $key ) ] ); |
|
| 76 | - } |
|
| 68 | + /** |
|
| 69 | + * Magic isset method. |
|
| 70 | + * |
|
| 71 | + * @param mixed $key Key to check. |
|
| 72 | + * @return bool |
|
| 73 | + */ |
|
| 74 | + public function __isset( $key ) { |
|
| 75 | + return isset( $this->_data[ sanitize_title( $key ) ] ); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Magic unset method. |
|
| 80 | - * |
|
| 81 | - * @param mixed $key Key to unset. |
|
| 82 | - */ |
|
| 83 | - public function __unset( $key ) { |
|
| 84 | - if ( isset( $this->_data[ $key ] ) ) { |
|
| 85 | - unset( $this->_data[ $key ] ); |
|
| 86 | - $this->_dirty = true; |
|
| 87 | - } |
|
| 88 | - } |
|
| 78 | + /** |
|
| 79 | + * Magic unset method. |
|
| 80 | + * |
|
| 81 | + * @param mixed $key Key to unset. |
|
| 82 | + */ |
|
| 83 | + public function __unset( $key ) { |
|
| 84 | + if ( isset( $this->_data[ $key ] ) ) { |
|
| 85 | + unset( $this->_data[ $key ] ); |
|
| 86 | + $this->_dirty = true; |
|
| 87 | + } |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Get a session variable. |
|
| 92 | - * |
|
| 93 | - * @param string $key Key to get. |
|
| 94 | - * @param mixed $default used if the session variable isn't set. |
|
| 95 | - * @return array|string value of session variable |
|
| 96 | - */ |
|
| 97 | - public function get( $key, $default = null ) { |
|
| 98 | - $key = sanitize_key( $key ); |
|
| 99 | - return isset( $this->_data[ $key ] ) ? maybe_unserialize( $this->_data[ $key ] ) : $default; |
|
| 100 | - } |
|
| 90 | + /** |
|
| 91 | + * Get a session variable. |
|
| 92 | + * |
|
| 93 | + * @param string $key Key to get. |
|
| 94 | + * @param mixed $default used if the session variable isn't set. |
|
| 95 | + * @return array|string value of session variable |
|
| 96 | + */ |
|
| 97 | + public function get( $key, $default = null ) { |
|
| 98 | + $key = sanitize_key( $key ); |
|
| 99 | + return isset( $this->_data[ $key ] ) ? maybe_unserialize( $this->_data[ $key ] ) : $default; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * Set a session variable. |
|
| 104 | - * |
|
| 105 | - * @param string $key Key to set. |
|
| 106 | - * @param mixed $value Value to set. |
|
| 107 | - */ |
|
| 108 | - public function set( $key, $value ) { |
|
| 109 | - if ( $value !== $this->get( $key ) ) { |
|
| 110 | - $this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value ); |
|
| 111 | - $this->_dirty = true; |
|
| 112 | - } |
|
| 113 | - } |
|
| 102 | + /** |
|
| 103 | + * Set a session variable. |
|
| 104 | + * |
|
| 105 | + * @param string $key Key to set. |
|
| 106 | + * @param mixed $value Value to set. |
|
| 107 | + */ |
|
| 108 | + public function set( $key, $value ) { |
|
| 109 | + if ( $value !== $this->get( $key ) ) { |
|
| 110 | + $this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value ); |
|
| 111 | + $this->_dirty = true; |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * Get customer ID. |
|
| 117 | - * |
|
| 118 | - * @return int |
|
| 119 | - */ |
|
| 120 | - public function get_customer_id() { |
|
| 121 | - return $this->_customer_id; |
|
| 122 | - } |
|
| 115 | + /** |
|
| 116 | + * Get customer ID. |
|
| 117 | + * |
|
| 118 | + * @return int |
|
| 119 | + */ |
|
| 120 | + public function get_customer_id() { |
|
| 121 | + return $this->_customer_id; |
|
| 122 | + } |
|
| 123 | 123 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * Handle data for the current customer session |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 6 | +if (!defined('ABSPATH')) { |
|
| 7 | 7 | exit; |
| 8 | 8 | } |
| 9 | 9 | |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | * @param mixed $key Key to get. |
| 52 | 52 | * @return mixed |
| 53 | 53 | */ |
| 54 | - public function __get( $key ) { |
|
| 55 | - return $this->get( $key ); |
|
| 54 | + public function __get($key) { |
|
| 55 | + return $this->get($key); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | * @param mixed $key Key to set. |
| 62 | 62 | * @param mixed $value Value to set. |
| 63 | 63 | */ |
| 64 | - public function __set( $key, $value ) { |
|
| 65 | - $this->set( $key, $value ); |
|
| 64 | + public function __set($key, $value) { |
|
| 65 | + $this->set($key, $value); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | * @param mixed $key Key to check. |
| 72 | 72 | * @return bool |
| 73 | 73 | */ |
| 74 | - public function __isset( $key ) { |
|
| 75 | - return isset( $this->_data[ sanitize_title( $key ) ] ); |
|
| 74 | + public function __isset($key) { |
|
| 75 | + return isset($this->_data[sanitize_title($key)]); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @param mixed $key Key to unset. |
| 82 | 82 | */ |
| 83 | - public function __unset( $key ) { |
|
| 84 | - if ( isset( $this->_data[ $key ] ) ) { |
|
| 85 | - unset( $this->_data[ $key ] ); |
|
| 83 | + public function __unset($key) { |
|
| 84 | + if (isset($this->_data[$key])) { |
|
| 85 | + unset($this->_data[$key]); |
|
| 86 | 86 | $this->_dirty = true; |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | * @param mixed $default used if the session variable isn't set. |
| 95 | 95 | * @return array|string value of session variable |
| 96 | 96 | */ |
| 97 | - public function get( $key, $default = null ) { |
|
| 98 | - $key = sanitize_key( $key ); |
|
| 99 | - return isset( $this->_data[ $key ] ) ? maybe_unserialize( $this->_data[ $key ] ) : $default; |
|
| 97 | + public function get($key, $default = null) { |
|
| 98 | + $key = sanitize_key($key); |
|
| 99 | + return isset($this->_data[$key]) ? maybe_unserialize($this->_data[$key]) : $default; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | * @param string $key Key to set. |
| 106 | 106 | * @param mixed $value Value to set. |
| 107 | 107 | */ |
| 108 | - public function set( $key, $value ) { |
|
| 109 | - if ( $value !== $this->get( $key ) ) { |
|
| 110 | - $this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value ); |
|
| 108 | + public function set($key, $value) { |
|
| 109 | + if ($value !== $this->get($key)) { |
|
| 110 | + $this->_data[sanitize_key($key)] = maybe_serialize($value); |
|
| 111 | 111 | $this->_dirty = true; |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | </div> |
| 127 | 127 | </div> |
| 128 | 128 | <?php |
| 129 | - }else{ |
|
| 129 | + } else{ |
|
| 130 | 130 | $installed_plugins = get_plugins(); |
| 131 | 131 | $addon_obj = new WPInv_Admin_Addons(); |
| 132 | 132 | if ($addons = $addon_obj->get_section_data( $current_tab ) ) : |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
| 152 | 152 | echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
| 153 | 153 | echo '</a>'; |
| 154 | - }elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
| 154 | + } elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
| 155 | 155 | if(defined('WP_EASY_UPDATES_ACTIVE')){ |
| 156 | 156 | $url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com&TB_iframe=true'); |
| 157 | - }else{ |
|
| 157 | + } else{ |
|
| 158 | 158 | // if installed show activation link |
| 159 | 159 | if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){ |
| 160 | 160 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation'; |
| 161 | - }else{ |
|
| 161 | + } else{ |
|
| 162 | 162 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external'; |
| 163 | 163 | } |
| 164 | 164 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | - exit; |
|
| 7 | + exit; |
|
| 8 | 8 | } |
| 9 | 9 | add_ThickBox(); |
| 10 | 10 | ?> |
@@ -14,18 +14,18 @@ discard block |
||
| 14 | 14 | <?php if ( $tabs ){ ?> |
| 15 | 15 | <nav class="nav-tab-wrapper wpi-nav-tab-wrapper"> |
| 16 | 16 | <?php |
| 17 | - foreach ( $tabs as $name => $label ) { |
|
| 18 | - echo '<a href="' . admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>'; |
|
| 19 | - } |
|
| 20 | - do_action( 'wpi_addons_tabs' ); |
|
| 21 | - ?> |
|
| 17 | + foreach ( $tabs as $name => $label ) { |
|
| 18 | + echo '<a href="' . admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>'; |
|
| 19 | + } |
|
| 20 | + do_action( 'wpi_addons_tabs' ); |
|
| 21 | + ?> |
|
| 22 | 22 | </nav> |
| 23 | 23 | |
| 24 | 24 | <?php |
| 25 | 25 | |
| 26 | - if($current_tab == 'membership'){ |
|
| 26 | + if($current_tab == 'membership'){ |
|
| 27 | 27 | |
| 28 | - ?> |
|
| 28 | + ?> |
|
| 29 | 29 | |
| 30 | 30 | <div class="wpi-membership-tab-conatiner"> |
| 31 | 31 | <div class="membership-content"> |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | <h2><?php _e("Have a membership key?","invoicing");?></h2> |
| 37 | 37 | <p> |
| 38 | 38 | <?php |
| 39 | - $wpeu_admin = new External_Updates_Admin('wpinvoicing.com','1'); |
|
| 40 | - echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership',array(95, 106, 108,12351)); |
|
| 41 | - ?> |
|
| 39 | + $wpeu_admin = new External_Updates_Admin('wpinvoicing.com','1'); |
|
| 40 | + echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership',array(95, 106, 108,12351)); |
|
| 41 | + ?> |
|
| 42 | 42 | </p> |
| 43 | 43 | <?php }?> |
| 44 | 44 | |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | <div class="feature-list"> |
| 49 | 49 | <ul> |
| 50 | 50 | <?php |
| 51 | - $addon_obj = new WPInv_Admin_Addons(); |
|
| 52 | - if ($addons = $addon_obj->get_section_data( 'addons' ) ) { |
|
| 53 | - foreach ( $addons as $addon ) { |
|
| 54 | - echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>'; |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | - ?> |
|
| 51 | + $addon_obj = new WPInv_Admin_Addons(); |
|
| 52 | + if ($addons = $addon_obj->get_section_data( 'addons' ) ) { |
|
| 53 | + foreach ( $addons as $addon ) { |
|
| 54 | + echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>'; |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | + ?> |
|
| 58 | 58 | </ul> |
| 59 | 59 | |
| 60 | 60 | <div class="feature-cta"> |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | <h3><?php _e("Included Gateways:","invoicing");?></h3> |
| 66 | 66 | <ul> |
| 67 | 67 | <?php |
| 68 | - if ($addons = $addon_obj->get_section_data( 'gateways' ) ) { |
|
| 69 | - foreach ( $addons as $addon ) { |
|
| 70 | - echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>'; |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - ?> |
|
| 68 | + if ($addons = $addon_obj->get_section_data( 'gateways' ) ) { |
|
| 69 | + foreach ( $addons as $addon ) { |
|
| 70 | + echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>'; |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + ?> |
|
| 74 | 74 | </ul> |
| 75 | 75 | </div> |
| 76 | 76 | |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | <div class="testimonial-content"> |
| 82 | 82 | <div class="t-image"> |
| 83 | 83 | <?php |
| 84 | - echo '<img src="' . plugins_url( 'images/t-image2.png', dirname(__FILE__) ) . '" > '; |
|
| 85 | - ?> |
|
| 84 | + echo '<img src="' . plugins_url( 'images/t-image2.png', dirname(__FILE__) ) . '" > '; |
|
| 85 | + ?> |
|
| 86 | 86 | </div> |
| 87 | 87 | <div class="t-content"> |
| 88 | 88 | <p> |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | <div class="testimonial-content"> |
| 102 | 102 | <div class="t-image"> |
| 103 | 103 | <?php |
| 104 | - echo '<img src="' . plugins_url( 'images/t-image1.png', dirname(__FILE__) ) . '" > '; |
|
| 105 | - ?> |
|
| 104 | + echo '<img src="' . plugins_url( 'images/t-image1.png', dirname(__FILE__) ) . '" > '; |
|
| 105 | + ?> |
|
| 106 | 106 | </div> |
| 107 | 107 | <div class="t-content"> |
| 108 | 108 | <p> |
@@ -126,20 +126,20 @@ discard block |
||
| 126 | 126 | </div> |
| 127 | 127 | </div> |
| 128 | 128 | <?php |
| 129 | - }else{ |
|
| 130 | - $installed_plugins = get_plugins(); |
|
| 129 | + }else{ |
|
| 130 | + $installed_plugins = get_plugins(); |
|
| 131 | 131 | $addon_obj = new WPInv_Admin_Addons(); |
| 132 | - if ($addons = $addon_obj->get_section_data( $current_tab ) ) : |
|
| 133 | - ?> |
|
| 132 | + if ($addons = $addon_obj->get_section_data( $current_tab ) ) : |
|
| 133 | + ?> |
|
| 134 | 134 | <ul class="wpi-products"><?php foreach ( $addons as $addon ) : |
| 135 | 135 | if(965==$addon->info->id){continue;}// don't show quote add on |
| 136 | - ?><li class="wpi-product"> |
|
| 136 | + ?><li class="wpi-product"> |
|
| 137 | 137 | <div class="wpi-product-title"> |
| 138 | 138 | <h3><?php |
| 139 | - if ( ! empty( $addon->info->excerpt) ){ |
|
| 140 | - echo wpi_help_tip( $addon->info->excerpt ); |
|
| 141 | - } |
|
| 142 | - echo esc_html( $addon->info->title ); ?></h3> |
|
| 139 | + if ( ! empty( $addon->info->excerpt) ){ |
|
| 140 | + echo wpi_help_tip( $addon->info->excerpt ); |
|
| 141 | + } |
|
| 142 | + echo esc_html( $addon->info->title ); ?></h3> |
|
| 143 | 143 | </div> |
| 144 | 144 | |
| 145 | 145 | <span class="wpi-product-image"> |
@@ -147,27 +147,27 @@ discard block |
||
| 147 | 147 | <img src="<?php echo esc_attr( $addon->info->thumbnail ); ?>"/> |
| 148 | 148 | <?php endif; |
| 149 | 149 | |
| 150 | - if(isset($addon->info->link) && substr( $addon->info->link, 0, 21 ) === "https://wordpress.org"){ |
|
| 151 | - echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
|
| 152 | - echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
|
| 153 | - echo '</a>'; |
|
| 154 | - }elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
| 155 | - if(defined('WP_EASY_UPDATES_ACTIVE')){ |
|
| 156 | - $url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com&TB_iframe=true'); |
|
| 157 | - }else{ |
|
| 158 | - // if installed show activation link |
|
| 159 | - if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){ |
|
| 160 | - $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation'; |
|
| 161 | - }else{ |
|
| 162 | - $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external'; |
|
| 163 | - } |
|
| 164 | - } |
|
| 165 | - echo '<a href="'.$url.'" class="thickbox">'; |
|
| 166 | - echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
|
| 167 | - echo '</a>'; |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - ?> |
|
| 150 | + if(isset($addon->info->link) && substr( $addon->info->link, 0, 21 ) === "https://wordpress.org"){ |
|
| 151 | + echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
|
| 152 | + echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
|
| 153 | + echo '</a>'; |
|
| 154 | + }elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
| 155 | + if(defined('WP_EASY_UPDATES_ACTIVE')){ |
|
| 156 | + $url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com&TB_iframe=true'); |
|
| 157 | + }else{ |
|
| 158 | + // if installed show activation link |
|
| 159 | + if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){ |
|
| 160 | + $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation'; |
|
| 161 | + }else{ |
|
| 162 | + $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external'; |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | + echo '<a href="'.$url.'" class="thickbox">'; |
|
| 166 | + echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
|
| 167 | + echo '</a>'; |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + ?> |
|
| 171 | 171 | |
| 172 | 172 | </span> |
| 173 | 173 | |
@@ -175,15 +175,15 @@ discard block |
||
| 175 | 175 | <span class="wpi-product-button"> |
| 176 | 176 | <?php |
| 177 | 177 | $addon_obj->output_button( $addon ); |
| 178 | - ?> |
|
| 178 | + ?> |
|
| 179 | 179 | </span> |
| 180 | 180 | |
| 181 | 181 | <span class="wpi-price"><?php //print_r($addon); //echo wp_kses_post( $addon->price ); ?></span></li><?php endforeach; ?></ul> |
| 182 | 182 | <?php endif; |
| 183 | - } |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - } |
|
| 186 | - ?> |
|
| 185 | + } |
|
| 186 | + ?> |
|
| 187 | 187 | |
| 188 | 188 | |
| 189 | 189 | <div class="clearfix" ></div> |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | <input class="wpeu-licence-key" type="text" placeholder="<?php _e("Enter your licence key",'invoicing');?>"> <button class="button-primary wpeu-licence-popup-button" ><?php _e("Install",'invoicing');?></button> |
| 203 | 203 | <br> |
| 204 | 204 | <?php |
| 205 | - echo sprintf( __('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">','</a>','<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">','</a>' ); |
|
| 206 | - ?> |
|
| 205 | + echo sprintf( __('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">','</a>','<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">','</a>' ); |
|
| 206 | + ?> |
|
| 207 | 207 | </span> |
| 208 | 208 | </div> |
| 209 | 209 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * Admin View: Page - Addons |
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 6 | +if (!defined('ABSPATH')) { |
|
| 7 | 7 | exit; |
| 8 | 8 | } |
| 9 | 9 | add_ThickBox(); |
@@ -11,19 +11,19 @@ discard block |
||
| 11 | 11 | <div class="wrap wpi_addons_wrap"> |
| 12 | 12 | <h1><?php echo get_admin_page_title(); ?></h1> |
| 13 | 13 | |
| 14 | - <?php if ( $tabs ){ ?> |
|
| 14 | + <?php if ($tabs) { ?> |
|
| 15 | 15 | <nav class="nav-tab-wrapper wpi-nav-tab-wrapper"> |
| 16 | 16 | <?php |
| 17 | - foreach ( $tabs as $name => $label ) { |
|
| 18 | - echo '<a href="' . admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>'; |
|
| 17 | + foreach ($tabs as $name => $label) { |
|
| 18 | + echo '<a href="' . admin_url('admin.php?page=wpi-addons&tab=' . $name) . '" class="nav-tab ' . ($current_tab == $name ? 'nav-tab-active' : '') . '">' . $label . '</a>'; |
|
| 19 | 19 | } |
| 20 | - do_action( 'wpi_addons_tabs' ); |
|
| 20 | + do_action('wpi_addons_tabs'); |
|
| 21 | 21 | ?> |
| 22 | 22 | </nav> |
| 23 | 23 | |
| 24 | 24 | <?php |
| 25 | 25 | |
| 26 | - if($current_tab == 'membership'){ |
|
| 26 | + if ($current_tab == 'membership') { |
|
| 27 | 27 | |
| 28 | 28 | ?> |
| 29 | 29 | |
@@ -32,42 +32,42 @@ discard block |
||
| 32 | 32 | <!-- |
| 33 | 33 | <h2>With our WPInvoicing Membership you get access to all our products!</h2> |
| 34 | 34 | <p><a class="button button-primary" href="https://wpinvoicing.com/downloads/membership/">View Memberships</a></p>--> |
| 35 | - <?php if(defined('WP_EASY_UPDATES_ACTIVE')){?> |
|
| 36 | - <h2><?php _e("Have a membership key?","invoicing");?></h2> |
|
| 35 | + <?php if (defined('WP_EASY_UPDATES_ACTIVE')) {?> |
|
| 36 | + <h2><?php _e("Have a membership key?", "invoicing"); ?></h2> |
|
| 37 | 37 | <p> |
| 38 | 38 | <?php |
| 39 | - $wpeu_admin = new External_Updates_Admin('wpinvoicing.com','1'); |
|
| 40 | - echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership',array(95, 106, 108,12351)); |
|
| 39 | + $wpeu_admin = new External_Updates_Admin('wpinvoicing.com', '1'); |
|
| 40 | + echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership', array(95, 106, 108, 12351)); |
|
| 41 | 41 | ?> |
| 42 | 42 | </p> |
| 43 | 43 | <?php }?> |
| 44 | 44 | |
| 45 | 45 | <div class="membership-cta-contet"> |
| 46 | 46 | <div class="main-cta"> |
| 47 | - <h2><?php _e("Membership benefits Include:","invoicing");?></h2> |
|
| 47 | + <h2><?php _e("Membership benefits Include:", "invoicing"); ?></h2> |
|
| 48 | 48 | <div class="feature-list"> |
| 49 | 49 | <ul> |
| 50 | 50 | <?php |
| 51 | 51 | $addon_obj = new WPInv_Admin_Addons(); |
| 52 | - if ($addons = $addon_obj->get_section_data( 'addons' ) ) { |
|
| 53 | - foreach ( $addons as $addon ) { |
|
| 54 | - echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>'; |
|
| 52 | + if ($addons = $addon_obj->get_section_data('addons')) { |
|
| 53 | + foreach ($addons as $addon) { |
|
| 54 | + echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html($addon->info->title) . '</li>'; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | ?> |
| 58 | 58 | </ul> |
| 59 | 59 | |
| 60 | 60 | <div class="feature-cta"> |
| 61 | - <h3><?php _e("Membership Starts from","invoicing");?></h3> |
|
| 61 | + <h3><?php _e("Membership Starts from", "invoicing"); ?></h3> |
|
| 62 | 62 | <h4>$99</h4> |
| 63 | - <a href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership","invoicing");?></a> |
|
| 63 | + <a href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership", "invoicing"); ?></a> |
|
| 64 | 64 | </div> |
| 65 | - <h3><?php _e("Included Gateways:","invoicing");?></h3> |
|
| 65 | + <h3><?php _e("Included Gateways:", "invoicing"); ?></h3> |
|
| 66 | 66 | <ul> |
| 67 | 67 | <?php |
| 68 | - if ($addons = $addon_obj->get_section_data( 'gateways' ) ) { |
|
| 69 | - foreach ( $addons as $addon ) { |
|
| 70 | - echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>'; |
|
| 68 | + if ($addons = $addon_obj->get_section_data('gateways')) { |
|
| 69 | + foreach ($addons as $addon) { |
|
| 70 | + echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html($addon->info->title) . '</li>'; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | ?> |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | <div class="testimonial-content"> |
| 82 | 82 | <div class="t-image"> |
| 83 | 83 | <?php |
| 84 | - echo '<img src="' . plugins_url( 'images/t-image2.png', dirname(__FILE__) ) . '" > '; |
|
| 84 | + echo '<img src="' . plugins_url('images/t-image2.png', dirname(__FILE__)) . '" > '; |
|
| 85 | 85 | ?> |
| 86 | 86 | </div> |
| 87 | 87 | <div class="t-content"> |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | <div class="testimonial-content"> |
| 102 | 102 | <div class="t-image"> |
| 103 | 103 | <?php |
| 104 | - echo '<img src="' . plugins_url( 'images/t-image1.png', dirname(__FILE__) ) . '" > '; |
|
| 104 | + echo '<img src="' . plugins_url('images/t-image1.png', dirname(__FILE__)) . '" > '; |
|
| 105 | 105 | ?> |
| 106 | 106 | </div> |
| 107 | 107 | <div class="t-content"> |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | </div> |
| 118 | 118 | </div> |
| 119 | 119 | <div class="member-footer"> |
| 120 | - <a class="footer-btn" href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership","invoicing");?></a> |
|
| 121 | - <a class="footer-link" href="post-new.php?post_type=wpi_invoice"><?php _e("Create Invoice","invoicing");?></a> |
|
| 120 | + <a class="footer-btn" href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership", "invoicing"); ?></a> |
|
| 121 | + <a class="footer-link" href="post-new.php?post_type=wpi_invoice"><?php _e("Create Invoice", "invoicing"); ?></a> |
|
| 122 | 122 | </div> |
| 123 | 123 | </div> |
| 124 | 124 | |
@@ -126,44 +126,44 @@ discard block |
||
| 126 | 126 | </div> |
| 127 | 127 | </div> |
| 128 | 128 | <?php |
| 129 | - }else{ |
|
| 129 | + } else { |
|
| 130 | 130 | $installed_plugins = get_plugins(); |
| 131 | 131 | $addon_obj = new WPInv_Admin_Addons(); |
| 132 | - if ($addons = $addon_obj->get_section_data( $current_tab ) ) : |
|
| 132 | + if ($addons = $addon_obj->get_section_data($current_tab)) : |
|
| 133 | 133 | ?> |
| 134 | - <ul class="wpi-products"><?php foreach ( $addons as $addon ) : |
|
| 135 | - if(965==$addon->info->id){continue;}// don't show quote add on |
|
| 134 | + <ul class="wpi-products"><?php foreach ($addons as $addon) : |
|
| 135 | + if (965 == $addon->info->id) {continue; }// don't show quote add on |
|
| 136 | 136 | ?><li class="wpi-product"> |
| 137 | 137 | <div class="wpi-product-title"> |
| 138 | 138 | <h3><?php |
| 139 | - if ( ! empty( $addon->info->excerpt) ){ |
|
| 140 | - echo wpi_help_tip( $addon->info->excerpt ); |
|
| 139 | + if (!empty($addon->info->excerpt)) { |
|
| 140 | + echo wpi_help_tip($addon->info->excerpt); |
|
| 141 | 141 | } |
| 142 | - echo esc_html( $addon->info->title ); ?></h3> |
|
| 142 | + echo esc_html($addon->info->title); ?></h3> |
|
| 143 | 143 | </div> |
| 144 | 144 | |
| 145 | 145 | <span class="wpi-product-image"> |
| 146 | - <?php if ( ! empty( $addon->info->thumbnail) ) : ?> |
|
| 147 | - <img src="<?php echo esc_attr( $addon->info->thumbnail ); ?>"/> |
|
| 146 | + <?php if (!empty($addon->info->thumbnail)) : ?> |
|
| 147 | + <img src="<?php echo esc_attr($addon->info->thumbnail); ?>"/> |
|
| 148 | 148 | <?php endif; |
| 149 | 149 | |
| 150 | - if(isset($addon->info->link) && substr( $addon->info->link, 0, 21 ) === "https://wordpress.org"){ |
|
| 151 | - echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
|
| 152 | - echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
|
| 150 | + if (isset($addon->info->link) && substr($addon->info->link, 0, 21) === "https://wordpress.org") { |
|
| 151 | + echo '<a href="' . admin_url('/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug) . '&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
|
| 152 | + echo '<span class="wpi-product-info">' . __('More info', 'invoicing') . '</span>'; |
|
| 153 | 153 | echo '</a>'; |
| 154 | - }elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
| 155 | - if(defined('WP_EASY_UPDATES_ACTIVE')){ |
|
| 156 | - $url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com&TB_iframe=true'); |
|
| 157 | - }else{ |
|
| 154 | + }elseif (isset($addon->info->link) && substr($addon->info->link, 0, 23) === "https://wpinvoicing.com") { |
|
| 155 | + if (defined('WP_EASY_UPDATES_ACTIVE')) { |
|
| 156 | + $url = admin_url('/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug . '&width=770&height=660&item_id=' . $addon->info->id . '&update_url=https://wpinvoicing.com&TB_iframe=true'); |
|
| 157 | + } else { |
|
| 158 | 158 | // if installed show activation link |
| 159 | - if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){ |
|
| 159 | + if (isset($installed_plugins['wp-easy-updates/external-updates.php'])) { |
|
| 160 | 160 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation'; |
| 161 | - }else{ |
|
| 161 | + } else { |
|
| 162 | 162 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external'; |
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | - echo '<a href="'.$url.'" class="thickbox">'; |
|
| 166 | - echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
|
| 165 | + echo '<a href="' . $url . '" class="thickbox">'; |
|
| 166 | + echo '<span class="wpi-product-info">' . __('More info', 'invoicing') . '</span>'; |
|
| 167 | 167 | echo '</a>'; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | <span class="wpi-product-button"> |
| 176 | 176 | <?php |
| 177 | - $addon_obj->output_button( $addon ); |
|
| 177 | + $addon_obj->output_button($addon); |
|
| 178 | 178 | ?> |
| 179 | 179 | </span> |
| 180 | 180 | |
@@ -188,21 +188,21 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | <div class="clearfix" ></div> |
| 190 | 190 | |
| 191 | - <?php if($current_tab =='addons'){ ?> |
|
| 192 | - <p><?php printf( __( 'All of our Invoicing Addons can be found on WPInvoicing.com here: <a href="%s">Invoicing Addons</a>', 'invoicing' ), 'https://wpinvoicing.com/downloads/category/addons/' ); ?></p> |
|
| 193 | - <?php } if($current_tab =='gateways'){ ?> |
|
| 194 | - <p><?php printf( __( 'All of our Invoicing Payment Gateways can be found on WPInvoicing.com here: <a href="%s">Invoicing Payment Gateways</a>', 'invoicing' ), 'https://wpinvoicing.com/downloads/category/gateways/' ); ?></p> |
|
| 191 | + <?php if ($current_tab == 'addons') { ?> |
|
| 192 | + <p><?php printf(__('All of our Invoicing Addons can be found on WPInvoicing.com here: <a href="%s">Invoicing Addons</a>', 'invoicing'), 'https://wpinvoicing.com/downloads/category/addons/'); ?></p> |
|
| 193 | + <?php } if ($current_tab == 'gateways') { ?> |
|
| 194 | + <p><?php printf(__('All of our Invoicing Payment Gateways can be found on WPInvoicing.com here: <a href="%s">Invoicing Payment Gateways</a>', 'invoicing'), 'https://wpinvoicing.com/downloads/category/gateways/'); ?></p> |
|
| 195 | 195 | <?php } ?> |
| 196 | 196 | |
| 197 | - <div id="wpi-wpeu-required-activation" style="display:none;"><span class="wpi-notification "><?php printf( __("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s'>activate</a> it now.",'invoicing'),wp_nonce_url(admin_url('plugins.php?action=activate&plugin=wp-easy-updates/external-updates.php'), 'activate-plugin_wp-easy-updates/external-updates.php'));?></span></div> |
|
| 198 | - <div id="wpi-wpeu-required-for-external" style="display:none;"><span class="wpi-notification "><?php printf( __("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s' onclick='window.open(\"https://wpeasyupdates.com/wp-easy-updates.zip\", \"_blank\");' >download</a> and install it now.",'invoicing'),admin_url("plugin-install.php?tab=upload&wpeu-install=true"));?></span></div> |
|
| 197 | + <div id="wpi-wpeu-required-activation" style="display:none;"><span class="wpi-notification "><?php printf(__("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s'>activate</a> it now.", 'invoicing'), wp_nonce_url(admin_url('plugins.php?action=activate&plugin=wp-easy-updates/external-updates.php'), 'activate-plugin_wp-easy-updates/external-updates.php')); ?></span></div> |
|
| 198 | + <div id="wpi-wpeu-required-for-external" style="display:none;"><span class="wpi-notification "><?php printf(__("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s' onclick='window.open(\"https://wpeasyupdates.com/wp-easy-updates.zip\", \"_blank\");' >download</a> and install it now.", 'invoicing'), admin_url("plugin-install.php?tab=upload&wpeu-install=true")); ?></span></div> |
|
| 199 | 199 | <div id="wpeu-licence-popup" style="display:none;"> |
| 200 | 200 | <span class="wpi-notification noti-white"> |
| 201 | - <h3 class="wpeu-licence-title"><?php _e("Licence key",'invoicing');?></h3> |
|
| 202 | - <input class="wpeu-licence-key" type="text" placeholder="<?php _e("Enter your licence key",'invoicing');?>"> <button class="button-primary wpeu-licence-popup-button" ><?php _e("Install",'invoicing');?></button> |
|
| 201 | + <h3 class="wpeu-licence-title"><?php _e("Licence key", 'invoicing'); ?></h3> |
|
| 202 | + <input class="wpeu-licence-key" type="text" placeholder="<?php _e("Enter your licence key", 'invoicing'); ?>"> <button class="button-primary wpeu-licence-popup-button" ><?php _e("Install", 'invoicing'); ?></button> |
|
| 203 | 203 | <br> |
| 204 | 204 | <?php |
| 205 | - echo sprintf( __('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">','</a>','<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">','</a>' ); |
|
| 205 | + echo sprintf(__('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">', '</a>', '<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">', '</a>'); |
|
| 206 | 206 | ?> |
| 207 | 207 | </span> |
| 208 | 208 | </div> |
@@ -44,22 +44,22 @@ |
||
| 44 | 44 | parent::__construct( $options ); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * The Super block output function. |
|
| 49 | - * |
|
| 50 | - * @param array $args |
|
| 51 | - * @param array $widget_args |
|
| 52 | - * @param string $content |
|
| 53 | - * |
|
| 54 | - * @return mixed|string|bool |
|
| 55 | - */ |
|
| 47 | + /** |
|
| 48 | + * The Super block output function. |
|
| 49 | + * |
|
| 50 | + * @param array $args |
|
| 51 | + * @param array $widget_args |
|
| 52 | + * @param string $content |
|
| 53 | + * |
|
| 54 | + * @return mixed|string|bool |
|
| 55 | + */ |
|
| 56 | 56 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
| 57 | 57 | |
| 58 | - ob_start(); |
|
| 58 | + ob_start(); |
|
| 59 | 59 | |
| 60 | - wpinv_print_errors(); |
|
| 60 | + wpinv_print_errors(); |
|
| 61 | 61 | |
| 62 | - return '<div class="wpinv">' . ob_get_clean() . '</div>'; |
|
| 62 | + return '<div class="wpinv">' . ob_get_clean() . '</div>'; |
|
| 63 | 63 | |
| 64 | 64 | } |
| 65 | 65 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if (!defined('ABSPATH')) { |
|
| 3 | 3 | exit; |
| 4 | 4 | } |
| 5 | 5 | |
@@ -22,15 +22,15 @@ discard block |
||
| 22 | 22 | 'block-keywords'=> "['invoicing','history']", |
| 23 | 23 | 'class_name' => __CLASS__, |
| 24 | 24 | 'base_id' => 'wpinv_messages', |
| 25 | - 'name' => __('GetPaid > Invoice Messages','invoicing'), |
|
| 25 | + 'name' => __('GetPaid > Invoice Messages', 'invoicing'), |
|
| 26 | 26 | 'widget_ops' => array( |
| 27 | 27 | 'classname' => 'wpinv-messages-class wpi-g', |
| 28 | - 'description' => esc_html__('Displays invoice error and warning messages on checkout page.','invoicing'), |
|
| 28 | + 'description' => esc_html__('Displays invoice error and warning messages on checkout page.', 'invoicing'), |
|
| 29 | 29 | ), |
| 30 | 30 | 'arguments' => array( |
| 31 | 31 | 'title' => array( |
| 32 | - 'title' => __( 'Widget title', 'invoicing' ), |
|
| 33 | - 'desc' => __( 'Enter widget title.', 'invoicing' ), |
|
| 32 | + 'title' => __('Widget title', 'invoicing'), |
|
| 33 | + 'desc' => __('Enter widget title.', 'invoicing'), |
|
| 34 | 34 | 'type' => 'text', |
| 35 | 35 | 'desc_tip' => true, |
| 36 | 36 | 'default' => '', |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | |
| 44 | - parent::__construct( $options ); |
|
| 44 | + parent::__construct($options); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return mixed|string|bool |
| 55 | 55 | */ |
| 56 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
| 56 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
| 57 | 57 | |
| 58 | 58 | ob_start(); |
| 59 | 59 | |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | return false; |
| 343 | 343 | } |
| 344 | 344 | if (null !== $this->apcuPrefix) { |
| 345 | - $file = apcu_fetch($this->apcuPrefix.$class, $hit); |
|
| 345 | + $file = apcu_fetch($this->apcuPrefix . $class, $hit); |
|
| 346 | 346 | if ($hit) { |
| 347 | 347 | return $file; |
| 348 | 348 | } |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | if (null !== $this->apcuPrefix) { |
| 359 | - apcu_add($this->apcuPrefix.$class, $file); |
|
| 359 | + apcu_add($this->apcuPrefix . $class, $file); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | if (false === $file) { |