| 1 |
<?php |
| 2 |
/** |
| 3 |
* UpStream_Options_Milestones |
| 4 |
* |
| 5 |
* @package UpStream |
| 6 |
*/ |
| 7 |
|
| 8 |
// Exit if accessed directly. |
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
if ( ! class_exists( 'UpStream_Options_Milestones' ) ) : |
| 14 |
|
| 15 |
/** |
| 16 |
* CMB2 Theme Options |
| 17 |
* |
| 18 |
* @version 0.1.0 |
| 19 |
*/ |
| 20 |
class UpStream_Options_Milestones { |
| 21 |
|
| 22 |
|
| 23 |
/** |
| 24 |
* Array of metaboxes/fields |
| 25 |
* |
| 26 |
* @var array |
| 27 |
*/ |
| 28 |
public $id = 'upstream_milestones'; |
| 29 |
|
| 30 |
/** |
| 31 |
* Page title |
| 32 |
* |
| 33 |
* @var string |
| 34 |
*/ |
| 35 |
protected $title = ''; |
| 36 |
|
| 37 |
/** |
| 38 |
* Menu Title |
| 39 |
* |
| 40 |
* @var string |
| 41 |
*/ |
| 42 |
protected $menu_title = ''; |
| 43 |
|
| 44 |
/** |
| 45 |
* Menu Title |
| 46 |
* |
| 47 |
* @var string |
| 48 |
*/ |
| 49 |
protected $description = ''; |
| 50 |
|
| 51 |
/** |
| 52 |
* Holds an instance of the object |
| 53 |
* |
| 54 |
* @var Myprefix_Admin |
| 55 |
**/ |
| 56 |
public static $instance = null; |
| 57 |
|
| 58 |
/** |
| 59 |
* Constructor |
| 60 |
* |
| 61 |
* @since 0.1.0 |
| 62 |
*/ |
| 63 |
public function __construct() { |
| 64 |
// Set our title. |
| 65 |
$this->title = upstream_milestone_label_plural(); |
| 66 |
$this->menu_title = $this->title; |
| 67 |
// $this->description = sprintf( __( '%s Description', 'upstream' ), upstream_milestone_label() ); |
| 68 |
} |
| 69 |
|
| 70 |
/** |
| 71 |
* Returns the running object |
| 72 |
* |
| 73 |
* @return Myprefix_Admin |
| 74 |
**/ |
| 75 |
public static function get_instance() { |
| 76 |
if ( is_null( self::$instance ) ) { |
| 77 |
self::$instance = new self(); |
| 78 |
} |
| 79 |
|
| 80 |
return self::$instance; |
| 81 |
} |
| 82 |
|
| 83 |
/** |
| 84 |
* Add the options metabox to the array of metaboxes |
| 85 |
* |
| 86 |
* @since 0.1.0 |
| 87 |
*/ |
| 88 |
public function options() { |
| 89 |
$options = apply_filters( |
| 90 |
$this->id . '_option_fields', |
| 91 |
array( |
| 92 |
'id' => $this->id, // upstream_milestones. |
| 93 |
'title' => $this->title, |
| 94 |
'menu_title' => $this->menu_title, |
| 95 |
'desc' => $this->description, |
| 96 |
'show_on' => array( |
| 97 |
'key' => 'options-page', |
| 98 |
'value' => array( $this->id ), |
| 99 |
), |
| 100 |
'show_names' => true, |
| 101 |
'fields' => array( |
| 102 |
array( |
| 103 |
'name' => upstream_milestone_label_plural(), |
| 104 |
'id' => 'milestone_title', |
| 105 |
'type' => 'title', |
| 106 |
), |
| 107 |
array( |
| 108 |
'name' => 'Milestone Categories', |
| 109 |
'id' => 'enable_milestone_categories', |
| 110 |
'type' => 'radio', |
| 111 |
'description' => '', |
| 112 |
'options' => array( |
| 113 |
'1' => __( 'Enabled', 'upstream' ), |
| 114 |
'0' => __( 'Disabled', 'upstream' ), |
| 115 |
), |
| 116 |
'default' => '0', |
| 117 |
), |
| 118 |
), |
| 119 |
) |
| 120 |
); |
| 121 |
|
| 122 |
return $options; |
| 123 |
} |
| 124 |
} |
| 125 |
|
| 126 |
endif; |
| 127 |
|