| @@ -9,15 +9,8 @@ | ||
| 9 | 9 | protected $cache_key = ''; |
| 10 | 10 | protected $cache_timeout = '+6 hours'; |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | - * The number of days an add-on is new. | |
| 14 | - * | |
| 15 | - * @var int $new_days | |
| 16 | - */ | |
| 17 | - protected $new_days = 90; | |
| 18 | - | |
| 19 | - /** | |
| 20 | 13 | * @since 3.06 |
| 21 | 14 | */ |
| 22 | 15 | public function __construct( $license = null ) { |
| 23 | 16 | $this->set_license( $license ); |
| @@ -25,10 +18,8 @@ | ||
| 25 | 18 | } |
| 26 | 19 | |
| 27 | 20 | /** |
| 28 | 21 | * @since 3.06 |
| 29 | - * | |
| 30 | - * @return void | |
| 31 | 22 | */ |
| 32 | 23 | private function set_license( $license ) { |
| 33 | 24 | if ( $license === null ) { |
| 34 | 25 | $edd_update = $this->get_pro_updater(); |
| @@ -48,10 +39,8 @@ | ||
| 48 | 39 | } |
| 49 | 40 | |
| 50 | 41 | /** |
| 51 | 42 | * @since 3.06 |
| 52 | - * | |
| 53 | - * @return void | |
| 54 | 43 | */ |
| 55 | 44 | protected function set_cache_key() { |
| 56 | 45 | $this->cache_key = 'frm_addons_l' . ( empty( $this->license ) ? '' : md5( $this->license ) ); |
| 57 | 46 | } |
| @@ -101,23 +90,15 @@ | ||
| 101 | 90 | $addons = array(); |
| 102 | 91 | } |
| 103 | 92 | |
| 104 | 93 | foreach ( $addons as $k => $addon ) { |
| 105 | - if ( ! is_array( $addon ) ) { | |
| 94 | + if ( ! isset( $addon['categories'] ) ) { | |
| 106 | 95 | continue; |
| 107 | 96 | } |
| 108 | - | |
| 109 | - if ( isset( $addon['categories'] ) ) { | |
| 110 | - $cats = array_intersect( $this->skip_categories(), $addon['categories'] ); | |
| 111 | - if ( ! empty( $cats ) ) { | |
| 112 | - unset( $addons[ $k ] ); | |
| 113 | - continue; | |
| 114 | - } | |
| 97 | + $cats = array_intersect( $this->skip_categories(), $addon['categories'] ); | |
| 98 | + if ( ! empty( $cats ) ) { | |
| 99 | + unset( $addons[ $k ] ); | |
| 115 | 100 | } |
| 116 | - | |
| 117 | - if ( ! array_key_exists( 'is_new', $addon ) && array_key_exists( 'released', $addon ) ) { | |
| 118 | - $addons[ $k ]['is_new'] = $this->is_new( $addon ); | |
| 119 | - } | |
| 120 | 101 | } |
| 121 | 102 | |
| 122 | 103 | $this->set_cached( $addons ); |
| 123 | 104 | |
| @@ -125,10 +106,8 @@ | ||
| 125 | 106 | } |
| 126 | 107 | |
| 127 | 108 | /** |
| 128 | 109 | * @since 3.06 |
| 129 | - * | |
| 130 | - * @return string | |
| 131 | 110 | */ |
| 132 | 111 | protected function api_url() { |
| 133 | 112 | return 'https://formidableforms.com/wp-json/s11edd/v1/updates/'; |
| 134 | 113 | } |
| @@ -134,10 +113,8 @@ | ||
| 134 | 113 | } |
| 135 | 114 | |
| 136 | 115 | /** |
| 137 | 116 | * @since 3.06 |
| 138 | - * | |
| 139 | - * @return string[] | |
| 140 | 117 | */ |
| 141 | 118 | protected function skip_categories() { |
| 142 | 119 | return array( 'WordPress Form Templates', 'WordPress Form Style Templates' ); |
| 143 | 120 | } |
| @@ -145,9 +122,8 @@ | ||
| 145 | 122 | /** |
| 146 | 123 | * @since 3.06 |
| 147 | 124 | * |
| 148 | 125 | * @param object $license_plugin The FrmAddon object |
| 149 | - * @param array $addons | |
| 150 | 126 | * |
| 151 | 127 | * @return array |
| 152 | 128 | */ |
| 153 | 129 | public function get_addon_for_license( $license_plugin, $addons = array() ) { |
| @@ -207,12 +183,8 @@ | ||
| 207 | 183 | } |
| 208 | 184 | |
| 209 | 185 | /** |
| 210 | 186 | * @since 3.06 |
| 211 | - * | |
| 212 | - * @param array $addons | |
| 213 | - * | |
| 214 | - * @return void | |
| 215 | 187 | */ |
| 216 | 188 | protected function set_cached( $addons ) { |
| 217 | 189 | FrmAppHelper::filter_gmt_offset(); |
| 218 | 190 | |
| @@ -226,10 +198,8 @@ | ||
| 226 | 198 | } |
| 227 | 199 | |
| 228 | 200 | /** |
| 229 | 201 | * @since 3.06 |
| 230 | - * | |
| 231 | - * @return void | |
| 232 | 202 | */ |
| 233 | 203 | public function reset_cached() { |
| 234 | 204 | delete_option( $this->cache_key ); |
| 235 | 205 | } |
| @@ -261,18 +231,6 @@ | ||
| 261 | 231 | do_action( 'frm_license_error', $addons['error'] ); |
| 262 | 232 | } |
| 263 | 233 | |
| 264 | 234 | return $errors; |
| 265 | - } | |
| 266 | - | |
| 267 | - /** | |
| 268 | - * Check if a template is new. | |
| 269 | - * | |
| 270 | - * @since 6.0 | |
| 271 | - * | |
| 272 | - * @param array $addon | |
| 273 | - * @return bool | |
| 274 | - */ | |
| 275 | - protected function is_new( $addon ) { | |
| 276 | - return strtotime( $addon['released'] ) > strtotime( '-' . $this->new_days . ' days' ); | |
| 277 | 235 | } |
| 278 | 236 | } |