PageRenderTime 26ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/popup-maker/includes/admin/extensions/extensions-page.php

https://bitbucket.org/mrabd4233/uprise
PHP | 213 lines | 132 code | 23 blank | 58 comment | 2 complexity | 780dacf878ef4b2026d4b2a57a0689e2 MD5 | raw file
Possible License(s): MIT, BSD-2-Clause, BSD-3-Clause
  1. <?php
  2. // Exit if accessed directly
  3. if ( ! defined( 'ABSPATH' ) ) {
  4. exit;
  5. }
  6. /**
  7. * Addons Page
  8. *
  9. * Renders the extensions page contents.
  10. *
  11. * @access private
  12. * @since 1.0
  13. * @return void
  14. */
  15. function popmake_extensions_page() { ?>
  16. <div class="wrap"><h1><?php _e( 'Extend Popup Maker', 'popup-maker' ) ?></h1>
  17. <div id="poststuff">
  18. <div id="post-body" class="metabox-holder">
  19. <div id="post-body-content"><?php
  20. $extensions = popmake_available_extensions(); ?>
  21. <hr class="clear" />
  22. <h2 class="section-heading">
  23. <?php _e( 'Extensions', 'popup-maker' ) ?>
  24. &nbsp;&nbsp;<a href="https://wppopupmaker.com/extensions/?utm_source=plugin-extension-page&utm_medium=text-link&utm_campaign=Upsell&utm_content=browse-all" class="button-primary" title="<?php _e( 'Browse All Extensions', 'popup-maker' ); ?>" target="_blank"><?php _e( 'Browse All Extensions', 'popup-maker' ); ?></a>
  25. </h2>
  26. <p><?php _e( 'These extensions <strong>add extra functionality</strong> to your popups.', 'popup-maker' ); ?></p>
  27. <ul class="extensions-available">
  28. <?php
  29. $plugins = get_plugins();
  30. $installed_plugins = array();
  31. foreach ( $plugins as $key => $plugin ) {
  32. $is_active = is_plugin_active( $key );
  33. $installed_plugin = array(
  34. 'is_active' => $is_active,
  35. );
  36. $installerUrl = add_query_arg( array(
  37. 'action' => 'activate',
  38. 'plugin' => $key,
  39. 'em' => 1,
  40. ), network_admin_url( 'plugins.php' ) //admin_url('update.php')
  41. );
  42. $installed_plugin["activation_url"] = $is_active ? "" : wp_nonce_url( $installerUrl, 'activate-plugin_' . $key );
  43. $installerUrl = add_query_arg( array(
  44. 'action' => 'deactivate',
  45. 'plugin' => $key,
  46. 'em' => 1,
  47. ), network_admin_url( 'plugins.php' ) //admin_url('update.php')
  48. );
  49. $installed_plugin["deactivation_url"] = ! $is_active ? "" : wp_nonce_url( $installerUrl, 'deactivate-plugin_' . $key );
  50. $installed_plugins[ $key ] = $installed_plugin;
  51. }
  52. $existing_extension_images = apply_filters( 'popmake_existing_extension_images', array() );
  53. if ( ! empty( $extensions ) ) {
  54. shuffle( $extensions );
  55. foreach ( $extensions as $key => $ext ) {
  56. unset( $extensions[ $key ] );
  57. $extensions[ $ext['slug'] ] = $ext;
  58. }
  59. $extensions = array_merge( array( 'core-extensions-bundle' => $extensions['core-extensions-bundle'] ), $extensions );
  60. $i = 0;
  61. foreach ( $extensions as $extension ) : ?>
  62. <li class="available-extension-inner <?php esc_attr_e( $extension['slug'] ); ?>">
  63. <h3>
  64. <a target="_blank" href="<?php echo esc_url( $extension['homepage'] ); ?>?utm_source=plugin-extension-page&utm_medium=extension-title-<?php echo $i; ?>&utm_campaign=Upsell&utm_content=<?php esc_attr_e( str_replace( ' ', '+', $extension['name'] ) ); ?>">
  65. <?php esc_html_e( $extension['name'] ) ?>
  66. </a>
  67. </h3>
  68. <?php $image = in_array( $extension['slug'], $existing_extension_images ) ? POPMAKE_URL . '/assets/images/extensions/' . $extension['slug'] . '.png' : $extension['image']; ?>
  69. <img class="extension-thumbnail" src="<?php esc_attr_e( $image ) ?>">
  70. <p><?php esc_html_e( $extension['excerpt'] ); ?></p>
  71. <?php
  72. /*
  73. if(!empty($extension->download_link) && !isset($installed_plugins[$extension->slug.'/'.$extension->slug.'.php']))
  74. {
  75. $installerUrl = add_query_arg(
  76. array(
  77. 'action' => 'install-plugin',
  78. 'plugin' => $extension->slug,
  79. 'edd_sample_plugin' => 1
  80. ),
  81. network_admin_url('update.php')
  82. //admin_url('update.php')
  83. );
  84. $installerUrl = wp_nonce_url($installerUrl, 'install-plugin_' . $extension->slug)?>
  85. <span class="action-links"><?php
  86. printf(
  87. '<a class="button install" href="%s">%s</a>',
  88. esc_attr($installerUrl),
  89. __('Install')
  90. );?>
  91. </span><?php
  92. }
  93. elseif(isset($installed_plugins[$extension->slug.'/'.$extension->slug.'.php']['is_active']))
  94. {?>
  95. <span class="action-links"><?php
  96. if(!$installed_plugins[$extension->slug.'/'.$extension->slug.'.php']['is_active'])
  97. {
  98. printf(
  99. '<a class="button install" href="%s">%s</a>',
  100. esc_attr($installed_plugins[$extension->slug.'/'.$extension->slug.'.php']["activation_url"]),
  101. __('Activate')
  102. );
  103. }
  104. else
  105. {
  106. printf(
  107. '<a class="button install" href="%s">%s</a>',
  108. esc_attr($installed_plugins[$extension->slug.'/'.$extension->slug.'.php']["deactivation_url"]),
  109. __('Deactivate')
  110. );
  111. }?>
  112. </span><?php
  113. }
  114. else
  115. {
  116. ?><span class="action-links"><a class="button" target="_blank" href="<?php esc_attr_e($extension->homepage);?>"><?php _e('Get It Now');?></a></span><?php
  117. }
  118. */
  119. ?>
  120. <span class="action-links">
  121. <a class="button" target="_blank" href="<?php echo esc_url( $extension['homepage'] ); ?>?utm_source=plugin-extension-page&utm_medium=extension-button-<?php echo $i; ?>&utm_campaign=Upsell&utm_content=<?php esc_attr_e( str_replace( ' ', '+', $extension['name'] ) ); ?>"><?php _e( 'Get this Extension', 'popup-maker' ); ?></a>
  122. </span>
  123. </li>
  124. <?php
  125. $i ++;
  126. endforeach;
  127. } ?>
  128. </ul>
  129. <br class="clear" />
  130. <a href="https://wppopupmaker.com/extensions/?utm_source=plugin-extension-page&utm_medium=text-link&utm_campaign=Upsell&utm_content=browse-all-bottom" class="button-primary" title="<?php _e( 'Browse All Extensions', 'popup-maker' ); ?>" target="_blank"><?php _e( 'Browse All Extensions', 'popup-maker' ); ?></a>
  131. <br class="clear" />
  132. <br class="clear" />
  133. <br class="clear" />
  134. <hr class="clear" />
  135. <br class="clear" />
  136. <h2 class="section-heading">
  137. <?php _e( 'Other Compatible Plugins', 'popup-maker' ); ?>
  138. </h2>
  139. <p><?php _e( 'These plugins should work in popups with no extra setup.', 'popup-maker' ); ?></p>
  140. <ul class="extensions-available">
  141. <?php
  142. $compatible_plugins = array(
  143. array(
  144. 'slug' => 'gravity-forms',
  145. 'name' => __( 'Gravity Forms', 'popup-maker' ),
  146. 'url' => 'https://wppopupmaker.com/grab/gravity-forms',
  147. 'desc' => __( 'Gravity Forms is one of the most popular form building plugins.', 'popup-maker' ),
  148. ),
  149. array(
  150. 'slug' => 'contact-form-7',
  151. 'name' => __( 'Contact Form 7', 'popup-maker' ),
  152. 'url' => 'https://wppopupmaker.com/grab/contact-form-7',
  153. 'desc' => __( 'CF7 is one of the most downloaded plugins on the WordPress repo. Make simple forms with ease and plenty of free addons available.', 'popup-maker' ),
  154. ),
  155. array(
  156. 'slug' => 'quiz-survey-master',
  157. 'name' => __( 'Quiz & Survey Master', 'popup-maker' ),
  158. 'url' => 'https://wppopupmaker.com/grab/quiz-survey-master',
  159. 'desc' => __( 'If you need more from your forms data look no further, QSM is all about the statistics & collective data, something other form plugins neglect.', 'popup-maker' ),
  160. ),
  161. );
  162. shuffle( $compatible_plugins );
  163. array_unshift( $compatible_plugins, array(
  164. 'slug' => 'ninja-forms',
  165. 'name' => __( 'Ninja Forms', 'popup-maker' ),
  166. 'url' => 'https://wppopupmaker.com/grab/ninja-forms',
  167. 'desc' => __( 'Ninja Forms has fast become the most extensible form plugin available. Build super custom forms and integrate with your favorite services.', 'popup-maker' ),
  168. ) );
  169. $i = 1;
  170. foreach ( $compatible_plugins as $plugin ) : ?>
  171. <li class="available-extension-inner <?php esc_attr_e( $plugin['slug'] ); ?>">
  172. <h3>
  173. <a target="_blank" href="<?php esc_attr_e( $plugin['url'] ); ?>?utm_campaign=FormPlugins&utm_source=plugin-extend-page&utm_medium=form-banner&utm_content=<?php echo $plugin['slug']; ?>">
  174. <?php esc_html_e( $plugin['name'] ) ?>
  175. </a>
  176. </h3>
  177. <img class="extension-thumbnail" src="<?php esc_attr_e( POPMAKE_URL . '/assets/images/plugins/' . $plugin['slug'] . '.png' ) ?>">
  178. <p><?php esc_html_e( $plugin['desc'] ); ?></p>
  179. <span class="action-links">
  180. <a class="button" target="_blank" href="<?php echo esc_url( $plugin['url'] ); ?>"><?php _e( 'Check it out', 'popup-maker' ); ?></a>
  181. </span>
  182. </li><?php
  183. $i ++;
  184. endforeach; ?>
  185. </ul>
  186. </div>
  187. </div>
  188. </div><?php
  189. }