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