/**
  * Initialize the class and set its properties.
  *
  * @since    1.0.0
  * @var      string    $plugin_slug    The name of the plugin.
  * @var      string    $version        The version of this plugin.
  */
 public function __construct($plugin)
 {
     $this->plugin = $plugin;
     $this->plugin_slug = $this->plugin->get('slug');
     $this->plugin_name = $this->plugin->get('name');
     $this->version = $this->plugin->get('version');
 }
Пример #2
0
/**
 * Begins execution of the plugin.
 *
 * Since everything within the plugin is registered via hooks,
 * then kicking off the plugin from this point in the file does
 * not affect the page life cycle.
 *
 * @since    1.0.0
 */
function run_rest_api_enabler()
{
    // Pass main plugin file through to plugin class for later use.
    $args = array('plugin_file' => __FILE__);
    $plugin = REST_API_Enabler::get_instance($args);
    $plugin->run();
}
    /**
     * Output post meta checkboxes in columns.
     *
     * @since 1.0.0
     *
     * @return string HTML output for post meta checkboxes.
     */
    private function do_post_meta_checkboxes()
    {
        // Break up post meta into groups for columns.
        $post_meta_keys = $this->plugin->get_post_meta_keys();
        $post_meta_count = count($post_meta_keys);
        $post_meta_groups = array_chunk($post_meta_keys, (int) ceil($post_meta_count / 3));
        foreach ($post_meta_groups as $post_meta_keys) {
            ?>
			<div class="rae-col">
			<?php 
            foreach ($post_meta_keys as $post_meta_key) {
                $args = array('id' => 'post_meta_individual', 'secondary_id' => $post_meta_key, 'description' => $post_meta_key, 'save_null' => true);
                $this->render_checkbox($args);
                echo '<br />';
            }
            ?>
			</div>
			<?php 
        }
    }
Пример #4
0
 /**
  * Creates or returns an instance of this class.
  *
  * @return    REST_API_Enabler    A single instance of this class.
  */
 public static function get_instance($args = array())
 {
     if (null == self::$instance) {
         self::$instance = new self($args);
     }
     return self::$instance;
 }