# boxzilla/trunk/src/admin/class-installer.php

Boxzilla – WordPress Popup Builder, version trunk. 93 lines.

- Page: https://pluginprobe.com/plugins/boxzilla/trunk/code/src/admin/class-installer.php
- Raw: https://pluginprobe.com/plugins/boxzilla/trunk/raw/src/admin/class-installer.php
- Modified: 2026-05-20T09:51:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/boxzilla/trunk/code/src/admin/class-installer.php#L10-L20`.

```php
<?php

namespace Boxzilla\Admin;

class Installer
{
    /**
     * Run the installer
     */
    public static function run()
    {
        $installer = new self();
        $installer->install();
    }

    /**
     * The main install method
     */
    public function install()
    {
        // don't install sample boxes on multisite
        if (is_multisite()) {
            return;
        }

        $this->transfer_from_stb();
        $this->create_sample_box();
    }

    /**
     *
     */
    public function transfer_from_stb()
    {
        global $wpdb;

        // transfer post types
        $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET post_type = %s WHERE  post_type = %s", 'boxzilla-box', 'scroll-triggered-box'));

        // transfer post meta
        $wpdb->query($wpdb->prepare("UPDATE {$wpdb->postmeta} SET meta_key = %s WHERE meta_key = %s", 'boxzilla_options', 'stb_options'));

        // transfer rules
        $wpdb->query($wpdb->prepare("UPDATE {$wpdb->options} SET option_name = %s WHERE option_name = %s", 'boxzilla_rules', 'stb_rules'));
    }

    /**
     * @return bool
     */
    protected function create_sample_box()
    {

        // only create sample box if no boxes were found
        $boxes = get_posts(
            [
                'post_type'   => 'boxzilla-box',
                'post_status' => [ 'publish', 'draft' ],
            ]
        );

        if (! empty($boxes)) {
            return false;
        }

        $box_id = wp_insert_post(
            [
                'post_type'    => 'boxzilla-box',
                'post_title'   => 'Sample Box',
                'post_content' => '<h4>Hello world.</h4><p>This is a sample box, with some sample content in it.</p>',
                'post_status'  => 'draft',
            ]
        );

        // set box settings
        $settings = [
            'css' => [
                'background_color' => '#edf9ff',
                'color'            => '',
                'width'            => '340',
                'border_color'     => '#dd7575',
                'border_width'     => '4',
                'border_style'     => 'dashed',
                'position'         => 'bottom-right',
                'manual'           => '',
            ],
        ];

        update_post_meta($box_id, 'boxzilla_options', $settings);

        return true;
    }
}

```
