function check($str) { $len = strlen($str); $stack = array(); for ($i = 0; $i < $len; $i++) { $theChar = $str[$i]; if (is_open($theChar)) { $stack[] = $theChar; } else { $matching = array_pop($stack); if (!matches($matching, $theChar)) { return false; } } } return count($stack) == 0; }
<span class="seperator"></span> <?php } ?> <h4>Εργαλεία</h4> <span class="print"> <a href="<?php echo URL; ?> /?p=<?php echo $post->ID; ?> &print=1">Εκτύπωση</a> </span> <?php if (!is_open($cons_cat->cat_ID)) { ?> <span class="export"> Εξαγωγή Σχολίων σε <a href="<?php echo URL; ?> /?ec=<?php echo $cons_cat->cat_ID; ?> &t=xls" title="XLS"><img src="<?php echo IMG; ?> /excel.gif" /></a> <a href="<?php echo URL;
function is_open($event, $schedule) { $result = true; foreach ($schedule as $key => $contents) { $operands = $schedule[$key]; switch ($key) { case 'or': $result = false; // one must succeed for ($i = 0; $i < count($operands) && !$result; $i++) { $result |= is_open($event, $operands[$i]); } break; case 'and': for ($i = 0; $i < count($operands) && $result; $i++) { $result &= is_open($event, $operands[$i]); } break; case 'not': $result = !is_open($event, $operands); break; case 'wd': //$wd = weekday($event[0], $event[1], $event[2]); if using weekday.js $stringtime = strval($event['year']) . '-' . strval($event['month']) . '-' . strval($event['day']); $timestamp = strtotime($stringtime); $wd = date("N", $timestamp); $result = false; for ($i = 0; $i < count($operands) && !$result; $i++) { $result |= $wd == $operands[$i]; } break; case 'ehr': $resolved = false; $j = 3; //hour in event $i = 0; $result = true; // if event just on end limit for ($j = 3; $j < count($event) && !$resolved; $j++) { if ($i < count($operands[$i])) { if ($event['hour'] < $operands[$i]) { $result = true; $resolved = true; } elseif ($event['hour'] > $operands[$i]) { $result = false; $resolved = true; } } elseif ($event[$j] > 0) { $result = false; $resolved = true; } $i++; } break; case 'bhr': $resolved = false; $j = 3; //hour in event $i = 0; for ($í = 0; $i < count($operands) && !$resolved; $i++) { if ($j < count($event)) { if ($event['hour'] < $operands[$i]) { $result = false; $resolved = true; } elseif ($event['hour'] > $operands[$i]) { $result = true; $resolved = true; } } elseif ($operands[$i] > 0) { $result = false; $resolved = true; } $j++; } break; } if (!$result) { break; } } return $result; }
echo '<font color="green"><em>' . mysql2date("j M Y, H:i", $dates[1]) . '</em></font>'; } ?> </td> <td class="posts column-posts num"> <a href="<?php echo URL; ?> /wp-admin/admin.php?page=edit-consultation-handle&cons=<?php echo $consultation->term_id; ?> ">Επεξεργασία</a> </td> <td class="posts column-posts num2"> <?php if (!is_open($consultation->term_id)) { if (strtotime($dates[1]) < strtotime($dateNow)) { ?> <a href="<?php echo URL; ?> /?cat=<?php echo $consultation->term_id; ?> " style="color:red;">Προβολή</a> <?php } else { ?> <a href="<?php echo URL; ?>