コード例 #1
0
 static function migrate()
 {
     global $wpdb;
     $old_table = maxUtils::get_buttons_table_name(true);
     $table = maxUtils::get_buttons_table_name();
     if (!self::maxbuttons_database_table_exists($old_table)) {
         return;
     }
     $sql = "SELECT id from {$table}";
     $result = $wpdb->get_results($sql, ARRAY_A);
     if (count($result) > 0) {
         return;
     }
     // don't do this if table already has data.
     $sql = "SELECT * FROM {$old_table}";
     $rows = $wpdb->get_results($sql, ARRAY_A);
     if (count($rows) == 0) {
         // no button in all table; all is good.
         return true;
     }
     foreach ($rows as $row) {
         $data = static::convertOldFields($row);
         $id = $data["id"];
         global $wpdb;
         $wpdb->insert($table, array("id" => $id));
         //$data = apply_filters("mb-migration-data",$data, $row);
         $button = new maxButton();
         $button->set($id);
         $button->save($data);
     }
 }
コード例 #2
0
    $install::migrate();
}
if (isset($_POST["replace"]) && check_admin_referer('mb_bulk_edit', 'bulk_edit')) {
    $search = $_POST["search"];
    $replace = $_POST["replace"];
    $field = $_POST["replace_field"];
    $button = new maxButton();
    if ($field == '') {
        exit("FATAL");
    }
    $admin = MB()->getClass('admin');
    $buttonsIDS = $admin->getButtons(array('limit' => -1));
    $data_found = false;
    foreach ($buttonsIDS as $row) {
        $button_id = $row["id"];
        $button->set($button_id);
        $data = $button->get();
        foreach ($data as $block => $fields) {
            if (isset($fields[$field])) {
                $value = $fields[$field];
                $data[$block][$field] = str_replace($search, $replace, $value);
                $button->update($data);
                //echo "UPDATE $field of $block with ($search) - $replace - ($value) <br>";
                $data_found = true;
                continue;
            }
            if ($data_found) {
                $data_found = false;
                continue;
            }
        }
コード例 #3
0
<?php

$result = '';
exit("Not used");
$button = new maxButton();
if ($_POST) {
    if (isset($_POST['button-id']) && isset($_POST['bulk-action-select'])) {
        if ($_POST['bulk-action-select'] == 'restore') {
            $count = 0;
            foreach ($_POST['button-id'] as $id) {
                $button->set($id);
                $button->setStatus('publish');
                //maxbuttons_button_restore($id);
                $count++;
            }
            if ($count == 1) {
                $result = __('Restored 1 button.', 'maxbuttons');
            }
            if ($count > 1) {
                $result = __('Restored ', 'maxbuttons') . $count . __(' buttons.', 'maxbuttons');
            }
        }
        if ($_POST['bulk-action-select'] == 'delete') {
            $count = 0;
            foreach ($_POST['button-id'] as $id) {
                $button->delete($id);
                $count++;
            }
            if ($count == 1) {
                $result = __('Deleted 1 button.', 'maxbuttons');
            }
コード例 #4
0
ファイル: advanced.php プロジェクト: pfurmel/MVCgroupwp
    public function admin_fields()
    {
        $data = $this->data[$this->blockname];
        foreach ($this->fields as $field => $options) {
            $default = isset($options["default"]) ? $options["default"] : '';
            ${$field} = isset($data[$field]) ? $data[$field] : $default;
            ${$field . "_default"} = $default;
            global $maxbuttons_container_alignments;
        }
        ?>
		
	
			<div class="option-container">
				<div class="title"><?php 
        _e('Advanced', 'maxbuttons');
        ?>
</div>
				<div class="inside">					
					<div class="option-design">
						<p class="note"><?php 
        _e('Adding !important to the button styles can help avoid potential conflicts with your theme styles.', 'maxbuttons');
        ?>
</p>
						<div class="label"><?php 
        _e('Use !important', 'maxbuttons');
        ?>
</div>
						<div class="input"><input type="checkbox" value="1" id="important_css" name="important_css" <?php 
        checked($important_css, 1);
        ?>
></div>
						<div class="clear"></div>
					</div>
					
					<div class="spacer big"></div>
					
					<div class="option-design">
						<p class="note"><?php 
        _e('By default, the CSS styles for the button are rendered within a &lt;style&gt; block in the HTML body. Enabling the "Use External CSS" option allows you to put the CSS code for the button into your theme stylesheet instead.', 'maxbuttons');
        ?>
</p>
						<div class="label"><?php 
        _e('Use External CSS', 'maxbuttons');
        ?>
</div>
						<div class="input"><input type="checkbox" id="external_css" name="external_css" value="1" <?php 
        checked($external_css, 1);
        ?>
></div>
						<div class="clear"></div>
					</div>
					
					<div class="option-design">
						<div class="label">&nbsp;</div>
						<div class="input"><a id="view_css_modal" name="view_css" href="#view_css" class="button" rel="leanModal"><?php 
        _e('View CSS', 'maxbuttons');
        ?>
</a></div>
						<div class="clear"></div>
						
						
					
						<div id="view_css" class="max-modal">
							<div class="modal_header">
								<?php 
        _e("External CSS", "maxbuttons");
        ?>
								<div class="modal_close tb-close-icon"></div>
							</div>

							<div class="note">
								<p><?php 
        _e('If the "Use External CSS" option is enabled for this button, copy and paste the CSS code below into your theme stylesheet.', 'maxbuttons');
        ?>
</p>
							</div>
							<textarea id="maxbutton-css">
							<?php 
        if (isset($this->data["id"])) {
            $id = $this->data["id"];
            $b = new maxButton();
            $b->set($id);
            $b->parse_button();
            $b->parse_css("preview");
            echo $b->getparsedCSS();
        } else {
            _e("Please save the button first", "maxbuttons");
        }
        ?>
</textarea>
						</div>

					</div>
				</div>
			</div>

<?php 
    }
コード例 #5
0
<?php

if (isset($_GET['id']) && $_GET['id'] != '') {
    $button_id = intval($_GET["id"]);
    // validation
    $button = new maxButton();
    $set = $button->set($button_id, '', 'trash');
    if (!$set) {
        exit("Restore failed");
    }
    $button->setStatus("publish");
}
?>
<script type="text/javascript">
	window.location = "<?php 
admin_url();
?>
admin.php?page=maxbuttons-controller&action=list&status=trash&message=1restore";
</script>
コード例 #6
0
<?php

if (isset($_GET['id']) && $_GET['id'] != '') {
    $button_id = intval($_GET["id"]);
    // validation
    $button = new maxButton();
    $result = $button->set($button_id);
    if ($result) {
        $button->setStatus('trash');
    }
}
?>
<script type="text/javascript">
	window.location = "<?php 
admin_url();
?>
admin.php?page=maxbuttons-controller&action=list&message=1";
</script>