PluginProbe
Simple Accessibility Button / 2.3.0
Simple Accessibility Button v2.3.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.8 1.0.9 1.1.0 1.1.2 1.1.4 1.1.5 1.1.6 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 All 31 releases
yydevelopment-accessibility / include / functions.php

functions.php in Simple Accessibility Button 2.3.0, at include/functions.php

129 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2 <?php
3
4 // ==================================================================
5 // output the values into the the page or input in the correct way
6 // allowing to have double and single quotes inside input
7 // ==================================================================
8
9 function yydev_accessibility_html_output($output_code) {
10
11 $output_code = stripslashes_deep($output_code);
12 $output_code = esc_html($output_code);
13 return $output_code;
14
15 } // function yydev_redirect_html_output($output_code) {
16
17 // ==================================================================
18 // This function will display error message if there was something wrong
19 // $error_message will be the name of the string we define and if it's exists
20 // it will echo the message to the page
21 // if $display_inline is set to 1 it will have style of display: inline
22 // ==================================================================
23
24 function yydev_accessibility_show_error_message($error_message, $display_inline = "") {
25
26 if($display_inline == 1) {
27 $display_inline_echo = "display-inline";
28 } // if($display_inline == 1) {
29
30 if( isset($error_message) ) {
31 ?>
32
33 <div class="output-data-error-message <?php echo $display_inline_echo; ?>">
34 <?php echo $error_message; ?>
35 </div>
36
37 <?php
38 } // if( isset($error) ) {
39
40 } // function yydev_accessibility_show_error_message($error) {
41
42
43 // ==================================================================
44 // Cehcking if the checkbox is already set
45 // ==================================================================
46
47 function yydev_accessibility_checkbox_isset($post_value) {
48
49 $checkbox_value = '';
50
51 if( isset( $_POST[$post_value] ) ) {
52 $checkbox_value = intval($_POST[$post_value]);
53 } // if( isset( $_POST[$post_value] ) ) {
54
55 return $checkbox_value;
56
57 } // function yydev_accessibility_checkbox_isset($error) {
58
59 // ================================================
60 // Echoing Message if it's exists
61 // ================================================
62
63 function yydev_accessibility_echo_message_if_exists() {
64
65 if(isset($_GET['message'])) {
66 echo "<div class='output-messsage'> " . htmlentities($_GET['message']) . " </div>";
67 } // if(isset($_GET['message'])) {
68
69 if(isset($_GET['error-message'])) {
70 echo "<div class='error-messsage'><b>Error:</b> " . htmlentities($_GET['error-message']) . " </div>";
71 } // if(isset($_GET['error-message'])) {
72
73 } // function yydev_accessibility_echo_message_if_exists() {
74
75
76 function yydev_accessibility_echo_success_message_if_exists($success) {
77
78 if(isset($success) && !empty($success) ) {
79 echo "<div class='output-messsage'> " . htmlentities($success) . " </div>";
80 } // if(isset($success) && !empty($success) ) {
81
82 } // function yydev_accessibility_echo_success_message_if_exists($success) {
83
84 function yydev_accessibility_echo_error_message_if_exists($error) {
85
86 if(isset($error) && !empty($error) ) {
87 echo "<div class='error-messsage'><b>Error:</b> " . $error . " </div>";
88 } // if(isset($_GET['error-message'])) {
89
90 } // function yydev_accessibility_echo_error_message_if_exists() {
91
92 // ================================================
93 // Echoing Message if it's exists
94 // ================================================
95
96 function yydev_accessibility_find_page_id() {
97
98 global $wpdb;
99 $post_id_num = 0;
100
101 // in case of page or blog post
102 if( is_single() || is_page() ) {
103 $post_id_num = get_the_ID();
104 } // if( is_single() || is_page() ) {
105
106 // in case of static home page
107 if( is_home() ) {
108 $blog_page_id = get_option( 'page_for_posts' );
109
110 // incase the blog is on the home page
111 if( !empty($blog_page_id) ) {
112 $post_id_num = $blog_page_id;
113 } // if( $blog_page_id ) {
114
115 } // if( !empty($blog_page_id) ) {
116
117 return intval($post_id_num);
118
119 } // function yydev_accessibility_find_page_id() {
120
121 // ==================================================================
122 // redirect the page using the path you provided
123 // ==================================================================
124
125 function yydev_accessibility_redirections_page($link) {
126 header("Location: {$link}");
127 exit;
128 } // function yydev_accessibility_redirections_page($path) {
129