ilovexm24.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /*
  3. Plugin Name: Wordpress I love Xm24 Ribbon
  4. Plugin URI: https://git.lattuga.net/hacklabbo/wordpress_ilovexm24_ribbon
  5. Description:
  6. Version: 0.0.3
  7. Author: Hacklabbo
  8. Author URI: http://www.ecn.org/xm24
  9. License: GPL3
  10. License URI: http://www.gnu.org/licenses/gpl-3.0.html
  11. Text Domain: ilovexm24
  12. @author HAcklabbo
  13. @category social
  14. @package Wordpress I love Xm24 Ribbon
  15. @since 0.0.1
  16. Wordpress I love Xm24 ribbon come from a void's idea. A Plugin for WordPress.
  17. Copyright (C) 2017 Hacklabbo -
  18. This program is free software: you can redistribute it and/or modify
  19. it under the terms of the GNU General Public License as published by
  20. the Free Software Foundation, either version 3 of the License, or
  21. (at your option) any later version.
  22. This program is distributed in the hope that it will be useful,
  23. but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. GNU General Public License for more details.
  26. You should have received a copy of the GNU General Public License
  27. along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0.html.
  28. */
  29. if ( ! defined( 'ABSPATH' ) ) :
  30. exit; // Exit if accessed directly
  31. endif;
  32. class Xm24_Ribbon {
  33. public function __construct() {
  34. add_action( 'wp_enqueue_scripts', array( &$this, 'ilovexm24_load_scripts' ));
  35. }
  36. public function getHtmlRibbon() {
  37. $xm24_url = 'http://www.ecn.org/xm24';
  38. $xm24_text = 'I <span class="love">&#9829;</span> XM24';
  39. $xm24_title = 'Solidarietà ad Xm24 a rischio di sgombero!';
  40. $ribbon = '<div class="ilovexm24_content">'.
  41. '<a title="'.$xm24_title.'" class="ilovexm24_link" target="_blank" href="'.$xm24_url.'">'.
  42. $xm24_text.
  43. '</a>'.
  44. '</div>';
  45. return $ribbon;
  46. }
  47. public function ilovexm24_load_scripts(){
  48. wp_register_style( 'ilovexm24', plugins_url( 'css/ilovexm24.css', __FILE__), false, true );
  49. wp_enqueue_style( 'ilovexm24' );
  50. wp_register_script( 'ilovexm24', plugins_url('js/ilovexm24.js', __FILE__), false, false, true);
  51. wp_enqueue_script( 'ilovexm24');
  52. $attrs = Array(
  53. 'ribbon' => $this->getHtmlRibbon()
  54. );
  55. wp_localize_script( 'ilovexm24', 'attrs', $attrs );
  56. }
  57. }
  58. $xm24r = new Xm24_Ribbon();