PluginProbe
UpStream: a Project Management Plugin for WordPress / 2.1.0
UpStream: a Project Management Plugin for WordPress v2.1.0
trunk 1.39.0 1.39.1 1.39.2 1.39.3 2.0.7 2.1.0
upstream / includes / admin / options / class-upstream-options-import.php

class-upstream-options-import.php in UpStream: a Project Management Plugin for WordPress 2.1.0, at includes/admin/options/class-upstream-options-import.php

136 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * UpStream_Options_Import
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_Import' ) ) :
14
15 /**
16 * CMB2 Theme Options
17 *
18 * @version 0.1.0
19 */
20 class UpStream_Options_Import {
21
22 /**
23 * Array of metaboxes/fields
24 *
25 * @var array
26 */
27 public $id = 'upstream_import';
28
29 /**
30 * Page title
31 *
32 * @var string
33 */
34 protected $title = '';
35
36 /**
37 * Menu Title
38 *
39 * @var string
40 */
41 protected $menu_title = '';
42
43 /**
44 * Menu Title
45 *
46 * @var string
47 */
48 protected $description = '';
49
50 /**
51 * Holds an instance of the object
52 *
53 * @var Myprefix_Admin
54 **/
55 public static $instance = null;
56
57 /**
58 * Constructor
59 *
60 * @since 0.1.0
61 */
62 public function __construct() {
63 // Set our title.
64 $this->title = __( 'Import', 'upstream' );
65 $this->menu_title = $this->title;
66 }
67
68 /**
69 * Returns the running object
70 *
71 * @return Myprefix_Admin
72 **/
73 public static function get_instance() {
74 if ( is_null( self::$instance ) ) {
75 self::$instance = new self();
76 }
77
78 return self::$instance;
79 }
80
81 /**
82 * Add the options metabox to the array of metaboxes
83 *
84 * @since 0.1.0
85 */
86 public function options() {
87 $options = apply_filters(
88 $this->id . '_option_fields',
89 array(
90 'id' => $this->id,
91 'title' => $this->title,
92 'menu_title' => $this->menu_title,
93 'desc' => $this->description,
94 'show_on' => array(
95 'key' => 'options-page',
96 'value' => array( $this->id ),
97 ),
98 'show_names' => true,
99 'fields' => array(
100 array(
101 'before_row' => sprintf(
102 '<h3>%s</h3><p>%s</p>',
103 __( 'Import from File', 'upstream' ),
104 __( 'Import data from a file.', 'upstream' )
105 ),
106 'name' => __( 'File to Import', 'upstream' ),
107 'id' => 'import_file',
108 'type' => 'file',
109 'desc' => __(
110 'Upload a file to import. Must be one of the valid formats you can find on our website.',
111 'upstream'
112 ),
113 ),
114 array(
115 'name' => __( 'Perform Import', 'upstream' ),
116 'id' => 'perform_import',
117 'type' => 'up_button',
118 'label' => __( 'Perform Import', 'upstream' ),
119 'desc' => __(
120 'Click this to perform the import.',
121 'upstream'
122 ),
123 'onclick' => 'upstream_import_file(event);',
124 'nonce' => wp_create_nonce( 'upstream_import_file' ),
125 ),
126
127 ),
128 )
129 );
130
131 return $options;
132 }
133 }
134
135 endif;
136