Plugin Directory

Changeset 3487710


Ignore:
Timestamp:
03/21/2026 10:23:33 AM (7 days ago)
Author:
solankisoftware
Message:

Added Leave review link

Location:
advanced-addons-theme-core-exporter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • advanced-addons-theme-core-exporter/tags/1.0.1/advanced-addons-theme-core-exporter.php

    r3446159 r3487710  
    7171
    7272        add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), [ $this, 'aptce_add_settings_link']);
     73        add_filter( 'plugin_row_meta', [ $this, 'aptce_add_review_row_meta' ], 10, 2 );
    7374    }
    7475
     
    148149                         '</a>';
    149150
    150         // Add the link at the first position
     151        // Add link at the first position
    151152        array_unshift( $links, $settings_link );
    152153
    153154        return $links;
     155    }
     156
     157    public function aptce_add_review_row_meta( $plugin_meta, $plugin_file ) {
     158        if ( plugin_basename( __FILE__ ) !== $plugin_file ) {
     159            return $plugin_meta;
     160        }
     161
     162        $review_link = '<a href="' . esc_url( 'https://wordpress.org/support/plugin/advanced-addons-theme-core-exporter/reviews/' ) . '" target="_blank" rel="noopener noreferrer">' .
     163            __( 'Leave a review', 'advanced-addons-theme-core-exporter' ) .
     164            '</a>';
     165
     166        $inserted = false;
     167        foreach ( $plugin_meta as $index => $meta_item ) {
     168            if ( false !== strpos( $meta_item, 'plugin-install.php?tab=plugin-information' ) ) {
     169                array_splice( $plugin_meta, $index + 1, 0, [ $review_link ] );
     170                $inserted = true;
     171                break;
     172            }
     173        }
     174
     175        if ( ! $inserted ) {
     176            $plugin_meta[] = $review_link;
     177        }
     178
     179        return $plugin_meta;
    154180    }
    155181
  • advanced-addons-theme-core-exporter/trunk/advanced-addons-theme-core-exporter.php

    r3446159 r3487710  
    7171
    7272        add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), [ $this, 'aptce_add_settings_link']);
     73        add_filter( 'plugin_row_meta', [ $this, 'aptce_add_review_row_meta' ], 10, 2 );
    7374    }
    7475
     
    148149                         '</a>';
    149150
    150         // Add the link at the first position
     151        // Add link at the first position
    151152        array_unshift( $links, $settings_link );
    152153
    153154        return $links;
     155    }
     156
     157    public function aptce_add_review_row_meta( $plugin_meta, $plugin_file ) {
     158        if ( plugin_basename( __FILE__ ) !== $plugin_file ) {
     159            return $plugin_meta;
     160        }
     161
     162        $review_link = '<a href="' . esc_url( 'https://wordpress.org/support/plugin/advanced-addons-theme-core-exporter/reviews/' ) . '" target="_blank" rel="noopener noreferrer">' .
     163            __( 'Leave a review', 'advanced-addons-theme-core-exporter' ) .
     164            '</a>';
     165
     166        $inserted = false;
     167        foreach ( $plugin_meta as $index => $meta_item ) {
     168            if ( false !== strpos( $meta_item, 'plugin-install.php?tab=plugin-information' ) ) {
     169                array_splice( $plugin_meta, $index + 1, 0, [ $review_link ] );
     170                $inserted = true;
     171                break;
     172            }
     173        }
     174
     175        if ( ! $inserted ) {
     176            $plugin_meta[] = $review_link;
     177        }
     178
     179        return $plugin_meta;
    154180    }
    155181
Note: See TracChangeset for help on using the changeset viewer.