AnsPress_Avatar_Hook::load_options()
Description #
Register Avatar options
Source #
File: addons/free/avatar.php
public static function load_options() { ob_start(); ?> <script type="text/javascript"> jQuery(document).ready(function($){ $('#ap-clear-avatar').click(function(e){ e.preventDefault(); $.ajax({ url: '<?php echo admin_url( "admin-ajax.php" ); ?>', data: { action: 'ap_clear_avatar_cache', __nonce: '<?php echo wp_create_nonce( "clear_avatar_cache" ); ?>' }, success: function(data){ if(data==='success') alert('All avatar deleted'); } }); }); }); </script> <?php $js = ob_get_clean(); ap_register_option_section( 'addons', basename( __FILE__ ), __( 'Dynamic Avatar', 'anspress-question-answer' ), array( array( 'name' => 'clear_avatar_cache', 'type' => 'custom', 'html' => '<label class="ap-form-label" for="avatar_font">' . __( 'Clear Cache', 'anspress-question-answer' ) . '</label><div class="ap-form-fields-in"><a id="ap-clear-avatar" href="#" class="button">' . __( 'Clear avatar cache', 'anspress-question-answer' ) . '</a></div>' .$js, ), array( 'name' => 'avatar_font', 'label' => __( 'Font family', 'anspress-question-answer' ), 'description' => __( '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', ), ), array( 'name' => 'avatar_force', 'label' => __( 'Force avatar', 'anspress-question-answer' ), 'description' => __( 'Show AnsPress avatars by default instead of gravatar fallback. Useful in localhost development.', 'anspress-question-answer' ), 'type' => 'checkbox', ), )); }
Expand full source code Collapse full source code View on GitHub: addons/free/avatar.php:116
Add your comment