PluginProbe
Boxzilla – WordPress Popup Builder / 3.2.21
Boxzilla – WordPress Popup Builder v3.2.21
3.4.11 3.4.10 3.4.9 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 trunk 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 All 72 releases
← All changes | src/admin/class-installer.php +75 -77 3.4.53.2.21 View file →
@@ -1,96 +1,94 @@
1 1 <?php
2 2
3 +
3 4 namespace Boxzilla\Admin;
4 5
5 -class Installer
6 -{
7 - /**
8 - * Run the installer
9 - */
10 - public static function run()
11 - {
12 - $installer = new self();
13 - $installer->install();
14 - }
6 +class Installer {
15 7
16 - /**
17 - * The main install method
18 - */
19 - public function install()
20 - {
21 8
22 - // don't install sample boxes on multisite
23 - if (is_multisite()) {
24 - return;
25 - }
9 + /**
10 + * Run the installer
11 + */
12 + public static function run() {
13 + $installer = new self;
14 + $installer->install();
15 + }
26 16
27 - $this->transfer_from_stb();
28 - $this->create_sample_box();
29 - }
17 + /**
18 + * The main install method
19 + */
20 + public function install() {
30 21
31 - /**
32 - *
33 - */
34 - public function transfer_from_stb()
35 - {
36 - global $wpdb;
22 + // don't install sample boxes on multisite
23 + if ( is_multisite() ) {
24 + return;
25 + }
37 26
38 - // transfer post types
39 - $query = $wpdb->prepare("UPDATE {$wpdb->posts} SET post_type = %s WHERE post_type = %s", 'boxzilla-box', 'scroll-triggered-box');
40 - $wpdb->query($query);
27 + $this->transfer_from_stb();
28 + $this->create_sample_box();
29 + }
41 30
42 - // transfer post meta
43 - $query = $wpdb->prepare("UPDATE {$wpdb->postmeta} SET meta_key = %s WHERE meta_key = %s", 'boxzilla_options', 'stb_options');
44 - $wpdb->query($query);
31 + /**
32 + *
33 + */
34 + public function transfer_from_stb() {
35 + global $wpdb;
45 36
46 - // transfer rules
47 - $query = $wpdb->prepare("UPDATE {$wpdb->options} SET option_name = %s WHERE option_name = %s", 'boxzilla_rules', 'stb_rules');
48 - $wpdb->query($query);
49 - }
37 + // transfer post types
38 + $query = $wpdb->prepare( "UPDATE {$wpdb->posts} SET post_type = %s WHERE post_type = %s", 'boxzilla-box', 'scroll-triggered-box' );
39 + $wpdb->query( $query );
50 40
51 - /**
52 - * @return bool
53 - */
54 - protected function create_sample_box()
55 - {
41 + // transfer post meta
42 + $query = $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_key = %s WHERE meta_key = %s", 'boxzilla_options', 'stb_options' );
43 + $wpdb->query( $query );
56 44
57 - // only create sample box if no boxes were found
58 - $boxes = get_posts(
59 - [
60 - 'post_type' => 'boxzilla-box',
61 - 'post_status' => [ 'publish', 'draft' ],
62 - ]
63 - );
45 + // transfer rules
46 + $query = $wpdb->prepare( "UPDATE {$wpdb->options} SET option_name = %s WHERE option_name = %s", 'boxzilla_rules', 'stb_rules' );
47 + $wpdb->query( $query );
48 + }
64 49
65 - if (! empty($boxes)) {
66 - return false;
67 - }
50 + /**
51 + * @return bool
52 + */
53 + protected function create_sample_box() {
68 54
69 - $box_id = wp_insert_post(
70 - [
71 - 'post_type' => 'boxzilla-box',
72 - 'post_title' => 'Sample Box',
73 - 'post_content' => '<h4>Hello world.</h4><p>This is a sample box, with some sample content in it.</p>',
74 - 'post_status' => 'draft',
75 - ]
76 - );
55 + // only create sample box if no boxes were found
56 + $boxes = get_posts(
57 + array(
58 + 'post_type' => 'boxzilla-box',
59 + 'post_status' => array( 'publish', 'draft' ),
60 + )
61 + );
77 62
78 - // set box settings
79 - $settings = [
80 - 'css' => [
81 - 'background_color' => '#edf9ff',
82 - 'color' => '',
83 - 'width' => '340',
84 - 'border_color' => '#dd7575',
85 - 'border_width' => '4',
86 - 'border_style' => 'dashed',
87 - 'position' => 'bottom-right',
88 - 'manual' => '',
89 - ],
90 - ];
63 + if ( ! empty( $boxes ) ) {
64 + return false;
65 + }
91 66
92 - update_post_meta($box_id, 'boxzilla_options', $settings);
67 + $box_id = wp_insert_post(
68 + array(
69 + 'post_type' => 'boxzilla-box',
70 + 'post_title' => 'Sample Box',
71 + 'post_content' => '<h4>Hello world.</h4><p>This is a sample box, with some sample content in it.</p>',
72 + 'post_status' => 'draft',
73 + )
74 + );
93 75
94 - return true;
95 - }
76 + // set box settings
77 + $settings = array(
78 + 'css' => array(
79 + 'background_color' => '#edf9ff',
80 + 'color' => '',
81 + 'width' => '340',
82 + 'border_color' => '#dd7575',
83 + 'border_width' => '4',
84 + 'border_style' => 'dashed',
85 + 'position' => 'bottom-right',
86 + 'manual' => '',
87 + ),
88 + );
89 +
90 + update_post_meta( $box_id, 'boxzilla_options', $settings );
91 +
92 + return true;
93 + }
96 94 }