This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Get date from Contact Form 7 before email send | |
| add_action("wpcf7_before_send_mail", "wpcf7_save_data"); | |
| function wpcf7_save_data(&$wpcf7_data) { | |
| // Here is the variable where the data are stored! | |
| $user_nume = $wpcf7_data->posted_data['user_nume']; | |
| $user_email = $wpcf7_data->posted_data['user_email']; | |
| // Set the cookies | |
| setcookie('os_username', $user_nume, time() + (10*365*24*60*60)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Create a new database connection | |
| $customdb = new wpdb(USERNAME, PASSWORD, DATABASE, 'localhost'); | |
| $customdb->show_errors(); | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Generate a random string with a given lenght and set special char on or off | |
| function random_gen($length, $special_char) { | |
| $random = ""; | |
| srand((double)microtime()*1000000); | |
| $char_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
| $char_list .= "abcdefghijklmnopqrstuvwxyz"; | |
| $char_list .= "1234567890"; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $new_general_setting = new new_general_setting(); | |
| class new_general_setting { | |
| function new_general_setting( ) { | |
| add_filter( 'admin_init' , array( &$this , 'register_fields' ) ); | |
| } | |
| function register_fields() { | |
| register_setting( 'general', 'OPTION_NAME', 'esc_attr' ); | |
| add_settings_field('OPTION_NAME', '<label for="OPTION_NAME">'.__('OPTION_LABEL_TEXT' , 'OPTION_NAME' ).'</label>' , array(&$this, 'fields_html') , 'general' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] ); | |
| require_once ($parse_uri[0] . 'wp-load.php'); | |
| require_once($parse_uri[0] . '/wp-admin/includes/taxonomy.php'); | |
| // Get coordinates for a specified address | |
| function getCoordinates($address){ | |
| $address = str_replace("Str.", "Strada", $address); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UPDATE wp_options SET option_value = '' WHERE option_name = 'active_plugins'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Requires dependencies https://github.com/carhartl/jquery-cookie --> | |
| <script src="{$js_dir}jquery.cookie.js"></script> | |
| {if $smarty.get.fb == 1 && $page_name == 'index'} | |
| <script type="text/javascript"> | |
| $(document).ready(function(){ | |
| // console.log("BEFORE"); | |
| var cookie = $.cookie("loggedinFB"); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require('includes/application_top.php'); | |
| // Output headers so that the file is downloaded rather than displayed | |
| header('Content-Type: text/csv; charset=utf-8'); | |
| header('Content-Disposition: attachment; filename=data.csv'); | |
| // Create a file pointer connected to the output stream | |
| $output = fopen('php://output', 'w'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add item to cart on visit | |
| add_action( 'init', 'add_product_to_cart' ); | |
| function add_product_to_cart() { | |
| if ( ! is_admin() ) { | |
| global $woocommerce; | |
| $product_id = THE_PRODUCT_ID; | |
| $found = false; | |
| //check if product already in cart | |
| if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT table_schema "Data Base Name", | |
| sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" | |
| FROM information_schema.TABLES GROUP BY table_schema ; |