widget-pages.php
109 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Template for the widget that display the per-page share count for ssharing. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.0.0 |
| 7 | */ |
| 8 | |
| 9 | $sshare_count = Hustle_Module_Collection::instance()->get_all( |
| 10 | null, |
| 11 | array( |
| 12 | 'module_type' => array( Hustle_Module_Model::SOCIAL_SHARING_MODULE ), |
| 13 | 'count_only' => true, |
| 14 | ) |
| 15 | ); |
| 16 | ?> |
| 17 | <div class="sui-box"> |
| 18 | |
| 19 | <div class="sui-box-header"> |
| 20 | |
| 21 | <h2 class="sui-box-title"> |
| 22 | <span class="sui-icon-<?php echo esc_attr( $widget_type ); ?>" aria-hidden="true"></span> |
| 23 | <?php echo esc_html( $widget_name ); ?> |
| 24 | </h2> |
| 25 | |
| 26 | </div> |
| 27 | |
| 28 | <div class="sui-box-body"> |
| 29 | |
| 30 | <p><?php echo esc_html( $description ); ?></p> |
| 31 | |
| 32 | <?php if ( $sshare_count && count( $sshare_per_page_data ) ) { ?> |
| 33 | |
| 34 | <table class="sui-table sui-table-flushed hui-table-dashboard"> |
| 35 | |
| 36 | <thead> |
| 37 | |
| 38 | <tr> |
| 39 | |
| 40 | <th><?php esc_html_e( 'Page Name', 'hustle' ); ?></th> |
| 41 | <th><?php esc_html_e( 'Total Shares', 'hustle' ); ?></th> |
| 42 | |
| 43 | </tr> |
| 44 | |
| 45 | </thead> |
| 46 | |
| 47 | <tbody> |
| 48 | |
| 49 | <?php |
| 50 | foreach ( $sshare_per_page_data as $page_data ) { |
| 51 | ?> |
| 52 | |
| 53 | <tr> |
| 54 | |
| 55 | <td class="sui-table-item-title"><a href="<?php echo esc_url( $page_data['url'] ); ?>" target="_blank"> |
| 56 | <?php echo esc_html( $page_data['title'] ); ?> |
| 57 | </a></td> |
| 58 | |
| 59 | <td><?php echo esc_html( $page_data['count'] ); ?></td> |
| 60 | |
| 61 | </tr> |
| 62 | |
| 63 | <?php } ?> |
| 64 | |
| 65 | </tbody> |
| 66 | |
| 67 | </table> |
| 68 | |
| 69 | <?php } ?> |
| 70 | |
| 71 | </div> |
| 72 | |
| 73 | <div class="sui-box-footer"<?php echo ( $sshare_count && count( $sshare_per_page_data ) ) ? '' : ' style="padding-top: 0; border-top: 0;"'; ?>> |
| 74 | |
| 75 | <?php $query_array = array( 'page' => Hustle_Data::get_listing_page_by_module_type( $widget_type ) ); ?> |
| 76 | |
| 77 | <?php if ( $capability['hustle_create'] ) { ?> |
| 78 | <a |
| 79 | href=" |
| 80 | <?php |
| 81 | $query_array = array( 'page' => Hustle_Data::get_listing_page_by_module_type( $widget_type ) ); |
| 82 | if ( ! Hustle_Data::was_free_limit_reached( $widget_type ) ) { |
| 83 | $args = array_merge( $query_array, array( 'create-module' => 'true' ) ); |
| 84 | } else { |
| 85 | $args = array_merge( $query_array, array( 'requires-pro' => 'true' ) ); |
| 86 | } |
| 87 | echo esc_url( add_query_arg( $args, 'admin.php' ) ); |
| 88 | ?> |
| 89 | " |
| 90 | class="sui-button sui-button-blue" |
| 91 | > |
| 92 | <span class="sui-icon-plus" aria-hidden="true"></span> |
| 93 | <?php esc_html_e( 'Create', 'hustle' ); ?> |
| 94 | </a> |
| 95 | <?php } ?> |
| 96 | |
| 97 | <?php if ( $sshare_count ) : ?> |
| 98 | |
| 99 | <div class="sui-actions-right"> |
| 100 | <?php /* translators: widget's module type */ ?> |
| 101 | <p><small><strong><a href="<?php echo esc_url( add_query_arg( $query_array, 'admin.php' ) ); ?>" style="color: #888888;"><?php printf( esc_html__( 'View all %s', 'hustle' ), esc_html( strtolower( $widget_name ) ) ); ?></a></strong></small></p> |
| 102 | </div> |
| 103 | |
| 104 | <?php endif; ?> |
| 105 | |
| 106 | </div> |
| 107 | |
| 108 | </div> |
| 109 |