public function run_sweep($items)
 {
     $sweep = new WPSweep();
     foreach ($items as $key => $value) {
         $count = $sweep->count($value);
         if ($count !== 0 && $count !== "0") {
             $message = $sweep->sweep($value);
             WP_CLI::success($message);
         }
     }
 }
 /**
  * Initializes the plugin object and returns its instance
  *
  * @since 1.0.0
  *
  * @access public
  * @return object The plugin object instance
  */
 public static function get_instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Exemple #3
0
                <td>
                    <strong><?php 
_e('Transient Options', 'wp-sweep');
?>
</strong>
                    <p class="sweep-details" style="display: none;"></p>
                </td>
                <td>
                    <span class="sweep-count"><?php 
echo number_format_i18n($transient_options);
?>
</span>
                </td>
                <td>
                    <span class="sweep-percentage"><?php 
echo WPSweep::get_instance()->format_percentage($transient_options, $total_options);
?>
</span>
                </td>
                <td>
                    <?php 
if (!empty($transient_options)) {
    ?>
                        <button data-action="sweep" data-sweep_name="transient_options" data-sweep_type="options" data-nonce="<?php 
    echo wp_create_nonce('wp_sweep_transient_options');
    ?>
" class="button button-primary btn-sweep"><?php 
    _e('Sweep', 'wp-sweep');
    ?>
</button>
                        <button data-action="sweep_details" data-sweep_name="transient_options" data-sweep_type="options" data-nonce="<?php