PageRenderTime 59ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

/p/wpmudev-updates/template/dashboard.php

https://bitbucket.org/matthewselby/wpdev
PHP | 277 lines | 225 code | 24 blank | 28 comment | 10 complexity | 000d2ca0bbb362a05f1987f96615bcac MD5 | raw file
Possible License(s): Apache-2.0, GPL-2.0, LGPL-3.0, LGPL-2.1, AGPL-1.0, BSD-3-Clause, MIT, GPL-3.0, MPL-2.0-no-copyleft-exception
  1. <?php
  2. /**
  3. * Dashboard template: Dashboard overview
  4. *
  5. * This template is used for the main overview, when the user clicks on the
  6. * main-menu item or the Dashboard sub-menu.
  7. *
  8. * Following variables are passed into the template:
  9. * $data (membership data)
  10. * $member (user profile data)
  11. * $urls (urls of all dashboard menu items)
  12. * $type [full|single|free]
  13. * $my_project (only needed for type == single)
  14. * $projects (keys: free|paid; list of projects, only for type free/single)
  15. *
  16. * @since 4.0.0
  17. * @package WPMUDEV_Dashboard
  18. */
  19. $profile = $member['profile'];
  20. $points = $member['points'];
  21. $history = $points['history'];
  22. $level = $points['rep_level'];
  23. if ( ! is_array( $history ) ) {
  24. $history = array();
  25. }
  26. // URL for the edit my profile functin.
  27. $url_profile = $urls->remote_site . 'hub/profile/';
  28. // Upgrade membership URL.
  29. $url_upgrade = $urls->remote_site . 'hub/account/';
  30. // Details on "Earn points".
  31. $url_points = $urls->remote_site . 'earn-your-wpmudev-membership/';
  32. // URLs for the Quick-link section.
  33. $quick_1 = $urls->plugins_url;
  34. $quick_2 = $urls->remote_site . 'manuals/';
  35. $quick_3 = $urls->remote_site . 'forums/#question';
  36. $quick_4 = $urls->remote_site . 'forums/';
  37. // Find the 5 most popular plugins, that are not installed yet.
  38. $popular = array();
  39. $count = 0;
  40. foreach ( $data['projects'] as $item ) {
  41. // Skip themes.
  42. if ( 'plugin' != $item['type'] ) {
  43. continue;
  44. }
  45. $plugin = WPMUDEV_Dashboard::$site->get_project_infos( $item['id'] );
  46. // Skip plugin if it's already installed.
  47. if ( $plugin->is_installed ) {
  48. continue;
  49. }
  50. // Skip plugins that are not compatible with current site.
  51. if ( ! $plugin->is_compatible ) {
  52. continue;
  53. }
  54. // Skip hidden/deprecated projects.
  55. if ( $plugin->is_hidden ) {
  56. continue;
  57. }
  58. $popular[] = $item;
  59. $count ++;
  60. if ( $count >= 5 ) {
  61. break;
  62. }
  63. }
  64. // New variables dashboard page
  65. $url_support = $urls->real_support_url;
  66. $url_logout = $urls->dashboard_url . '&clear_key=1';
  67. $hub_url = $urls->remote_site . 'hub/';
  68. $real_support_url = $urls->remote_site . 'support/';
  69. $community_url = $urls->remote_site . 'hub/community/';
  70. $learn_url = $urls->remote_site . 'academy/';
  71. $upfront_builder_info_modal = $urls->plugins_url . '#pid=1107287';
  72. ?>
  73. <?php
  74. $page_title = __( 'Overview', 'wpmudev' );
  75. $this->render_header( $page_title );
  76. ?>
  77. <div class="wpmudui-row">
  78. <div class="wpmudui-col is-half-md">
  79. <div id="wpmud-dash-tools-box" class="wpmudui-box">
  80. <header class="wpmudui-box__header has-actions">
  81. <h2><?php esc_html_e( 'Tools', 'wpmudev' ); ?></h2>
  82. <div class="wpmudui-box__header__actions">
  83. <a href="<?php echo esc_url( $hub_url ); ?>"
  84. class="wpmudui-btn is-sm is-ghost"><?php esc_html_e( 'Go to my Hub', 'wpmudev' ); ?></a>
  85. </div>
  86. </header>
  87. <section class="wpmudui-box__main no-pad">
  88. <div class="wpmudui-box-padded-content">
  89. <p><?php esc_html_e( 'We don’t just build plugins… take advantage of our great services included with your membership.', 'wpmudev' ); ?></p>
  90. </div>
  91. <ul class="wpmudui-products-list is-tools">
  92. <li class="wpmudui-product-list__item">
  93. <div class="wpmudui-product-list__info">
  94. <div aria-hidden="true" class="wpmudui-product-list__avatar"
  95. style="background-image: url('<?php echo esc_url( WPMUDEV_Dashboard::$site->plugin_url ); ?>image/tools/the-hub.png');"></div>
  96. <div class="wpmudui-product-list__details">
  97. <h4><?php esc_html_e( 'The Hub', 'wpmudev' ); ?></h4>
  98. <p><?php esc_html_e( 'Manage all your websites updates &amp; more in one place.', 'wpmudev' ); ?></p>
  99. </div>
  100. </div>
  101. <div class="wpmudui-product-list__cta">
  102. <a href="<?php echo esc_url( $hub_url ); ?>" class="wpmudui-product-list__btn is-external"
  103. tooltip="<?php esc_html_e( 'Go to The Hub', 'wpmudev' ); ?>"><i aria-hidden="true"
  104. class="wpmudui-fi wpmudui-fi-arrow-right"></i></a>
  105. </div>
  106. </li>
  107. <li class="wpmudui-product-list__item">
  108. <div class="wpmudui-product-list__info">
  109. <div aria-hidden="true" class="wpmudui-product-list__avatar"
  110. style="background-image: url('<?php echo esc_url( WPMUDEV_Dashboard::$site->plugin_url ); ?>image/tools/support.png');"></div>
  111. <div class="wpmudui-product-list__details">
  112. <h4><?php esc_html_e( 'Support', 'wpmudev' ); ?></h4>
  113. <p><?php esc_html_e( 'Get 24/7 expert WordPress support for any issue.', 'wpmudev' ); ?></p>
  114. </div>
  115. </div>
  116. <div class="wpmudui-product-list__cta">
  117. <a href="<?php echo esc_url( $real_support_url ); ?>"
  118. class="wpmudui-product-list__btn is-external"
  119. tooltip="<?php esc_html_e( 'Get Support', 'wpmudev' ); ?>"><i aria-hidden="true"
  120. class="wpmudui-fi wpmudui-fi-arrow-right"></i></a>
  121. </div>
  122. </li>
  123. <li class="wpmudui-product-list__item">
  124. <div class="wpmudui-product-list__info">
  125. <div aria-hidden="true" class="wpmudui-product-list__avatar"
  126. style="background-image: url('<?php echo esc_url( WPMUDEV_Dashboard::$site->plugin_url ); ?>image/tools/community.png');"></div>
  127. <div class="wpmudui-product-list__details">
  128. <h4><?php esc_html_e( 'Community', 'wpmudev' ); ?></h4>
  129. <p><?php esc_html_e( 'Discuss your favorite topics with other developers.', 'wpmudev' ); ?></p>
  130. </div>
  131. </div>
  132. <div class="wpmudui-product-list__cta">
  133. <a href="<?php echo esc_url( $community_url ); ?>"
  134. class="wpmudui-product-list__btn is-external"
  135. tooltip="<?php esc_html_e( 'View Forums', 'wpmudev' ); ?>"><i aria-hidden="true"
  136. class="wpmudui-fi wpmudui-fi-arrow-right"></i></a>
  137. </div>
  138. </li>
  139. <li class="wpmudui-product-list__item">
  140. <div class="wpmudui-product-list__info">
  141. <div aria-hidden="true" class="wpmudui-product-list__avatar"
  142. style="background-image: url('<?php echo esc_url( WPMUDEV_Dashboard::$site->plugin_url ); ?>image/tools/learn.png');"></div>
  143. <div class="wpmudui-product-list__details">
  144. <h4><?php esc_html_e( 'Learn', 'wpmudev' ); ?></h4>
  145. <p><?php esc_html_e( 'Become an expert by taking an Academy course.', 'wpmudev' ); ?></p>
  146. </div>
  147. </div>
  148. <div class="wpmudui-product-list__cta">
  149. <a href="<?php echo esc_url( $learn_url ); ?>" class="wpmudui-product-list__btn is-external"
  150. tooltip="<?php esc_html_e( 'Go to The Academy', 'wpmudev' ); ?>"><i aria-hidden="true"
  151. class="wpmudui-fi wpmudui-fi-arrow-right"></i></a>
  152. </div>
  153. </li>
  154. </ul>
  155. </section>
  156. </div><!-- end wpmud-dash-tools-box -->
  157. </div>
  158. <div class="wpmudui-col is-half-md">
  159. <?php if ( $my_project ) : ?>
  160. <div id="wpmud-dash-purchased-box" class="wpmudui-box">
  161. <header class="wpmudui-box__header has-actions">
  162. <h2><?php esc_html_e( 'Purchased', 'wpmudev' ); ?></h2>
  163. <div class="wpmudui-box__header__actions">
  164. <a href="<?php echo esc_url( $url_upgrade ); ?>" class="wpmudui-btn is-sm is-cta"
  165. target="_blank"><?php esc_html_e( 'Upgrade membership', 'wpmudev' ); ?></a>
  166. </div>
  167. </header>
  168. <section class="wpmudui-box__main no-pad">
  169. <ul class="wpmudui-products-list is-standalone is-plugins">
  170. <li class="wpmudui-product-list__item">
  171. <?php
  172. $url = WPMUDEV_Dashboard::$ui->page_urls->plugins_url;
  173. $url .= '#pid=' . $my_project->pid;
  174. ?>
  175. <div class="wpmudui-product-list__info">
  176. <div aria-hidden="true" class="wpmudui-product-list__avatar"
  177. style="background-image: url('<?php echo esc_url( $my_project->url->thumbnail_square ); ?>');">
  178. </div>
  179. <div class="wpmudui-product-list__details">
  180. <h4><?php echo esc_html( $my_project->name ); ?></h4>
  181. <p><?php echo esc_html( $my_project->info ); ?></p>
  182. </div>
  183. </div>
  184. <div class="wpmudui-product-list__cta">
  185. <a href="<?php echo esc_url( $url ); ?>" class="wpmudui-product-list__btn"
  186. tooltip="<?php esc_html_e( 'View plugin info', 'wpmudev' ); ?>"><i aria-hidden="true"
  187. class="wpmudui-fi wpmudui-fi-plus"></i></a>
  188. </div>
  189. </li>
  190. </ul>
  191. </section>
  192. </div>
  193. <?php endif; ?>
  194. <div id="wpmud-dash-plugins-box" class="wpmudui-box">
  195. <header class="wpmudui-box__header">
  196. <h2><?php esc_html_e( 'Plugins', 'wpmudev' ); ?></h2>
  197. </header>
  198. <section class="wpmudui-box__main no-pad">
  199. <div class="wpmudui-box-padded-content">
  200. <p><?php esc_html_e( 'Your WPMU DEV membership gives you access to 100+ premium plugins. Here’s our most popular!', 'wpmudev' ); ?></p>
  201. </div>
  202. <ul class="wpmudui-products-list is-plugins">
  203. <?php foreach ( $popular as $item ) : ?>
  204. <li class="wpmudui-product-list__item">
  205. <?php
  206. $url = WPMUDEV_Dashboard::$ui->page_urls->plugins_url;
  207. $url .= '#pid=' . $item['id'];
  208. ?>
  209. <div class="wpmudui-product-list__info">
  210. <div aria-hidden="true" class="wpmudui-product-list__avatar"
  211. style="background-image: url('<?php echo esc_url( $item['thumbnail_square'] ); ?>');">
  212. </div>
  213. <div class="wpmudui-product-list__details">
  214. <h4><?php esc_html_e( $item['name'] ); ?></h4>
  215. <p><?php esc_html_e( $item['short_description'] ); ?></p>
  216. </div>
  217. </div>
  218. <div class="wpmudui-product-list__cta">
  219. <?php
  220. $res = WPMUDEV_Dashboard::$site->get_project_infos( $item['id'] );
  221. if ( $res->is_compatible ) { ?>
  222. <a href="<?php echo esc_url( $url ); ?>" class="wpmudui-product-list__btn"
  223. tooltip="<?php esc_html_e( 'View plugin info', 'wpmudev' ); ?>"><i
  224. aria-hidden="true" class="wpmudui-fi wpmudui-fi-plus"></i></a>
  225. <?php } ?>
  226. </div>
  227. </li>
  228. <?php endforeach; ?>
  229. </ul>
  230. </section>
  231. <footer class="wpmudui-box__footer">
  232. <a href="<?php echo esc_url( $urls->plugins_url ); ?>" class="wpmudui-btn is-sm is-ghost"><?php
  233. /* translators: Number of plugins */
  234. printf( __( 'View %s Plugins', 'wpmudev' ), $projects_nr['plugins'] );
  235. ?></a>
  236. </footer>
  237. </div><!-- end wpmud-dash-plugins-box -->
  238. </div>
  239. </div>
  240. <?php if ( isset( $_GET['synced'] ) ) { //auto show modal after login redirect ?>
  241. <dialog id="confirmation-modal" title="You’re connected!"
  242. class="no-close wpmudui wpmudui-modal has-bottom-hero auto-show">
  243. <div class="wpmudui-alert is-success">
  244. <p><i aria-hidden="true"
  245. class="wpmudui-fi wpmudui-fi-circle-tick"></i> <?php esc_html_e( 'Great, your website is now synced to the WPMU DEV Hub!', 'wpmudev' ); ?>
  246. </p>
  247. </div>
  248. <p><?php printf( __( 'Keep this plugin installed to access Pro-only features, 24/7 support and <a href="%s" target=_blank">use the Hub</a> to manage all your websites in one handy place.', 'wpmudev' ), $hub_url ); ?></p>
  249. <p class="wpmdui-ctn-right">
  250. <button class="wpmudui-btn is-brand close"><?php esc_html_e( 'Get Started', 'wpmudev' ); ?></button>
  251. </p>
  252. </dialog><!-- end confirmation-modal-->
  253. <?php } //end modal ?>