PluginProbe ʕ •ᴥ•ʔ
Code Manager / 1.0.43
Code Manager v1.0.43
1.0.47 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.25 1.0.26 1.0.27 1.0.28 1.0.3 1.0.30 1.0.31 1.0.32 1.0.33 1.0.34 1.0.35 1.0.36 1.0.37 1.0.38 1.0.39 1.0.4 1.0.40 1.0.41 1.0.42 1.0.43 1.0.44 1.0.45 1.0.46 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
code-manager / Code_Manager / Code_Manager_Import.php
code-manager / Code_Manager Last commit date
Code_Manager.php 11 months ago Code_Manager_Dashboard.php 11 months ago Code_Manager_Export.php 11 months ago Code_Manager_Form.php 11 months ago Code_Manager_Import.php 11 months ago Code_Manager_Import_File.php 11 months ago Code_Manager_List.php 11 months ago Code_Manager_List_View.php 11 months ago Code_Manager_Model.php 11 months ago Code_Manager_Preview.php 11 months ago Code_Manager_Settings.php 11 months ago Code_Manager_Tabs.php 11 months ago Message_Box.php 11 months ago WP_List_Table.php 11 months ago
Code_Manager_Import.php
51 lines
1 <?php
2 /**
3 * Code Manager import code
4 *
5 * @package Code_Manager
6 */
7
8 namespace Code_Manager {
9
10 /**
11 * Class Code_Manager_Import
12 *
13 * Add import feature to plugin (reached from list table).
14 *
15 * @author Peter Schulz
16 * @since 1.0.0
17 */
18 class Code_Manager_Import {
19
20 /**
21 * Start import
22 *
23 * @return void
24 */
25 public static function import() {
26 if ( isset( $_FILES['filename'], $_FILES['filename']['error'], $_FILES['filename']['tmp_name'] ) &&
27 UPLOAD_ERR_OK === $_FILES['filename']['error']
28 && is_uploaded_file( sanitize_text_field( wp_unslash( $_FILES['filename']['tmp_name'] ) ) )
29 ) {
30 // Get file content.
31 $import_file = new Code_Manager_Import_File(
32 sanitize_text_field( wp_unslash( $_FILES['filename']['tmp_name'] ) )
33 );
34 $import_file->import();
35 } else {
36 // File upload failed.
37 $msg = new Message_Box(
38 array(
39 'message_text' => __( 'File upload failed', 'code-manager' ),
40 'message_type' => 'error',
41 'message_is_dismissible' => false,
42 )
43 );
44 $msg->box();
45 }
46 }
47
48 }
49
50 }
51