Init ribbon
This commit is contained in:
parent
a4f7eaf323
commit
b2b3d72e03
3 changed files with 102 additions and 0 deletions
26
css/ilovexm24.css
Normal file
26
css/ilovexm24.css
Normal file
|
@ -0,0 +1,26 @@
|
|||
.ilovexm24_content {
|
||||
font-family: Helvetica;
|
||||
font-weight: bolder;
|
||||
font-size: 1.4em;
|
||||
width: 200px;
|
||||
background: #FFF;
|
||||
text-align: center;
|
||||
line-height: 50px;
|
||||
letter-spacing: 1px;
|
||||
color: red;
|
||||
transform: rotate(-45deg);
|
||||
-webkit-transform: rotate(-45deg);
|
||||
position: fixed;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,.3);
|
||||
top: 25px;
|
||||
right: -50px;
|
||||
transform: rotate(45deg);
|
||||
-webkit-transform: rotate(45deg);
|
||||
background: #FFF;
|
||||
z-index:9999;
|
||||
}
|
||||
|
||||
.ilovexm24_link:hover,
|
||||
.ilovexm24_link {
|
||||
color: #FF0000;
|
||||
}
|
73
ilovexm24.php
Normal file
73
ilovexm24.php
Normal file
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
/*
|
||||
Plugin Name: Wordpress I love Xm24 Ribbon
|
||||
Plugin URI: https://git.lattuga.net/hacklabbo/wordpress_ilovexm24_ribbon
|
||||
Description:
|
||||
Version: 0.0.1
|
||||
Author: Hacklabbo
|
||||
Author URI: http://www.ecn.org/xm24
|
||||
License: GPL3
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
Text Domain: ilovexm24
|
||||
|
||||
@author HAcklabbo
|
||||
@category social
|
||||
@package Wordpress I love Xm24 Ribbon
|
||||
@since 0.0.1
|
||||
|
||||
Wordpress I love Xm24 ribbon come from a void's idea. A Plugin for WordPress.
|
||||
Copyright (C) 2017 Hacklabbo -
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0.html.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) :
|
||||
exit; // Exit if accessed directly
|
||||
endif;
|
||||
|
||||
class Xm24_Ribbon {
|
||||
public function __construct() {
|
||||
add_action( 'wp_enqueue_scripts', array( &$this, 'ilovexm24_load_scripts' ));
|
||||
}
|
||||
|
||||
public function getHtmlRibbon() {
|
||||
$xm24_url = 'http://www.ecn.org/xm24';
|
||||
$xm24_text = 'I♥XM24';
|
||||
$xm24_title = 'Solidarietà ad Xm24 a rischio di sgombero!';
|
||||
|
||||
$ribbon = '<div class="ilovexm24_content">'.
|
||||
'<a title="'.$xm24_title.'" class="ilovexm24_link" target="_blank" href="'.$xm4_url.'">'.
|
||||
$xm24_text.
|
||||
'</a>'.
|
||||
'</div>';
|
||||
|
||||
return $ribbon;
|
||||
}
|
||||
|
||||
public function ilovexm24_load_scripts(){
|
||||
wp_register_style( 'ilovexm24', plugins_url( 'css/ilovexm24.css', __FILE__), false, true );
|
||||
wp_enqueue_style( 'ilovexm24' );
|
||||
|
||||
wp_register_script( 'ilovexm24', plugins_url('js/ilovexm24.js', __FILE__), false, false, true);
|
||||
wp_enqueue_script( 'ilovexm24');
|
||||
|
||||
$attrs = Array(
|
||||
'ribbon' => $this->getHtmlRibbon()
|
||||
);
|
||||
|
||||
wp_localize_script( 'ilovexm24', 'attrs', $attrs );
|
||||
}
|
||||
}
|
||||
|
||||
$xm24r = new Xm24_Ribbon();
|
3
js/ilovexm24.js
Normal file
3
js/ilovexm24.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
var div = document.createElement('div');
|
||||
div.innerHTML = attrs.ribbon;
|
||||
document.body.appendChild(div);
|
Loading…
Reference in a new issue