<?php

$options = WP_Buoy_Settings::get_instance();
?>
<form id="activate-alert-form" action="<?php 
print esc_attr(admin_url('admin-ajax.php'));
?>
" method="POST">
    <?php 
wp_nonce_field(self::$prefix . '_new_alert', self::$prefix . '_nonce');
?>
    <input type="hidden"
        name="action"
        value="<?php 
print esc_attr(self::$prefix);
?>
_new_alert"
    />

    <div id="modal-features" class="hidden">
        <?php 
if ($options->get('future_alerts')) {
    ?>
        <button id="schedule-future-alert-btn" class="btn" type="button">
            <img src="<?php 
    print esc_attr(plugins_url('../img/stock_alarm.svg', __FILE__));
    ?>
" alt="<?php 
    esc_attr_e('Schedule timed alert', 'buoy');
    ?>
" />
 /**
  * Enqueues the Bootstrap framework CSS and JavaScript.
  *
  * @link https://getbootstrap.com/
  *
  * @return void
  */
 public static function enqueueBootstrapFramework()
 {
     // Enqueue BootstrapCSS/JS framework.
     wp_enqueue_style('bootstrap-css', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');
     wp_enqueue_script('bootstrap-js', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js', array(), null, true);
     if (is_ssl() || WP_Buoy_Settings::get_instance()->get('debug')) {
         add_filter('style_loader_tag', array(__CLASS__, 'addIntegrityAttribute'), 9999, 2);
         add_filter('script_loader_tag', array(__CLASS__, 'addIntegrityAttribute'), 9999, 2);
     }
 }
 /**
  * Enqueues the Bootstrap CSS and JavaScript framework resources,
  * along with jQuery and Google library plugins used for Alert UI.
  *
  * @todo Should this kind of utility loader be moved into its own class?
  *
  * @return void
  */
 public static function enqueueFrameworkScripts()
 {
     // Enqueue jQuery plugins.
     wp_enqueue_style('jquery-datetime-picker', plugins_url('includes/jquery.datetimepicker.css', __FILE__));
     wp_enqueue_script('jquery-datetime-picker', plugins_url('includes/jquery.datetimepicker.full.min.js', __FILE__), array('jquery'), null, true);
     // Enqueue BootstrapCSS/JS framework.
     wp_enqueue_style('bootstrap-css', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');
     wp_enqueue_script('bootstrap-js', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js', array(), null, true);
     wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?language=' . get_locale(), array(), null, true);
     // Enqueue a custom pulse loader CSS animation.
     wp_enqueue_style(self::$prefix . '-pulse-loader', plugins_url('includes/pulse-loader.css', __FILE__));
     if (is_ssl() || WP_Buoy_Settings::get_instance()->get('debug')) {
         add_filter('style_loader_tag', array(__CLASS__, 'addIntegrityAttribute'), 9999, 2);
         add_filter('script_loader_tag', array(__CLASS__, 'addIntegrityAttribute'), 9999, 2);
     }
 }
<?php

/**
 * Buoy uninstaller.
 *
 * @package WordPress\Plugin\WP_Buoy_Plugin\Uninstaller
 */
// Don't execute any uninstall code unless WordPress core requests it.
if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
require_once plugin_dir_path(__FILE__) . 'buoy.php';
require_once plugin_dir_path(__FILE__) . 'class-buoy-settings.php';
require_once plugin_dir_path(__FILE__) . 'class-buoy-user-settings.php';
$my_prefix = WP_Buoy_Plugin::$prefix;
$post_types = array("{$my_prefix}_alert", "{$my_prefix}_team");
$posts = get_posts(array('post_type' => $post_types, 'post_status' => get_post_stati(), 'posts_per_page' => -1));
foreach ($posts as $post) {
    wp_delete_post($post->ID, true);
}
// Delete plugin options.
delete_option(WP_Buoy_Settings::get_instance()->meta_key);
foreach (get_users() as $usr) {
    // Delete all custom user profile data.
    $usropt = new WP_Buoy_User_Settings($usr);
    foreach ($usropt->default as $k => $v) {
        $usropt->delete($k);
    }
    $usropt->save();
}
 /**
  * Gets the instance of this object.
  *
  * @return WP_Buoy_Settings
  */
 public static function get_instance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 /**
  * Outputs the <meta> tag for refreshing the chat room automatically.
  *
  * @todo The default refresh rate could (should?) become an admin
  *       option configurable via the plugin's settings page.
  *
  *       Is there a way to go to the #page-footer upon reresh by setting the url here?
  *       Placing it in the meta tag here doesn't seem to work (browser ignores it?)
  *
  * @return void
  */
 public static function renderMetaRefresh()
 {
     /**
      * Filters the chat room refresh rate.
      */
     $refresh = apply_filters(self::$prefix . '_chat_room_meta_refresh_rate', 5);
     /**
      * Filters the URL to which the chat room reloads to.
      */
     $url = apply_filters(self::$prefix . '_chat_room_meta_refresh_url', $_SERVER['REQUEST_URI']);
     $html = '<meta http-equiv="refresh" content="%1$s;url=%2$s" />';
     $options = WP_Buoy_Settings::get_instance();
     if ($options->get('debug')) {
         return;
         // don't print anything
     }
     print sprintf($html, $refresh, str_replace('&reset', '', $url));
 }
Exemple #7
0
 /**
  * Prints a message to the WordPress debug log if the plugin's
  * "detailed debugging" setting is enabled.
  *
  * By default, the WordPress debug log is `wp-content/debug.log`
  * relative to the WordPress installation root (`ABSPATH`).
  *
  * @link https://codex.wordpress.org/Debugging_in_WordPress
  *
  * @uses WP_Buoy_Settings::get()
  *
  * @param string $message
  *
  * @return void
  */
 protected static function debug_log($message)
 {
     if (WP_Buoy_Settings::get_instance()->get('debug')) {
         error_log(static::error_msg($message));
     }
 }
 /**
  * Ensures default "Safety Information" exists.
  */
 public function test_default_safety_information_exists()
 {
     $this->assertNotEmpty(WP_Buoy_Settings::get_instance()->get('safety_info'));
 }