Avatar::option_form()
Description #
Register options of Avatar addon.
Source #
File: addons/avatar/avatar.php
public static function option_form() { $opt = ap_opt(); ob_start(); ?> <script type="text/javascript"> jQuery(document).ready(function($){ $('#ap-clear-avatar').on('click', function(e){ e.preventDefault(); $.ajax({ url: '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>', data: { action: 'ap_clear_avatar_cache', __nonce: '<?php echo esc_attr( wp_create_nonce( 'clear_avatar_cache' ) ); ?>' }, success: function(data){ if(data==='success') alert('All avatar deleted'); } }); }); }); </script> <?php $js = ob_get_clean(); $form = array( 'submit_label' => __( 'Save add-on options', 'anspress-question-answer' ), 'fields' => array( 'clear_avatar_cache' => array( 'label' => __( 'Clear Cache', 'anspress-question-answer' ), 'html' => '<div class="ap-form-fields-in"><a id="ap-clear-avatar" href="#" class="button">' . __( 'Clear avatar cache', 'anspress-question-answer' ) . '</a></div>' . $js, ), 'avatar_font' => array( 'label' => __( 'Font family', 'anspress-question-answer' ), 'desc' => __( 'Select font family for avatar letters.', 'anspress-question-answer' ), 'type' => 'select', 'options' => array( 'calibri' => 'Calibri', 'Pacifico' => 'Pacifico', 'OpenSans' => 'Open Sans', 'Glegoo-Bold' => 'Glegoo Bold', 'DeliusSwashCaps' => 'Delius Swash Caps', ), 'value' => $opt['avatar_font'], ), 'avatar_force' => array( 'label' => __( 'Force avatar', 'anspress-question-answer' ), 'desc' => __( 'Show AnsPress avatars by default instead of gravatar fallback. Useful in localhost development.', 'anspress-question-answer' ), 'type' => 'checkbox', 'value' => $opt['avatar_force'], ), ), ); return $form; }
Expand full source code Collapse full source code View on GitHub: addons/avatar/avatar.php:89
Add your comment