functions.php
4 weeks ago
install.php
4 weeks ago
main-page.php
4 weeks ago
redirect-page.php
4 weeks ago
script.php
4 weeks ago
secondary-page.php
4 weeks ago
settings.php
4 weeks ago
style.php
4 weeks ago
functions.php
93 lines
| 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_redirect_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_redirect_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_redirect_show_error_message($error) { |
| 41 | |
| 42 | |
| 43 | // ================================================ |
| 44 | // Echoing Message if it's exists |
| 45 | // ================================================ |
| 46 | |
| 47 | function yydev_redirect_echo_message_if_exists() { |
| 48 | |
| 49 | if(isset($_GET['message'])) { |
| 50 | echo "<div class='output-messsage'> " . htmlentities($_GET['message']) . " </div>"; |
| 51 | } // if(isset($_GET['message'])) { |
| 52 | |
| 53 | if(isset($_GET['error-message'])) { |
| 54 | echo "<div class='error-messsage'><b>Error:</b> " . htmlentities($_GET['error-message']) . " </div>"; |
| 55 | } // if(isset($_GET['error-message'])) { |
| 56 | |
| 57 | } // function yydev_redirect_echo_message_if_exists() { |
| 58 | |
| 59 | |
| 60 | function yydev_redirect_echo_success_message_if_exists($success) { |
| 61 | |
| 62 | if(isset($success) && !empty($success) ) { |
| 63 | echo "<div class='output-messsage'> " . htmlentities($success) . " </div>"; |
| 64 | } // if(isset($success) && !empty($success) ) { |
| 65 | |
| 66 | } // function yydev_redirect_echo_success_message_if_exists($success) { |
| 67 | |
| 68 | function yydev_redirect_link_echo_success_message_if_exists($success) { |
| 69 | |
| 70 | if(isset($success) && !empty($success) ) { |
| 71 | echo "<div class='output-messsage'> " . $success . " </div>"; |
| 72 | } // if(isset($success) && !empty($success) ) { |
| 73 | |
| 74 | } // function yydev_redirect_echo_success_message_if_exists($success) { |
| 75 | |
| 76 | |
| 77 | function yydev_redirect_echo_error_message_if_exists($error) { |
| 78 | |
| 79 | if(isset($error) && !empty($error) ) { |
| 80 | echo "<div class='error-messsage'><b>Error:</b> " . $error . " </div>"; |
| 81 | } // if(isset($_GET['error-message'])) { |
| 82 | |
| 83 | } // function yydev_redirect_echo_error_message_if_exists() { |
| 84 | |
| 85 | // ================================================================== |
| 86 | // redirect the page using the path you provided |
| 87 | // ================================================================== |
| 88 | |
| 89 | function yydev_redirect_redirections_page($link) { |
| 90 | header("Location: {$link}"); |
| 91 | exit; |
| 92 | } // function yydev_redirect_redirections_page($path) { |
| 93 |