author | Anthony Ly <anthonyly.com@gmail.com> |
Mon, 19 Nov 2012 18:26:13 +0100 | |
changeset 194 | 32102edaa81b |
parent 192 | ad0cebafc06f |
permissions | -rw-r--r-- |
136 | 1 |
<?php |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
2 |
function theme_init(){ |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
192
diff
changeset
|
3 |
load_theme_textdomain('IriTheme', get_template_directory() . '/language'); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
4 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
192
diff
changeset
|
5 |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
6 |
add_action ('init', 'theme_init'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
7 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
8 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
9 |
// |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
10 |
define('THEME_TEXTDOMAIN','IriTheme'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
11 |
define('THEME_LANGS_FOLDER','/language'); |
136 | 12 |
require( "lib/zip.lib.php" ) ; //indiquez le chemin d'accès à la lib |
13 |
||
14 |
//error_reporting(E_ALL); |
|
15 |
||
16 |
function getPost($post = NULL) { |
|
17 |
include('post.php'); |
|
18 |
} |
|
19 |
||
20 |
function getSearch($q = NULL) { |
|
21 |
include('searchform.php'); |
|
22 |
} |
|
23 |
||
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
24 |
if ( function_exists('register_sidebar') ){ |
136 | 25 |
register_sidebar |
26 |
( array |
|
27 |
( |
|
28 |
'name' => 'Sidebar-Single', |
|
29 |
'before_widget' => '<div class="bottombar">', |
|
30 |
'after_widget' => '</div>', |
|
31 |
'before_title' => '<h2 class="widgettitle">', |
|
32 |
'after_title' => '</h2>', |
|
33 |
) |
|
34 |
); |
|
35 |
register_sidebar |
|
36 |
( array |
|
37 |
( |
|
38 |
'name' => 'Sidebar-Single-home', |
|
39 |
'before_widget' => '<div class="bottombar">', |
|
40 |
'after_widget' => '</div>', |
|
41 |
'before_title' => '<h2 class="widgettitle">', |
|
42 |
'after_title' => '</h2>', |
|
43 |
) |
|
44 |
); |
|
45 |
register_sidebar |
|
46 |
( array |
|
47 |
( |
|
48 |
'name' => 'Bottom-Left', |
|
49 |
'before_widget' => '<div class="bottombar">', |
|
50 |
'after_widget' => '</div>', |
|
51 |
'before_title' => '<h2 class="widgettitle">', |
|
52 |
'after_title' => '</h2>', |
|
53 |
) |
|
54 |
); |
|
55 |
register_sidebar |
|
56 |
( array |
|
57 |
( |
|
58 |
'name' => 'Bottom-Middle', |
|
59 |
'before_widget' => '<div class="bottombar">', |
|
60 |
'after_widget' => '</div>', |
|
61 |
'before_title' => '<h2 class="widgettitle">', |
|
62 |
'after_title' => '</h2>', |
|
63 |
) |
|
64 |
); |
|
65 |
register_sidebar |
|
66 |
( array |
|
67 |
( |
|
68 |
'name' => 'Bottom-Right', |
|
69 |
'before_widget' => '<div class="bottombar">', |
|
70 |
'after_widget' => '</div>', |
|
71 |
'before_title' => '<h2 class="widgettitle">', |
|
72 |
'after_title' => '</h2>', |
|
73 |
) |
|
74 |
); |
|
75 |
} |
|
76 |
||
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
77 |
// Need the tag Cloud Plug In |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
78 |
// piece together the flash code |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
79 |
function xilimlSam_wp_cumulus_createflashcode( $widget=false, $atts=NULL ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
80 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
81 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
82 |
// get the options |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
83 |
if( $widget == true ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
84 |
$options = get_option('wpcumulus_widget'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
85 |
$soname = "widget_so"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
86 |
$divname = "wpcumuluswidgetcontent"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
87 |
// get compatibility mode variable from the main options |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
88 |
$mainoptions = get_option('wpcumulus_options'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
89 |
$options['compmode'] = $mainoptions['compmode']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
90 |
$options['showwptags'] = $mainoptions['showwptags']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
91 |
} else if( $atts != NULL ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
92 |
$options = shortcode_atts( get_option('wpcumulus_options'), $atts ); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
93 |
$soname = "shortcode_so"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
94 |
$divname = "wpcumuluscontent"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
95 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
96 |
$options = get_option('wpcumulus_options'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
97 |
$soname = "so"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
98 |
$divname = "wpcumuluscontent"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
99 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
100 |
// get the tag cloud... |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
101 |
if( $options['mode'] != "cats" ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
102 |
ob_start(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
103 |
//wp_tag_cloud( $options['args'] ); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
104 |
xili_tidy_tag_cloud('tagsgroup='.the_curlang()); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
105 |
$tagcloud = urlencode( str_replace( " ", " ", ob_get_clean() ) ); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
106 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
107 |
// get categories |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
108 |
if( $options['mode'] != "tags" ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
109 |
ob_start(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
110 |
xili_tidy_tag_cloud('tagsgroup='.the_curlang());// |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
111 |
$cats = urlencode( ob_get_clean() ); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
112 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
113 |
// get some paths |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
114 |
if( function_exists('plugins_url') ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
115 |
// 2.6 or better |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
116 |
$movie = plugins_url('wp-cumulus/tagcloud.swf'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
117 |
$path = plugins_url('wp-cumulus/'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
118 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
119 |
// pre 2.6 |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
120 |
$movie = get_bloginfo('wpurl') . "/wp-content/plugins/wp-cumulus/tagcloud.swf"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
121 |
$path = get_bloginfo('wpurl')."/wp-content/plugins/wp-cumulus/"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
122 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
123 |
// add random seeds to so name and movie url to avoid collisions and force reloading (needed for IE) |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
124 |
$soname .= rand(0,9999999); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
125 |
$movie .= '?r=' . rand(0,9999999); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
126 |
$divname .= rand(0,9999999); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
127 |
// write flash tag |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
128 |
if( $options['compmode']!='true' ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
129 |
$flashtag = '<!-- SWFObject embed by Geoff Stearns geoff@deconcept.com http://blog.deconcept.com/swfobject/ -->'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
130 |
$flashtag .= '<script type="text/javascript" src="'.$path.'swfobject.js"></script>'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
131 |
// ------------------------------------------------------------------------------------ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
132 |
$flashtag .= '<div id="'.$divname.'" style="position:absolute;z-index:0;">'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
133 |
if( $options['showwptags'] == 'true' ){ $flashtag .= '<p>'; } else { $flashtag .= '<p style="display:none;">'; }; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
134 |
// alternate content |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
135 |
if( $options['mode'] != "cats" ){ $flashtag .= urldecode($tagcloud); } |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
136 |
if( $options['mode'] != "tags" ){ $flashtag .= urldecode($cats); } |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
137 |
$flashtag .= '</p><!-- WP Cumulus Flash tag cloud by <a href="http://www.roytanck.com">Roy Tanck</a> and <a href="http://lukemorton.co.uk/">Luke Morton</a> requires <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> 9 or better. --></div>'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
138 |
$flashtag .= '<script type="text/javascript">'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
139 |
$flashtag .= 'var '.$soname.' = new SWFObject("'.$movie.'", "tagcloudflash", "'.$options['width'].'", "'.$options['height'].'", "9", "#'.$options['bgcolor'].'");'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
140 |
if( $options['trans'] == 'true' ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
141 |
$flashtag .= $soname.'.addParam("wmode", "transparent");'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
142 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
143 |
$flashtag .= $soname.'.addParam("allowScriptAccess", "always");'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
144 |
$flashtag .= $soname.'.addVariable("tcolor", "0x'.$options['tcolor'].'");'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
145 |
$flashtag .= $soname.'.addVariable("tcolor2", "0x' . ($options['tcolor2'] == "" ? $options['tcolor'] : $options['tcolor2']) . '");'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
146 |
$flashtag .= $soname.'.addVariable("hicolor", "0x' . ($options['hicolor'] == "" ? $options['tcolor'] : $options['hicolor']) . '");'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
147 |
$flashtag .= $soname.'.addVariable("tspeed", "'.$options['speed'].'");'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
148 |
$flashtag .= $soname.'.addVariable("distr", "'.$options['distr'].'");'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
149 |
$flashtag .= $soname.'.addVariable("mode", "'.$options['mode'].'");'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
150 |
// put tags in flashvar |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
151 |
if( $options['mode'] != "cats" ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
152 |
$flashtag .= $soname.'.addVariable("tagcloud", "'.urlencode('<tags>') . $tagcloud . urlencode('</tags>').'");'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
153 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
154 |
// put categories in flashvar |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
155 |
if( $options['mode'] != "tags" ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
156 |
$flashtag .= $soname.'.addVariable("categories", "' . $cats . '");'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
157 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
158 |
$flashtag .= $soname.'.write("'.$divname.'");'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
159 |
$flashtag .= '</script>'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
160 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
161 |
$flashtag = '<object type="application/x-shockwave-flash" data="'.$movie.'" width="'.$options['width'].'" height="'.$options['height'].'" wmode="opaque">'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
162 |
$flashtag .= '<param name="movie" value="'.$movie.'" />'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
163 |
$flashtag .= '<param name="bgcolor" value="#'.$options['bgcolor'].'" />'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
164 |
$flashtag .= '<param name="AllowScriptAccess" value="always" />'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
165 |
$flashtag .= '<param name="wmode" value="opaque" />'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
166 |
if( $options['trans'] == 'true' ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
167 |
$flashtag .= '<param name="wmode" value="transparent" />'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
168 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
169 |
$flashtag .= '<param name="flashvars" value="'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
170 |
$flashtag .= 'tcolor=0x'.$options['tcolor']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
171 |
$flashtag .= '&tcolor2=0x'.$options['tcolor2']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
172 |
$flashtag .= '&hicolor=0x'.$options['hicolor']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
173 |
$flashtag .= '&tspeed='.$options['speed']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
174 |
$flashtag .= '&distr='.$options['distr']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
175 |
$flashtag .= '&mode='.$options['mode']; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
176 |
// put tags in flashvar |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
177 |
if( $options['mode'] != "cats" ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
178 |
$flashtag .= '&tagcloud='.urlencode('<tags>') . $tagcloud . urlencode('</tags>'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
179 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
180 |
// put categories in flashvar |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
181 |
if( $options['mode'] != "tags" ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
182 |
$flashtag .= '&categories=' . $cats; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
183 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
184 |
$flashtag .= '" />'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
185 |
// alternate content |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
186 |
if( $options['mode'] != "cats" ){ $flashtag .= '<p>'.urldecode($tagcloud).'</p>'; } |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
187 |
if( $options['mode'] != "tags" ){ $flashtag .= '<p>'.urldecode($cats).'</p>'; } |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
188 |
$flashtag .= '<!-- WP-Cumulus by <a href="http://www.roytanck.com/">Roy Tanck</a> and <a href="http://lukemorton.co.uk/">Luke Morton</a> requires <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> 9 or better. -->'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
189 |
$flashtag .= '</object>'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
190 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
191 |
return $flashtag; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
192 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
193 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
194 |
// Copy of the current category widget plugin adapted to xiliml |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
195 |
function xilimlSam_post_of_current_category (){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
196 |
global $wpdb; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
197 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
198 |
$defaults = array( |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
199 |
'limit' => 30, |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
200 |
'AscDesc' => "DSC", |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
201 |
'OrderBy' =>'ID', |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
202 |
); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
203 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
204 |
$args = $defaults; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
205 |
$lang = the_curlang();//echo ($lang); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
206 |
extract($args); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
207 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
208 |
$limit = (int) abs($limit); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
209 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
210 |
if(is_category()){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
211 |
$curCategoryID = get_query_var('cat'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
212 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
213 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
214 |
if (is_single()) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
215 |
$curCategoryID = ''; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
216 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
217 |
foreach (get_the_category() as $catt) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
218 |
$curCategoryID .= $catt->cat_ID.' '; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
219 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
220 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
221 |
$curCategoryID = str_replace(" ", ",", trim($curCategoryID)); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
222 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
223 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
224 |
if (!intval($curCategoryID)) $curCategoryID=''; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
225 |
$query = "&category=$curCategoryID&showposts=$limit&orderby=$OrderBy&order=$AscDesc"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
226 |
$posts = get_posts($query); //get posts |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
227 |
$postlist = ''; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
228 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
229 |
foreach ($posts as $post) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
230 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
231 |
$CurLang = get_cur_post_lang_dir ($post->ID);//echo ($post->ID."-> ".$CurLang["lang"]." <br/>"); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
232 |
if($CurLang["lang"]==$lang){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
233 |
$post_title_s = htmlspecialchars(stripslashes(cache_cutter($post->post_title))); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
234 |
$post_title_l = htmlspecialchars(stripslashes(text_cutter($post->post_title,200))); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
235 |
$postlist .= '<li> <a href="' . get_permalink($post->ID) . '" title="'. $post_title_s .'" >' . $post_title_l . ' </a> </li>'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
236 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
237 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
238 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
239 |
echo '<ul class="advanced-recent-posts">'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
240 |
echo $postlist; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
241 |
echo '</ul>'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
242 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
243 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
244 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
245 |
# |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
246 |
function xilimlSam_page2cat_output_Hook($cat){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
247 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
248 |
if( function_exists(page2cat_output) and function_exists(xiliml_the_other_posts) ){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
249 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
250 |
global $wpdb; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
251 |
$mypage = $wpdb->get_row("SELECT * FROM {$wpdb->page2cat} WHERE cat_ID = '".$cat."';",OBJECT); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
252 |
$pageid = $mypage->page_ID; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
253 |
$pageInOtherLang = xiliml_the_other_posts ($pageid,'','','array'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
254 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
255 |
if($pageInOtherLang[the_curlang()]!=null){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
256 |
$pageid=$pageInOtherLang[the_curlang()]; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
257 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
258 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
259 |
if($pageid != ""): |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
260 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
261 |
switch($style): |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
262 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
263 |
case 'inline': |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
264 |
default: |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
265 |
?> |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
266 |
<div id="category-page-header"> |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
267 |
<?php |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
268 |
$pagina = "SELECT * FROM {$wpdb->posts} WHERE ID='".$pageid."' AND post_type = 'page';"; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
269 |
$mine = $wpdb->get_results($pagina); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
270 |
if($mine[0]->post_title!=""){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
271 |
?> |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
272 |
<div id="p2c-header"> |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
273 |
<h2><?php echo $mine[0]->post_title; ?></h2> |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
274 |
<p><?php echo wptexturize($mine[0]->post_content,1); ?></p> |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
275 |
</div> |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
276 |
<div class="category-page-cleaner"></div> |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
277 |
</div> |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
278 |
<?php |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
279 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
280 |
break; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
281 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
282 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
283 |
endswitch; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
284 |
endif; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
285 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
286 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
287 |
/* |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
288 |
$current_lang = the_cur_lang_dir(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
289 |
page2cat_output($cat); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
290 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
291 |
$MyPost = xiliml_the_other_posts($post_ID,"","","array"); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
292 |
//var_dump($MyPost); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
293 |
//echo($current_lang['lang']." -> ".$MyPost[$current_lang['lang']]); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
294 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
295 |
if (in_array($current_lang['lang'],$MyPost)){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
296 |
return ($post_ID); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
297 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
298 |
return ($MyPost[$current_lang['lang']]); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
299 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
300 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
301 |
*/ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
302 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
303 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
304 |
# |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
305 |
function xilimlSam_other_posts($post_ID){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
306 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
307 |
if (class_exists('xili_language')) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
308 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
309 |
$current_lang = the_cur_lang_dir(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
310 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
311 |
$MyPost = xiliml_the_other_posts($post_ID,"","","array"); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
312 |
//var_dump($MyPost); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
313 |
//echo($current_lang['lang']." -> ".$MyPost[$current_lang['lang']]); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
314 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
315 |
if (in_array($current_lang['lang'],$MyPost)){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
316 |
return ($post_ID); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
317 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
318 |
return ($MyPost[$current_lang['lang']]); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
319 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
320 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
321 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
322 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
323 |
return ($post_ID); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
324 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
325 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
326 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
327 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
328 |
# |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
329 |
function xilimlSam_other_pages($post_ID){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
330 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
331 |
if (class_exists('xili_language')) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
332 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
333 |
$current_lang = the_cur_lang_dir(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
334 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
335 |
$MyPost = xiliml_the_other_posts($post_ID,"","","array"); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
336 |
//var_dump($MyPost); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
337 |
//echo($current_lang['lang']." -> ".$MyPost[$current_lang['lang']]); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
338 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
339 |
if (in_array($current_lang['lang'],$MyPost)){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
340 |
return ($post_ID); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
341 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
342 |
return ($MyPost[$current_lang['lang']]); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
343 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
344 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
345 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
346 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
347 |
return ($post_ID); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
348 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
349 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
350 |
|
136 | 351 |
# Displays a list of categories |
352 |
function dp_list_categories($Eparam='') { |
|
353 |
||
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
354 |
if (class_exists('xili_language')) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
355 |
$current_lang = the_cur_lang_dir(); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
356 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
192
diff
changeset
|
357 |
$args=array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
192
diff
changeset
|
358 |
'orderby' => 'name', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
192
diff
changeset
|
359 |
'order' => 'ASC', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
192
diff
changeset
|
360 |
'hide_empty'=>'1', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
192
diff
changeset
|
361 |
'exclude'=>'1,8,16,17,38,171,169,170' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
192
diff
changeset
|
362 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
192
diff
changeset
|
363 |
$categories = get_categories($args); |
136 | 364 |
$first = true; |
365 |
$count = 0; |
|
366 |
||
367 |
foreach ($categories as $category) { |
|
368 |
||
369 |
if ($category->parent<1) { |
|
370 |
||
371 |
echo ('<li class="menu-h-li">'); |
|
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
372 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
373 |
if (class_exists('xili_language')) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
374 |
echo ('<a href="'.xiliml_get_category_link($category->cat_ID).'?lang='.$current_lang['lang'].'">'.__($category->name,'IriTheme').' </a>'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
375 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
376 |
echo ('<a href="'.get_category_link($category->cat_ID).'">'.__($category->name,'IriTheme').' </a>'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
377 |
} |
136 | 378 |
echo '<ul>'; |
379 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
192
diff
changeset
|
380 |
$category_posts = get_posts('numberposts=30&order=ASC&orderby=title&category='.$category->cat_ID);// |
136 | 381 |
$count2 = 0; |
192
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
382 |
|
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
383 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
384 |
// A REECRIRE PAS PROPRE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
385 |
|
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
386 |
if ($category->cat_ID==5){ |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
387 |
//.'?lang='.$current_lang['lang']. |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
388 |
if($current_lang['lang']=="en_us"){ |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
389 |
echo '<li class="menu-h-li2" title="pedagogy"><a href="http://www.iri.centrepompidou.fr/pedagogie/?lang=en_US" class="menu-h-li2" >Pedagogy</a></li>'; |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
390 |
} else { |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
391 |
echo '<li class="menu-h-li2" title="pedagogy"><a href="http://www.iri.centrepompidou.fr/pedagogie/?lang=fr_FR" class="menu-h-li2" > Pédagogie</a></li>'; |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
392 |
} |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
393 |
|
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
394 |
}else { |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
395 |
//echo '<li class="menu-h-li2" title="pedagogy"><a href="'.get_category_link(89).'" class="menu-h-li2" > '.$category->cat_ID.'</a></li>'; |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
396 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
397 |
/*$categoryN2 = get_category_link($category->cat_ID); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
398 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
399 |
foreach($categoryN2 as $catN2) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
400 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
401 |
//$category_posts = get_posts('numberposts=15&order=ASC&orderby=parent&category='.$category->cat_ID); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
402 |
echo ('<li class="menu-h-li2"><a href="'.get_category_link($catN2->cat_ID).'"> XX '.$catN2->name.' </a></li>'); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
403 |
}*/ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
404 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
405 |
//echo("<!-- ".sizeof($category_posts)." -->"); |
136 | 406 |
foreach($category_posts as $post) { |
407 |
||
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
408 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
409 |
if (class_exists('xili_language')) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
410 |
// Affiche les posts de la langue courante + les indéfinis |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
411 |
//if (get_cur_language($post->ID)==$current_lang['lang'] or get_cur_language($post->ID)==""){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
412 |
// Affiche seulement les posts de la langue courante + les indéfinis |
180
d8780eeb2607
- delete time in the home calendar
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
170
diff
changeset
|
413 |
//echo ("<div> ID = ".$post->ID." : ".get_cur_language($post->ID)."</div>"); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
414 |
if (get_cur_language($post->ID)==$current_lang['lang']){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
415 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
416 |
// gestion des niv 2 ajout de class si nécessaire |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
417 |
$MyCategoryPost = get_the_category($post->ID); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
418 |
//var_dump($MyCategoryPost); |
180
d8780eeb2607
- delete time in the home calendar
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
170
diff
changeset
|
419 |
|
d8780eeb2607
- delete time in the home calendar
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
170
diff
changeset
|
420 |
//echo ("<div> MyC:".count($MyCategoryPost)."</div>"); |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
421 |
$MoreStyle=""; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
422 |
$title =""; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
423 |
if (count($MyCategoryPost)>1){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
424 |
foreach($MyCategoryPost as $MyCategory) { |
180
d8780eeb2607
- delete time in the home calendar
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
170
diff
changeset
|
425 |
$MoreStyle.= $MyCategory->category_nicename." "; |
d8780eeb2607
- delete time in the home calendar
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
170
diff
changeset
|
426 |
$title.= $MyCategory->category_nicename." "; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
427 |
//category_parent!=0 |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
428 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
429 |
} else { |
180
d8780eeb2607
- delete time in the home calendar
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
170
diff
changeset
|
430 |
$MoreStyle ="menu-h-li2"; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
431 |
} |
192
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
432 |
if($MoreStyle != "menu-h-li2"){ |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
433 |
$MoreStyle2 = " : ".$MoreStyle; |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
434 |
} else { |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
435 |
$MoreStyle2 = ""; |
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
436 |
} |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
437 |
|
192
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
438 |
echo '<li class="'.$MoreStyle.'" title="'.cache_cutter($post->post_title).$MoreStyle2.'"><a href="'.get_permalink($post->ID).'?lang='.$current_lang['lang'].'" class="'.$MoreStyle.'" >'.text_cutter($post->post_title,200).'</a></li>'; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
439 |
$count2++; //if ($count2>6) break; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
440 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
441 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
442 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
443 |
|
192
ad0cebafc06f
new version and introduction of "pedagogie" link in "tool" category
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
180
diff
changeset
|
444 |
echo '<li class="menu-h-li2" title="'.cache_cutter($post->post_title).'"><a href="'.get_permalink($post->ID).'?lang='.$current_lang['lang'].'">'.text_cutter($post->post_title,200).'</a></li>'; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
445 |
$count2++; //if ($count2>6) break; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
446 |
} |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
447 |
|
136 | 448 |
}; |
449 |
||
450 |
||
451 |
echo "</ul></li>"; |
|
452 |
||
453 |
} |
|
454 |
$count++; //if ($count>6) break; // limit to 5 |
|
455 |
||
456 |
} |
|
457 |
} |
|
458 |
||
459 |
# Display the list of movies |
|
460 |
function listeMyLdt(){ |
|
461 |
||
142
f6e6b46f8260
Correct iri + missing pdf
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
136
diff
changeset
|
462 |
$MyLdtDataBase = DB_NAME; |
f6e6b46f8260
Correct iri + missing pdf
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
136
diff
changeset
|
463 |
$MyWPDataBase = DB_NAME; |
144
df0ebfb22f63
- Added Path variable in the config file for the LDT's donwloader script (functions.php)
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
142
diff
changeset
|
464 |
$MyLdtTable = LDT_DB; |
136 | 465 |
$MyLdtconnexion = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); |
466 |
$MyLdtListe = ""; |
|
467 |
//$WP_db_selected = mysql_select_db(); |
|
468 |
||
469 |
if (!$MyLdtconnexion) { |
|
470 |
echo "Impossible de se connecter à la base de données : " . mysql_error(); |
|
471 |
exit; |
|
472 |
} |
|
473 |
||
474 |
if (!mysql_select_db($MyLdtDataBase)) { |
|
475 |
echo "Impossible de sélectionner la base mydbname : " . mysql_error(); |
|
476 |
exit; |
|
477 |
} |
|
478 |
||
479 |
$MyLdtSql = "SELECT * FROM ".$MyLdtTable." ORDER BY `Lignes`.`Auteur` ASC";// WHERE `NomFichier` NOT LIKE ''"; |
|
480 |
||
481 |
$result = mysql_query($MyLdtSql); |
|
482 |
||
483 |
if (!$result) { |
|
484 |
echo "Impossible d'exécuter la requête ($MyLdtSql) dans la base : " . mysql_error(); |
|
485 |
exit; |
|
486 |
} |
|
487 |
||
488 |
if (mysql_num_rows($result) == 0) { |
|
489 |
echo "Aucune ligne trouvée, rien à afficher."; |
|
490 |
exit; |
|
491 |
} |
|
492 |
$MyLdtTable=""; |
|
493 |
while ($row = mysql_fetch_assoc($result)) { |
|
494 |
$MyLdtLineTemplate = "<tr class='rollover'> |
|
495 |
<td>".$row['Auteur']."</td> <td>".$row['Titre']."</td> <td>".$row['Contributeur']."</td> "; |
|
496 |
||
497 |
if ($row['NomFichier']!="") { |
|
498 |
$MyLdtLineTemplate .= "<td> <a href='?URL=".$row['NomFichier']."' title='Cliquez ici pour télécharger le projet".$row['NomFichier']."'> <img src='".get_bloginfo('stylesheet_directory')."/images/get.png'/> </a> </td> </tr>"; |
|
499 |
}else { |
|
500 |
$MyLdtLineTemplate .= "<td> <a href='#' title='Fichier non disponible'> <img src='".get_bloginfo('stylesheet_directory')."/images/help.png'/> </a> </td> </tr>"; |
|
501 |
} |
|
502 |
||
503 |
$MyLdtTable .= $MyLdtLineTemplate."\n"; |
|
504 |
||
505 |
} |
|
506 |
||
507 |
// tableau |
|
508 |
$MyLdtOutPut = " |
|
509 |
<div class='box'> |
|
510 |
<table style='width:100%;'> |
|
511 |
<thead> |
|
512 |
<tr> |
|
513 |
<td class='thead'> <b>Auteur</b></td> |
|
514 |
<td class='thead'> <b>Titre</b> </td> |
|
515 |
<td class='thead'> <b>Contributeur(s)</b> </td> |
|
516 |
<td class='thead'> </td> |
|
517 |
</tr> |
|
518 |
</thead> |
|
519 |
".$MyLdtTable." |
|
520 |
</table></div>"; |
|
521 |
||
522 |
echo($MyLdtOutPut); |
|
523 |
||
524 |
mysql_free_result($result); |
|
525 |
mysql_select_db($MyWPDataBase); |
|
526 |
//mysql_select_db($WP_db_selected); |
|
527 |
} |
|
528 |
||
529 |
# Create the LDT's ZIP to download IT |
|
530 |
function createMyLdtProject($fichierIRI){ |
|
531 |
||
144
df0ebfb22f63
- Added Path variable in the config file for the LDT's donwloader script (functions.php)
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
142
diff
changeset
|
532 |
$MyLDTRoot = ABSPATH; |
df0ebfb22f63
- Added Path variable in the config file for the LDT's donwloader script (functions.php)
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
142
diff
changeset
|
533 |
$MyDocPath = LDT_PATH; |
df0ebfb22f63
- Added Path variable in the config file for the LDT's donwloader script (functions.php)
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
142
diff
changeset
|
534 |
$MyRootRel = DWL_PAGE; |
df0ebfb22f63
- Added Path variable in the config file for the LDT's donwloader script (functions.php)
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
142
diff
changeset
|
535 |
$MyCache = LDT_CACHE; |
df0ebfb22f63
- Added Path variable in the config file for the LDT's donwloader script (functions.php)
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
142
diff
changeset
|
536 |
$MyExemple = LDT_TEMPLATE; |
136 | 537 |
$MyPattern = "X_NOMPROJET_X"; |
538 |
$MyLdtName = "projet_".$MyPattern.".ldt"; |
|
539 |
$MyReadMeName="LISEZ_MOI_READ_ME.txt"; |
|
540 |
$MySoundExt = "_audio.xml"; |
|
541 |
$Return = ""; |
|
542 |
||
146
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
543 |
$end = strrpos($fichierIRI,"."); |
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
544 |
$FileName = substr($fichierIRI, 0, $end); |
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
545 |
$ext = substr($fichierIRI, $end, strlen($FileName)); |
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
546 |
$Zipfilename = $MyLDTRoot.$MyCache."/".$FileName.".zip"; |
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
547 |
$ZipfilenameRedir = $MyRootRel.$MyCache."/".$FileName.".zip"; |
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
548 |
$baseExemplePath = $MyLDTRoot.$MyExemple; |
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
549 |
$baseDocPath = $MyLDTRoot.$MyDocPath; |
136 | 550 |
|
551 |
// cette fontion n'est utilisé que sur les .IRI |
|
552 |
if ($ext==".iri"){ |
|
553 |
||
554 |
// Vérifie si le cache éxiste déja |
|
146
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
555 |
if (file_exists($Zipfilename)){ |
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
556 |
echo ($Zipfilename." is in cache "); |
136 | 557 |
// ensuite envoyer vers la redirection. |
144
df0ebfb22f63
- Added Path variable in the config file for the LDT's donwloader script (functions.php)
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
142
diff
changeset
|
558 |
echo ("Veuillez patientez un instant..."); |
146
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
559 |
redirectionDWL($ZipfilenameRedir); |
136 | 560 |
|
561 |
} else { |
|
562 |
||
144
df0ebfb22f63
- Added Path variable in the config file for the LDT's donwloader script (functions.php)
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
142
diff
changeset
|
563 |
echo ("Le fichier ".$FileName.".zip est en cours de compression, veuillez patientez un instant..."); |
136 | 564 |
|
565 |
// Créer le .LDT à partir de l'exemple |
|
146
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
566 |
$MyLdtExemple = implode(file($baseExemplePath."/".$MyLdtName , FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)); |
136 | 567 |
$MyFuturLdt = str_replace($MyPattern, $FileName, $MyLdtExemple); |
568 |
||
569 |
// Créer le read me |
|
146
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
570 |
$MyReadMeExemple = implode(file($baseExemplePath."/".$MyPattern."/".$MyReadMeName , FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)); |
136 | 571 |
$MyFuturReadMe = str_replace($MyPattern, $FileName, $MyReadMeExemple); |
572 |
||
144
df0ebfb22f63
- Added Path variable in the config file for the LDT's donwloader script (functions.php)
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
142
diff
changeset
|
573 |
// ZIP l'ensemble est mis dans le cache |
146
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
574 |
|
136 | 575 |
$zip = new ZipArchive(); |
576 |
if ($zip->open($Zipfilename, ZIPARCHIVE::CREATE)!==TRUE) { |
|
577 |
exit("Impossible d'ouvrir <$filename>\n"); |
|
578 |
} |
|
579 |
// ZIP - ajouter le .LDT |
|
580 |
$MyLdtNewName = str_replace($MyPattern, $FileName, $MyLdtName); |
|
581 |
$zip->addFromString($MyLdtNewName, $MyFuturLdt); //$zip->addFile($MyFuturLdtName, $FileName); |
|
582 |
// ZIP - ajouter le .IRI |
|
146
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
583 |
$zip->addFile($baseDocPath."/".$fichierIRI, $FileName."/".$fichierIRI); |
136 | 584 |
// ZIP - ajouter le ReadMe |
585 |
$zip->addFromString($FileName."/".$MyReadMeName, $MyFuturReadMe); //$zip->addFile($MyRoot.$MyTemp."/".$FileName."/".$MyReadMeName, $FileName."/".$MyReadMeName); |
|
586 |
// ZIP - ajouter le audio si il y a |
|
146
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
587 |
$fileAudio = $baseDocPath."/".$FileName.$MySoundExt ; |
136 | 588 |
if (file_exists($fileAudio)){ |
589 |
$zip->addFile($fileAudio, $FileName."/".$FileName.$MySoundExt); |
|
590 |
} |
|
591 |
$zip->close(); |
|
592 |
||
593 |
// mettre a jour la bdd ? pour vider le cache quand c'est un nouveau fichier ? |
|
594 |
||
595 |
// ensuite envoyer vers la redirection. |
|
146
8d4c66d892cf
Correct iri project download
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
144
diff
changeset
|
596 |
redirectionDWL($ZipfilenameRedir); |
144
df0ebfb22f63
- Added Path variable in the config file for the LDT's donwloader script (functions.php)
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
142
diff
changeset
|
597 |
//echo ('<br/> DWL : '.$FileDWL); |
136 | 598 |
} |
599 |
} |
|
600 |
} |
|
601 |
||
602 |
# Javascript DWL redirection |
|
603 |
function redirectionDWL ($url) { |
|
604 |
||
605 |
$URL = get_bloginfo('url')."/".$url; |
|
606 |
||
607 |
echo("Le téléchargement est en cours... <br/>\n |
|
608 |
Si le téléchargement ne démarre pas automatiquement, veuillez cliquez <a href=".$URL.">ici</a>.<br/>\n"); |
|
609 |
||
610 |
echo("<script language=\"javascript\" type=\"text/javascript\"> \n"); |
|
611 |
echo(" <!--\n"); |
|
144
df0ebfb22f63
- Added Path variable in the config file for the LDT's donwloader script (functions.php)
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
142
diff
changeset
|
612 |
echo(" jQuery(document).ready(function($) {"); |
df0ebfb22f63
- Added Path variable in the config file for the LDT's donwloader script (functions.php)
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
142
diff
changeset
|
613 |
echo(" $(location).attr('href','".$URL."');"); |
df0ebfb22f63
- Added Path variable in the config file for the LDT's donwloader script (functions.php)
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
142
diff
changeset
|
614 |
echo(" });"); |
136 | 615 |
echo(" //-->\n"); |
616 |
echo("</script>\n"); |
|
617 |
||
618 |
} |
|
619 |
||
620 |
# Text cutter |
|
621 |
function text_cutter($text,$length){ |
|
622 |
$symbole="<!-- cut -->"; |
|
623 |
||
624 |
$lastpos = strrpos($text,$symbole); |
|
625 |
||
626 |
if($lastpos!=FALSE){ |
|
627 |
||
628 |
return (substr($text, 0, $lastpos)); |
|
629 |
||
630 |
} else { |
|
631 |
||
632 |
if(strlen($text)>$length){ |
|
633 |
return (substr($text, 0, $length)."[...]"); |
|
634 |
} else { |
|
635 |
return ($text); |
|
636 |
} |
|
637 |
} |
|
638 |
} |
|
639 |
||
640 |
# Cache cutter |
|
641 |
function cache_cutter($text){ |
|
642 |
return (str_replace( "<!-- cut -->", "", $text)); |
|
643 |
} |
|
644 |
||
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
645 |
# Créer le menu du footer |
136 | 646 |
function dp_list_posts($Eparam='') { |
647 |
||
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
648 |
$category_posts = get_posts($Eparam); |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
649 |
|
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
650 |
if (class_exists('xili_language')) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
651 |
$current_lang = the_cur_lang_dir(); |
136 | 652 |
foreach($category_posts as $post) { |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
653 |
if (get_cur_language($post->ID)==$current_lang['lang']){ |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
654 |
echo '<li><a href="'.get_permalink($post->ID).'">'.__($post->post_title,'IriTheme').'</a></li>'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
655 |
} |
136 | 656 |
}; |
170
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
657 |
} else { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
658 |
foreach($category_posts as $post) { |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
659 |
echo '<li><a href="'.get_permalink($post->ID).'">'.__($post->post_title,'IriTheme').'</a></li>'; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
660 |
}; |
8e3a5a6fc63e
English version just for user loged view
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
146
diff
changeset
|
661 |
} |
136 | 662 |
} |
663 |
||
664 |
||
665 |
/* |
|
666 |
Plugin Name: Get The Image |
|
667 |
Plugin URI: http://justintadlock.com/archives/2008/05/27/get-the-image-wordpress-plugin |
|
668 |
Description: This is a highly intuitive script that gets an image either by custom field input or post attachment. |
|
669 |
Version: 0.1 Beta |
|
670 |
Author: Justin Tadlock |
|
671 |
Author URI: http://justintadlock.com |
|
672 |
License: GPL |
|
673 |
*/ |
|
674 |
||
675 |
/*********************************************************** |
|
676 |
Catchall function for getting images |
|
677 |
***********************************************************/ |
|
678 |
function get_the_image($arr = false, $default_size = 'medium', $default_img = false) { |
|
679 |
global $post; |
|
680 |
$cf_array = load_the_image($arr, $post, $default_size); |
|
681 |
$image = display_the_image($cf_array, $post, $default_size, $default_img); |
|
682 |
if($image == false) $image = '<!-- No images were added to this post. -->'; |
|
683 |
return $image; |
|
684 |
} |
|
685 |
||
686 |
/*********************************************************** |
|
687 |
Catchall function for getting images with a link |
|
688 |
***********************************************************/ |
|
689 |
function get_the_image_link($arr = false, $default_size = 'medium', $default_img = false) { |
|
690 |
global $post; |
|
691 |
$cf_array = load_the_image($arr, $post, $default_size); |
|
692 |
$image = display_the_image($cf_array, $post, $default_size, $default_img); |
|
693 |
||
694 |
if($image == false) : |
|
695 |
$image_link = '<!-- No images were added to this post. -->'; |
|
696 |
else : |
|
697 |
$post_perm = get_permalink($post->ID); |
|
698 |
$image_link = "<a href=\"$post_perm\" title=\"$post->post_title\">$image</a>"; |
|
699 |
endif; |
|
700 |
return $image_link; |
|
701 |
} |
|
702 |
||
703 |
/*********************************************************** |
|
704 |
Function for loading an image |
|
705 |
***********************************************************/ |
|
706 |
function load_the_image($custom_fields = false, $en_post, $default_size) { |
|
707 |
||
708 |
// Checks only if there are custom fields to check for |
|
709 |
if(isset($custom_fields)) { |
|
710 |
||
711 |
// Loop through the custom fields, checking for images or video |
|
712 |
$i = 0; |
|
713 |
while(strcmp($image[0],'') == 0 && $i <= sizeof($custom_fields)) { |
|
714 |
||
715 |
// Check custom field values for image, image alt text, and image class |
|
716 |
$image = get_post_custom_values($key = $custom_fields[$i]); |
|
717 |
$image_alt = get_post_custom_values($key = $custom_fields[$i] . ' Alt'); |
|
718 |
$image_class = get_post_custom_values($key = $custom_fields[$i] . ' Class'); |
|
719 |
// Convert custom field key name to image class |
|
720 |
$img_class = $custom_fields[$i]; |
|
721 |
$img_class = strtolower($img_class); |
|
722 |
$img_class = str_replace (" ", "-", $img_class); |
|
723 |
||
724 |
// Add space to image class if user inputs an extra class |
|
725 |
if($image_class == true) $image_class .= ' '; |
|
726 |
||
727 |
// Add user image class to default image classes |
|
728 |
if($default_size == 'thumbnail' && $img_class == 'thumbnail') $image_class .= $default_size; |
|
729 |
elseif($default_size == 'medium' && $img_class == 'medium') $image_class .= $default_size; |
|
730 |
elseif($default_size == 'full' && $img_class == 'full') $image_class .= $default_size; |
|
731 |
else $image_class .= $img_class . ' ' . $default_size; |
|
732 |
||
733 |
$i++; |
|
734 |
} // End while loop |
|
735 |
} // End check for custom field image |
|
736 |
||
737 |
// If there is no image set through custom fields, check post attachments |
|
738 |
if($image == false && $default_size == true) { |
|
739 |
$img_att_arr = find_attachment_image($custom_fields[0], $en_post, $default_size); |
|
740 |
if(strcmp($image_att_arr[0],'') == 0) : |
|
741 |
$image = $img_att_arr[0]; |
|
742 |
$image_class = $img_att_arr[1]; |
|
743 |
$image_alt = false; |
|
744 |
else : |
|
745 |
$image = false; $image_alt = false; $image_class = false; |
|
746 |
endif; |
|
747 |
} |
|
748 |
||
749 |
// Return array with an image, image alt, and image class |
|
750 |
return array($image, $image_alt, $image_class); |
|
751 |
} |
|
752 |
||
753 |
/*********************************************************** |
|
754 |
Function for displaying an image |
|
755 |
***********************************************************/ |
|
756 |
function display_the_image($cf_array = false, $en_post = false, $default_size = false, $default_img = false) { |
|
757 |
||
758 |
// Set nice names for image info |
|
759 |
if($cf_array[0] == false && $default_img == true) : |
|
760 |
$image[0] = $default_img; |
|
761 |
$image_class = $default_size; |
|
762 |
else : |
|
763 |
$image = $cf_array[0]; |
|
764 |
$image_alt = $cf_array[1]; |
|
765 |
$image_class = $cf_array[2]; |
|
766 |
endif; |
|
767 |
||
768 |
// If there's any kind of image for this post |
|
769 |
if(isset($image[0]) && strcmp($image[0],'') != 0) : |
|
770 |
// Open img tag |
|
771 |
$output = '<img src="'.$image[0].'"'; |
|
772 |
$output .= ' alt="'; |
|
773 |
// Image alt text |
|
774 |
if(isset($image_alt[0]) && strcmp($image_alt[0],'') != 0) $output .= $image_alt[0]; |
|
775 |
else $output .= $en_post->post_title; |
|
776 |
// Image class |
|
777 |
$output .= '" class="'; |
|
778 |
if(isset($image_class[0])) $output .= $image_class; |
|
779 |
else $output .= 'left'; |
|
780 |
// Close img tag |
|
781 |
$output .= '" />'; |
|
782 |
// If there's no image |
|
783 |
else : |
|
784 |
$output = false; |
|
785 |
endif; |
|
786 |
// Return the image |
|
787 |
return $output; |
|
788 |
} |
|
789 |
||
790 |
/*********************************************************** |
|
791 |
Function for finding an attachment image. |
|
792 |
Only called if no custom field images are set. |
|
793 |
***********************************************************/ |
|
794 |
function find_attachment_image($custom_fields = false, $en_post = false, $default_size = 'medium') { |
|
795 |
||
796 |
$custom = $custom_fields; |
|
797 |
$custom = strtolower($custom); |
|
798 |
$custom = str_replace (" ", "-", $custom); |
|
799 |
// Don't repeat the same class name |
|
800 |
if($custom == 'thumbnail' || $custom == 'medium' || $custom == 'full') $img_class = $default_size; |
|
801 |
else $img_class = $custom . ' ' . $default_size; |
|
802 |
||
803 |
$attachments = get_children("post_parent=$en_post->ID&post_type=attachment&post_mime_type=image&orderby=\"menu_order ASC, ID ASC\"&numberposts=1"); |
|
804 |
if($attachments == true) : |
|
805 |
foreach($attachments as $id => $attachment) : |
|
806 |
$img = wp_get_attachment_image_src($id, $default_size); |
|
807 |
$img_arr[0] = $img; |
|
808 |
endforeach; |
|
809 |
$img_arr[1] = $img_class; |
|
810 |
else : |
|
811 |
$img_arr = false; |
|
812 |
endif; |
|
813 |
return $img_arr; |
|
814 |
} |
|
815 |
?> |