| @@ -34,8 +34,9 @@ | ||
| 34 | 34 | |
| 35 | 35 | <div class="wp-filter"> |
| 36 | 36 | <ul class="filter-links"> |
| 37 | 37 | <li class="plugins-premium"><a href="#" data-target="gamipress-premium-add-on" class="current"><?php echo gamipress_dashicon( 'gamipress', 'span' ); ?> <?php _e( 'Premium', 'gamipress' ); ?></a></li> |
| 38 | + <li class="plugins-assets"><a href="#" data-target="gamipress-asset-add-on"><?php echo gamipress_dashicon( 'awards', 'span' ); ?> <?php _e( 'Assets', 'gamipress' ); ?></a></li> | |
| 38 | 39 | <li class="plugins-free"><a href="#" data-target="gamipress-free-add-on"><?php echo gamipress_dashicon( 'heart', 'span' ); ?> <?php _e( 'Free', 'gamipress' ); ?></a></li> |
| 39 | 40 | <li class="plugins-integrations"><a href="#" data-target="gamipress-integration-add-on"><?php echo gamipress_dashicon( 'admin-plugins', 'span' ); ?> <?php _e( 'Integrations', 'gamipress' ); ?></a></li> |
| 40 | 41 | <li class="plugins-third-party"><a href="#" data-target="gamipress-third-party-add-on"><?php echo gamipress_dashicon( 'star-filled', 'span' ); ?> <?php _e( '3rd Party', 'gamipress' ); ?></a></li> |
| 41 | 42 | <li class="plugins-tools"><a href="#" data-target="gamipress-tool-add-on"><?php echo gamipress_dashicon( 'admin-tools', 'span' ); ?> <?php _e( 'Tools', 'gamipress' ); ?></a></li> |
| @@ -58,9 +59,9 @@ | ||
| 58 | 59 | |
| 59 | 60 | foreach ( $plugins as $plugin ) { |
| 60 | 61 | |
| 61 | 62 | // Skip if is an asset or pass |
| 62 | - if( gamipress_is_plugin_asset( $plugin ) || gamipress_is_plugin_pass( $plugin ) ) | |
| 63 | + if( gamipress_is_plugin_pass( $plugin ) ) | |
| 63 | 64 | continue; |
| 64 | 65 | |
| 65 | 66 | gamipress_render_plugin_card( $plugin ); |
| 66 | 67 | |
| @@ -129,15 +130,15 @@ | ||
| 129 | 130 | |
| 130 | 131 | $class = 'gamipress-third-party-add-on'; |
| 131 | 132 | |
| 132 | 133 | // "More Information" action |
| 133 | - $action_links[] = '<a href="https://gamipress.com/add-ons/' . $plugin->info->slug . '" class="button" target="_blank">' . __( 'More Information', 'gamipress' ) . '</a>'; | |
| 134 | + $action_links[] = '<a href="https://gamipress.com/add-ons/' . $plugin->info->slug . '" class="button button-primary" target="_blank">' . __( 'More Information', 'gamipress' ) . '</a>'; | |
| 134 | 135 | |
| 135 | 136 | } else if( gamipress_plugin_has_category( $plugin, 'integrations' ) ) { |
| 136 | 137 | $class = 'gamipress-integration-add-on'; |
| 137 | 138 | |
| 138 | 139 | // "More Information" action |
| 139 | - $action_links[] = '<a href="https://gamipress.com/add-ons/' . $plugin->info->slug . '" class="button" target="_blank">' . __( 'More Information', 'gamipress' ) . '</a>'; | |
| 140 | + $action_links[] = '<a href="https://gamipress.com/add-ons/' . $plugin->info->slug . '" class="button button-primary" target="_blank">' . __( 'More Information', 'gamipress' ) . '</a>'; | |
| 140 | 141 | } else if( $plugin->wp_info ) { |
| 141 | 142 | // Free add-ons |
| 142 | 143 | |
| 143 | 144 | if( gamipress_plugin_has_category( $plugin, 'integrations' ) ) { |
| @@ -154,15 +155,15 @@ | ||
| 154 | 155 | |
| 155 | 156 | switch ( $status['status'] ) { |
| 156 | 157 | case 'install': |
| 157 | 158 | if ( $status['url'] ) { |
| 158 | - $action_links[] = '<a class="install-now button" data-slug="' . esc_attr( $slug ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Install %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Install Now' ) . '</a>'; | |
| 159 | + $action_links[] = '<a class="install-now button button-primary" data-slug="' . esc_attr( $slug ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Install %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Install Now' ) . '</a>'; | |
| 159 | 160 | } |
| 160 | 161 | break; |
| 161 | 162 | |
| 162 | 163 | case 'update_available': |
| 163 | 164 | if ( $status['url'] ) { |
| 164 | - $action_links[] = '<a class="update-now button aria-button-if-js" data-plugin="' . esc_attr( $status['file'] ) . '" data-slug="' . esc_attr( $slug ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Update %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Update Now' ) . '</a>'; | |
| 165 | + $action_links[] = '<a class="update-now button button-primary aria-button-if-js" data-plugin="' . esc_attr( $status['file'] ) . '" data-slug="' . esc_attr( $slug ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Update %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Update Now' ) . '</a>'; | |
| 165 | 166 | } |
| 166 | 167 | break; |
| 167 | 168 | |
| 168 | 169 | case 'latest_installed': |
| @@ -184,9 +185,9 @@ | ||
| 184 | 185 | $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); |
| 185 | 186 | } |
| 186 | 187 | |
| 187 | 188 | $action_links[] = sprintf( |
| 188 | - '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>', | |
| 189 | + '<a href="%1$s" class="button button-primary activate-now" aria-label="%2$s">%3$s</a>', | |
| 189 | 190 | esc_url( $activate_url ), |
| 190 | 191 | esc_attr( sprintf( $button_label, $name ) ), |
| 191 | 192 | $button_text |
| 192 | 193 | ); |
| @@ -253,9 +254,9 @@ | ||
| 253 | 254 | } |
| 254 | 255 | |
| 255 | 256 | // "Activate" action |
| 256 | 257 | $action_links[] = sprintf( |
| 257 | - '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>', | |
| 258 | + '<a href="%1$s" class="button button-primary activate-now" aria-label="%2$s">%3$s</a>', | |
| 258 | 259 | esc_url( $activate_url ), |
| 259 | 260 | esc_attr( sprintf( $button_label, $name ) ), |
| 260 | 261 | $button_text |
| 261 | 262 | ); |
| @@ -279,13 +280,8 @@ | ||
| 279 | 280 | |
| 280 | 281 | } |
| 281 | 282 | } |
| 282 | 283 | |
| 283 | - if( ! gamipress_plugin_has_category( $plugin, '3rd-party' ) && ! gamipress_plugin_has_category( $plugin, 'integrations' ) ) { | |
| 284 | - // "More Details" action | |
| 285 | - // $action_links[] = '<a href="https://gamipress.com/add-ons/' . $plugin->info->slug . '" class="more-details" aria-label="' . esc_attr( sprintf( __( 'More information about %s' ), $name ) ) . '" data-title="' . esc_attr( $name ) . '" target="_blank">' . __( 'More Details' ) . '</a>'; | |
| 286 | - } | |
| 287 | - | |
| 288 | 284 | /** |
| 289 | 285 | * Plugin card actions |
| 290 | 286 | * |
| 291 | 287 | * @since 1.0.0 |
| @@ -699,5 +695,61 @@ | ||
| 699 | 695 | } |
| 700 | 696 | |
| 701 | 697 | return false; |
| 702 | 698 | |
| 699 | +} | |
| 700 | + | |
| 701 | +/** | |
| 702 | + * Helper function to determine if give plugin has the passes category | |
| 703 | + * | |
| 704 | + * @since 1.6.9.2 | |
| 705 | + * | |
| 706 | + * @param stdClass $plugin | |
| 707 | + * | |
| 708 | + * @return bool | |
| 709 | + */ | |
| 710 | +function gamipress_is_plugin_pass( $plugin ) { | |
| 711 | + | |
| 712 | + // Check if plugin has categories | |
| 713 | + if( is_array( $plugin->info->category ) && count( $plugin->info->category ) ) { | |
| 714 | + | |
| 715 | + // Loop plugin categories | |
| 716 | + foreach( $plugin->info->category as $category ) { | |
| 717 | + | |
| 718 | + // Passes category found | |
| 719 | + if( $category->slug === 'passes' ) { | |
| 720 | + return true; | |
| 721 | + } | |
| 722 | + } | |
| 723 | + | |
| 724 | + } | |
| 725 | + | |
| 726 | + return false; | |
| 727 | +} | |
| 728 | + | |
| 729 | +/** | |
| 730 | + * Helper function to determine if give plugin has the asset tag | |
| 731 | + * | |
| 732 | + * @since 1.6.0 | |
| 733 | + * | |
| 734 | + * @param stdClass $plugin | |
| 735 | + * | |
| 736 | + * @return bool | |
| 737 | + */ | |
| 738 | +function gamipress_is_plugin_asset( $plugin ) { | |
| 739 | + | |
| 740 | + // Check if plugin has tags | |
| 741 | + if( is_array( $plugin->info->tags ) && count( $plugin->info->tags ) ) { | |
| 742 | + | |
| 743 | + // Loop plugin tags | |
| 744 | + foreach( $plugin->info->tags as $tag ) { | |
| 745 | + | |
| 746 | + // asset tag found | |
| 747 | + if( $tag->slug === 'asset' ) { | |
| 748 | + return true; | |
| 749 | + } | |
| 750 | + } | |
| 751 | + | |
| 752 | + } | |
| 753 | + | |
| 754 | + return false; | |
| 703 | 755 | } |