admin_url( 'admin-ajax.php' ) )); } } add_action( 'wp_enqueue_scripts', 'acp_toolbar_assets' ); function get_acp_toolbar_toggle() { $options = get_option('accessible_poetry'); $ariaLabel = __('Toggle accessibility toolbar', 'acp'); $output = ''; return $output; } function get_acp_close_toolbar() { $ariaLabel = __('Close the accessibility toolbar', 'acp'); $output = ''; return $output; } /* * Creates the button sets * of the toolbar */ function get_acp_toolbar_set($label, $id) { // Get our setting values $options = get_option('accessible_poetry'); // Font Sizer & Contrast Sets if( 'acp-toolbar-textsize' == $id || 'acp-toolbar-contrast' == $id ) { $type = ( 'acp-toolbar-textsize' == $id ) ? 'text' : 'contrast'; if( 'acp-toolbar-textsize' == $id ) { $st1_btn_id = 'acp-text-down'; $st1_btn_icon = 'zoom_out'; $st1_btn_label = __('Decrease font size', 'acp'); $st2_btn_id = 'acp-text-up'; $st2_btn_icon = 'zoom_in'; $st2_btn_label = __('Increase font size', 'acp'); $st3_btn_id = 'acp-text-reset'; $st3_btn_label = __('Back to original', 'acp'); } elseif( 'acp-toolbar-contrast' == $id ) { $st1_btn_id = 'acp-contrast-dark'; $st1_btn_icon = 'brightness_low'; $st1_btn_label = __('Dark contrast', 'acp'); $st2_btn_id = 'acp-contrast-bright'; $st2_btn_icon = 'brightness_high'; $st2_btn_label = __('Bright contrast', 'acp'); $st3_btn_id = 'acp-contrast-reset'; $st3_btn_label = __('Back to original', 'acp'); } $output = '' .$label . ''; $output .= ''; } // Links Set elseif( 'acp-toolbar-links' == $id ) { $output = '' . $label . ''; $output .= ''; } // Fonts & Animations Sets elseif( 'acp-toolbar-font' == $id || 'acp-toolbar-animation' == $id ) { if( 'acp-toolbar-font' == $id ) { $btn_id = 'acp-font-readable'; $icon = 'text_format'; $label = __('Fonts', 'acp'); $label2 = __('Readable Font', 'acp'); } elseif( 'acp-toolbar-animation' == $id ) { $btn_id = 'acp-animation'; $icon = 'local_movies'; $label = __('Animations', 'acp'); $label2 = __('Disable Animations', 'acp'); } $output = '' . $label . ''; $output .= ''; } // Declaration & Contact Set elseif( 'declaration' == $id ) { $output = ''; } return $output; } /* * Creates the Toolbar */ function acp_get_toolbar() { $options = get_option('accessible_poetry'); $include = 'data-fontsizer-include="' . $options['fontsizer_include'] . '"'; $exclude = 'data-fontsizer-exclude="' . $options['fontsizer_exclude'] . '"'; $fromTop = ( 15 < $options['icon_position'] ) ? intval($options['icon_position']) : 30; $skin_class = 'style-' . $options['toolbar_skin']; echo ''; } /* * Toolbar validation for mobile visibility * * this function is the one that needed * to be executed. */ function acp_toolbar() { // Get our setting values $options = get_option( 'accessible_poetry' ); if( isset($options['enable_manual_toolbar']) || isset($options['enable_ajax_toolbar']) ) { if( isset($options['disable_mobile_toolbar']) && wp_is_mobile() ) exit(); if( isset($options['enable_ajax_toolbar']) ) { acp_get_toolbar(); die(); } else { acp_get_toolbar(); } } } add_action('wp_ajax_acp_toolbar', 'acp_toolbar'); add_action('wp_ajax_nopriv_acp_toolbar', 'acp_toolbar');