class-admin-notices.php
3 years ago
class-admin.php
3 years ago
class-attachment-fields.php
3 years ago
class-columns.php
3 years ago
class-demo-content.php
3 years ago
class-extensions.php
3 years ago
class-gallery-attachment-modal.php
3 years ago
class-gallery-datasources.php
3 years ago
class-gallery-editor.php
3 years ago
class-gallery-metabox-fields.php
3 years ago
class-gallery-metabox-items.php
3 years ago
class-gallery-metabox-settings-helper.php
3 years ago
class-gallery-metabox-settings.php
3 years ago
class-gallery-metaboxes.php
3 years ago
class-menu.php
3 years ago
class-pro-promotion.php
3 years ago
class-settings.php
3 years ago
class-silent-installer-skin.php
3 years ago
demo-content-galleries.php
3 years ago
demo-content-images.php
3 years ago
index.php
3 years ago
view-extensions.php
3 years ago
view-help-demos.php
3 years ago
view-help-getting-started.php
3 years ago
view-help-pro.php
3 years ago
view-help.php
3 years ago
view-system-info.php
3 years ago
view-extensions.php
140 lines
| 1 | <?php |
| 2 | $instance = FooGallery_Plugin::get_instance(); |
| 3 | $api = new FooGallery_Extensions_API(); |
| 4 | |
| 5 | $extensions = $api->get_all_for_view(); |
| 6 | $has_errors = false; |
| 7 | |
| 8 | $show_message = safe_get_from_request( 'show_message' ); |
| 9 | |
| 10 | if ( 'yes' === $show_message ) { |
| 11 | $result = get_transient( FOOGALLERY_EXTENSIONS_MESSAGE_TRANSIENT_KEY ); |
| 12 | if ( $result === false ) { |
| 13 | $result = null; |
| 14 | } |
| 15 | } |
| 16 | $tagline = apply_filters( 'foogallery_admin_extensions_tagline', sprintf( __( 'Enable additional features to make %s even more awesome!', 'foogallery' ), foogallery_plugin_name() ) ); |
| 17 | ?> |
| 18 | <style> |
| 19 | .foogallery-text { |
| 20 | font-size: 18px; |
| 21 | margin: 10px 0; |
| 22 | } |
| 23 | </style> |
| 24 | <div class="wrap foogallery-extensions"> |
| 25 | <h2><?php printf( __( '%s Features', 'foogallery' ), foogallery_plugin_name() ); ?><span class="spinner"></span></h2> |
| 26 | <div class="foogallery-text"><?php echo $tagline; ?></div> |
| 27 | <?php |
| 28 | if ( isset( $result ) ) { ?> |
| 29 | <div class="foogallery-message-<?php echo $result['type']; ?>"> |
| 30 | <p><?php echo $result['message']; ?></p> |
| 31 | </div> |
| 32 | <?php } ?> |
| 33 | <hr /> |
| 34 | </div> |
| 35 | |
| 36 | <div class="foogallery-extension-browser"> |
| 37 | <div class="extensions"> |
| 38 | <?php foreach ( $extensions as $extension ) { |
| 39 | $slug = $extension['slug']; |
| 40 | $classes = array('extension', 'all', 'extension-' . $slug); |
| 41 | |
| 42 | $downloaded = isset( $extension['downloaded'] ) && true === $extension['downloaded']; |
| 43 | $is_active = isset( $extension['is_active'] ) && true === $extension['is_active']; |
| 44 | $has_errors = isset( $extension['has_errors'] ) && true === $extension['has_errors']; |
| 45 | |
| 46 | $banner_text = ''; |
| 47 | |
| 48 | $tag_html = ''; |
| 49 | if ( isset( $extension['tags'] ) ) { |
| 50 | foreach ( $extension['tags'] as $tag ) { |
| 51 | $classes[] = $tag; |
| 52 | $tag_html .= '<span class="tag ' . $tag . '">'. $tag . '</span>'; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | foreach ( $extension['categories'] as $category ) { |
| 57 | $classes[] = foo_convert_to_key( $category ); |
| 58 | } |
| 59 | |
| 60 | if ( isset( $extension['css_class'] ) ) { |
| 61 | $classes[] = $extension['css_class']; |
| 62 | } |
| 63 | |
| 64 | $thumbnail = $extension['thumbnail']; |
| 65 | if ( foo_starts_with( $thumbnail, '/') ) { |
| 66 | $thumbnail = rtrim( FOOGALLERY_URL, '/' ) . $thumbnail; |
| 67 | } |
| 68 | $base_url = add_query_arg( 'extension', $slug ); |
| 69 | $download_url = add_query_arg( 'action', 'download', $base_url ); |
| 70 | $activate_url = add_query_arg( 'action', 'activate', $base_url ); |
| 71 | $deactivate_url = add_query_arg( 'action', 'deactivate', $base_url ); |
| 72 | |
| 73 | $download_button_html = ''; |
| 74 | |
| 75 | //check if we want to override the download button |
| 76 | if ( isset( $extension['download_button'] ) ) { |
| 77 | $download_button = $extension['download_button']; |
| 78 | $download_button_href = esc_url( isset( $download_button['href'] ) ? $download_button['href'] : $download_url ); |
| 79 | $download_button_target = isset( $download_button['target'] ) ? ' target="' . $download_button['target'] . '" ' : ''; |
| 80 | $download_button_text = isset( $download_button['text'] ) ? __( $download_button['text'], 'foogallery' ) : ''; |
| 81 | $download_button_banner_text = ' data-banner-text="' . (isset( $download_button['banner-text'] ) ? $download_button['banner-text'] : __( 'downloading...', 'foogallery')) . '"'; |
| 82 | $download_button_confirm = isset( $download_button['confirm'] ) ? ' data-confirm="' .$download_button['confirm'] . '" ' : ''; |
| 83 | $download_button_html = "<a class=\"ext_action button button-primary download\" {$download_button_banner_text} {$download_button_target} href=\"{$download_button_href}\" >{$download_button_text}</a>"; |
| 84 | } |
| 85 | |
| 86 | //build up a freemius buy button |
| 87 | if ( isset( $extension['freemius_button'] ) ) { |
| 88 | $downloaded = $is_active = false; |
| 89 | $freemius_button = $extension['freemius_button']; |
| 90 | $freemius_button_text = isset( $freemius_button['text'] ) ? __( $freemius_button['text'], 'foogallery' ) : ''; |
| 91 | $plugin_id = esc_attr( $freemius_button['plugin_id'] ); |
| 92 | $pricing_id = esc_attr( $freemius_button['pricing_id'] ); |
| 93 | |
| 94 | $href = foogallery_fs()->addon_checkout_url( $plugin_id, $pricing_id ); |
| 95 | |
| 96 | $download_button_html = "<a class=\"ext_action button button-primary download\" href=\"{$href}\" >{$freemius_button_text}</a>"; |
| 97 | } |
| 98 | |
| 99 | if ( $downloaded ) { |
| 100 | $classes[] = 'downloaded'; |
| 101 | } else { |
| 102 | $classes[] = 'download'; |
| 103 | } |
| 104 | |
| 105 | if ( $downloaded && $is_active ) { |
| 106 | $classes[] = 'activated'; |
| 107 | $banner_text = __( 'Activated', 'foogallery' ); |
| 108 | } |
| 109 | |
| 110 | if ( $has_errors ) { |
| 111 | $classes[] = 'has_error'; |
| 112 | $banner_text = $api->get_error_message( $slug ); |
| 113 | } |
| 114 | |
| 115 | ?> |
| 116 | <div class="<?php echo implode(' ', $classes); ?>"> |
| 117 | |
| 118 | <div class="screenshot" style="background: url(<?php echo $thumbnail; ?>) no-repeat"></div> |
| 119 | |
| 120 | <div class="extension-details"> |
| 121 | <p class="search-me"><?php echo $extension['description']; ?></p> |
| 122 | <a target="_blank" href="<?php echo esc_url( $extension['author_url'] ); ?>">By <?php echo $extension['author']; ?></a> |
| 123 | </div> |
| 124 | |
| 125 | <h3 class="search-me"><?php echo $extension['title'] . $tag_html; ?></h3> |
| 126 | |
| 127 | <div class="extension-actions"> |
| 128 | <?php if ( ! empty( $download_button_html ) ) { |
| 129 | echo $download_button_html; |
| 130 | } else { ?> |
| 131 | <a class="ext_action button button-primary download" data-banner-text="<?php _e( 'downloading...', 'foogallery'); ?>" data-confirm="<?php _e( 'Are you sure you want to download this extension?', 'foogallery' ); ?>" href="<?php echo esc_url( $download_url ); ?>"><?php _e( 'Download', 'foogallery' ); ?></a> |
| 132 | <?php } ?> |
| 133 | <a class="ext_action button button-primary activate" data-banner-text="<?php _e( 'activating...', 'foogallery'); ?>" href="<?php echo esc_url( $activate_url ); ?>"><?php _e( 'Activate', 'foogallery' ); ?></a> |
| 134 | <a class="ext_action button button-secondary deactivate" data-banner-text="<?php _e( 'deactivating...', 'foogallery'); ?>" href="<?php echo esc_url( $deactivate_url ); ?>"><?php _e( 'Deactivate', 'foogallery' ); ?></a> |
| 135 | </div> |
| 136 | <div class="banner"><?php echo $banner_text; ?></div> |
| 137 | </div> |
| 138 | <?php } ?> |
| 139 | </div> |
| 140 | </div> |