PerfectoLite.php
256 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ProfilePress\Core\Themes\DragDrop\Login; |
| 4 | |
| 5 | use ProfilePress\Core\Admin\SettingsPages\DragDropBuilder\DragDropBuilder; |
| 6 | use ProfilePress\Core\Themes\DragDrop\AbstractTheme; |
| 7 | use ProfilePress\Core\Admin\SettingsPages\DragDropBuilder\Fields; |
| 8 | |
| 9 | class PerfectoLite extends AbstractTheme |
| 10 | { |
| 11 | public static function default_field_listing() |
| 12 | { |
| 13 | Fields\Init::init(); |
| 14 | $standard_fields = DragDropBuilder::get_instance()->standard_fields(); |
| 15 | |
| 16 | return [ |
| 17 | $standard_fields['login-username'], |
| 18 | $standard_fields['login-password'], |
| 19 | $standard_fields['login-remember'], |
| 20 | ]; |
| 21 | } |
| 22 | |
| 23 | public function appearance_settings($settings) |
| 24 | { |
| 25 | $settings[] = [ |
| 26 | 'id' => 'perfectolite_login_headline', |
| 27 | 'type' => 'text', |
| 28 | 'label' => esc_html__('Headline', 'wp-user-avatar'), |
| 29 | 'priority' => 20 |
| 30 | ]; |
| 31 | |
| 32 | return $settings; |
| 33 | } |
| 34 | |
| 35 | public function color_settings($settings) |
| 36 | { |
| 37 | $settings2 = [ |
| 38 | [ |
| 39 | 'id' => 'perfectolite_login_bg_color', |
| 40 | 'type' => 'color', |
| 41 | 'label' => esc_html__('Background', 'wp-user-avatar') |
| 42 | ], |
| 43 | [ |
| 44 | 'id' => 'perfectolite_login_border', |
| 45 | 'type' => 'color', |
| 46 | 'label' => esc_html__('Form Border', 'wp-user-avatar') |
| 47 | ], |
| 48 | [ |
| 49 | 'id' => 'perfectolite_login_text_color', |
| 50 | 'type' => 'color', |
| 51 | 'label' => esc_html__('Text', 'wp-user-avatar') |
| 52 | ], |
| 53 | [ |
| 54 | 'id' => 'perfectolite_login_placeholder_color', |
| 55 | 'type' => 'color', |
| 56 | 'label' => esc_html__('Field Placeholder', 'wp-user-avatar') |
| 57 | ], |
| 58 | [ |
| 59 | 'id' => 'perfectolite_login_button_bg_color', |
| 60 | 'type' => 'color', |
| 61 | 'label' => esc_html__('Button Background', 'wp-user-avatar') |
| 62 | ], |
| 63 | [ |
| 64 | 'id' => 'perfectolite_login_button_text_color', |
| 65 | 'type' => 'color', |
| 66 | 'label' => esc_html__('Button Text', 'wp-user-avatar') |
| 67 | ] |
| 68 | ]; |
| 69 | |
| 70 | return array_merge($settings, $settings2); |
| 71 | } |
| 72 | |
| 73 | public function default_metabox_settings() |
| 74 | { |
| 75 | $data = parent::default_metabox_settings(); |
| 76 | $data['perfectolite_login_headline'] = esc_html__('Sign in to Your Account', 'wp-user-avatar'); |
| 77 | $data['perfectolite_login_bg_color'] = '#ffffff'; |
| 78 | $data['perfectolite_login_border'] = '#f0f0f0'; |
| 79 | $data['perfectolite_login_text_color'] = '#555555'; |
| 80 | $data['perfectolite_login_placeholder_color'] = '#555555'; |
| 81 | $data['perfectolite_login_button_bg_color'] = '#196cd8'; |
| 82 | $data['perfectolite_login_button_text_color'] = '#ffffff'; |
| 83 | |
| 84 | return $data; |
| 85 | } |
| 86 | |
| 87 | public function form_structure() |
| 88 | { |
| 89 | $fields = $this->field_listing(); |
| 90 | $button = $this->form_submit_button(); |
| 91 | $headline = wp_kses_post($this->get_meta('perfectolite_login_headline')); |
| 92 | |
| 93 | return <<<HTML |
| 94 | [pp-form-wrapper class="perfecto"] |
| 95 | <div class="perfecto-heading">$headline</div> |
| 96 | $fields |
| 97 | $button |
| 98 | [/pp-form-wrapper] |
| 99 | HTML; |
| 100 | |
| 101 | } |
| 102 | |
| 103 | public function form_css() |
| 104 | { |
| 105 | $form_id = $this->form_id; |
| 106 | $form_type = $this->form_type; |
| 107 | |
| 108 | $bg_color = esc_html($this->get_meta('perfectolite_login_bg_color')); |
| 109 | $border_color = esc_html($this->get_meta('perfectolite_login_border')); |
| 110 | $text_color = esc_html($this->get_meta('perfectolite_login_text_color')); |
| 111 | $placeholder_color = esc_html($this->get_meta('perfectolite_login_placeholder_color')); |
| 112 | $button_bg_color = esc_html($this->get_meta('perfectolite_login_button_bg_color')); |
| 113 | $button_text_color = esc_html($this->get_meta('perfectolite_login_button_text_color')); |
| 114 | |
| 115 | return <<<CSS |
| 116 | /* css class for the form generated errors */ |
| 117 | #pp-$form_type-$form_id-wrap .profilepress-login-status { |
| 118 | border-radius: 5px; |
| 119 | font-size: 16px; |
| 120 | line-height: 1.471; |
| 121 | padding: 10px; |
| 122 | background-color: #e74c3c; |
| 123 | color: #ffffff; |
| 124 | font-weight: normal; |
| 125 | text-align: center; |
| 126 | vertical-align: middle; |
| 127 | margin: 10px auto; |
| 128 | -webkit-box-sizing: border-box; |
| 129 | -moz-box-sizing: border-box; |
| 130 | box-sizing: border-box; |
| 131 | max-width: 450px; |
| 132 | } |
| 133 | |
| 134 | #pp-$form_type-$form_id-wrap .profilepress-login-status a { |
| 135 | color: #fff; |
| 136 | text-decoration: underline; |
| 137 | } |
| 138 | |
| 139 | div#pp-$form_type-$form_id.perfecto * { |
| 140 | -webkit-box-sizing: border-box; |
| 141 | -moz-box-sizing: border-box; |
| 142 | box-sizing: border-box; |
| 143 | color: $text_color; |
| 144 | } |
| 145 | |
| 146 | div#pp-$form_type-$form_id.perfecto ::placeholder{ |
| 147 | color: $placeholder_color; |
| 148 | } |
| 149 | |
| 150 | div#pp-$form_type-$form_id.perfecto ::-webkit-input-placeholder{ |
| 151 | color: $placeholder_color; |
| 152 | } |
| 153 | |
| 154 | div#pp-$form_type-$form_id.perfecto ::-moz-placeholder{ |
| 155 | color: $placeholder_color; |
| 156 | } |
| 157 | |
| 158 | div#pp-$form_type-$form_id.perfecto :-moz-placeholder{ |
| 159 | color: $placeholder_color; |
| 160 | } |
| 161 | |
| 162 | div#pp-$form_type-$form_id.perfecto :-ms-input-placeholder{ |
| 163 | color: $placeholder_color; |
| 164 | } |
| 165 | |
| 166 | div#pp-$form_type-$form_id.perfecto { |
| 167 | margin: 5px auto; |
| 168 | border: 2px solid $border_color; |
| 169 | background: $bg_color; |
| 170 | max-width: 450px; |
| 171 | padding: 30px; |
| 172 | width: 100%; |
| 173 | font-family: helvetica, arial, sans-serif; |
| 174 | -webkit-font-smoothing: antialiased; |
| 175 | -moz-font-smoothing: antialiased; |
| 176 | font-smoothing: antialiased; |
| 177 | font-size: 14px; |
| 178 | line-height: 24px; |
| 179 | -webkit-box-sizing: border-box; |
| 180 | -moz-box-sizing: border-box; |
| 181 | box-sizing: border-box; |
| 182 | } |
| 183 | |
| 184 | div#pp-$form_type-$form_id.perfecto .perfecto-heading { |
| 185 | font-size: 24px; |
| 186 | line-height: 34px; |
| 187 | margin-bottom: 20px; |
| 188 | display: block; |
| 189 | font-weight: 100; |
| 190 | text-align: center; |
| 191 | } |
| 192 | |
| 193 | div#pp-$form_type-$form_id.perfecto .ppform-remember-me { |
| 194 | font-size: 14px; |
| 195 | font-family: helvetica, arial, sans-serif; |
| 196 | } |
| 197 | |
| 198 | div#pp-$form_type-$form_id.perfecto input:not([type="submit"]) { |
| 199 | box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.125); |
| 200 | padding: 12px 18px; |
| 201 | width: 100%; |
| 202 | outline: none; |
| 203 | font-size: 12px; |
| 204 | line-height: 22px; |
| 205 | font-family: helvetica, arial, sans-serif; |
| 206 | -webkit-font-smoothing: antialiased; |
| 207 | -moz-font-smoothing: antialiased; |
| 208 | font-smoothing: antialiased; |
| 209 | border: 1px solid #ddd; |
| 210 | -webkit-border-radius: 2px; |
| 211 | -moz-border-radius: 2px; |
| 212 | border-radius: 2px; |
| 213 | margin-bottom: 10px; |
| 214 | -webkit-transition: 0.4s; |
| 215 | -moz-transition: 0.4s; |
| 216 | transition: 0.4s; |
| 217 | } |
| 218 | |
| 219 | div#pp-$form_type-$form_id.perfecto input:not([type="submit"]):focus { |
| 220 | border-color: #ccc; |
| 221 | background: #fafafa; |
| 222 | -webkit-box-shadow: inset 0px 1px 5px 0px #f0f0f0; |
| 223 | -moz-box-shadow: inset 0px 1px 5px 0px #f0f0f0; |
| 224 | box-shadow: inset 0px 1px 5px 0px #f0f0f0; |
| 225 | } |
| 226 | |
| 227 | div#pp-$form_type-$form_id.perfecto input.ppform-submit-button { |
| 228 | padding: 12px 10px; |
| 229 | width: 100%; |
| 230 | border: 0; |
| 231 | outline: none; |
| 232 | margin: 0; |
| 233 | margin-top: 10px; |
| 234 | color: $button_text_color; |
| 235 | cursor: pointer; |
| 236 | background: $button_bg_color; |
| 237 | font-size: 11px; |
| 238 | line-height: 21px; |
| 239 | letter-spacing: 1px; |
| 240 | text-transform: uppercase; |
| 241 | font-weight: bold; |
| 242 | font-family: helvetica, arial, sans-serif; |
| 243 | -webkit-font-smoothing: antialiased; |
| 244 | -moz-font-smoothing: antialiased; |
| 245 | font-smoothing: antialiased; |
| 246 | -webkit-border-radius: 2px; |
| 247 | -moz-border-radius: 2px; |
| 248 | border-radius: 2px; |
| 249 | -webkit-transition: 0.4s; |
| 250 | -moz-transition: 0.4s; |
| 251 | transition: 0.4s; |
| 252 | } |
| 253 | CSS; |
| 254 | |
| 255 | } |
| 256 | } |