[10752] | 1 | <?php |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | class Musicplayer |
---|
| 5 | { |
---|
| 6 | var $plugin_name, $plugin_path; |
---|
| 7 | |
---|
| 8 | function Musicplayer($plugin_name, $plugin_path) |
---|
| 9 | { |
---|
| 10 | // Args |
---|
| 11 | $this->plugin_name = $plugin_name; |
---|
| 12 | $this->plugin_path = $plugin_path; |
---|
| 13 | } |
---|
| 14 | function var_template() |
---|
| 15 | { |
---|
| 16 | global $user; |
---|
| 17 | if ($user['template'] == 'flop_pure_design') |
---|
| 18 | { |
---|
| 19 | $r = 'include/var_fpd.inc.php'; |
---|
| 20 | } |
---|
| 21 | else |
---|
| 22 | { |
---|
| 23 | $r = 'include/var.inc.php'; |
---|
| 24 | } |
---|
| 25 | return $r; |
---|
| 26 | } |
---|
| 27 | function register_mp_menubar_blocks($menu_ref_arr) { |
---|
| 28 | $menu = & $menu_ref_arr[0]; |
---|
| 29 | if ($menu->get_id() != 'menubar') |
---|
| 30 | return; |
---|
| 31 | $menu->register_block(new RegisteredBlock('mbMusicPlayer', 'Music player', 'MP')); |
---|
| 32 | } |
---|
| 33 | function placer_icon() |
---|
| 34 | { |
---|
| 35 | global $conf, $template; |
---|
| 36 | $conf_plugin = explode("," , $conf['mp_plugin']); |
---|
| 37 | if (isset($conf_plugin)) { |
---|
| 38 | $template->concat( 'PLUGIN_INDEX_ACTIONS', |
---|
[12578] | 39 | '<li><a href="javascript:void(0)" title="Play Music" onClick="window.open(\''.get_root_url().'plugins/'.$this->plugin_name.'/lecteur.php\',\'musique\',\'width='.$conf_plugin[4].',height='.$conf_plugin[3].',top=400,left=400,toolbar=no,location=no,menubar=no,resizable=yes,status=no,alwaysRaised=yes\')" ><img src="'.get_root_url().'plugins/'.$this->plugin_name.'/template/icon/icon32.png" width="26" height="26" alt="Music Player" class="button" /></a></li>'); |
---|
[10752] | 40 | } |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | function placer_lien($menu_ref_arr) |
---|
| 44 | { |
---|
| 45 | |
---|
| 46 | ///////////////////////[début de l'affichage lien]//////////////////// |
---|
| 47 | |
---|
| 48 | global $lang, $conf, $template; |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | $menu = & $menu_ref_arr[0]; |
---|
| 52 | |
---|
| 53 | if ( ($block = $menu->get_block('mbSpecials')) != null ) |
---|
| 54 | { |
---|
| 55 | load_language('plugin.lang', $this->plugin_path); |
---|
| 56 | |
---|
| 57 | $position = count($block->data)+1; |
---|
| 58 | |
---|
| 59 | array_splice($block->data, $position-1, 0, array('mp' => |
---|
| 60 | array( |
---|
| 61 | 'URL' => 'javascript:void(0)'.'onClick="window.open(\''.get_root_url().'plugins/'.$this->plugin_name.'/lecteur.php\',\'musique\',\'width='.$conf_plugin[4].',height='.$conf_plugin[3].',top=400,left=400,toolbar=no,location=no,menubar=no,resizable=yes,status=no,alwaysRaised=yes\')" ', |
---|
| 62 | 'TITLE' => l10n('lien_expl'), |
---|
| 63 | 'NAME' => l10n('lien_titre') |
---|
| 64 | ) |
---|
| 65 | ) |
---|
| 66 | ); |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | /* |
---|
| 70 | /////[ si metre en evidence |
---|
| 71 | if ($conf_plugin[0]=="true") |
---|
| 72 | { |
---|
| 73 | //si envoi formulaire avec "se rappeler" coché |
---|
| 74 | if (isset($_POST['mp_remember']) and $_POST['mp_remember']=="on") |
---|
| 75 | { |
---|
| 76 | switch($_POST['mp_rep']) |
---|
| 77 | { |
---|
| 78 | /*case 'oui':setcookie( 'pwg_music_player', 'open', time()+60*60*24*10, cookie_path() );break; |
---|
| 79 | case 'non':setcookie( 'pwg_music_player', 'closed', time()+60*60*24*10, cookie_path() );break; |
---|
| 80 | case 'oui':setcookie( 'pwg_music_player', 'open', time()+60, cookie_path() );break; |
---|
| 81 | case 'non':setcookie( 'pwg_music_player', 'closed', time()+60, cookie_path() );break; |
---|
| 82 | } |
---|
| 83 | } |
---|
| 84 | elseif (isset($_POST['mp_rep'])) |
---|
| 85 | { |
---|
| 86 | switch($_POST['mp_rep']) |
---|
| 87 | { |
---|
| 88 | case 'oui':pwg_set_session_var( 'pwg_music_player', 'open' );break; |
---|
| 89 | case 'non':pwg_set_session_var( 'pwg_music_player', 'closed' );break; |
---|
| 90 | } |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | $mp_ses = pwg_get_session_var( 'pwg_music_player', '' ); |
---|
| 94 | //si on a cliqué oui, affiche le lecteur |
---|
| 95 | if ( $_COOKIE['pwg_music_player'] == 'open' or $mp_ses == 'open' or $_POST['mp_rep'] == 'oui' ) |
---|
| 96 | { |
---|
| 97 | $my_root_url = get_root_url().'plugins/'. basename(dirname(__FILE__)).'/'; |
---|
| 98 | $js = |
---|
| 99 | '<script type="text/javascript"> |
---|
| 100 | var theLecteur = window.open("", "musique", "width='.$conf_plugin[4].',height='.$conf_plugin[3].',top=400,left=400,menubar=no,resizable=yes,toolbar=no,status=no,alwaysRaised=yes"); |
---|
| 101 | if ( theLecteur.location.toString()=="about:blank" || !theLecteur.location.toString().match(/^(https?.*\/)lecteur\.php(\?.+)?$/)) |
---|
| 102 | { |
---|
| 103 | theLecteur.location = "'.$my_root_url.'lecteur.php"; |
---|
| 104 | } |
---|
| 105 | </script>'; |
---|
| 106 | |
---|
| 107 | $template->assign_block_vars( 'head_element', array( |
---|
| 108 | 'CONTENT' => $js |
---|
| 109 | ) |
---|
| 110 | ); |
---|
| 111 | |
---|
| 112 | } |
---|
| 113 | //si on a cliqué non, on n'affiche pas le msg |
---|
| 114 | //si on a pas cliqué, on affiche le msg |
---|
| 115 | elseif ( !isset($_COOKIE['pwg_music_player']) and !isset($_POST['mp_rep']) and !isset($_SESSION['pwg_pwg_music_player']) ) |
---|
| 116 | { |
---|
| 117 | include($this->var_template()); |
---|
| 118 | $this->add_before_code('menubar','<!-- BEGIN links -->', $msg);*/ |
---|
| 119 | /*$template->assign_block_vars( 'head_element', array( |
---|
| 120 | 'CONTENT' => '<style type="text/css"> |
---|
| 121 | #mbMusic_player |
---|
| 122 | { |
---|
| 123 | font-size: 1em; |
---|
| 124 | padding: 0px; |
---|
| 125 | } |
---|
| 126 | </style>' |
---|
| 127 | ) |
---|
| 128 | );*/ |
---|
| 129 | //} |
---|
| 130 | //} /fin metre en evidence |
---|
| 131 | |
---|
| 132 | }//fin placer_lien |
---|
| 133 | |
---|
| 134 | function placer_block($menu_ref_arr) |
---|
| 135 | { |
---|
| 136 | global $template, $user, $conf; |
---|
| 137 | load_language('plugin.lang', $this->plugin_path); |
---|
| 138 | |
---|
| 139 | $conf_plugin = explode("," , $conf['mp_plugin']); |
---|
| 140 | |
---|
| 141 | $menu = & $menu_ref_arr[0]; |
---|
| 142 | $template->assign(array( 'ATRIB' => 'name="'.l10n('lien_expl').'" href="javascript:void(0)" onClick="window.open(\''.get_root_url().'plugins/'.$this->plugin_name.'/lecteur.php\',\'musique\',\'width='.$conf_plugin[4].',height='.$conf_plugin[3].',top=400,left=400,menubar=no,resizable=yes,toolbar=no,status=no,alwaysRaised=yes\')"' , |
---|
| 143 | 'PLG_path' => get_root_url().'plugins/'.$this->plugin_name )); |
---|
| 144 | |
---|
| 145 | if (($block = $menu->get_block( 'mbMusicPlayer' )) != null) { |
---|
| 146 | $block->set_title(l10n('lien_titre')); |
---|
| 147 | $block->template = $this->plugin_path.'template/block.tpl'; |
---|
| 148 | } |
---|
| 149 | |
---|
| 150 | } |
---|
| 151 | function mp_lien_menu($menu) |
---|
| 152 | { |
---|
| 153 | array_push($menu, array('NAME' => 'Music Player', |
---|
| 154 | 'URL' => get_admin_plugin_menu_link(get_root_url().'plugins/'.$this->plugin_name.'/admin/admin.php'))); |
---|
| 155 | return $menu; |
---|
| 156 | } |
---|
| 157 | |
---|
| 158 | function add_css() |
---|
| 159 | { |
---|
| 160 | global $page, $template; |
---|
| 161 | if (isset($page['body_id']) and isset($_GET['section']) and $page['body_id']=='theAdminPage' and ($_GET['section']=='music_player/admin/admin.php' or $_GET['section']=='music_player/admin/help.php' or $_GET['section']=='music_player/admin/admin_edit.php') ) |
---|
| 162 | { |
---|
| 163 | $template -> assign( |
---|
| 164 | 'head_element', array ( |
---|
| 165 | 'CONTENT' => '<link rel="stylesheet" type="text/css" href="plugins/'.$this->plugin_name.'/template/admin.css">' |
---|
| 166 | ) |
---|
| 167 | ); |
---|
| 168 | } |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | } |
---|
| 172 | |
---|
| 173 | }//fin class |
---|
[3329] | 174 | ?> |
---|