PluginProbe
Phone Button / trunk
Phone Button vtrunk
trunk 1.0.0 1.0.1 1.0.3 1.1.0 1.1.1 2.0.0 2.1.0 2.1.1 2.1.2
← All changes | include/functions.php +38 -18 1.1.1trunk View file →
@@ -1,29 +1,20 @@
1 1 <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2 2 <?php
3 3
4 4 // ==================================================================
5 -// This function create a content in mysql that will fit the database and will ignore marks like ("", \, =)
5 +// output the values into the the page or input in the correct way
6 +// allowing to have double and single quotes inside input
6 7 // ==================================================================
7 8
8 -function yydev_phone_btn_mysql_prep( $value ) {
9 - $magic_quotes_active = get_magic_quotes_gpc();
10 - $new_enough_php = function_exists( "mysql_real_escape_string" ); // i.e. PHP >= v4.3.0
11 - if( $new_enough_php ) { // PHP v4.3.0 or higher
12 - // undo any magic quote effects so mysql_real_escape_string can do the work
13 - if( $magic_quotes_active ) { $value = stripslashes( $value ); }
14 - } else { // before PHP v4.3.0
15 - // if magic quotes aren't already on then add slashes manually
16 - if( !$magic_quotes_active ) { $value = addslashes( $value ); }
17 - // if magic quotes are active, then the slashes already exist
18 - }
19 - $value = trim($value);
20 - $value = stripslashes($value);
21 - $value = stripslashes_deep($value);
22 -
23 - return $value;
24 -} // function yydev_phone_btn_mysql_prep( $value ) {
9 +function yydev_phone_btn_html_output($output_code) {
25 10
11 + $output_code = stripslashes_deep($output_code);
12 + $output_code = esc_html($output_code);
13 + return $output_code;
14 +
15 +} // function yydev_phone_btn_html_output($output_code) {
16 +
26 17 // ==================================================================
27 18 // This function will display error message if there was something wrong
28 19 // $error_message will be the name of the string we define and if it's exists
29 20 // it will echo the message to the page
@@ -83,8 +74,37 @@
83 74 echo "<div class='error-messsage'><b>Error:</b> " . $error . " </div>";
84 75 } // if(isset($_GET['error-message'])) {
85 76
86 77 } // function yydev_phone_btn_echo_error_message_if_exists() {
78 +
79 +// ================================================
80 +// Echoing Message if it's exists
81 +// ================================================
82 +
83 +function yydev_phone_btn_find_page_id() {
84 +
85 + global $wpdb;
86 + $post_id_num = 0;
87 +
88 + // in case of page or blog post
89 + if( is_single() || is_page() ) {
90 + $post_id_num = get_the_ID();
91 + } // if( is_single() || is_page() ) {
92 +
93 + // in case of static home page
94 + if( is_home() ) {
95 + $blog_page_id = get_option( 'page_for_posts' );
96 +
97 + // incase the blog is on the home page
98 + if( !empty($blog_page_id) ) {
99 + $post_id_num = $blog_page_id;
100 + } // if( $blog_page_id ) {
101 +
102 + } // if( !empty($blog_page_id) ) {
103 +
104 + return intval($post_id_num);
105 +
106 +} // function yydev_phone_btn_find_page_id() {
87 107
88 108 // ==================================================================
89 109 // redirect the page using the path you provided
90 110 // ==================================================================