public static function build_body($args = array()) { $body = ''; foreach ($args as $key => $value) { $tag = isset($value['tag']) ? $value['tag'] : ''; if (!empty($tag)) { $html = new SB_HTML($tag); $text = isset($value['text']) ? $value['text'] : ''; $html->set_attribute('text', $text); $body .= $html->build(); } } return $body; }
public static function send_signup_verify_email($user) { $cookie = self::get_verify_email_cookie($user); $session = self::get_verify_email_session($user); if (1 == $cookie || 1 == $session) { return; } $code = self::generate_activation_code($user); $url = self::get_account_verify_url($user->ID, $code); $subject = __('Xác nhận đăng ký tài khoản', 'sb-core'); $paragraph = new SB_HTML('p'); $paragraph->set_text(sprintf(__('Cảm ơn bạn đã đăng ký với tên tài khoản của bạn là %s, hãy nhấn chuột vào nút bên dưới để xác thực địa chỉ email của bạn.', 'sb-core'), $user->user_login)); $body = $paragraph->build(); $paragraph->set_attribute('style', 'display: block; clear: both; padding: 20px 0px;'); $paragraph->set_text('<a target="_blank" style="white-space: nowrap; text-align: center; height: 28px; background: none repeat scroll 0% 0% rgb(77, 144, 254); border: 1px solid rgb(48, 121, 237); color: rgb(255, 255, 255); text-decoration: none; padding: 5px 30px; font-size: 13px; font-weight: 700;" href="' . $url . '">' . __('Xác nhận địa chỉ email', 'sb-core') . '</a>'); $body .= $paragraph->build(); $paragraph->set_attribute('style', 'padding: 0;'); $paragraph->set_text(__('Hoặc bạn có thể sử dụng đường dẫn bên dưới:', 'sb-core') . '<br><a target="_blank" style="border:none;color:#0084b4;text-decoration:none" href="' . $url . '">' . $url . '</a>'); $body .= $paragraph->build(); $paragraph->set_text(sprintf(__('Mã xác nhận: %s', 'sb-core'), $code)); $body .= $paragraph->build(); $result = SB_Mail::send_html($user->user_email, $subject, $body); if ($result) { self::set_verify_email_session($user); } }
public static function select($args = array()) { $id = isset($args['id']) ? $args['id'] : ''; $name = isset($args['name']) ? $args['name'] : ''; $list_options = isset($args['list_options']) ? $args['list_options'] : array(); $options = isset($args['options']) ? $args['options'] : array(); $description = isset($args['description']) ? $args['description'] : ''; $container_class = isset($args['container_class']) ? $args['container_class'] : ''; $value = isset($args['value']) ? $args['value'] : ''; $field_class = isset($args['field_class']) ? $args['field_class'] : ''; if (!is_array($options) || count($options) < 1) { $options = $list_options; } $all_option = isset($args['all_option']) ? $args['all_option'] : ''; $before = isset($args['before']) ? $args['before'] : '<div class="' . $container_class . '">'; $after = isset($args['after']) ? $args['after'] : '</div>'; echo $before; $autocomplete = isset($args['autocomplete']) ? '' : 'off'; $select_option = isset($args['default_option']) ? $args['default_option'] : ''; if (empty($all_option)) { foreach ($options as $key => $text) { $select_option .= self::get_option(array('value' => $key, 'text' => $text, 'selected' => $value)); } } else { $select_option .= $all_option; } $html = new SB_HTML('select'); $atts = array('id' => esc_attr($id), 'name' => $name, 'class' => $field_class, 'autocomplete' => $autocomplete, 'text' => $select_option); $html->set_attribute_array($atts); echo $html->build(); self::the_description($description); self::the_after($before, $after); }