Removed unused functions
[danixland-site-plugin.git] / danixland-site-plugin.php
1 <?php
2 /*
3 Plugin Name: Site Plugin for danix.xyz
4 Description: Site specific code changes for danix.xyz
5 Plugin URI: https://danix.xyz
6 Version: 0.7
7 Author: Danilo 'danix' Macri
8 Author URI: https://danix.xyz
9 */
10
11 /**
12 * Disable admin bar sitewide
13 */
14 show_admin_bar(__return_false());
15
16 /**
17 * Allow Shortcodes inside the html widget
18 */
19 //add_filter( 'widget_text', 'do_shortcode' );
20
21 /**
22 * make sure the links menu in the admin is visible
23 */
24 add_filter( 'pre_option_link_manager_enabled', '__return_true' );
25
26 /**
27 * The gravatar shortcode
28 *
29 * @param email $email email address used to retrieve the gravatar image
30 * @return string HTML the image tag which will display the gravatar image.
31 *
32 */
33 function danix_gravatar( $atts ) {
34 extract(shortcode_atts(array(
35 'email' => '',
36 'size' => '200',
37 'default' => '',
38 'alt' => ''
39 ), $atts));
40
41 if( empty($email) )
42 return '';
43
44 $output = get_avatar($email, $size, $default, $alt);
45
46 return $output;
47 }
48 add_shortcode('gravatar', 'danix_gravatar');
49
50 /**
51 * The google analytics code
52 *
53 */
54 /*function danix_google_anal() {
55 if ( function_exists('cn_cookies_accepted') && cn_cookies_accepted() ) { ?>
56 <!-- Global site tag (gtag.js) - Google Analytics -->
57 <script async src="https://www.googletagmanager.com/gtag/js?id=UA-23882460-1"></script>
58 <script>
59 window.dataLayer = window.dataLayer || [];
60 function gtag(){dataLayer.push(arguments);}
61 gtag('js', new Date());
62
63 gtag('config', 'UA-23882460-1');
64 </script>
65 <?php }
66 }
67 add_action('wp_head', 'danix_google_anal', 10);
68 */
69 /**
70 * The googlemaps shortcode
71 *
72 * @param width the width of the returned map
73 * @param height the height of the returned map
74 * @param src the url of the map you want to display
75 * @return string HTML the map object
76 * @since 0.57
77 *
78 */
79 /*function danix_gmaps($atts, $content = null) {
80 extract(shortcode_atts(array(
81 "width" => '640',
82 "height" => '480',
83 "src" => ''
84 ), $atts));
85 return '<iframe width="'.$width.'" height="'.$height.'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$src.'&amp;output=embed" ></iframe>';
86 }
87 add_shortcode("googlemaps", "danix_gmaps");
88 */
89
90 /*
91 * Swap src with data-src inside img tags to use lazyload
92 */
93 function dagreynix_lazy_load($atts) {
94 $default = get_template_directory_uri() . '/img/standard-post-thumb.png';
95 if ( array_key_exists('src', $atts) ) {
96 $atts['data-src'] = $atts['src'];
97 $atts['src'] = $default;
98 }
99 return $atts;
100 }
101 // add_filter( 'wp_get_attachment_image_attributes', 'dagreynix_lazy_load', 10, 2 );