Changeset 93615 in spip-zone
- Timestamp:
- Dec 13, 2015, 11:41:45 AM (5 years ago)
- Location:
- _core_/plugins/mediabox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
_core_/plugins/mediabox/colorbox/fancybox/mediabox_config_theme.php
r53377 r93615 1 1 <?php 2 2 3 if (!defined('_ECRIRE_INC_VERSION')) return; 3 if (!defined('_ECRIRE_INC_VERSION')) { 4 return; 5 } 4 6 5 function mediabox_config_theme() {7 function mediabox_config_theme() { 6 8 $config = array( 7 9 'minHeight' => false, 8 10 'minWidth' => false 9 11 ); 12 10 13 return $config; 11 14 } -
_core_/plugins/mediabox/formulaires/configurer_mediabox.php
r93092 r93615 7 7 */ 8 8 9 if (!defined('_ECRIRE_INC_VERSION')) return; 9 if (!defined('_ECRIRE_INC_VERSION')) { 10 return; 11 } 10 12 11 13 include_spip('mediabox_pipelines'); 12 14 13 function box_lister_skins() {14 $skins = array('none' =>array('nom'=>_T('mediabox:label_aucun_style')));15 function box_lister_skins() { 16 $skins = array('none' => array('nom' => _T('mediabox:label_aucun_style'))); 15 17 16 18 $maxfiles = 1000; … … 18 20 $recurs = array(); 19 21 foreach (creer_chemin() as $d) { 20 $f = $d ."colorbox/";21 if (@is_dir($f)) {22 $liste = preg_files($f, "colorbox[.]css$",$maxfiles-count($liste_fichiers),$recurs);23 foreach ($liste as $chemin){24 $nom = substr(dirname($chemin), strlen($f));22 $f = $d . "colorbox/"; 23 if (@is_dir($f)) { 24 $liste = preg_files($f, "colorbox[.]css$", $maxfiles-count($liste_fichiers), $recurs); 25 foreach ($liste as $chemin) { 26 $nom = substr(dirname($chemin), strlen($f)); 25 27 // ne prendre que les fichiers pas deja trouves 26 28 // car find_in_path prend le premier qu'il trouve, 27 29 // les autres sont donc masques 28 if (!isset($liste_fichiers[$nom])) 30 if (!isset($liste_fichiers[$nom])) { 29 31 $liste_fichiers[$nom] = $chemin; 32 } 30 33 } 31 34 } 32 35 } 33 foreach ($liste_fichiers as $short=>$fullpath){34 $skins[$short] = array('nom' =>basename($short));35 if (file_exists($f = dirname($fullpath) ."/vignette.jpg"))36 foreach ($liste_fichiers as $short => $fullpath) { 37 $skins[$short] = array('nom' => basename($short)); 38 if (file_exists($f = dirname($fullpath) . "/vignette.jpg")) { 36 39 $skins[$short]['img'] = $f; 40 } 37 41 } 42 38 43 return $skins; 39 44 } 40 45 41 function box_choisir_skin($skins, $selected, $name = 'skin') {46 function box_choisir_skin($skins, $selected, $name = 'skin') { 42 47 $out = ""; 43 if (!is_array($skins) OR !count($skins)) 48 if (!is_array($skins) OR !count($skins)) { 44 49 return $out; 45 foreach($skins as $k=>$skin){ 46 $id = "${name}_".preg_replace(",[^a-z0-9_],i", "_", $k); 47 $sel = ($selected=="$k" ?" checked='checked'":''); 50 } 51 foreach ($skins as $k => $skin) { 52 $id = "${name}_" . preg_replace(",[^a-z0-9_],i", "_", $k); 53 $sel = ($selected == "$k" ? " checked='checked'" : ''); 48 54 $balise_img = chercher_filtre('balise_img'); 49 $label = isset($skin['img'])? 50 '<a href="'.$skin['img'].'" class="mediabox" rel="habillage">'.$balise_img($skin['img'],$skin['nom'])."</a>" 51 :$skin['nom']; 55 $label = isset($skin['img']) ? 56 '<a href="' . $skin['img'] . '" class="mediabox" rel="habillage">' . $balise_img($skin['img'], 57 $skin['nom']) . "</a>" 58 : $skin['nom']; 52 59 53 60 $out .= "<div class='choix'>"; … … 56 63 $out .= "</div>\n"; 57 64 } 65 58 66 return $out; 59 67 } 60 68 61 69 62 function formulaires_configurer_mediabox_charger_dist() {70 function formulaires_configurer_mediabox_charger_dist() { 63 71 $valeurs = mediabox_config(true); 64 72 $valeurs['_skins'] = box_lister_skins(); 65 73 66 74 return $valeurs; 67 75 } 68 76 69 function formulaires_configurer_mediabox_traiter_dist() {77 function formulaires_configurer_mediabox_traiter_dist() { 70 78 $config = mediabox_config(true); 71 79 72 80 include_spip('inc/meta'); 73 if (_request('reinit')) {74 foreach ($config as $k =>$v){81 if (_request('reinit')) { 82 foreach ($config as $k => $v) { 75 83 set_request($k); 76 84 } 77 85 effacer_meta('mediabox'); 86 } else { 87 // cas particulier de la checkbox : 88 if (!_request('active')) { 89 set_request('active', 'non'); 90 } 91 foreach ($config as $k => $v) { 92 if (!is_null(_request($k))) { 93 $config[$k] = _request($k); 94 } 95 } 96 ecrire_meta('mediabox', serialize($config)); 78 97 } 79 else { 80 // cas particulier de la checkbox : 81 if (!_request('active')) 82 set_request('active','non'); 83 foreach ($config as $k=>$v){ 84 if (!is_null(_request($k))) 85 $config[$k] = _request($k); 86 } 87 ecrire_meta('mediabox',serialize($config)); 88 } 89 90 return array('message_ok'=>_T('config_info_enregistree'),'editable'=>true); 98 99 return array('message_ok' => _T('config_info_enregistree'), 'editable' => true); 91 100 } 92 101 -
_core_/plugins/mediabox/mediabox_ieconfig.php
r57798 r93615 1 1 <?php 2 2 3 if (!defined("_ECRIRE_INC_VERSION")) return; 3 if (!defined("_ECRIRE_INC_VERSION")) { 4 return; 5 } 4 6 5 7 // On déclare ici la config du core 6 function mediabox_ieconfig_metas($table) {8 function mediabox_ieconfig_metas($table) { 7 9 $table['mediabox']['titre'] = _T('mediabox:titre_menu_box'); 8 10 $table['mediabox']['icone'] = 'mediabox-16.png'; 9 11 $table['mediabox']['metas_serialize'] = 'mediabox'; 10 12 11 13 return $table; 12 14 } -
_core_/plugins/mediabox/mediabox_pipelines.php
r93092 r93615 1 1 <?php 2 2 3 if (!defined('_ECRIRE_INC_VERSION')) return; 3 if (!defined('_ECRIRE_INC_VERSION')) { 4 return; 5 } 4 6 5 function mediabox_config($public = null) {7 function mediabox_config($public = null) { 6 8 include_spip("inc/filtres"); 7 9 include_spip("inc/config"); … … 18 20 'skin' => 'black-striped', 19 21 'transition' => 'elastic', 20 'speed' =>'200',21 'maxWidth' =>'90%',22 'maxHeight' =>'90%',23 'minWidth' =>'400px',24 'minHeight' =>'',22 'speed' => '200', 23 'maxWidth' => '90%', 24 'maxHeight' => '90%', 25 'minWidth' => '400px', 26 'minHeight' => '', 25 27 'slideshow_speed' => '2500', 26 28 'opacite' => '0.9', 27 29 ), $config); 28 30 29 if ((is_null($public) AND test_espace_prive()) OR $public ===false) {30 $config = array_merge($config, array(31 'active' => 'oui',32 'selecteur_galerie' => '#portfolios a[type^=\'image/\']',33 'selecteur_commun' => '.mediabox, .iconifier a[href$=jpg],.iconifier a[href$=png],.iconifier a[href$=gif]',34 'splash_url' => '',35 'skin' => 'white-shadow',36 'maxWidth'=>'90%',37 'maxHeight'=>'95%',38 'minWidth'=>'600px',39 'minHeight'=>'300px',40 'opacite' => '0.9',31 if ((is_null($public) AND test_espace_prive()) OR $public === false) { 32 $config = array_merge($config, array( 33 'active' => 'oui', 34 'selecteur_galerie' => '#portfolios a[type^=\'image/\']', 35 'selecteur_commun' => '.mediabox, .iconifier a[href$=jpg],.iconifier a[href$=png],.iconifier a[href$=gif]', 36 'splash_url' => '', 37 'skin' => 'white-shadow', 38 'maxWidth' => '90%', 39 'maxHeight' => '95%', 40 'minWidth' => '600px', 41 'minHeight' => '300px', 42 'opacite' => '0.9', 41 43 )); 42 44 } 43 45 44 46 // Gerer aussi les liens internes de SPIP 45 47 if (!test_espace_prive() AND $config['splash_url']) { 46 48 include_spip("inc/filtres_ecrire"); 47 $config['splash_url'] = url_absolue(extraire_attribut(lien_article_virtuel($config['splash_url']), 'href'));49 $config['splash_url'] = url_absolue(extraire_attribut(lien_article_virtuel($config['splash_url']), 'href')); 48 50 } 49 51 50 52 // charger la config du theme uniquement dans le public 51 if (!test_espace_prive() AND include_spip("colorbox/" .$config['skin']."/mediabox_config_theme")) {53 if (!test_espace_prive() AND include_spip("colorbox/" . $config['skin'] . "/mediabox_config_theme")) { 52 54 $config_theme = mediabox_config_theme(); 53 55 $config = array_merge($config, $config_theme); 54 56 } 55 56 return $config; 57 58 return $config; 57 59 } 58 60 59 function mediabox_insert_head_css($flux) {61 function mediabox_insert_head_css($flux) { 60 62 $config = mediabox_config(); 61 if ($config['active']=='oui' AND $f = find_in_path((test_espace_prive()?"prive/":"")."colorbox/".$config['skin'].'/colorbox.css')) 62 { 63 $flux .= '<link rel="stylesheet" href="'.direction_css($f).'" type="text/css" media="all" />'; 63 if ($config['active'] == 'oui' AND $f = find_in_path((test_espace_prive() ? "prive/" : "") . "colorbox/" . $config['skin'] . '/colorbox.css')) { 64 $flux .= '<link rel="stylesheet" href="' . direction_css($f) . '" type="text/css" media="all" />'; 64 65 /** 65 66 * Initialiser la config de la mediabox 66 67 */ 67 68 $configmediabox = '<script type="text/javascript">/* <![CDATA[ */ 68 var box_settings = {tt_img:' .($config['traiter_toutes_images'] == 'oui'?'true':'false')69 .',sel_g:"'.$config['selecteur_galerie']70 .'",sel_c:"'.$config['selecteur_commun']71 .'",trans:"'.$config['transition']72 .'",speed:"'.$config['speed']73 .'",ssSpeed:"'.$config['slideshow_speed']74 .'",maxW:"'.$config['maxWidth']75 .'",maxH:"'.$config['maxHeight']76 .'",minW:"'.$config['minWidth']77 .'",minH:"'.$config['minHeight']78 .'",opa:"'.$config['opacite']79 .'",str_ssStart:"'.unicode2charset(html2unicode(_T('mediabox:boxstr_slideshowStart')))80 .'",str_ssStop:"'.unicode2charset(html2unicode(_T('mediabox:boxstr_slideshowStop')))81 .'",str_cur:"'._T('mediabox:boxstr_current', array('current'=>'{current}', 'total'=>'{total}'))82 .'",str_prev:"'._T('mediabox:boxstr_previous')83 .'",str_next:"'._T('mediabox:boxstr_next')84 .'",str_close:"'._T('mediabox:boxstr_close')85 .'",splash_url:"'.$config['splash_url']86 .'"};'."\n";69 var box_settings = {tt_img:' . ($config['traiter_toutes_images'] == 'oui' ? 'true' : 'false') 70 . ',sel_g:"' . $config['selecteur_galerie'] 71 . '",sel_c:"' . $config['selecteur_commun'] 72 . '",trans:"' . $config['transition'] 73 . '",speed:"' . $config['speed'] 74 . '",ssSpeed:"' . $config['slideshow_speed'] 75 . '",maxW:"' . $config['maxWidth'] 76 . '",maxH:"' . $config['maxHeight'] 77 . '",minW:"' . $config['minWidth'] 78 . '",minH:"' . $config['minHeight'] 79 . '",opa:"' . $config['opacite'] 80 . '",str_ssStart:"' . unicode2charset(html2unicode(_T('mediabox:boxstr_slideshowStart'))) 81 . '",str_ssStop:"' . unicode2charset(html2unicode(_T('mediabox:boxstr_slideshowStop'))) 82 . '",str_cur:"' . _T('mediabox:boxstr_current', array('current' => '{current}', 'total' => '{total}')) 83 . '",str_prev:"' . _T('mediabox:boxstr_previous') 84 . '",str_next:"' . _T('mediabox:boxstr_next') 85 . '",str_close:"' . _T('mediabox:boxstr_close') 86 . '",splash_url:"' . $config['splash_url'] 87 . '"};' . "\n"; 87 88 // Si c'est une image, on la chargera avec une redimentionnement automatique 88 89 // Sinon, chargement dans une iframe 89 90 $extension = pathinfo($config['splash_url'], PATHINFO_EXTENSION); 90 91 if (match($extension, 'gif|png|jpg|jpeg')) { 91 $configmediabox .= 'var box_settings_iframe = false;' ."\n";92 $configmediabox .= 'var box_settings_iframe = false;' . "\n"; 92 93 } else { 93 $configmediabox .= 'var box_settings_splash_width = "' .$config['splash_width'].'";94 var box_settings_splash_height = "' .$config['splash_height'].'";'."\n";95 $configmediabox .= 'var box_settings_iframe = true;' ."\n";94 $configmediabox .= 'var box_settings_splash_width = "' . $config['splash_width'] . '"; 95 var box_settings_splash_height = "' . $config['splash_height'] . '";' . "\n"; 96 $configmediabox .= 'var box_settings_iframe = true;' . "\n"; 96 97 } 97 $flux = $configmediabox . '/* ]]> */</script>'."\n" . $flux; 98 } 99 return $flux; 100 } 101 102 103 function mediabox_timestamp($fichier){ 104 if ($m = filemtime($fichier)) 105 return "$fichier?$m"; 106 return $fichier; 107 } 108 109 function mediabox_insert_head($flux){ 110 $config = mediabox_config(); 111 if ($config['active']=='oui') { 112 113 $flux .=' 114 <script src="'.mediabox_timestamp(find_in_path('javascript/jquery.colorbox.js')).'" type="text/javascript"></script> 115 <script src="'.mediabox_timestamp(find_in_path('javascript/spip.mediabox.js')).'" type="text/javascript"></script>'; 116 if ($config['splash_url']) 117 $flux .='<script src="'.mediabox_timestamp(find_in_path('javascript/splash.mediabox.js')).'" type="text/javascript"></script>'; 98 $flux = $configmediabox . '/* ]]> */</script>' . "\n" . $flux; 118 99 } 119 100 … … 121 102 } 122 103 123 function mediabox_jquery_plugins($plugins){ 104 105 function mediabox_timestamp($fichier) { 106 if ($m = filemtime($fichier)) { 107 return "$fichier?$m"; 108 } 109 110 return $fichier; 111 } 112 113 function mediabox_insert_head($flux) { 114 $config = mediabox_config(); 115 if ($config['active'] == 'oui') { 116 117 $flux .= ' 118 <script src="' . mediabox_timestamp(find_in_path('javascript/jquery.colorbox.js')) . '" type="text/javascript"></script> 119 <script src="' . mediabox_timestamp(find_in_path('javascript/spip.mediabox.js')) . '" type="text/javascript"></script>'; 120 if ($config['splash_url']) { 121 $flux .= '<script src="' . mediabox_timestamp(find_in_path('javascript/splash.mediabox.js')) . '" type="text/javascript"></script>'; 122 } 123 } 124 125 return $flux; 126 } 127 128 function mediabox_jquery_plugins($plugins) { 124 129 $config = mediabox_config(); 125 130 if ($config['splash_url']) { 126 131 $plugins[] = 'javascript/jquery.cookie.js'; 127 132 } 133 128 134 return $plugins; 129 135 }
Note: See TracChangeset
for help on using the changeset viewer.