| @@ -102,9 +102,12 @@ | ||
| 102 | 102 | var as = document.getElementsByClassName('plugin-revision-action'),n=0,req = new XMLHttpRequest(),fd=new FormData(),nonce=document.getElementById('plugin_reviews_restore_version').value; |
| 103 | 103 | for(n;n<as.length;++n){ |
| 104 | 104 | as[n].addEventListener('click',function(e){ |
| 105 | 105 | e.preventDefault(); |
| 106 | - this.closest('td').classList.add('plugin-revision-processing'); | |
| 106 | + var cell = this.closest('.plugin-title') || this.closest('td') || this.closest('th'); | |
| 107 | + if(cell){ | |
| 108 | + cell.classList.add('plugin-revision-processing'); | |
| 109 | + } | |
| 107 | 110 | this.style.backgroundPosition = 'center center'; |
| 108 | 111 | for(var k=0;k<as.length;++k){ |
| 109 | 112 | as[k].style.pointerEvents = 'none'; |
| 110 | 113 | } |
| @@ -160,8 +163,10 @@ | ||
| 160 | 163 | */ |
| 161 | 164 | function eos_plugin_revisions_remove_versions( $N = false,$plugin_name = false ){ |
| 162 | 165 | $key = eos_plugin_revision_key(); |
| 163 | 166 | $all_dirs = eos_plugin_revisions_scandir( dirname( PLUGIN_REVISIONS_PLUGIN_DIR ) ); |
| 167 | + $prefix = 'pr-'.$key.'-'; | |
| 168 | + $suffix = '-ver-'.$plugin_name.'.zip'; | |
| 164 | 169 | global $wp_filesystem; |
| 165 | 170 | if( empty( $wp_filesystem ) ){ |
| 166 | 171 | require_once ABSPATH . 'wp-admin/includes/file.php'; |
| 167 | 172 | WP_Filesystem(); |
| @@ -167,9 +172,9 @@ | ||
| 167 | 172 | WP_Filesystem(); |
| 168 | 173 | } |
| 169 | 174 | if( $all_dirs && !empty( $all_dirs ) ){ |
| 170 | 175 | foreach( $all_dirs as $all_dir ){ |
| 171 | - if( substr( $all_dir,-strlen( $plugin_name ),strlen( $plugin_name ) ) !== $plugin_name ){ | |
| 176 | + if( 0 !== strpos( $all_dir,$prefix ) || substr( $all_dir,-strlen( $suffix ) ) !== $suffix ){ | |
| 172 | 177 | unset( $all_dirs[array_search( $all_dir,$all_dirs )] ); |
| 173 | 178 | } |
| 174 | 179 | } |
| 175 | 180 | $n = 0; |
| @@ -529,4 +534,17 @@ | ||
| 529 | 534 | </form> |
| 530 | 535 | </div> |
| 531 | 536 | <?php |
| 532 | 537 | }); |
| 538 | + | |
| 539 | +add_filter( 'plugin_action_links_plugversions/plugversions.php', function( $links ) { | |
| 540 | + /** | |
| 541 | + * Add plugin action link for Annual Protection Plan. | |
| 542 | + * | |
| 543 | + * @param array $links Array of plugin action links | |
| 544 | + * @return array Modified array of plugin action links | |
| 545 | + */ | |
| 546 | + $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>'; | |
| 547 | + // Add to the beginning of the links array | |
| 548 | + array_unshift( $links, $plan_link ); | |
| 549 | + return $links; | |
| 550 | +} ); | |