@@ -73,10 +73,6 @@ |
||
| 73 | 73 | /** |
| 74 | 74 | * Outputs a button. |
| 75 | 75 | *ccc |
| 76 | - * @param string $url |
|
| 77 | - * @param string $text |
|
| 78 | - * @param string $theme |
|
| 79 | - * @param string $plugin |
|
| 80 | 76 | */ |
| 81 | 77 | public function output_button( $addon ) { |
| 82 | 78 | $current_tab = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] ); |
@@ -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) ){ |
@@ -51,8 +51,8 @@ |
||
| 51 | 51 | /** |
| 52 | 52 | * Get section for the addons screen. |
| 53 | 53 | * |
| 54 | - * @param string $section_id |
|
| 55 | 54 | * |
| 55 | + * @param string $tab_id |
|
| 56 | 56 | * @return object|bool |
| 57 | 57 | */ |
| 58 | 58 | public function get_tab($tab_id) |
@@ -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 |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | </div> |
| 45 | 45 | |
| 46 | 46 | <?php |
| 47 | - }else{ |
|
| 47 | + } else{ |
|
| 48 | 48 | $installed_plugins = get_plugins(); |
| 49 | 49 | $addon_obj = new WPInv_Admin_Addons(); |
| 50 | 50 | if ($addons = $addon_obj->get_section_data( $current_tab ) ) : |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&TB_iframe=true&width=770&height=660" class="thickbox" >'; |
| 70 | 70 | echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
| 71 | 71 | echo '</a>'; |
| 72 | - }elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
| 72 | + } elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
| 73 | 73 | if(defined('WP_EASY_UPDATES_ACTIVE')){ |
| 74 | 74 | $url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&TB_iframe=true&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com'); |
| 75 | - }else{ |
|
| 75 | + } else{ |
|
| 76 | 76 | // if installed show activation link |
| 77 | 77 | if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){ |
| 78 | 78 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation'; |
| 79 | - }else{ |
|
| 79 | + } else{ |
|
| 80 | 80 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external'; |
| 81 | 81 | } |
| 82 | 82 | } |