Linted file. Added phpcs.xml config file for linting. Added
[danixland-site-plugin.git] / danixland-site-plugin.php
CommitLineData
5d4d783d 1<?php
2/*
bf61b3c6 3Plugin Name: Site Plugin for danix.xyz
4Description: Site specific code changes for danix.xyz
b4113a8e 5Plugin URI: https://danix.xyz
89b9676f 6Version: 0.7.3
b4113a8e 7Author: Danilo 'danix' Macri
8Author URI: https://danix.xyz
5d4d783d 9*/
10
11/**
12 * Disable admin bar sitewide
13 */
89b9676f 14show_admin_bar( __return_false() );
5d4d783d 15
16/**
17 * Allow Shortcodes inside the html widget
18 */
0fcdb4ac 19//add_filter( 'widget_text', 'do_shortcode' );
5d4d783d 20
21/**
22 * make sure the links menu in the admin is visible
23 */
24add_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 */
33function danix_gravatar( $atts ) {
89b9676f 34 extract(
35 shortcode_atts(
36 array(
37 'email' => '',
38 'size' => '200',
39 'default' => '',
40 'alt' => '',
41 ),
42 $atts
43 )
44 );
5d4d783d 45
89b9676f 46 if ( empty( $email ) ) {
47 return '';
48 }
5d4d783d 49
89b9676f 50 $output = get_avatar( $email, $size, $default, $alt );
5d4d783d 51
89b9676f 52 return $output;
5d4d783d 53}
89b9676f 54add_shortcode( 'gravatar', 'danix_gravatar' );
2f370882 55
56/**
57 * Added baguette.js to display a lightbox for images and galleries
58 */
59function baguette_register_assets() {
89b9676f 60 wp_register_script( 'baguettebox', plugin_dir_url( __FILE__ ) . '/baguette/baguetteBox.min.js', array(), '1.11.1', true );
61 wp_register_script( 'baguetteload', plugin_dir_url( __FILE__ ) . '/baguette/baguetteLoad.js', array(), '1.11.1', true );
62 wp_register_style( 'baguettebox-css', plugin_dir_url( __FILE__ ) . '/baguette/baguetteBox.min.css', array(), '1.11.1' );
2f370882 63}
64add_action( 'wp_enqueue_scripts', 'baguette_register_assets' );
65
66function baguette_enqueue_assets() {
89b9676f 67 if ( has_block( 'gallery' ) || has_block( 'image' ) ) {
68 wp_enqueue_script( 'baguettebox' );
69 wp_enqueue_script( 'baguetteload' );
70 wp_enqueue_style( 'baguettebox-css' );
71 }
2f370882 72}
73add_action( 'wp_enqueue_scripts', 'baguette_enqueue_assets' );
89b9676f 74
75/*
76 * Do not translate smileys into emoticons.
77 */
78add_filter( 'option_use_smilies', '__return_false' );