Example #1
0
function sola_nl_add_camp()
{
    global $wpdb;
    global $sola_nl_camp_tbl;
    extract($_POST);
    if (isset($subject) && $subject) {
        if (isset($sub_list) && $sub_list || $campaign_type == 2) {
            $custom_time = $_POST['sola_nl_time'];
            $day = $_POST['sola_nl_days'];
            $type = $_POST['sola_nl_time_slot'];
            $the_current_time = current_time('timestamp');
            if ($type == 1) {
                //Daily
                if (strtotime(date("Y-m-d", $the_current_time) . " " . $custom_time . ":00") > $the_current_time) {
                    $time = date('Y-m-d H:i:s', strtotime(date("Y-m-d", $the_current_time) . " " . $custom_time . ":00"));
                } else {
                    $time = date('Y-m-d H:i:s', strtotime('+1 day ' . $custom_time . ':00', $the_current_time));
                }
            } else {
                if ($type == 2) {
                    //Weekly
                    if ($day == 1) {
                        $chosen_day = 'Monday';
                    } else {
                        if ($day == 2) {
                            $chosen_day = 'Tuesday';
                        } else {
                            if ($day == 3) {
                                $chosen_day = 'Wednesday';
                            } else {
                                if ($day == 4) {
                                    $chosen_day = 'Thursday';
                                } else {
                                    if ($day == 5) {
                                        $chosen_day = 'Friday';
                                    } else {
                                        if ($day == 6) {
                                            $chosen_day = 'Saturday';
                                        } else {
                                            if ($day == 7) {
                                                $chosen_day = 'Sunday';
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    $time = date('Y-m-d H:i:s', strtotime($chosen_day . ' ' . $custom_time . ':00', $the_current_time));
                } else {
                    $time = date('Y-m-d H:i:s', current_time('timestamp'));
                }
            }
            $automated = array('type' => $_POST['sola_nl_time_slot'], 'action' => $_POST['sola_nl_action'], 'data' => array('day' => $_POST['sola_nl_days'], 'time' => $_POST['sola_nl_time'], 'daynum' => $_POST['sola_nl_monthly_day'], 'timeafter' => $_POST['sola_nl_time_after'], 'timeqty' => $_POST['sola_nl_custom_time'], 'role' => $_POST['sola_nl_roles']), 'automatic_layout' => 'layout-1', 'automatic_options_posts' => '1', 'automatic_options_columns' => '1', 'automatic_image' => '1', 'automatic_author' => '1', 'automatic_title' => '1', 'automatic_content' => '1', 'automatic_readmore' => '1', 'automatic_scheduled_date' => $time);
            if ($campaign_type == '1') {
                $checker = $wpdb->insert($sola_nl_camp_tbl, array('camp_id' => '', 'subject' => $subject, 'type' => $campaign_type, 'automatic_data' => '', 'styles' => sola_nl_default_styles_array(), 'action' => 0));
            } else {
                if ($campaign_type == '2') {
                    $checker = $wpdb->insert($sola_nl_camp_tbl, array('camp_id' => '', 'subject' => $subject, 'type' => $campaign_type, 'automatic_data' => maybe_serialize($automated), 'styles' => sola_nl_default_styles_array(), 'action' => $sola_nl_action));
                } else {
                    if ($campaign_type == '3') {
                        $checker = $wpdb->insert($sola_nl_camp_tbl, array('camp_id' => '', 'subject' => $subject, 'type' => $campaign_type, 'automatic_data' => '', 'styles' => '', 'action' => 0));
                    }
                }
            }
            if ($checker) {
                $camp_id = $wpdb->insert_id;
                if ($campaign_type == '1' || $campaign_type == '3') {
                    sola_nl_add_camp_list($sub_list, $camp_id);
                } else {
                    if ($campaign_type == '2' && $sola_nl_action == '3') {
                        sola_nl_add_camp_list($sub_list, $camp_id);
                    }
                }
                return $camp_id;
            } else {
                return new WP_Error('db_query_error', __('Could not execute query', 'sola'), $wpdb->last_error);
            }
        } else {
            return new WP_Error('Subject Error', __('Please Select at least one list to send to', 'sola'));
        }
    } else {
        return new WP_Error('Subject Error', __('Please Enter a Subject', 'sola'));
    }
}
Example #2
0
function sola_nl_add_default_editor_style()
{
    global $wpdb;
    global $sola_nl_style_table;
    global $sola_nl_css_options_table;
    global $sola_nl_style_elements_table;
    global $sola_nl_themes_table;
    $letter_1 = sola_nl_default_letter();
    $styles = sola_nl_default_styles_array();
    $style_version = 1.1;
    $wpdb->query($wpdb->prepare("\n                INSERT IGNORE INTO `{$sola_nl_themes_table}` (`theme_id`, `theme_name`, `theme_html`, `styles`, `version`) VALUES\n                (%d, %s, %s, %s, %d)\n\t\t", 1, 'single column', $letter_1, $styles, $style_version));
    $results = $wpdb->get_row("SELECT * FROM `{$sola_nl_themes_table}` WHERE `theme_id` = 1");
    if ($results->version != $style_version) {
        $wpdb->query("UPDATE `{$sola_nl_themes_table}` SET `styles` = '{$styles}', `theme_html` = '{$letter_1}', `version` = '{$style_version}' WHERE `theme_id` = 1");
    }
    $sql = "INSERT IGNORE INTO `{$sola_nl_css_options_table}` (`id`, `css_name`, `name`, `value`) VALUES\n        ('1', 'font-family', 'Georgia', 'Georgia, serif'),\n        ('2', 'font-family', 'Palatino Linotype', '\"Palatino Linotype\", \"Book Antiqua\", Palatino, serif'),\n        ('3', 'font-family', 'Times New Roman', '\"Times New Roman\", Times, serif'),\n        ('4', 'font-family', 'Arial', 'Arial, Helvetica, sans-serif'),\n        ('5', 'font-family', 'Arial Black', '\"Arial Black\", Gadget, sans-serif'),\n        ('6', 'font-family', 'Comic Sans MS', '\"Comic Sans MS\", cursive, sans-serif'),\n        ('7', 'font-family', 'Impact', 'Impact, Charcoal, sans-serif'),\n        ('8', 'font-family', 'Lucida Sans Unicode', '\"Lucida Sans Unicode\", \"Lucida Grande\", sans-serif'),\n        ('9', 'font-family', 'Tahoma', 'Tahoma, Geneva, sans-serif'),\n        ('10', 'font-family', 'Trebuchet MS', '\"Trebuchet MS\", Helvetica, sans-serif'),\n        ('11', 'font-family', 'Verdana', 'Verdana, Geneva, sans-serif'),\n        ('12', 'font-family', 'Courier New', '\"Courier New\", Courier, monospace'),\n        ('13', 'font-family', 'Lucida Console', '\"Lucida Console\" Monaco, monospace'),\n        ('14', 'font-family', 'Inherit', 'inherit'),\n        ('15', 'border-style', 'Dashed', 'dashed'),\n        ('16', 'border-style', 'Dotted', 'dotted'),\n        ('17', 'border-style', 'Double', 'double'),\n        ('18', 'border-style', 'Groove', 'groove'),\n        ('19', 'border-style', 'Hidden', 'hidden'),\n        ('20', 'border-style', 'Inset', 'inset'),\n        ('21', 'border-style', 'None', 'none'),\n        ('22', 'border-style', 'Outset', 'outset'),\n        ('23', 'border-style', 'Ridge', 'ridge'),\n        ('24', 'border-style', 'Solid', 'solid'),\n        ('25', 'font-style', 'Inherit', 'inherit'),\n        ('26', 'font-style', 'Initial', 'initial'),\n        ('27', 'font-style', 'Italic', 'italic'),\n        ('28', 'font-style', 'Normal', 'normal'),\n        ('29', 'font-weight', 'Bold', 'bold'),\n        ('30', 'font-weight', 'Bolder', 'bolder'),\n        ('31', 'font-weight', 'Inherit', 'inherit'),\n        ('32', 'font-weight', 'Initial', 'initial'),\n        ('33', 'font-weight', 'Lighter', 'lighter'),\n        ('34', 'font-weight', 'Normal', 'normal'),\n        ('35', 'text-align', 'Center', 'center'),\n        ('36', 'text-align', 'Inherit', 'inherit'),\n        ('37', 'text-align', 'Justify', 'justify'),\n        ('38', 'text-align', 'Left', 'left'),\n        ('39', 'text-align', 'Right', 'right'),\n        ('40', 'text-decoration', 'Inherit', 'inherit'),\n        ('41', 'text-decoration', 'Initial', 'initial'),\n        ('42', 'text-decoration', 'Line-Through', 'line-through'),\n        ('43', 'text-decoration', 'None', 'none'),\n        ('44', 'text-decoration', 'Overline', 'overline'),\n        ('45', 'text-decoration', 'Underline', 'underline'),\n        ('46', 'border-right-style', 'Dashed', 'dashed'),\n        ('47', 'border-right-style', 'Dotted', 'dotted'),\n        ('48', 'border-right-style', 'Double', 'double'),\n        ('49', 'border-right-style', 'Groove', 'groove'),\n        ('50', 'border-right-style', 'Hidden', 'hidden'),\n        ('51', 'border-right-style', 'Inset', 'inset'),\n        ('52', 'border-right-style', 'None', 'none'),\n        ('53', 'border-right-style', 'Outset', 'outset'),\n        ('54', 'border-right-style', 'Ridge', 'ridge'),\n        ('55', 'border-right-style', 'Solid', 'solid');\n    ";
    $wpdb->query($sql);
}