public static function initialize_plugin_data() { $globals = EZP_CS_JSON_Entity_Base::get_by_type(self::TYPE); if ($globals == null) { // RSR TODO: error checking here to ensure data doesnt get out of sync $display = EZP_CS_Display_Entity::create_with_defaults(); $display->save(); $content = EZP_CS_Content_Entity::create_with_defaults(); $content->save(); $set = EZP_CS_Set_Entity::create($display->id, $content->id); $set->save(); $config = EZP_CS_Config_Entity::create_with_defaults(); $config->save(); $global = new EZP_CS_Global_Entity(); $global->set("active_set_index", $set->id); $global->set("config_index", $config->id); $global->save(); } }
<td> <div class="compound-setting"> <input class='narrow-input' name="email_button_height" type="text" value="<?php echo $display->email_button_height; ?> " /> <span class="description"><?php echo '*' . EZP_CS_Utility::__('Append px or %'); ?> </span> </div> </td> </tr> <tr> <?php echo EZP_CS_Display_Entity::display_font_field_row("Font", 'email_button', $display); ?> </tr> <tr> <th scope="row"> <?php echo EZP_CS_Utility::_e("Color"); ?> </th> <td> <div class="compound-setting"> <input name="email_button_color" class="spectrum-picker" type="text" value="<?php echo $display->email_button_color; ?> "/> </div>
public function get_font_styling($variable_base_name) { $font_name_variable_name = $variable_base_name . '_font_name'; $font_size_variable_name = $variable_base_name . '_font_size'; $font_color_variable_name = $variable_base_name . '_font_color'; $font_name_key_value = $this->{$font_name_variable_name}; $font_size_value = $this->{$font_size_variable_name}; $font_color_value = $this->{$font_color_variable_name}; $font_family_value = EZP_CS_Display_Entity::get_font_family_by_key($font_name_key_value); return "color: {$font_color_value}; font-size: {$font_size_value}; font-family: {$font_family_value}"; }
function ws_copy_template() { $post = stripslashes_deep($_POST); if (isset($post['template_key'])) { $template_key = $post['template_key']; $global = EZP_CS_Global_Entity::get_instance(); $set_index = $global->active_set_index; $set = EZP_CS_Set_Entity::get_by_id($set_index); $display = EZP_CS_Display_Entity::get_by_id($set->display_index); // RSR TODO: Have to be careful here - ensure that a single error won't hose up the state of the system - TODO: Maybe a reset to defaults option to clean out db? $display->delete(); $new_display = EZP_CS_Display_Entity::create_from_template($template_key); $new_display->save(); $set->display_index = $new_display->id; $set->save(); } }
<?php $global = EZP_CS_Global_Entity::get_instance(); $set_index = $global->active_set_index; $set = EZP_CS_Set_Entity::get_by_id($set_index); $display = EZP_CS_Display_Entity::get_by_id($set->display_index); $content = EZP_CS_Content_Entity::get_by_id($set->content_index); $config = EZP_CS_Config_Entity::get_by_id($global->config_index); $error_display = 'none'; $error_text = ''; $js_thank_you = "var thankYouDisplayed=false;"; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $subscriber = new EZP_CS_Subscriber_Entity(); $error_text = EZP_CS_Query_Utility::add_new_subscriber($_POST['ezp_cs_name'], $_POST['ezp_cs_email']); if ($error_text == null) { $js_thank_you = "var thankYouDisplayed=true;"; $initial_section_display = 'none'; $thank_you_section_display = 'block'; } else { $error_display = 'block'; $initial_section_display = 'block'; $thank_you_section_display = 'none'; } } else { $initial_section_display = 'block'; $thank_you_section_display = 'none'; } ?> <!DOCTYPE html> <html> <head>