Ejemplo n.º 1
0
    function clearcontent_social_media_icons()
    {
        $icon_path = get_template_directory_uri() . '/pics/64_64/';
        /*
         * Every key represents a slug which determines the kind of social plugin.
         * Then the value is an array with the following arguments:
         * [1] icon image when not hoving over
         * [2] icon image when hoving over
         * [3] url to the social media profile.
         * It must have an length of 3.
         */
        $icon_data = array('Github' => array($icon_path . 'github.png', $icon_path . 'github_x.png', 'https://github.com/NikolaiT'), 'Twitter' => array($icon_path . 'twitter.png', $icon_path . 'twitter_x.png', 'https://twitter.com/incolumitas_'), 'Rss' => array($icon_path . 'rss.png', $icon_path . 'rss_x.png', get_bloginfo('url')), 'Email' => array($icon_path . 'email.png', $icon_path . 'email_x.png', get_bloginfo('url')));
        /* Clean recursively */
        $cleaner = function ($item) {
            return clearcontent_esc_deep($item);
        };
        $icon_data = array_map($cleaner, $icon_data);
        ?>
            <div class="header-icons">
                <?php 
        foreach ($icon_data as $key => $value) {
            ?>
                    <a title="Follow Nikolai Tschacher on <?php 
            esc_html_e($key);
            ?>
" href="<?php 
            echo $value[2];
            ?>
" target="_blank">
                        <img src="<?php 
            echo $value[0];
            ?>
" onmouseover="this.src = '<?php 
            echo $value[1];
            ?>
'" onmouseout="this.src = '<?php 
            echo $value[0];
            ?>
'"width="36px" alt="Follow me on <?php 
            echo $key;
            ?>
"></a>
            <?php 
        }
        ?>
            </div>

            <?php 
    }
Ejemplo n.º 2
0
 function clearcontent_esc_deep($value)
 {
     if (is_array($value)) {
         $value = array_map('clearcontent_esc_deep', $value);
     } elseif (is_object($value)) {
         $vars = get_object_vars($value);
         foreach ($vars as $key => $data) {
             $value->{$key} = clearcontent_esc_deep($data);
         }
     } elseif (is_string($value)) {
         $value = esc_html($value);
     }
     return $value;
 }