web/wp-content/themes/elegant-box/functions.php
changeset 1 0d28b7c10758
equal deleted inserted replaced
0:0d9a58d2c515 1:0d28b7c10758
       
     1 <?php
       
     2 
       
     3 /** elegantbox options */
       
     4 class ElegantboxOptions {
       
     5 	function getOptions() {
       
     6 		$options = get_option('elegantbox_options');
       
     7 		if (!is_array($options)) {
       
     8 			$options['style'] = 'white';
       
     9 			$options['style_switcher'] = true;
       
    10 			$options['google_cse'] = false;
       
    11 			$options['google_cse_cx'] = '';
       
    12 			$options['menu_type'] = 'pages';
       
    13 			$options['notice'] = false;
       
    14 			$options['notice_icon'] = false;
       
    15 			$options['notice_content'] = '';
       
    16 			$options['showcase_registered'] = false;
       
    17 			$options['showcase_commentator'] = false;
       
    18 			$options['showcase_visitor'] = false;
       
    19 			$options['showcase_content'] = '';
       
    20 			$options['showcase_2_registered'] = false;
       
    21 			$options['showcase_2_commentator'] = false;
       
    22 			$options['showcase_2_visitor'] = false;
       
    23 			$options['showcase_2_content'] = '';
       
    24 			$options['categories'] = false;
       
    25 			$options['tags'] = true;
       
    26 			$options['ctrlentry'] = false;
       
    27 			$options['feed'] = false;
       
    28 			$options['feed_url'] = '';
       
    29 			$options['feed_readers'] = true;
       
    30 			$options['twitter'] = false;
       
    31 			$options['twitter_username'] = '';
       
    32 			$options['analytics'] = false;
       
    33 			$options['analytics_content'] = '';
       
    34 			update_option('elegantbox_options', $options);
       
    35 		}
       
    36 		return $options;
       
    37 	}
       
    38 
       
    39 	function add() {
       
    40 		if(isset($_POST['elegantbox_save'])) {
       
    41 			$options = ElegantboxOptions::getOptions();
       
    42 
       
    43 			// style
       
    44 			$options['style'] = $_POST['style'];
       
    45 			if(!$_POST['style_switcher']) {
       
    46 				$options['style_switcher'] = (bool)false;
       
    47 			} else {
       
    48 				$options['style_switcher'] = (bool)true;
       
    49 			}
       
    50 
       
    51 			// google custom search engine
       
    52 			if ($_POST['google_cse']) {
       
    53 				$options['google_cse'] = (bool)true;
       
    54 			} else {
       
    55 				$options['google_cse'] = (bool)false;
       
    56 			}
       
    57 			$options['google_cse_cx'] = stripslashes($_POST['google_cse_cx']);
       
    58 
       
    59 			// menu
       
    60 			$options['menu_type'] = stripslashes($_POST['menu_type']);
       
    61 
       
    62 			// notice
       
    63 			if ($_POST['notice']) {
       
    64 				$options['notice'] = (bool)true;
       
    65 			} else {
       
    66 				$options['notice'] = (bool)false;
       
    67 			}
       
    68 			if ($_POST['notice_icon']) {
       
    69 				$options['notice_icon'] = (bool)true;
       
    70 			} else {
       
    71 				$options['notice_icon'] = (bool)false;
       
    72 			}
       
    73 			$options['notice_content'] = stripslashes($_POST['notice_content']);
       
    74 
       
    75 			// showcase
       
    76 			if ($_POST['showcase_registered']) {
       
    77 				$options['showcase_registered'] = (bool)true;
       
    78 			} else {
       
    79 				$options['showcase_registered'] = (bool)false;
       
    80 			}
       
    81 			if ($_POST['showcase_commentator']) {
       
    82 				$options['showcase_commentator'] = (bool)true;
       
    83 			} else {
       
    84 				$options['showcase_commentator'] = (bool)false;
       
    85 			}
       
    86 			if ($_POST['showcase_visitor']) {
       
    87 				$options['showcase_visitor'] = (bool)true;
       
    88 			} else {
       
    89 				$options['showcase_visitor'] = (bool)false;
       
    90 			}
       
    91 			$options['showcase_content'] = stripslashes($_POST['showcase_content']);
       
    92 			if ($_POST['showcase_2_registered']) {
       
    93 				$options['showcase_2_registered'] = (bool)true;
       
    94 			} else {
       
    95 				$options['showcase_2_registered'] = (bool)false;
       
    96 			}
       
    97 			if ($_POST['showcase_2_commentator']) {
       
    98 				$options['showcase_2_commentator'] = (bool)true;
       
    99 			} else {
       
   100 				$options['showcase_2_commentator'] = (bool)false;
       
   101 			}
       
   102 			if ($_POST['showcase_2_visitor']) {
       
   103 				$options['showcase_2_visitor'] = (bool)true;
       
   104 			} else {
       
   105 				$options['showcase_2_visitor'] = (bool)false;
       
   106 			}
       
   107 			$options['showcase_2_content'] = stripslashes($_POST['showcase_2_content']);
       
   108 
       
   109 			// categories & tags
       
   110 			if ($_POST['categories']) {
       
   111 				$options['categories'] = (bool)true;
       
   112 			} else {
       
   113 				$options['categories'] = (bool)false;
       
   114 			}
       
   115 			if (!$_POST['tags']) {
       
   116 				$options['tags'] = (bool)false;
       
   117 			} else {
       
   118 				$options['tags'] = (bool)true;
       
   119 			}
       
   120 
       
   121 			// ctrl + entry
       
   122 			if ($_POST['ctrlentry']) {
       
   123 				$options['ctrlentry'] = (bool)true;
       
   124 			} else {
       
   125 				$options['ctrlentry'] = (bool)false;
       
   126 			}
       
   127 
       
   128 			// feed
       
   129 			if ($_POST['feed']) {
       
   130 				$options['feed'] = (bool)true;
       
   131 			} else {
       
   132 				$options['feed'] = (bool)false;
       
   133 			}
       
   134 			$options['feed_url'] = stripslashes($_POST['feed_url']);
       
   135 			if (!$_POST['feed_readers']) {
       
   136 				$options['feed_readers'] = (bool)false;
       
   137 			} else {
       
   138 				$options['feed_readers'] = (bool)true;
       
   139 			}
       
   140 
       
   141 			// twitter
       
   142 			if ($_POST['twitter']) {
       
   143 				$options['twitter'] = (bool)true;
       
   144 			} else {
       
   145 				$options['twitter'] = (bool)false;
       
   146 			}
       
   147 			$options['twitter_username'] = stripslashes($_POST['twitter_username']);
       
   148 
       
   149 			// analytics
       
   150 			if ($_POST['analytics']) {
       
   151 				$options['analytics'] = (bool)true;
       
   152 			} else {
       
   153 				$options['analytics'] = (bool)false;
       
   154 			}
       
   155 			$options['analytics_content'] = stripslashes($_POST['analytics_content']);
       
   156 
       
   157 			update_option('elegantbox_options', $options);
       
   158 
       
   159 		} else {
       
   160 			ElegantboxOptions::getOptions();
       
   161 		}
       
   162 
       
   163 		add_theme_page(__('Current Theme Options', 'elegantbox'), __('Current Theme Options', 'elegantbox'), 'edit_themes', basename(__FILE__), array('ElegantboxOptions', 'display'));
       
   164 	}
       
   165 
       
   166 	function display() {
       
   167 		$options = ElegantboxOptions::getOptions();
       
   168 
       
   169 		// Get the styles folder listing
       
   170 		$styleFolder = TEMPLATEPATH . '/styles/';
       
   171 		$styleArray = array();
       
   172 		$objStyleFolder = dir($styleFolder);
       
   173 		while(false !== ($styleFile = $objStyleFolder->read())) {
       
   174 			if(is_dir($styleFolder . $styleFile) && $styleFile != '.' &&  $styleFile != '..') {
       
   175 				$styleArray[] = $styleFile;
       
   176 			}
       
   177 		}
       
   178 		$objStyleFolder->close();
       
   179 ?>
       
   180 
       
   181 <form action="#" method="post" enctype="multipart/form-data" name="elegantbox_form" id="elegantbox_form">
       
   182 	<div class="wrap">
       
   183 		<h2><?php _e('Current Theme Options', 'elegantbox'); ?></h2>
       
   184 
       
   185 		<table class="form-table">
       
   186 			<tbody>
       
   187 				<tr valign="top">
       
   188 					<th scope="row"><?php _e('Style', 'elegantbox'); ?></th>
       
   189 					<td>
       
   190 						<label>
       
   191 							<input name="style_switcher" type="checkbox" value="checkbox" <?php if($options['style_switcher']) echo "checked='checked'"; ?> />
       
   192 							 <?php _e('Allow visitors to change the style.', 'elegantbox'); ?>
       
   193 						</label>
       
   194 						<br/>
       
   195 						<?php _e('Default style:', 'elegantbox'); ?>
       
   196 						 <select name="style" size="1">
       
   197 <?php
       
   198 		if (is_array($styleArray)) {
       
   199 			foreach ($styleArray as $style) {
       
   200 				if ($style == $options['style']) {
       
   201 					$styleSelected = ' selected ';
       
   202 				} else {
       
   203 					$styleSelected = '';
       
   204 				}
       
   205 				echo '<option value="' . $style . '"' . $styleSelected . '>' . $style . '</option>' . "\n";
       
   206 			}
       
   207 		} else {
       
   208 			echo '<option value="0">' . __('Please install a valid style in the /styles/ folder.', 'elegantbox') . '</option>';
       
   209 		}
       
   210 ?>
       
   211 						</select>
       
   212 					</td>
       
   213 				</tr>
       
   214 			</tbody>
       
   215 		</table>
       
   216 
       
   217 		<table class="form-table">
       
   218 			<tbody>
       
   219 				<tr valign="top">
       
   220 					<th scope="row"><?php _e('Search', 'elegantbox'); ?></th>
       
   221 					<td>
       
   222 						<label>
       
   223 							<input name="google_cse" type="checkbox" value="checkbox" <?php if($options['google_cse']) echo "checked='checked'"; ?> />
       
   224 							 <?php _e('Using google custom search engine.', 'elegantbox'); ?>
       
   225 						</label>
       
   226 						<br/>
       
   227 						<?php _e('CX:', 'elegantbox'); ?>
       
   228 						 <input type="text" name="google_cse_cx" id="google_cse_cx" class="code" size="40" value="<?php echo($options['google_cse_cx']); ?>">
       
   229 						<br/>
       
   230 						<?php _e('Find <code>name="cx"</code> in the <strong>Search box code</strong> of <a href="http://www.google.com/coop/cse/">Google Custom Search Engine</a>, and type the <code>value</code> here.<br/>For example: <code>014782006753236413342:1ltfrybsbz4</code>', 'elegantbox'); ?>
       
   231 					</td>
       
   232 				</tr>
       
   233 			</tbody>
       
   234 		</table>
       
   235 
       
   236 		<table class="form-table">
       
   237 			<tbody>
       
   238 				<tr valign="top">
       
   239 					<th scope="row"><?php _e('Menubar', 'elegantbox'); ?></th>
       
   240 					<td>
       
   241 						<label style="margin-right:20px;">
       
   242 							<input name="menu_type" type="radio" value="pages" <?php if($options['menu_type'] != 'categories') echo "checked='checked'"; ?> />
       
   243 							 <?php _e('Show pages as menu.', 'elegantbox'); ?>
       
   244 						</label>
       
   245 						<label>
       
   246 							<input name="menu_type" type="radio" value="categories" <?php if($options['menu_type'] == 'categories') echo "checked='checked'"; ?> />
       
   247 							 <?php _e('Show categories as menu.', 'elegantbox'); ?>
       
   248 						</label>
       
   249 					</td>
       
   250 				</tr>
       
   251 			</tbody>
       
   252 		</table>
       
   253 
       
   254 		<table class="form-table">
       
   255 			<tbody>
       
   256 				<tr valign="top">
       
   257 					<th scope="row">
       
   258 						<?php _e('Notice', 'elegantbox'); ?>
       
   259 						<br/>
       
   260 						<small style="font-weight:normal;"><?php _e('HTML enabled', 'elegantbox') ?></small>
       
   261 					</th>
       
   262 					<td>
       
   263 						<label style="margin-right:20px;">
       
   264 							<input name="notice" type="checkbox" value="checkbox" <?php if($options['notice']) echo "checked='checked'"; ?> />
       
   265 							 <?php _e('Show notice.', 'elegantbox'); ?>
       
   266 						</label>
       
   267 						<label>
       
   268 							<input name="notice_icon" type="checkbox" value="checkbox" <?php if($options['notice_icon']) echo "checked='checked'"; ?> />
       
   269 							 <?php _e('Display an icon in the notice bar.', 'elegantbox'); ?>
       
   270 						</label>
       
   271 						</div>
       
   272 						<label>
       
   273 							<textarea name="notice_content" cols="50" rows="10" id="notice_content" style="width:98%;font-size:12px;" class="code"><?php echo($options['notice_content']); ?></textarea>
       
   274 						</label>
       
   275 					</td>
       
   276 				</tr>
       
   277 			</tbody>
       
   278 		</table>
       
   279 
       
   280 		<table class="form-table">
       
   281 			<tbody>
       
   282 				<tr valign="top">
       
   283 					<th scope="row">
       
   284 						<?php _e('Showcase', 'elegantbox'); ?>
       
   285 						<br/>
       
   286 						<small style="font-weight:normal;"><?php _e('HTML enabled', 'elegantbox') ?></small>
       
   287 					</th>
       
   288 					<td>
       
   289 
       
   290 						<!-- showcase START -->
       
   291 						<?php _e('This showcase will display at the top of sidebar.', 'elegantbox'); ?>
       
   292 						<br />
       
   293 						<?php _e('Who can see?', 'elegantbox'); ?>
       
   294 						<label style="margin-left:10px;">
       
   295 						<input name="showcase_registered" type="checkbox" value="checkbox" <?php if($options['showcase_registered']) echo "checked='checked'"; ?> />
       
   296 							 <?php _e('Registered Users', 'elegantbox'); ?>
       
   297 						</label>
       
   298 						<label style="margin-left:10px;">
       
   299 							<input name="showcase_commentator" type="checkbox" value="checkbox" <?php if($options['showcase_commentator']) echo "checked='checked'"; ?> />
       
   300 							 <?php _e('Commentators', 'elegantbox'); ?>
       
   301 						</label>
       
   302 						<label style="margin-left:10px;">
       
   303 							<input name="showcase_visitor" type="checkbox" value="checkbox" <?php if($options['showcase_visitor']) echo "checked='checked'"; ?> />
       
   304 							 <?php _e('Visitors', 'elegantbox'); ?>
       
   305 						</label>
       
   306 						<br />
       
   307 						<label>
       
   308 							<textarea name="showcase_content" cols="50" rows="10" id="showcase_content" style="width:98%;font-size:12px;" class="code"><?php echo($options['showcase_content']); ?></textarea>
       
   309 						</label>
       
   310 						<!-- showcase END -->
       
   311 
       
   312 						<br/><br/>
       
   313 
       
   314 						<!-- showcase 2 START -->
       
   315 						<?php _e('This showcase will display at the bottom of sidebar.', 'elegantbox'); ?>
       
   316 						<br />
       
   317 						<?php _e('Who can see?', 'elegantbox'); ?>
       
   318 						<label style="margin-left:10px;">
       
   319 							<input name="showcase_2_registered" type="checkbox" value="checkbox" <?php if($options['showcase_2_registered']) echo "checked='checked'"; ?> />
       
   320 							 <?php _e('Registered Users', 'elegantbox'); ?>
       
   321 						</label>
       
   322 						<label style="margin-left:10px;">
       
   323 							<input name="showcase_2_commentator" type="checkbox" value="checkbox" <?php if($options['showcase_2_commentator']) echo "checked='checked'"; ?> />
       
   324 							 <?php _e('Commentators', 'elegantbox'); ?>
       
   325 						</label>
       
   326 						<label style="margin-left:10px;">
       
   327 							<input name="showcase_2_visitor" type="checkbox" value="checkbox" <?php if($options['showcase_2_visitor']) echo "checked='checked'"; ?> />
       
   328 							 <?php _e('Visitors', 'elegantbox'); ?>
       
   329 						</label>
       
   330 						<br />
       
   331 						<label>
       
   332 							<textarea name="showcase_2_content" cols="50" rows="10" id="showcase_2_content" style="width:98%;font-size:12px;" class="code"><?php echo($options['showcase_2_content']); ?></textarea>
       
   333 						</label>
       
   334 						<!-- showcase 2 END -->
       
   335 
       
   336 					</td>
       
   337 				</tr>
       
   338 			</tbody>
       
   339 		</table>
       
   340 
       
   341 		<table class="form-table">
       
   342 			<tbody>
       
   343 				<tr valign="top">
       
   344 					<th scope="row"><?php _e('Posts', 'elegantbox'); ?></th>
       
   345 					<td>
       
   346 						<label style="margin-right:20px;">
       
   347 							<input name="categories" type="checkbox" value="checkbox" <?php if($options['categories']) echo "checked='checked'"; ?> />
       
   348 							 <?php _e('Show categories on posts.', 'elegantbox'); ?>
       
   349 						</label>
       
   350 						<label>
       
   351 							<input name="tags" type="checkbox" value="checkbox" <?php if($options['tags']) echo "checked='checked'"; ?> />
       
   352 							 <?php _e('Show tags on posts.', 'elegantbox'); ?>
       
   353 						</label>
       
   354 					</td>
       
   355 				</tr>
       
   356 			</tbody>
       
   357 		</table>
       
   358 
       
   359 		<table class="form-table">
       
   360 			<tbody>
       
   361 				<tr valign="top">
       
   362 					<th scope="row"><?php _e('Comments', 'elegantbox'); ?></th>
       
   363 					<td>
       
   364 						<label>
       
   365 							<input name="ctrlentry" type="checkbox" value="checkbox" <?php if($options['ctrlentry']) echo "checked='checked'"; ?> />
       
   366 							 <?php _e('Submit comments with Ctrl+Enter.', 'elegantbox'); ?>
       
   367 						</label>
       
   368 					</td>
       
   369 				</tr>
       
   370 			</tbody>
       
   371 		</table>
       
   372 
       
   373 		<table class="form-table">
       
   374 			<tbody>
       
   375 				<tr valign="top">
       
   376 					<th scope="row"><?php _e('Feed', 'elegantbox'); ?></th>
       
   377 					<td>
       
   378 						<label>
       
   379 							<input name="feed" type="checkbox" value="checkbox" <?php if($options['feed']) echo "checked='checked'"; ?> />
       
   380 							 <?php _e('Using custom feed.', 'elegantbox'); ?>
       
   381 						</label>
       
   382 						 <?php _e('Feed URL:', 'elegantbox'); ?>
       
   383 						 <input type="text" name="feed_url" id="feed_url" class="code" size="40" value="<?php echo($options['feed_url']); ?>">
       
   384 						<br/>
       
   385 						<label>
       
   386 							<input name="feed_readers" type="checkbox" value="checkbox" <?php if($options['feed_readers']) echo "checked='checked'"; ?> />
       
   387 							 <?php _e('Show the feed reader list when mouse over on feed button.', 'elegantbox'); ?>
       
   388 						</label>
       
   389 					</td>
       
   390 				</tr>
       
   391 			</tbody>
       
   392 		</table>
       
   393 
       
   394 		<table class="form-table">
       
   395 			<tbody>
       
   396 				<tr valign="top">
       
   397 					<th scope="row"><?php _e('Twitter', 'elegantbox'); ?></th>
       
   398 					<td>
       
   399 						<label>
       
   400 							<input name="twitter" type="checkbox" value="checkbox" <?php if($options['twitter']) echo "checked='checked'"; ?> />
       
   401 							 <?php _e('Add Twitter button.', 'elegantbox'); ?>
       
   402 						</label>
       
   403 						<br />
       
   404 						 <?php _e('Twitter username:', 'elegantbox'); ?>
       
   405 						 <input type="text" name="twitter_username" id="twitter_username" class="code" size="40" value="<?php echo($options['twitter_username']); ?>">
       
   406 						<br />
       
   407 						<a href="https://twitter.com/neoease/" onclick="window.open(this.href);return false;">Follow NeoEase</a>
       
   408 						 | <a href="https://twitter.com/mg12/" onclick="window.open(this.href);return false;">Follow MG12</a>
       
   409 					</td>
       
   410 				</tr>
       
   411 			</tbody>
       
   412 		</table>
       
   413 
       
   414 		<table class="form-table">
       
   415 			<tbody>
       
   416 				<tr valign="top">
       
   417 					<th scope="row">
       
   418 						<?php _e('Web Analytics', 'elegantbox'); ?>
       
   419 						<br/>
       
   420 						<small style="font-weight:normal;"><?php _e('HTML enabled', 'elegantbox'); ?></small>
       
   421 					</th>
       
   422 					<td>
       
   423 						<label>
       
   424 							<input name="analytics" type="checkbox" value="checkbox" <?php if($options['analytics']) echo "checked='checked'"; ?> />
       
   425 							 <?php _e('Add web analytics code to your site. (e.g. Google Analytics, Yahoo! Web Analytics, ...)', 'elegantbox'); ?>
       
   426 						</label>
       
   427 						<label>
       
   428 							<textarea name="analytics_content" cols="50" rows="10" id="analytics_content" class="code" style="width:98%;font-size:12px;"><?php echo($options['analytics_content']); ?></textarea>
       
   429 						</label>
       
   430 					</td>
       
   431 				</tr>
       
   432 			</tbody>
       
   433 		</table>
       
   434 
       
   435 		<p class="submit">
       
   436 			<input class="button-primary" type="submit" name="elegantbox_save" value="<?php _e('Save Changes', 'elegantbox'); ?>" />
       
   437 		</p>
       
   438 	</div>
       
   439 
       
   440 </form>
       
   441 
       
   442 <!-- donation -->
       
   443 <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
       
   444 	<div class="wrap" style="background:#E3E3E3; margin-bottom:1em;">
       
   445 
       
   446 		<table class="form-table">
       
   447 			<tbody>
       
   448 				<tr valign="top">
       
   449 					<th scope="row">Donation</th>
       
   450 					<td>
       
   451 						If you find my work useful and you want to encourage the development of more free resources, you can do it by donating...
       
   452 						<br />
       
   453 						<input type="hidden" name="cmd" value="_s-xclick" />
       
   454 						<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----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-----END PKCS7-----" />
       
   455 						<input style="border:none;" type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donate_LG.gif" name="submit" alt="" />
       
   456 						<img alt="" src="https://www.paypal.com/zh_XC/i/scr/pixel.gif" width="1" height="1" />
       
   457 					</td>
       
   458 				</tr>
       
   459 			</tbody>
       
   460 		</table>
       
   461 
       
   462 	</div>
       
   463 </form>
       
   464 
       
   465 <?php
       
   466 	}
       
   467 }
       
   468 
       
   469 // Register functions
       
   470 add_action('admin_menu', array('ElegantboxOptions', 'add'));
       
   471 
       
   472 /** l10n */
       
   473 function theme_init(){
       
   474 	load_theme_textdomain('elegantbox', get_template_directory() . '/languages');
       
   475 }
       
   476 add_action ('init', 'theme_init');
       
   477 
       
   478 /** widgets */
       
   479 if( function_exists('register_sidebar') )
       
   480 	register_sidebar(array(
       
   481 		'before_widget' => '<li class="widget %2$s">',
       
   482 		'after_widget' => '</li>',
       
   483 		'before_title' => '<h3>',
       
   484 		'after_title' => '</h3>',
       
   485 	));
       
   486 
       
   487 /** Comments */
       
   488 if (function_exists('wp_list_comments')) {
       
   489 	// comment count
       
   490 	function comment_count( $commentcount ) {
       
   491 		global $id;
       
   492 		$_comments = get_comments('status=approve&post_id=' . $id);
       
   493 		$comments_by_type = &separate_comments($_comments);
       
   494 		return count($comments_by_type['comment']);
       
   495 	}
       
   496 }
       
   497 
       
   498 // custom comments
       
   499 function custom_comments($comment, $args, $depth) {
       
   500 	$GLOBALS['comment'] = $comment;
       
   501 	global $commentcount;
       
   502 	if(!$commentcount) {
       
   503 		$commentcount = 0;
       
   504 	}
       
   505 ?>
       
   506 	<li class="comment <?php if($comment->comment_author_email == get_the_author_email()) {echo ' admincomment';} ?>" id="comment-<?php comment_ID() ?>">
       
   507 		<div class="userinfo">
       
   508 			<?php
       
   509 				// WordPress 2.5 or higher
       
   510 				if (function_exists('get_avatar') && get_option('show_avatars')) {
       
   511 					echo '<div class="userpic">'; echo get_avatar($comment, 24); echo '</div>';
       
   512 				// WordPress 2.3.3 or lower
       
   513 				} else if (function_exists('gravatar')) {
       
   514 					echo '<div class="userpic"><img class="avatar" src="'; gravatar("G", 24); echo '" alt="avatar" /></div>';
       
   515 				}
       
   516 			?>
       
   517 			<div class="usertext">
       
   518 				<div class="username">
       
   519 					<?php if (get_comment_author_url()) : ?>
       
   520 						<a id="commentauthor-<?php comment_ID() ?>" href="<?php comment_author_url() ?>" rel="external nofollow">
       
   521 					<?php else : ?>
       
   522 						<span id="commentauthor-<?php comment_ID() ?>">
       
   523 					<?php endif; ?>
       
   524 						<?php comment_author() ?>
       
   525 					<?php if(get_comment_author_url()) : ?>
       
   526 						</a>
       
   527 					<?php else : ?>
       
   528 						</span>
       
   529 					<?php endif; ?>
       
   530 				</div>
       
   531 				<div class="date"><?php printf( __('%1$s at %2$s', 'elegantbox'), get_comment_date(__('F jS, Y', 'elegantbox')), get_comment_time(__('H:i', 'elegantbox')) ); ?></div>
       
   532 			</div>
       
   533 			<div class="count">
       
   534 				<?php if (!get_option('thread_comments')) : ?>
       
   535 					<a href="javascript:void(0);" onclick="CMT.reply('commentauthor-<?php comment_ID() ?>', 'comment-<?php comment_ID() ?>', 'comment');"><?php _e('Reply', 'elegantbox'); ?></a> | 
       
   536 				<?php else : ?>
       
   537 					<?php comment_reply_link(array('depth' => $depth, 'max_depth'=> $args['max_depth'], 'reply_text' => __('Reply', 'elegantbox'), 'after' => ' | '));?>
       
   538 				<?php endif; ?>
       
   539 				<a href="javascript:void(0);" onclick="CMT.quote('commentauthor-<?php comment_ID() ?>', 'comment-<?php comment_ID() ?>', 'commentbody-<?php comment_ID() ?>', 'comment');"><?php _e('Quote', 'elegantbox'); ?></a> | 
       
   540 				<?php edit_comment_link(__('Edit', 'elegantbox'), '', ' | '); ?>
       
   541 				<a href="#comment-<?php comment_ID() ?>"><?php printf('#%1$s', ++$commentcount); ?></a>
       
   542 			</div>
       
   543 			<div class="fixed"></div>
       
   544 		</div>
       
   545 		<div class="comment_text">
       
   546 			<?php if ($comment->comment_approved == '0') : ?>
       
   547 				<p><small><?php _e('Your comment is awaiting moderation.', 'elegantbox'); ?></small></p>
       
   548 			<?php endif; ?>
       
   549 
       
   550 			<div id="commentbody-<?php comment_ID() ?>"><?php comment_text() ?></div>
       
   551 		</div>
       
   552 
       
   553 <?php
       
   554 }
       
   555 ?>