PageRenderTime 23ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/LayerSlider/wp/notices.php

https://gitlab.com/webkod3r/tripolis
PHP | 137 lines | 120 code | 12 blank | 5 comment | 19 complexity | 4cf9b0d5ebd11fa4c9e1a230e87f87bf MD5 | raw file
  1. <?php
  2. // Update notice
  3. if(strpos($_SERVER['REQUEST_URI'], '?page=layerslider') !== false) {
  4. add_action('admin_notices', 'layerslider_update_notice');
  5. add_action('admin_notices', 'layerslider_unauthorized_update_notice');
  6. add_action('admin_notices', 'layerslider_dependency_notice');
  7. if( get_option('ls-show-support-notice', 1) && !get_option('layerslider-validated', null) && !get_option('layerslider-authorized-site', null) ) {
  8. add_action('admin_notices', 'layerslider_premium_support');
  9. }
  10. }
  11. // Storage notice
  12. if(get_option('layerslider-slides') !== false) {
  13. global $pagenow;
  14. if($pagenow == 'plugins.php' || $pagenow == 'index.php' || strpos($_SERVER['REQUEST_URI'], 'layerslider')) {
  15. add_action('admin_notices', 'layerslider_compatibility_notice');
  16. }
  17. }
  18. // License notification under the plugin row on the Plugins screen
  19. if(!get_option('layerslider-authorized-site', null)) {
  20. add_action('after_plugin_row_'.LS_PLUGIN_BASE, 'layerslider_plugins_purchase_notice', 10, 3 );
  21. }
  22. function layerslider_update_notice() {
  23. if(get_option('layerslider-authorized-site', false)) {
  24. // Get plugin updates
  25. $updates = get_plugin_updates();
  26. // Check for update
  27. if(isset($updates[LS_PLUGIN_BASE]) && isset($updates[LS_PLUGIN_BASE]->update)) {
  28. $update = $updates[LS_PLUGIN_BASE];
  29. add_thickbox();
  30. ?>
  31. <div class="layerslider_notice">
  32. <img src="<?php echo LS_ROOT_URL.'/static/img/ls_80x80.png' ?>" alt="LayerSlider icon">
  33. <h1><?php _e('An update is available for LayerSlider WP!', 'LayerSlider') ?></h1>
  34. <p>
  35. <?php echo sprintf(__('You have version %1$s. Update to version %2$s.', 'LayerSlider'), $update->Version, $update->update->new_version); ?><br>
  36. <i><?php echo $update->update->upgrade_notice ?></i>
  37. <a href="<?php echo wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin='.LS_PLUGIN_BASE), 'upgrade-plugin_'.LS_PLUGIN_BASE) ?>" class="button button-primary button-hero" title="<? _e('Install now', 'LayerSlider') ?>">
  38. <?php _e('Install now', 'LayerSlider') ?>
  39. </a>
  40. </p>
  41. <div class="clear"></div>
  42. </div>
  43. <?php
  44. }
  45. }
  46. }
  47. function layerslider_unauthorized_update_notice() {
  48. if(!get_option('layerslider-authorized-site', false)) {
  49. $latest = get_option('ls-latest-version', false);
  50. if($latest && version_compare(LS_PLUGIN_VERSION, $latest, '<')) {
  51. $last_notification = get_option('ls-last-update-notification', LS_PLUGIN_VERSION);
  52. if(version_compare($last_notification, $latest, '<')) {
  53. ?>
  54. <div class="layerslider_notice">
  55. <img src="<?php echo LS_ROOT_URL.'/static/img/ls_80x80.png' ?>" alt="LayerSlider icon">
  56. <h1><?php _e('An update is available for LayerSlider WP!', 'LayerSlider') ?></h1>
  57. <p>
  58. <?php echo sprintf(__('You have version %1$s. The latest version is %2$s.', 'LayerSlider'), LS_PLUGIN_VERSION, $latest); ?><br>
  59. <i><?php _e('New releases contain new features, bug fixes and various improvements across the entire plugin.', 'LayerSlider') ?></i>
  60. <i><?php _e("Set up auto-updates to upgrade to this new version, or request it from the author of your theme if you've received LayerSlider from them.", "LayerSlider") ?> <a href="http://support.kreaturamedia.com/docs/layersliderwp/documentation.html#updating" target="_blank"><? _e('Click here', 'LayerSlider') ?></a> <?php _e('to learn more', 'LayerSlider') ?></a>.</i>
  61. <a href="<?php echo wp_nonce_url('?page=layerslider&action=hide-update-notice', 'hide-update-notice') ?>" class="button button-extra"><?php _e('Hide this message', 'LayerSlider') ?></a>
  62. </p>
  63. <div class="clear"></div>
  64. </div><?php
  65. }
  66. }
  67. }
  68. }
  69. function layerslider_compatibility_notice() { ?>
  70. <div class="layerslider_notice">
  71. <img src="<?php echo LS_ROOT_URL.'/static/img/ls_80x80.png' ?>" alt="LayerSlider icon">
  72. <h1><?php _e('The new version of LayerSlider WP is almost ready!', 'LayerSlider') ?></h1>
  73. <p>
  74. <?php _e('For a faster and more reliable solution, LayerSlider WP needs to convert your data associated with the plugin. Your sliders and settings will remain still, and it only takes a click on this button.', 'LayerSlider') ?>
  75. <a href="<?php echo wp_nonce_url('?page=layerslider&action=convert', 'convertoldsliders') ?>" class="button button-primary button-hero">
  76. <?php _e('Convert Data', 'LayerSlider') ?>
  77. </a>
  78. </p>
  79. <div class="clear"></div>
  80. </div>
  81. <?php }
  82. function layerslider_dependency_notice() {
  83. if(version_compare(PHP_VERSION, '5.0.0', '<') || !class_exists('DOMDocument')) {
  84. ?>
  85. <div class="layerslider_notice">
  86. <img src="<?php echo LS_ROOT_URL.'/static/img/ls_80x80.png' ?>" alt="LayerSlider icon">
  87. <h1><?php _e('Server configuration issues detected!', 'LayerSlider') ?></h1>
  88. <p>
  89. <?php _e('phpQuery, an external library in LayerSlider, have unmet dependencies. It requires PHP5 with the following extensions installed: PHP DOM extension, PHP Multibyte String extension. Please contact with your hosting provider to resolve these dependencies, as it will likely prevent LayerSlider from functioning properly.', 'LayerSlider') ?>
  90. <strong><?php _e('This issue could result a blank page in slider builder.', 'LayerSlider') ?></strong>
  91. </p>
  92. <div class="clear"></div>
  93. </div>
  94. <?php } }
  95. function layerslider_premium_support() {
  96. if(get_user_meta(get_current_user_id(), 'layerslider_help_wp_pointer', true)) {
  97. ?>
  98. <div class="layerslider_notice">
  99. <img src="<?php echo LS_ROOT_URL.'/static/img/ls_80x80.png' ?>" alt="LayerSlider icon">
  100. <h1><?php _e('Would you like to receive automatic updates and premium support?', 'LayerSlider') ?></h1>
  101. <p>
  102. <?php _e("By activating the plugin with your Item Purchase Code you can receive update notifications with one-click installation and better support services. This is optional and not needed if you've received LayerSlider bundled with a theme.", "LayerSlider") ?>
  103. <a href="<?php echo wp_nonce_url('?page=layerslider&action=hide-support-notice', 'hide-support-notice') ?>" class="button button-primary button-hero">Hide this message</a>
  104. </p>
  105. <div class="clear"></div>
  106. </div>
  107. <?php } }
  108. function layerslider_plugins_purchase_notice($plugin_file, $plugin_data, $status){
  109. $table = _get_list_table('WP_Plugins_List_Table');
  110. ?>
  111. <tr class="plugin-update-tr"><td colspan="<?php echo $table->get_column_count(); ?>" class="plugin-update colspanchange">
  112. <div class="update-message ls-plugins-screen-notice">
  113. <?php
  114. printf(__('You need to authorize this site in order to get upgrades or support for this plugin. %sPurchase a license%s or %senter an existing purchase code%s.', 'installer'),
  115. '<a href="http://codecanyon.net/item/layerslider-responsive-wordpress-slider-plugin-/1362246" target="_blank">', '</a>', '<a href="'.admin_url('admin.php?page=layerslider').'">', '</a>');
  116. ?>
  117. </div>
  118. </tr>
  119. <?php } ?>