| @@ -160,8 +160,10 @@ | ||
| 160 | 160 | */ |
| 161 | 161 | function eos_plugin_revisions_remove_versions( $N = false,$plugin_name = false ){ |
| 162 | 162 | $key = eos_plugin_revision_key(); |
| 163 | 163 | $all_dirs = eos_plugin_revisions_scandir( dirname( PLUGIN_REVISIONS_PLUGIN_DIR ) ); |
| 164 | + $prefix = 'pr-'.$key.'-'; | |
| 165 | + $suffix = '-ver-'.$plugin_name.'.zip'; | |
| 164 | 166 | global $wp_filesystem; |
| 165 | 167 | if( empty( $wp_filesystem ) ){ |
| 166 | 168 | require_once ABSPATH . 'wp-admin/includes/file.php'; |
| 167 | 169 | WP_Filesystem(); |
| @@ -167,9 +169,9 @@ | ||
| 167 | 169 | WP_Filesystem(); |
| 168 | 170 | } |
| 169 | 171 | if( $all_dirs && !empty( $all_dirs ) ){ |
| 170 | 172 | foreach( $all_dirs as $all_dir ){ |
| 171 | - if( substr( $all_dir,-strlen( $plugin_name ),strlen( $plugin_name ) ) !== $plugin_name ){ | |
| 173 | + if( 0 !== strpos( $all_dir,$prefix ) || substr( $all_dir,-strlen( $suffix ) ) !== $suffix ){ | |
| 172 | 174 | unset( $all_dirs[array_search( $all_dir,$all_dirs )] ); |
| 173 | 175 | } |
| 174 | 176 | } |
| 175 | 177 | $n = 0; |
| @@ -529,4 +531,17 @@ | ||
| 529 | 531 | </form> |
| 530 | 532 | </div> |
| 531 | 533 | <?php |
| 532 | 534 | }); |
| 535 | + | |
| 536 | +add_filter( 'plugin_action_links_plugversions/plugversions.php', function( $links ) { | |
| 537 | + /** | |
| 538 | + * Add plugin action link for Annual Protection Plan. | |
| 539 | + * | |
| 540 | + * @param array $links Array of plugin action links | |
| 541 | + * @return array Modified array of plugin action links | |
| 542 | + */ | |
| 543 | + $plan_link = '<a href="https://shop.josemortellaro.com/downloads/plugin-update-rescue-annual-protection-plan/" style="color: #d63638; font-weight: bold;">' . esc_html__( 'Protection Plan', 'plugversions' ) . '</a>'; | |
| 544 | + // Add to the beginning of the links array | |
| 545 | + array_unshift( $links, $plan_link ); | |
| 546 | + return $links; | |
| 547 | +} ); | |