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 | |
| /** | |
| * Anti Spam Email | |
| * [email][email protected][/email] | |
| **/ | |
| function tp_hide_email_shortcode( $atts , $content = null ) | |
| { | |
| if ( ! is_email( $content ) ) { | |
| return; | |
| } |
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
| var isMobile = false; //initiate as false | |
| // device detection | |
| if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) | |
| || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1 |
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
| /** | |
| * Get all post id's ordered by distance from given point | |
| * | |
| * @param string $post_type The post type of posts you are searching | |
| * @param float $search_lat The latitude of where you are searching | |
| * @param float $search_lng The Longitude of where you are searching | |
| * @param string $orderby What order do you want the ID's returned as? ordered by distance ASC or DESC? | |
| * @return array $wpdb->get_col() array of ID's in ASC or DESC order as distance from point | |
| */ | |
| function fuji_revendeur_getPostIDsByRange( $search_lat = 51.499882, $search_lng = -0.126178, $orderby = "ASC", $limit = 10, $services = false ) |
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
| /** | |
| * Save _lat _lng | |
| * | |
| **/ | |
| add_action( 'save_post', 'stl_store_meta_save' ); | |
| function stl_store_meta_save( $post_id ) | |
| { | |
| global $wpdb; | |
| $table = $wpdb->prefix .'geodatastore'; |
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
| //************** SEARCH FILTER **************// | |
| add_filter('posts_join', 'revendeurs_search_join' ); | |
| function revendeurs_search_join ($join){ | |
| global $pagenow, $wpdb; | |
| // I want the filter only when performing a search on edit page of Custom Post Type named "revendeurs" | |
| if ( is_admin() && $pagenow=='edit.php' && $_GET['post_type']=='revendeurs' && $_GET['s'] != '') | |
| { | |
| $join .='LEFT JOIN '.$wpdb->postmeta. ' ON '. $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id '; | |
| } | |
| return $join; |
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 | |
| $host = gethostbyaddr( $_SERVER['REMOTE_ADDR'] ); | |
| if( strstr( $host, 'pnet.pl' ) ) | |
| { | |
| ob_end_clean(); | |
| header("HTTP/1.0 404 Not Found"); | |
| header('location:http://www.dtc.fr/'); | |
| die(); | |
| } |
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 | |
| // [update : sécurité des sorties] | |
| add_filter( 'gform_field_content', 'tp_subsection_field', 10, 5 ); | |
| function tp_subsection_field( $content, $field, $value, $lead_id, $form_id ) | |
| { | |
| // Limiter les balises HTML autorisées dans les labels (gras, images, etc.) | |
| $allowed_html = array( | |
| 'strong' => array(), | |
| 'em' => array(), | |
| 'b' => array(), |
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
| /** | |
| * Exemple de formulaire | |
| * Qx = Question | |
| * - Réponse : valeur | |
| * | |
| **/ | |
| Q1 : Tu aimes quel animal ? | |
| - Cheval : cheval | |
| - Papillon : papillon | |
| - Ours : ours |
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 | |
| if( function_exists( 'acf_set_options_page_menu') ) | |
| { | |
| acf_set_options_page_menu( __( 'Calculator', 'domainname' ) ); | |
| } |
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 | |
| if( !class_exists( 'acf' ) || !function_exists( 'acfgp_register_fields' ) ) | |
| { | |
| function tp_acf_admin_error_notice() | |
| { | |
| $plugin = get_plugin_data( __FILE__ ); | |
| echo '<div class="error"><p><strong>'. $plugin['Name'] .'</strong> need <strong>ACF</strong> and <strong>ACF Gallery Field</strong> plugin to work :(</p></div>'; | |
| } | |
| add_action( 'admin_notices', 'tp_acf_admin_error_notice' ); |