コード例 #1
0
ファイル: maxbuttons.php プロジェクト: umairakhtar123/hova
function maxbuttons_button_delete_permanently($id)
{
    global $wpdb;
    $wpdb->query($wpdb->prepare("DELETE FROM " . maxbuttons_get_buttons_table_name() . " WHERE id = %d", $id));
}
コード例 #2
0
$gradient_end_rgba_hover = maxbuttons_hex2rgba($maxbutton_gradient_end_color_hover_value, $maxbutton_gradient_end_opacity_hover_value);
$redirect = false;
$button_id = isset($_GET['id']) ? $_GET['id'] : 0;
if ($_POST) {
    global $wpdb;
    $data = array('name' => $_POST[$maxbutton_name_key] != '' ? stripslashes($_POST[$maxbutton_name_key]) : __('Unnamed Button', 'maxbuttons'), 'description' => stripslashes($_POST[$maxbutton_description_key]), 'url' => stripslashes($_POST[$maxbutton_url_key]), 'text' => stripslashes($_POST[$maxbutton_text_key]), 'new_window' => $wpdb->escape($_POST[$maxbutton_new_window_key]), 'nofollow' => $wpdb->escape($_POST[$maxbutton_nofollow_key]), 'text_font_family' => $_POST[$maxbutton_text_font_family_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_font_family_key]) : $maxbutton_text_font_family_default, 'text_font_size' => $_POST[$maxbutton_text_font_size_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_font_size_key]) : $maxbutton_text_font_size_default, 'text_font_style' => $_POST[$maxbutton_text_font_style_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_font_style_key]) : $maxbutton_text_font_style_default, 'text_font_weight' => $_POST[$maxbutton_text_font_weight_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_font_weight_key]) : $maxbutton_text_font_weight_default, 'text_color' => $_POST[$maxbutton_text_color_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_color_key]) : $maxbutton_text_color_default, 'text_color_hover' => $_POST[$maxbutton_text_color_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_color_hover_key]) : $maxbutton_text_color_hover_default, 'text_shadow_offset_left' => $_POST[$maxbutton_text_shadow_offset_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_shadow_offset_left_key]) . 'px' : $maxbutton_text_shadow_offset_left_default, 'text_shadow_offset_top' => $_POST[$maxbutton_text_shadow_offset_top_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_shadow_offset_top_key]) . 'px' : $maxbutton_text_shadow_offset_top_default, 'text_shadow_width' => $_POST[$maxbutton_text_shadow_width_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_shadow_width_key]) . 'px' : $maxbutton_text_shadow_width_default, 'text_shadow_color' => $_POST[$maxbutton_text_shadow_color_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_shadow_color_key]) : $maxbutton_text_shadow_color_default, 'text_shadow_color_hover' => $_POST[$maxbutton_text_shadow_color_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_shadow_color_hover_key]) : $maxbutton_text_shadow_color_hover_default, 'text_padding_top' => $_POST[$maxbutton_text_padding_top_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_padding_top_key]) . 'px' : $maxbutton_text_padding_top_default, 'text_padding_bottom' => $_POST[$maxbutton_text_padding_bottom_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_padding_bottom_key]) . 'px' : $maxbutton_text_padding_bottom_default, 'text_padding_left' => $_POST[$maxbutton_text_padding_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_padding_left_key]) . 'px' : $maxbutton_text_padding_left_default, 'text_padding_right' => $_POST[$maxbutton_text_padding_right_key] != '' ? $wpdb->escape($_POST[$maxbutton_text_padding_right_key]) . 'px' : $maxbutton_text_padding_right_default, 'border_radius_top_left' => $_POST[$maxbutton_border_radius_top_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_radius_top_left_key]) . 'px' : $maxbutton_border_radius_top_left_default, 'border_radius_top_right' => $_POST[$maxbutton_border_radius_top_right_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_radius_top_right_key]) . 'px' : $maxbutton_border_radius_top_right_default, 'border_radius_bottom_left' => $_POST[$maxbutton_border_radius_bottom_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_radius_bottom_left_key]) . 'px' : $maxbutton_border_radius_bottom_left_default, 'border_radius_bottom_right' => $_POST[$maxbutton_border_radius_bottom_right_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_radius_bottom_right_key]) . 'px' : $maxbutton_border_radius_bottom_right_default, 'border_style' => $_POST[$maxbutton_border_style_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_style_key]) : $maxbutton_border_style_default, 'border_width' => $_POST[$maxbutton_border_width_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_width_key]) . 'px' : $maxbutton_border_width_default, 'border_color' => $_POST[$maxbutton_border_color_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_color_key]) : $maxbutton_border_color_default, 'border_color_hover' => $_POST[$maxbutton_border_color_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_border_color_hover_key]) : $maxbutton_border_color_hover_default, 'box_shadow_offset_left' => $_POST[$maxbutton_box_shadow_offset_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_box_shadow_offset_left_key]) . 'px' : $maxbutton_box_shadow_offset_left_default, 'box_shadow_offset_top' => $_POST[$maxbutton_box_shadow_offset_top_key] != '' ? $wpdb->escape($_POST[$maxbutton_box_shadow_offset_top_key]) . 'px' : $maxbutton_box_shadow_offset_top_default, 'box_shadow_width' => $_POST[$maxbutton_box_shadow_width_key] != '' ? $wpdb->escape($_POST[$maxbutton_box_shadow_width_key]) . 'px' : $maxbutton_box_shadow_width_default, 'box_shadow_color' => $_POST[$maxbutton_box_shadow_color_key] != '' ? $wpdb->escape($_POST[$maxbutton_box_shadow_color_key]) : $maxbutton_box_shadow_color_default, 'box_shadow_color_hover' => $_POST[$maxbutton_box_shadow_color_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_box_shadow_color_hover_key]) : $maxbutton_box_shadow_color_hover_default, 'gradient_start_color' => $_POST[$maxbutton_gradient_start_color_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_start_color_key]) : $maxbutton_gradient_start_color_default, 'gradient_start_color_hover' => $_POST[$maxbutton_gradient_start_color_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_start_color_hover_key]) : $maxbutton_gradient_start_color_hover_default, 'gradient_end_color' => $_POST[$maxbutton_gradient_end_color_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_end_color_key]) : $maxbutton_gradient_end_color_default, 'gradient_end_color_hover' => $_POST[$maxbutton_gradient_end_color_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_end_color_hover_key]) : $maxbutton_gradient_end_color_hover_default, 'gradient_stop' => $_POST[$maxbutton_gradient_stop_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_stop_key]) : $maxbutton_gradient_stop_default, 'gradient_start_opacity' => $_POST[$maxbutton_gradient_start_opacity_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_start_opacity_key]) : $maxbutton_gradient_start_opacity_default, 'gradient_end_opacity' => $_POST[$maxbutton_gradient_end_opacity_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_end_opacity_key]) : $maxbutton_gradient_end_opacity_default, 'gradient_start_opacity_hover' => $_POST[$maxbutton_gradient_start_opacity_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_start_opacity_hover_key]) : $maxbutton_gradient_start_opacity_hover_default, 'gradient_end_opacity_hover' => $_POST[$maxbutton_gradient_end_opacity_hover_key] != '' ? $wpdb->escape($_POST[$maxbutton_gradient_end_opacity_hover_key]) : $maxbutton_gradient_end_opacity_hover_default, 'container_enabled' => $wpdb->escape($_POST[$maxbutton_container_enabled_key]), 'container_width' => $_POST[$maxbutton_container_width_key] != '' ? $wpdb->escape($_POST[$maxbutton_container_width_key]) . 'px' : '', 'container_margin_top' => $_POST[$maxbutton_container_margin_top_key] != '' ? $wpdb->escape($_POST[$maxbutton_container_margin_top_key]) . 'px' : '', 'container_margin_right' => $_POST[$maxbutton_container_margin_right_key] != '' ? $wpdb->escape($_POST[$maxbutton_container_margin_right_key]) . 'px' : '', 'container_margin_bottom' => $_POST[$maxbutton_container_margin_bottom_key] != '' ? $wpdb->escape($_POST[$maxbutton_container_margin_bottom_key]) . 'px' : '', 'container_margin_left' => $_POST[$maxbutton_container_margin_left_key] != '' ? $wpdb->escape($_POST[$maxbutton_container_margin_left_key]) . 'px' : '', 'container_alignment' => $_POST[$maxbutton_container_alignment_key] != '' ? $wpdb->escape($_POST[$maxbutton_container_alignment_key]) : '', 'container_center_div_wrap_enabled' => $wpdb->escape($_POST[$maxbutton_container_center_div_wrap_enabled_key]), 'external_css' => $wpdb->escape($_POST[$maxbutton_external_css_key]), 'important_css' => $wpdb->escape($_POST[$maxbutton_important_css_key]));
    if ($_GET['id'] == '') {
        // This is a new button
        $wpdb->insert(maxbuttons_get_buttons_table_name(), $data);
        $button_id = $wpdb->insert_id;
    } else {
        // Updating an existing button
        $where = array('id' => $_GET['id']);
        $data_format = array('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s');
        $where_format = array('%d');
        $wpdb->update(maxbuttons_get_buttons_table_name(), $data, $where, $data_format, $where_format);
        $button_id = $_GET['id'];
    }
    $redirect = true;
}
function maxbuttons_strip_px($value)
{
    return rtrim($value, 'px');
}
?>

<script type="text/javascript">
	<?php 
if ($redirect == true) {
    ?>
		window.location = "<?php 
コード例 #3
0
<?php

if (isset($_GET['id']) && $_GET['id'] != '') {
    $button = maxbuttons_get_button($_GET['id']);
    $data = array('name' => $button->name, 'description' => $button->description, 'url' => $button->url, 'new_window' => $button->new_window, 'nofollow' => $button->nofollow, 'text' => $button->text, 'text_font_family' => $button->text_font_family, 'text_font_size' => $button->text_font_size, 'text_font_style' => $button->text_font_style, 'text_font_weight' => $button->text_font_weight, 'text_color' => $button->text_color, 'text_color_hover' => $button->text_color_hover, 'text_shadow_offset_left' => $button->text_shadow_offset_left, 'text_shadow_offset_top' => $button->text_shadow_offset_top, 'text_shadow_width' => $button->text_shadow_width, 'text_shadow_color' => $button->text_shadow_color, 'text_shadow_color_hover' => $button->text_shadow_color_hover, 'text_padding_top' => $button->text_padding_top, 'text_padding_bottom' => $button->text_padding_bottom, 'text_padding_left' => $button->text_padding_left, 'text_padding_right' => $button->text_padding_right, 'border_radius_top_left' => $button->border_radius_top_left, 'border_radius_top_right' => $button->border_radius_top_right, 'border_radius_bottom_left' => $button->border_radius_bottom_left, 'border_radius_bottom_right' => $button->border_radius_bottom_right, 'border_style' => $button->border_style, 'border_width' => $button->border_width, 'border_color' => $button->border_color, 'border_color_hover' => $button->border_color_hover, 'box_shadow_offset_left' => $button->box_shadow_offset_left, 'box_shadow_offset_top' => $button->box_shadow_offset_top, 'box_shadow_width' => $button->box_shadow_width, 'box_shadow_color' => $button->box_shadow_color, 'box_shadow_color_hover' => $button->box_shadow_color_hover, 'gradient_start_color' => $button->gradient_start_color, 'gradient_start_color_hover' => $button->gradient_start_color_hover, 'gradient_end_color' => $button->gradient_end_color, 'gradient_end_color_hover' => $button->gradient_end_color_hover, 'gradient_start_opacity' => $button->gradient_start_opacity, 'gradient_end_opacity' => $button->gradient_end_opacity, 'gradient_start_opacity_hover' => $button->gradient_start_opacity_hover, 'gradient_end_opacity_hover' => $button->gradient_end_opacity_hover, 'gradient_stop' => $button->gradient_stop, 'container_enabled' => $button->container_enabled, 'container_width' => $button->container_width, 'container_margin_top' => $button->container_margin_top, 'container_margin_right' => $button->container_margin_right, 'container_margin_bottom' => $button->container_margin_bottom, 'container_margin_left' => $button->container_margin_left, 'container_alignment' => $button->container_alignment, 'container_center_div_wrap_enabled' => $button->container_center_div_wrap_enabled, 'status' => $button->status);
    global $wpdb;
    $wpdb->insert(maxbuttons_get_buttons_table_name(), $data);
    $button_id = $wpdb->insert_id;
}
?>
<script type="text/javascript">
	<?php 
if (isset($_GET['id']) && $_GET['id'] != '') {
    ?>
		window.location = "<?php 
    admin_url();
    ?>
admin.php?page=maxbuttons-controller&action=button&id=<?php 
    echo $button_id;
    ?>
";
	<?php 
} else {
    ?>
		window.location = "<?php 
    admin_url();
    ?>
admin.php?page=maxbuttons-controller&action=list";
	<?php 
}
?>
コード例 #4
0
    }
    return array('user_agent' => $user_agent, 'name' => $browser_name, 'version' => $version, 'platform' => $platform, 'pattern' => $pattern);
}
function check_charset()
{
    global $maxbuttons_installed_version;
    global $wpdb;
    $check = "SHOW FULL COLUMNS FROM " . maxButtonsUtils::get_buttons_table_name();
    $charset = $wpdb->query($check);
    return $charset;
}
if (isset($_POST['alter_charset'])) {
    $kludge = 'altering table to be utf-8';
    global $maxbuttons_installed_version;
    global $wpdb;
    $table_name = maxbuttons_get_buttons_table_name();
    $kludge = $table_name;
    // IMPORTANT: There MUST be two spaces between the PRIMARY KEY keywords
    // and the column name, and the column name MUST be in parenthesis.
    $sql = "ALTER TABLE " . $table_name . " CONVERT TO CHARACTER SET utf8";
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    $wpdb->query($wpdb->prepare($sql));
} else {
    $kludge = 'Not yet enabled';
}
$charr = check_charset();
?>

<div id="maxbuttons">
	<div class="wrap">