# phone-button/1.0.0/include/functions.php

Phone Button, version 1.0.0. 96 lines.

- Page: https://pluginprobe.com/plugins/phone-button/1.0.0/code/include/functions.php
- Raw: https://pluginprobe.com/plugins/phone-button/1.0.0/raw/include/functions.php
- Modified: 2020-05-04T22:53:08+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/phone-button/1.0.0/code/include/functions.php#L10-L20`.

```php
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
<?php

// ==================================================================
// This function create a content in mysql that will fit the database and will ignore marks like ("", \, =)
// ==================================================================

function yydev_phone_btn_mysql_prep( $value ) {
        $magic_quotes_active = get_magic_quotes_gpc();
        $new_enough_php = function_exists( "mysql_real_escape_string" ); // i.e. PHP >= v4.3.0
        if( $new_enough_php ) { // PHP v4.3.0 or higher
                // undo any magic quote effects so mysql_real_escape_string can do the work
                if( $magic_quotes_active ) { $value = stripslashes( $value ); }
        } else { // before PHP v4.3.0
                // if magic quotes aren't already on then add slashes manually
                if( !$magic_quotes_active ) { $value = addslashes( $value ); }
                // if magic quotes are active, then the slashes already exist
        }
        $value = trim($value);
        $value = stripslashes($value);
        $value = stripslashes_deep($value);
        
        return $value;
} // function yydev_phone_btn_mysql_prep( $value ) {

// ==================================================================
// This function will display error message if there was something wrong
// $error_message will be the name of the string we define and if it's exists
// it will echo the message to the page
// if $display_inline is set to 1 it will have style of display: inline
// ==================================================================

function yydev_phone_btn_show_error_message($error_message, $display_inline = "") {
    
    if($display_inline == 1) {
        $display_inline_echo = "display-inline";
    } // if($display_inline == 1) {
    
    if( isset($error_message) ) {
        ?>
        
        <div class="output-data-error-message <?php echo $display_inline_echo; ?>">
            <?php echo $error_message; ?>
        </div>
        
        <?php
    } // if( isset($error) ) {
    
} // function yydev_phone_btn_show_error_message($error) {


// ==================================================================
// Cehcking if the checkbox is already set
// ==================================================================

function yydev_phone_btn_checkbox_isset($post_value) {
    
    $checkbox_value = '';

    if( isset( $_POST[$post_value] ) ) {
        $checkbox_value = intval($_POST[$post_value]);
    } // if( isset( $_POST[$post_value] ) ) {

    return $checkbox_value;
    
} // function yydev_phone_btn_checkbox_isset($error) {

// ================================================
// Echoing Message if it's exists 
// ================================================

function yydev_phone_btn_echo_success_message_if_exists($success) {

    if(isset($success) && !empty($success) ) {
        echo "<div class='output-messsage'> " . htmlentities($success) . " </div>";
    } // if(isset($success) && !empty($success) ) {

} // function yydev_phone_btn_echo_success_message_if_exists($success) {

function yydev_phone_btn_echo_error_message_if_exists($error) {

    if(isset($error) && !empty($error) ) {
        echo "<div class='error-messsage'><b>Error:</b> " .  $error . " </div>";
    } // if(isset($_GET['error-message'])) {

} // function yydev_phone_btn_echo_error_message_if_exists() {

// ==================================================================
// redirect the page using the path you provided
// ==================================================================

function yydev_phone_btn_redirections_page($link) {
	header("Location: {$link}");
	exit;
} // function yydev_phone_btn_redirections_page($path) {

```
