admin.php
547 lines
| 1 | <?php |
| 2 | add_action('wpcf7_editor_panels', 'MPFCF7_editor_panel', 10, 1); |
| 3 | |
| 4 | function MPFCF7_editor_panel( $panels ) { |
| 5 | $panels['my-custom-panel'] = array( |
| 6 | 'title' => __( 'Popup Setting', 'my-plugin' ), |
| 7 | 'callback' => 'MPFCF7_panel_callback', |
| 8 | ); |
| 9 | return $panels; |
| 10 | } |
| 11 | |
| 12 | function MPFCF7_panel_callback() { |
| 13 | |
| 14 | if(isset($_REQUEST['post']) && $_REQUEST['post'] != '') { |
| 15 | $formid = sanitize_text_field($_REQUEST['post']); |
| 16 | } else { |
| 17 | $formid = NULL; |
| 18 | } |
| 19 | ?> |
| 20 | <div class="my-custom-panel"> |
| 21 | <table class="form-table"> |
| 22 | |
| 23 | <tr> |
| 24 | <th scope="row" colspan="2"> |
| 25 | <label><?php echo __('Enable Success Message','message-popup-for-contact-form-7');?></label> |
| 26 | </th> |
| 27 | <td> |
| 28 | <?php |
| 29 | $mpfcf7_popup_success_enabled = get_post_meta( $formid, 'mpfcf7_popup_success_enabled', true ); |
| 30 | ?> |
| 31 | <input type="checkbox" id="mpfcf7_popup_success_enabled" name="mpfcf7_popup_success_enabled" value="1" <?php checked( $mpfcf7_popup_success_enabled, '1' ); ?>> |
| 32 | <label for="mpfcf7_popup_success_enabled"><?php echo __('Show success message','message-popup-for-contact-form-7'); ?></label> |
| 33 | </td> |
| 34 | </tr> |
| 35 | |
| 36 | <tr> |
| 37 | <th scope="row" colspan="2"> |
| 38 | <label><?php echo __('Button Text','message-popup-for-contact-form-7');?></label> |
| 39 | </th> |
| 40 | <td> |
| 41 | <input type="text" id="mpfcf7_btn_text" name="mpfcf7_btn_text" value="<?php echo esc_attr(get_post_meta( $formid, 'mpfcf7_btn_text', true ));?>"><label class="mpfcf7_comman_link"></a></label> |
| 42 | </td> |
| 43 | </tr> |
| 44 | <tr> |
| 45 | <th scope="row" colspan="2"> |
| 46 | <label><?php echo __('Popup Width','message-popup-for-contact-form-7');?></label> |
| 47 | </th> |
| 48 | <td> |
| 49 | <?php |
| 50 | $mpfcf7_popup_width = get_post_meta( $formid,'mpfcf7_popup_width', true ); |
| 51 | if($mpfcf7_popup_width == ''){ |
| 52 | $mpfcf7_popup_width = '478px'; |
| 53 | } |
| 54 | ?> |
| 55 | <input type="text" id="mpfcf7_popup_width" name="mpfcf7_popup_width" value="<?php echo esc_attr($mpfcf7_popup_width); ?>"> |
| 56 | </td> |
| 57 | </tr> |
| 58 | <tr> |
| 59 | <th scope="row" colspan="2"> |
| 60 | <label><?php echo __('Popup Border Radius','message-popup-for-contact-form-7');?></label> |
| 61 | </th> |
| 62 | <td> |
| 63 | <?php |
| 64 | $mpfcf7_popup_border_radious = get_post_meta( $formid,'mpfcf7_popup_border_radious', true ); |
| 65 | if($mpfcf7_popup_border_radious == ''){ |
| 66 | $mpfcf7_popup_border_radious = '5px'; |
| 67 | } |
| 68 | ?> |
| 69 | <input type="text" id="mpfcf7_popup_border_radious" name="mpfcf7_popup_border_radious" value="<?php echo esc_attr($mpfcf7_popup_border_radious); ?>"> |
| 70 | </td> |
| 71 | </tr> |
| 72 | <tr> |
| 73 | <th scope="row" colspan="2"> |
| 74 | <label><?php echo __('Background Overlay Color','message-popup-for-contact-form-7');?></label> |
| 75 | </th> |
| 76 | <td> |
| 77 | <?php |
| 78 | $mpfcf7_background_overlay = get_post_meta( $formid,'mpfcf7_background_overlay', true ); |
| 79 | if($mpfcf7_background_overlay == ''){ |
| 80 | $mpfcf7_background_overlay = 'rgba(0,0,0,.4)'; |
| 81 | } |
| 82 | ?> |
| 83 | <input type="text" id="mpfcf7_background_overlay" name="mpfcf7_background_overlay" class="mpfcf7_color" value="<?php echo esc_attr($mpfcf7_background_overlay); ?>"> |
| 84 | </td> |
| 85 | </tr> |
| 86 | <tr> |
| 87 | <th scope="row" colspan="2"> |
| 88 | <label><?php echo __('Popup Background Color','message-popup-for-contact-form-7');?></label> |
| 89 | </th> |
| 90 | <td> |
| 91 | <?php |
| 92 | $mpfcf7_background_color = get_post_meta( $formid,'mpfcf7_background_color', true ); |
| 93 | if($mpfcf7_background_color == ''){ |
| 94 | $mpfcf7_background_color = '#ffffff'; |
| 95 | } |
| 96 | ?> |
| 97 | <input type="text" id="mpfcf7_background_color" name="mpfcf7_background_color" class="mpfcf7_color" value="<?php echo esc_attr($mpfcf7_background_color); ?>"> |
| 98 | </td> |
| 99 | </tr> |
| 100 | <tr> |
| 101 | <th scope="row" colspan="2"> |
| 102 | <label><?php echo __('Popup Border Width','message-popup-for-contact-form-7');?></label> |
| 103 | </th> |
| 104 | <td> |
| 105 | <?php |
| 106 | $mpfcf7_popup_border_width = get_post_meta( $formid,'mpfcf7_popup_border_width', true ); |
| 107 | if($mpfcf7_popup_border_width == ''){ |
| 108 | $mpfcf7_popup_border_width = '3px'; |
| 109 | } |
| 110 | ?> |
| 111 | <input type="text" id="mpfcf7_popup_border_width" name="mpfcf7_popup_border_width" value="<?php echo esc_attr($mpfcf7_popup_border_width); ?>"> |
| 112 | </td> |
| 113 | </tr> |
| 114 | <tr> |
| 115 | <th scope="row" colspan="2"> |
| 116 | <label><?php echo __('Popup Border Color','message-popup-for-contact-form-7');?></label> |
| 117 | </th> |
| 118 | <td> |
| 119 | <?php |
| 120 | $mpfcf7_border_color = get_post_meta( $formid,'mpfcf7_border_color', true ); |
| 121 | if($mpfcf7_border_color == ''){ |
| 122 | $mpfcf7_border_color = '#ffffff'; |
| 123 | } |
| 124 | ?> |
| 125 | <input type="text" id="mpfcf7_border_color" name="mpfcf7_border_color" class="mpfcf7_color" value="<?php echo esc_attr($mpfcf7_border_color); ?>"> |
| 126 | </td> |
| 127 | </tr> |
| 128 | <tr> |
| 129 | <th scope="row" colspan="2"> |
| 130 | <label><?php echo __('Popup Text Color','message-popup-for-contact-form-7');?></label> |
| 131 | </th> |
| 132 | <td> |
| 133 | <?php |
| 134 | $mpfcf7_popup_text_color = get_post_meta( $formid,'mpfcf7_popup_text_color', true ); |
| 135 | if($mpfcf7_popup_text_color == ''){ |
| 136 | $mpfcf7_popup_text_color = '#61534e'; |
| 137 | } |
| 138 | ?> |
| 139 | <input type="text" id="mpfcf7_popup_text_color" name="mpfcf7_popup_text_color" class="mpfcf7_color" value="<?php echo esc_attr($mpfcf7_popup_text_color); ?>"> |
| 140 | </td> |
| 141 | </tr> |
| 142 | <tr> |
| 143 | <th scope="row" colspan="2"> |
| 144 | <label><?php echo __('Button Background Color','message-popup-for-contact-form-7');?></label> |
| 145 | </th> |
| 146 | <td> |
| 147 | <?php |
| 148 | $mpfcf7_btn_background_color = get_post_meta( $formid,'mpfcf7_btn_background_color', true ); |
| 149 | if($mpfcf7_btn_background_color == ''){ |
| 150 | $mpfcf7_btn_background_color = '#7cd1f9'; |
| 151 | } |
| 152 | ?> |
| 153 | <input type="text" id="mpfcf7_btn_background_color" name="mpfcf7_btn_background_color" class="mpfcf7_color" value="<?php echo esc_attr($mpfcf7_btn_background_color); ?>"> |
| 154 | </td> |
| 155 | </tr> |
| 156 | <tr> |
| 157 | <th scope="row" colspan="2"> |
| 158 | <label><?php echo __('Hide Popup','message-popup-for-contact-form-7');?></label> |
| 159 | </th> |
| 160 | <td> |
| 161 | <input type="text" id="mpfcf7_hide_popup" name="mpfcf7_hide_popup" value="<?php echo esc_attr(get_post_meta( $formid, 'mpfcf7_hide_popup', true ));?>"> |
| 162 | <span class="description"><?php echo __('Add value like this eg. 5000 (Popup will hide after 5 Seconds).','message-popup-for-contact-form-7');?></span><br> |
| 163 | </td> |
| 164 | </tr> |
| 165 | |
| 166 | <tr> |
| 167 | |
| 168 | </table> |
| 169 | |
| 170 | |
| 171 | <!-- disable --> |
| 172 | |
| 173 | <h2>Failure message Settings <label class="mpfcf7_comman_link"> <a href="https://topsmodule.com/product/message-popup-for-contact-form-7/" target="_blank"><?php echo esc_html( __( 'Pro Version', 'message-popup-for-contact-form-7' ) ); ?></a></label> |
| 174 | </h2> |
| 175 | <fieldset class="verions_pro"> |
| 176 | <legend>You can Enable/Disable this Failure popup and also you can you other setting related to Failure popup.</legend> |
| 177 | <table class="form-table"> |
| 178 | |
| 179 | <tr> |
| 180 | <th scope="row" colspan="2"> |
| 181 | <label><?php echo __('Enable Failure Message','message-popup-for-contact-form-7');?></label> |
| 182 | </th> |
| 183 | <td> |
| 184 | <?php |
| 185 | $mpfcf7_popup_failure_enabled = get_post_meta( $formid, 'mpfcf7_popup_failure_enabled', true ); |
| 186 | ?> |
| 187 | <input type="checkbox" id="mpfcf7_popup_failure_enabled" name="mpfcf7_popup_failure_enabled" value="1" <?php checked( $mpfcf7_popup_failure_enabled, '1' ); ?>> |
| 188 | <label for="mpfcf7_popup_failure_enabled"><?php echo __('Show failure message','message-popup-for-contact-form-7'); ?></label> |
| 189 | </td> |
| 190 | </tr> |
| 191 | |
| 192 | <tr> |
| 193 | <th scope="row" colspan="2"> |
| 194 | <label><?php echo __('failure Button Text','message-popup-for-contact-form-7');?></label> |
| 195 | </th> |
| 196 | <td> |
| 197 | <input type="text" id="mpfcf7_failure_btn_text" name="mpfcf7_failure_btn_text" value="<?php echo esc_attr(get_post_meta( $formid, 'mpfcf7_failure_btn_text', true ));?>"> |
| 198 | </td> |
| 199 | </tr> |
| 200 | |
| 201 | <tr> |
| 202 | <th scope="row" colspan="2"> |
| 203 | <label><?php echo __('failure Popup Width','message-popup-for-contact-form-7');?></label> |
| 204 | </th> |
| 205 | <td> |
| 206 | <?php |
| 207 | $mpfcf7_popup_failure_width = get_post_meta( $formid, 'mpfcf7_popup_failure_width', true ); |
| 208 | if($mpfcf7_popup_failure_width == ''){ |
| 209 | $mpfcf7_popup_failure_width = '478px'; |
| 210 | } |
| 211 | ?> |
| 212 | <input type="text" id="mpfcf7_popup_failure_width" name="mpfcf7_popup_failure_width" value="<?php echo esc_attr($mpfcf7_popup_failure_width); ?>"> |
| 213 | </td> |
| 214 | </tr> |
| 215 | |
| 216 | <tr> |
| 217 | <th scope="row" colspan="2"> |
| 218 | <label><?php echo __('failure Popup Border Radius','message-popup-for-contact-form-7');?></label> |
| 219 | </th> |
| 220 | <td> |
| 221 | <?php |
| 222 | $mpfcf7_popup_failure_border_radius = get_post_meta( $formid, 'mpfcf7_popup_failure_border_radius', true ); |
| 223 | if($mpfcf7_popup_failure_border_radius == ''){ |
| 224 | $mpfcf7_popup_failure_border_radius = '5px'; |
| 225 | } |
| 226 | ?> |
| 227 | <input type="text" id="mpfcf7_popup_failure_border_radius" name="mpfcf7_popup_failure_border_radius" value="<?php echo esc_attr($mpfcf7_popup_failure_border_radius); ?>"> |
| 228 | </td> |
| 229 | </tr> |
| 230 | |
| 231 | <tr> |
| 232 | <th scope="row" colspan="2"> |
| 233 | <label><?php echo __('failure Background Overlay Color','message-popup-for-contact-form-7');?></label> |
| 234 | </th> |
| 235 | <td> |
| 236 | <?php |
| 237 | $mpfcf7_failure_background_overlay = get_post_meta( $formid, 'mpfcf7_failure_background_overlay', true ); |
| 238 | if($mpfcf7_failure_background_overlay == ''){ |
| 239 | $mpfcf7_failure_background_overlay = 'rgba(0,0,0,.4)'; |
| 240 | } |
| 241 | ?> |
| 242 | <input type="text" id="mpfcf7_failure_background_overlay" name="mpfcf7_failure_background_overlay" class="mpfcf7_color" value="<?php echo esc_attr($mpfcf7_failure_background_overlay); ?>"> |
| 243 | </td> |
| 244 | </tr> |
| 245 | |
| 246 | <tr> |
| 247 | <th scope="row" colspan="2"> |
| 248 | <label><?php echo __('failure Popup Background Color','message-popup-for-contact-form-7');?></label> |
| 249 | </th> |
| 250 | <td> |
| 251 | <?php |
| 252 | $mpfcf7_failure_background_color = get_post_meta( $formid, 'mpfcf7_failure_background_color', true ); |
| 253 | if($mpfcf7_failure_background_color == ''){ |
| 254 | $mpfcf7_failure_background_color = '#ffdddd'; |
| 255 | } |
| 256 | ?> |
| 257 | <input type="text" id="mpfcf7_failure_background_color" name="mpfcf7_failure_background_color" class="mpfcf7_color" value="<?php echo esc_attr($mpfcf7_failure_background_color); ?>"> |
| 258 | </td> |
| 259 | </tr> |
| 260 | |
| 261 | <tr> |
| 262 | <th scope="row" colspan="2"> |
| 263 | <label><?php echo __('failure Popup Border Width','message-popup-for-contact-form-7');?></label> |
| 264 | </th> |
| 265 | <td> |
| 266 | <?php |
| 267 | $mpfcf7_popup_failure_border_width = get_post_meta( $formid, 'mpfcf7_popup_failure_border_width', true ); |
| 268 | if($mpfcf7_popup_failure_border_width == ''){ |
| 269 | $mpfcf7_popup_failure_border_width = '3px'; |
| 270 | } |
| 271 | ?> |
| 272 | <input type="text" id="mpfcf7_popup_failure_border_width" name="mpfcf7_popup_failure_border_width" value="<?php echo esc_attr($mpfcf7_popup_failure_border_width); ?>"> |
| 273 | </td> |
| 274 | </tr> |
| 275 | |
| 276 | <tr> |
| 277 | <th scope="row" colspan="2"> |
| 278 | <label><?php echo __('failure Popup Border Color','message-popup-for-contact-form-7');?></label> |
| 279 | </th> |
| 280 | <td> |
| 281 | <?php |
| 282 | $mpfcf7_failure_border_color = get_post_meta( $formid, 'mpfcf7_failure_border_color', true ); |
| 283 | if($mpfcf7_failure_border_color == ''){ |
| 284 | $mpfcf7_failure_border_color = '#ffaaaa'; |
| 285 | } |
| 286 | ?> |
| 287 | <input type="text" id="mpfcf7_failure_border_color" name="mpfcf7_failure_border_color" class="mpfcf7_color" value="<?php echo esc_attr($mpfcf7_failure_border_color); ?>"> |
| 288 | </td> |
| 289 | </tr> |
| 290 | |
| 291 | <tr> |
| 292 | <th scope="row" colspan="2"> |
| 293 | <label><?php echo __('failure Popup Text Color','message-popup-for-contact-form-7');?></label> |
| 294 | </th> |
| 295 | <td> |
| 296 | <?php |
| 297 | $mpfcf7_failure_text_color = get_post_meta( $formid, 'mpfcf7_failure_text_color', true ); |
| 298 | if($mpfcf7_failure_text_color == ''){ |
| 299 | $mpfcf7_failure_text_color = '#cc0000'; |
| 300 | } |
| 301 | ?> |
| 302 | <input type="text" id="mpfcf7_failure_text_color" name="mpfcf7_failure_text_color" class="mpfcf7_color" value="<?php echo esc_attr($mpfcf7_failure_text_color); ?>" > |
| 303 | </td> |
| 304 | </tr> |
| 305 | |
| 306 | <tr> |
| 307 | <th scope="row" colspan="2"> |
| 308 | <label><?php echo __('failure Button Background Color','message-popup-for-contact-form-7');?></label> |
| 309 | </th> |
| 310 | <td> |
| 311 | <?php |
| 312 | $mpfcf7_failure_btn_background_color = get_post_meta( $formid, 'mpfcf7_failure_btn_background_color', true ); |
| 313 | if($mpfcf7_failure_btn_background_color == ''){ |
| 314 | $mpfcf7_failure_btn_background_color = '#ff6666'; |
| 315 | } |
| 316 | ?> |
| 317 | <input type="text" id="mpfcf7_failure_btn_background_color" name="mpfcf7_failure_btn_background_color" class="mpfcf7_color" value="<?php echo esc_attr($mpfcf7_failure_btn_background_color);?>"> |
| 318 | </td> |
| 319 | </tr> |
| 320 | |
| 321 | <tr> |
| 322 | <th scope="row" colspan="2"> |
| 323 | <label><?php echo __('failure Hide Popup','message-popup-for-contact-form-7');?></label> |
| 324 | </th> |
| 325 | <td> |
| 326 | <?php |
| 327 | ?> |
| 328 | <input type="text" id="mpfcf7_hide_failure_popup" name="mpfcf7_hide_failure_popup" value="<?php echo esc_attr(get_post_meta( $formid, 'mpfcf7_hide_failure_popup', true ));?>"> |
| 329 | <span class="description"><?php echo __('Add value like this eg. 5000 (Popup will hide after 5 Seconds).','message-popup-for-contact-form-7');?></span><br> |
| 330 | </td> |
| 331 | </tr> |
| 332 | </table> |
| 333 | </fieldset> |
| 334 | </div> |
| 335 | <?php |
| 336 | } |
| 337 | |
| 338 | /* Save Form Value*/ |
| 339 | function MPFCF7_update_editor_panel_meta($post_id) { |
| 340 | |
| 341 | $formids = $post_id->id; |
| 342 | |
| 343 | if (isset($_POST['mpfcf7_popup_success_enabled'])) { |
| 344 | update_post_meta($formids, 'mpfcf7_popup_success_enabled', '1'); |
| 345 | } else { |
| 346 | update_post_meta($formids, 'mpfcf7_popup_success_enabled', '0'); |
| 347 | } |
| 348 | if (isset($_POST['mpfcf7_btn_text'])) { |
| 349 | update_post_meta($formids, 'mpfcf7_btn_text', $_POST['mpfcf7_btn_text']); |
| 350 | } |
| 351 | if (isset($_POST['mpfcf7_popup_width'])) { |
| 352 | update_post_meta($formids, 'mpfcf7_popup_width', $_POST['mpfcf7_popup_width']); |
| 353 | } |
| 354 | if (isset($_POST['mpfcf7_popup_border_radious'])) { |
| 355 | update_post_meta($formids, 'mpfcf7_popup_border_radious', $_POST['mpfcf7_popup_border_radious']); |
| 356 | } |
| 357 | if (isset($_POST['mpfcf7_background_overlay'])) { |
| 358 | update_post_meta($formids, 'mpfcf7_background_overlay', $_POST['mpfcf7_background_overlay']); |
| 359 | } |
| 360 | if (isset($_POST['mpfcf7_background_color'])) { |
| 361 | update_post_meta($formids, 'mpfcf7_background_color', $_POST['mpfcf7_background_color']); |
| 362 | } |
| 363 | if (isset($_POST['mpfcf7_popup_border_width'])) { |
| 364 | update_post_meta($formids, 'mpfcf7_popup_border_width', $_POST['mpfcf7_popup_border_width']); |
| 365 | } |
| 366 | if (isset($_POST['mpfcf7_border_color'])) { |
| 367 | update_post_meta($formids, 'mpfcf7_border_color', $_POST['mpfcf7_border_color']); |
| 368 | } |
| 369 | if (isset($_POST['mpfcf7_popup_text_color'])) { |
| 370 | update_post_meta($formids, 'mpfcf7_popup_text_color', $_POST['mpfcf7_popup_text_color']); |
| 371 | } |
| 372 | if (isset($_POST['mpfcf7_btn_background_color'])) { |
| 373 | update_post_meta($formids, 'mpfcf7_btn_background_color', $_POST['mpfcf7_btn_background_color']); |
| 374 | } |
| 375 | if (isset($_POST['mpfcf7_hide_popup'])) { |
| 376 | update_post_meta($formids, 'mpfcf7_hide_popup', intval($_POST['mpfcf7_hide_popup'])); |
| 377 | } |
| 378 | |
| 379 | // failure data save |
| 380 | |
| 381 | if (isset($_POST['mpfcf7_popup_failure_enabled'])) { |
| 382 | // If checkbox is checked, store '1', otherwise store '0' |
| 383 | update_post_meta($formids, 'mpfcf7_popup_failure_enabled', '1'); |
| 384 | } else { |
| 385 | // If checkbox is not checked, store '0' |
| 386 | update_post_meta($formids, 'mpfcf7_popup_failure_enabled', '0'); |
| 387 | } |
| 388 | if (isset($_POST['mpfcf7_failure_btn_text'])) { |
| 389 | update_post_meta($formids, 'mpfcf7_failure_btn_text', sanitize_text_field($_POST['mpfcf7_failure_btn_text'])); |
| 390 | } |
| 391 | if (isset($_POST['mpfcf7_failure_btn_text'])) { |
| 392 | update_post_meta($formids, 'mpfcf7_failure_btn_text', sanitize_text_field($_POST['mpfcf7_failure_btn_text'])); |
| 393 | } |
| 394 | if (isset($_POST['mpfcf7_popup_failure_width'])) { |
| 395 | update_post_meta($formids, 'mpfcf7_popup_failure_width', sanitize_text_field($_POST['mpfcf7_popup_failure_width'])); |
| 396 | } |
| 397 | if (isset($_POST['mpfcf7_popup_failure_border_radius'])) { |
| 398 | update_post_meta($formids, 'mpfcf7_popup_failure_border_radius', sanitize_text_field($_POST['mpfcf7_popup_failure_border_radius'])); |
| 399 | } |
| 400 | if (isset($_POST['mpfcf7_failure_background_overlay'])) { |
| 401 | update_post_meta($formids, 'mpfcf7_failure_background_overlay', sanitize_text_field($_POST['mpfcf7_failure_background_overlay'])); |
| 402 | } |
| 403 | if (isset($_POST['mpfcf7_failure_background_color'])) { |
| 404 | update_post_meta($formids, 'mpfcf7_failure_background_color', sanitize_text_field($_POST['mpfcf7_failure_background_color'])); |
| 405 | } |
| 406 | if (isset($_POST['mpfcf7_popup_failure_border_width'])) { |
| 407 | update_post_meta($formids, 'mpfcf7_popup_failure_border_width', sanitize_text_field($_POST['mpfcf7_popup_failure_border_width'])); |
| 408 | } |
| 409 | if (isset($_POST['mpfcf7_failure_border_color'])) { |
| 410 | update_post_meta($formids, 'mpfcf7_failure_border_color', sanitize_text_field($_POST['mpfcf7_failure_border_color'])); |
| 411 | } |
| 412 | if (isset($_POST['mpfcf7_failure_text_color'])) { |
| 413 | update_post_meta($formids, 'mpfcf7_failure_text_color', sanitize_text_field($_POST['mpfcf7_failure_text_color'])); |
| 414 | } |
| 415 | if (isset($_POST['mpfcf7_failure_btn_background_color'])) { |
| 416 | update_post_meta($formids, 'mpfcf7_failure_btn_background_color', sanitize_text_field($_POST['mpfcf7_failure_btn_background_color'])); |
| 417 | } |
| 418 | if (isset($_POST['mpfcf7_hide_failure_popup'])) { |
| 419 | update_post_meta($formids, 'mpfcf7_hide_failure_popup', intval($_POST['mpfcf7_hide_failure_popup'])); |
| 420 | } |
| 421 | |
| 422 | } |
| 423 | add_action( 'wpcf7_after_save', 'MPFCF7_update_editor_panel_meta' , 10, 1 ); |
| 424 | |
| 425 | /* Default save value */ |
| 426 | function MPFCF7_activate() { |
| 427 | $args = array( |
| 428 | 'post_type' => 'wpcf7_contact_form', |
| 429 | 'posts_per_page' => -1 |
| 430 | ); |
| 431 | $cf7Forms = get_posts( $args ); |
| 432 | |
| 433 | foreach ($cf7Forms as $form) { |
| 434 | $contact_form_id = $form->ID; |
| 435 | } |
| 436 | |
| 437 | update_post_meta($contact_form_id, 'mpfcf7_popup_width', '478px'); |
| 438 | update_post_meta($contact_form_id, 'mpfcf7_popup_border_radious', '5px'); |
| 439 | update_post_meta($contact_form_id, 'mpfcf7_background_overlay', 'rgba(0,0,0,.4)'); |
| 440 | update_post_meta($contact_form_id, 'mpfcf7_background_color', '#ffffff'); |
| 441 | update_post_meta($contact_form_id, 'mpfcf7_popup_border_width', '3px'); |
| 442 | update_post_meta($contact_form_id, 'mpfcf7_border_color', '#ffffff'); |
| 443 | update_post_meta($contact_form_id, 'mpfcf7_popup_text_color', '#61534e'); |
| 444 | update_post_meta($contact_form_id, 'mpfcf7_btn_background_color', '#7cd1f9'); |
| 445 | update_post_meta($contact_form_id, 'mpfcf7_hide_popup', '100000'); |
| 446 | |
| 447 | } |
| 448 | register_activation_hook( mpfcf7_plugin_file, 'MPFCF7_activate' ); |
| 449 | |
| 450 | /* Popup Style Value */ |
| 451 | function MPFCF7_popup_customize(){ |
| 452 | |
| 453 | $args = array( |
| 454 | 'post_type' => 'wpcf7_contact_form', |
| 455 | 'posts_per_page' => -1 |
| 456 | ); |
| 457 | $cf7Forms = get_posts( $args ); |
| 458 | |
| 459 | foreach ($cf7Forms as $form) { |
| 460 | $contact_form_id = $form->ID; |
| 461 | } |
| 462 | |
| 463 | $mpfcf7_popup_width = get_post_meta( $contact_form_id,'mpfcf7_popup_width', true ); |
| 464 | $mpfcf7_popup_border_radious = get_post_meta( $contact_form_id,'mpfcf7_popup_border_radious', true ); |
| 465 | $mpfcf7_background_overlay = get_post_meta( $contact_form_id,'mpfcf7_background_overlay', true ); |
| 466 | $mpfcf7_background_color = get_post_meta( $contact_form_id,'mpfcf7_background_color', true ); |
| 467 | $mpfcf7_popup_border_width = get_post_meta( $contact_form_id,'mpfcf7_popup_border_width', true ); |
| 468 | $mpfcf7_border_color = get_post_meta( $contact_form_id,'mpfcf7_border_color', true ); |
| 469 | $mpfcf7_popup_text_color = get_post_meta( $contact_form_id,'mpfcf7_popup_text_color', true ); |
| 470 | $mpfcf7_btn_background_color = get_post_meta( $contact_form_id,'mpfcf7_btn_background_color', true ); |
| 471 | |
| 472 | |
| 473 | |
| 474 | $mpfcf7_popup_failure_width = get_post_meta($contact_form_id, 'mpfcf7_popup_failure_width', true); |
| 475 | $mpfcf7_popup_failure_border_radius = get_post_meta($contact_form_id, 'mpfcf7_popup_failure_border_radius', true); |
| 476 | $mpfcf7_failure_background_overlay = get_post_meta($contact_form_id, 'mpfcf7_failure_background_overlay', true); |
| 477 | $mpfcf7_failure_background_color = get_post_meta($contact_form_id, 'mpfcf7_failure_background_color', true); |
| 478 | $mpfcf7_popup_failure_border_width = get_post_meta($contact_form_id, 'mpfcf7_popup_failure_border_width', true); |
| 479 | $mpfcf7_failure_border_color = get_post_meta($contact_form_id, 'mpfcf7_failure_border_color', true); |
| 480 | $mpfcf7_failure_text_color = get_post_meta($contact_form_id, 'mpfcf7_failure_text_color', true); |
| 481 | $mpfcf7_failure_btn_background_color = get_post_meta($contact_form_id, 'mpfcf7_failure_btn_background_color', true); |
| 482 | |
| 483 | |
| 484 | ?> |
| 485 | <style type="text/css"> |
| 486 | |
| 487 | .custom-success-overlay { |
| 488 | background-color: <?php echo esc_attr($mpfcf7_background_overlay); ?>; |
| 489 | } |
| 490 | .custom-success-popup { |
| 491 | width: <?php echo esc_attr($mpfcf7_popup_width); ?>; |
| 492 | background-color: <?php echo esc_attr($mpfcf7_background_color); ?>; |
| 493 | border: <?php echo esc_attr($mpfcf7_popup_border_width); ?> solid; |
| 494 | border-color: <?php echo esc_attr($mpfcf7_border_color); ?>; |
| 495 | border-radius: <?php echo esc_attr($mpfcf7_popup_border_radious); ?>; |
| 496 | |
| 497 | } |
| 498 | .custom-success-popup .swal-text { |
| 499 | color: <?php echo esc_attr($mpfcf7_popup_text_color); ?>; |
| 500 | } |
| 501 | .custom-success-popup .swal-button { |
| 502 | background-color: <?php echo esc_attr($mpfcf7_btn_background_color); ?>!important; |
| 503 | } |
| 504 | |
| 505 | .custom-failure-overlay{ |
| 506 | background-color: <?php echo esc_attr($mpfcf7_failure_background_overlay); ?>; |
| 507 | } |
| 508 | |
| 509 | .custom-failure-popup { |
| 510 | width: <?php echo esc_attr($mpfcf7_popup_failure_width); ?>; |
| 511 | background-color: <?php echo esc_attr($mpfcf7_failure_background_color); ?>; |
| 512 | border: <?php echo esc_attr($mpfcf7_popup_failure_border_width); ?> solid; |
| 513 | border-color: <?php echo esc_attr($mpfcf7_failure_border_color); ?>; |
| 514 | border-radius: <?php echo esc_attr($mpfcf7_popup_failure_border_radius); ?>; |
| 515 | } |
| 516 | |
| 517 | .custom-failure-popup .swal-text{ |
| 518 | color: <?php echo esc_attr($mpfcf7_failure_text_color); ?>; |
| 519 | } |
| 520 | |
| 521 | .custom-failure-popup .swal-button{ |
| 522 | background-color: <?php echo esc_attr($mpfcf7_failure_btn_background_color); ?>!important; |
| 523 | } |
| 524 | .swal-icon--success:after, .swal-icon--success:before{ |
| 525 | display: none; |
| 526 | } |
| 527 | .swal-icon--success__hide-corners{ |
| 528 | display: none; |
| 529 | } |
| 530 | </style> |
| 531 | <?php |
| 532 | |
| 533 | } |
| 534 | add_action( 'wp_footer', 'MPFCF7_popup_customize' ); |
| 535 | |
| 536 | function MPFCF7_admin_customize () { |
| 537 | ?> |
| 538 | <style type="text/css"> |
| 539 | fieldset.verions_pro { |
| 540 | pointer-events: none; |
| 541 | opacity: 0.7; |
| 542 | } |
| 543 | </style> |
| 544 | <?php |
| 545 | } |
| 546 | add_action( 'admin_footer', 'MPFCF7_admin_customize' ); |
| 547 |