function display_week() { global $vars; $heading_html = tag('tr'); $heading_html->add(tag('th', __p('Week', 'W'))); for ($i = 0; $i < 7; $i++) { $d = ($i + day_of_week_start()) % 7; $heading_html->add(tag('th', day_name($d))); } if (!isset($vars['week']) || !isset($vars['year'])) { soft_error(__('Invalid date.')); } $week_of_year = intval($vars['week']); $year = intval($vars['year']); $day_of_year = 1 + ($week_of_year - 1) * 7 - day_of_week(1, 1, $year); $from_stamp = mktime(0, 0, 0, 1, $day_of_year, $year); $start_month = date("n", $from_stamp); $start_year = date("Y", $from_stamp); $last_day = $day_of_year + 6; $to_stamp = mktime(23, 59, 59, 1, $last_day, $year); $end_month = date("n", $to_stamp); $end_year = date("Y", $to_stamp); $heading = month_name($start_month) . " {$start_year}"; if ($end_month != $start_month) { $heading .= " - " . month_name($end_month) . " {$end_year}"; } return tag('', tag("div", attributes('id="phpc-summary-view"'), tag("div", attributes('id="phpc-summary-head"'), tag("div", attributes('id="phpc-summary-title"'), ''), tag("div", attributes('id="phpc-summary-author"'), ''), tag("div", attributes('id="phpc-summary-category"'), ''), tag("div", attributes('id="phpc-summary-time"'), '')), tag("div", attributes('id="phpc-summary-body"'), '')), tag('table', attributes('class="phpc-main phpc-calendar"'), tag('caption', $heading), tag('colgroup', tag('col', attributes('class="phpc-week"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"'))), tag('thead', $heading_html), create_week($week_of_year, $from_stamp, $to_stamp, $year))); }
public function test__p() { ob_start(); __p("<br />\n"); $output = ob_get_clean(); $this->assertEquals("<br />\n", $output); }
function parsePreviewString($product, $width = 300, $height = 300) { $path_to_original = $this->getOriginalPaths($product['Product']['id']); $s = null; $p_options = array('src' => $product['Product']['image'], 'id' => $product['Product']['id'], 'width' => $width, 'height' => $height, 'square' => 3); $s['id'] = $product['Product']['id']; $s['title'] = $product['Product']['title']; $s['company'] = $product['Product']['company']; $s['src'] = !empty($path_to_original[0]) && !is_null($product['Product']['image']) ? __p($p_options) : '/img/default_avatar.jpg.big.jpg'; $s['keys'] = ''; foreach ($product['Serial'] as $tmpserial) { $s['keys'] .= $tmpserial['key'] . ','; } $out = rtrim($s['id'] . DR . $s['src'] . DR . $s['title'] . DR . $s['company'] . DR . rtrim($s['keys'], ','), DR); return $out; }
function display_month() { global $month, $year, $phpc_home_url, $phpcid; $heading_html = tag('tr'); $heading_html->add(tag('th', __p('Week', 'W'))); for ($i = 0; $i < 7; $i++) { $d = ($i + day_of_week_start()) % 7; $heading_html->add(tag('th', day_name($d))); } $months = array(); for ($i = 1; $i <= 12; $i++) { $m = month_name($i); $months["{$phpc_home_url}?action=display_month&phpcid={$phpcid}&month={$i}&year={$year}"] = $m; } $years = array(); for ($i = $year - 5; $i <= $year + 5; $i++) { $years["{$phpc_home_url}?action=display_month&phpcid={$phpcid}&month={$month}&year={$i}"] = $i; } return tag('', tag("div", attributes('id="phpc-summary-view"'), tag("div", attributes('id="phpc-summary-head"'), tag("div", attributes('id="phpc-summary-title"'), ''), tag("div", attributes('id="phpc-summary-author"'), ''), tag("div", attributes('id="phpc-summary-category"'), ''), tag("div", attributes('id="phpc-summary-time"'), '')), tag("div", attributes('id="phpc-summary-body"'), '')), tag('table', attributes('class="phpc-main phpc-calendar"'), tag('caption', create_dropdown_list(month_name($month), $months), create_dropdown_list($year, $years)), tag('colgroup', tag('col', attributes('class="phpc-week"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"'))), tag('thead', $heading_html), create_month($month, $year))); }
echo ' onclick="browseNav(' . ($bnav - 1) * $perPage . ',' . $view . ')">' . number_format($bnav) . '</a>'; } } echo '</span>'; if ($currentPage < $totalPages) { echo '<a id="nextNav" onclick="browseNav(' . $currentPage * $perPage . ',' . $view . ')">' . __("Next") . '</a>'; echo '<a id="lastNav" onclick="browseNav(' . ($totalPages - 1) * $perPage . ',' . $view . ')">' . __("Last") . '</a>'; } echo '</td>'; echo '</tr>'; echo '</table>'; } else { echo '<table class="browsenav">'; echo '<tr>'; echo '<td class="options">'; printf(__p("Your query returned %d result.", "Your query returned %d results.", $totalRows), $totalRows); echo " " . sprintf(__("(%.4f seconds)"), $queryTime); if ($totalRows > $displayLimit) { echo ' (' . sprintf(__("Note: To avoid crashing your browser, only the first %d results have been displayed"), $displayLimit) . '.)'; } echo '</td>'; echo '</tr>'; echo '</table>'; } echo '<div class="grid">'; if (isset($primaryKeys) && count($primaryKeys)) { echo '<div class="emptyvoid" style="width: 30px"> </div>'; } echo '<div class="gridheader'; if (!isset($queryTable)) { echo ' nosort';
function recentList($imgs, $max, $w, $h, $album = false) { $o = '<ol class="snap-thumbs">'; if ($album) { $row = 3; } else { $row = 4; } $i = $total = 1; foreach ($imgs as $img) { $o .= '<li class="loadme' . ($i == $row ? ' end' : '') . '">'; $o .= '<span class="preview-me" onclick="Preview.bury();location.href=\'' . $this->Html->url("/albums/edit/{$img['Image']['aid']}/content/{$img['Image']['id']}") . '\'"><span>'; if (isNotImg($img['Image']['src'])) { $o .= $this->getVidThumb($img['Image']['src'], $img['Image']['lg_preview'], $img['Image']['aid'], 250, 250, 0, 70, 1); } else { $arr = unserialize($img['Image']['anchor']); if (empty($arr)) { $x = $y = 50; } else { $x = $arr['x']; $y = $arr['y']; } $o .= __p(array('src' => $img['Image']['src'], 'album_id' => $img['Image']['aid'], 'width' => 250, 'height' => 250, 'square' => 0, 'anchor_x' => $x, 'anchor_y' => $y)); } $o .= '||' . $img['Image']['src'] . '||' . $this->_date(__('%m/%d/%Y', true), $img['Image']['created_on']) . '||'; if ($album) { $o .= '_'; } else { $o .= $img['Album']['name']; } $o .= '||'; if (isNotImg($img['Image']['src'])) { $o .= $this->getVidThumb($img['Image']['src'], $img['Image']['lg_preview'], $img['Image']['aid'], 90, 70, 1, 70, 1, true); } else { $o .= __p(array('src' => $img['Image']['src'], 'album_id' => $img['Image']['aid'], 'width' => 90, 'height' => 70, 'anchor_x' => $x, 'anchor_y' => $y)); } $o .= '</span>'; if ($img['Image']['is_video']) { $o .= $this->Html->image('vid_overlay.png', array('width' => 32, 'height' => 32, 'class' => 'video-overlay', 'alt' => 'icon')); } $o .= '</span></li>'; if ($i < $row) { $i++; } else { $i = 1; } $total++; } if ($total <= $max) { for ($j = $total; $j <= $max; $j++) { $o .= '<li class="empty' . ($i == $row ? ' end' : '') . '"></li>'; $i < $row ? $i++ : ($i = 1); } } $o .= '</ol>'; return $o; }
<meta http-equiv="content-script-type" content="text/javascript" /> <title>サンプル</title> </head> <body> <div id="contact"> <h1>お問い合わせサンプル</h1> <div id="formarea"> <form method="post" action="form.php" name="contactform"> <div class="inputbox"> <strong>※印は、必須</strong> <table> <tr> <th><p>お問い合わせの種類<strong>※</strong></p></th> <td> <?php __p($mailform->getSelectedValue('kind')); ?> </td> </tr> <tr> <th><p>名前<strong>※</strong></p></th> <td><div><?php __e($mailform->getValue('username')); ?> </div></td> </tr> <tr> <th><p>フリガナ(カタカナ)<strong>※</strong></p></th> <td><div><?php __e($mailform->getValue('kana')); ?>
function user($id, $users, $size = array()) { if (is_null($id)) { $id = $users['king']; } $data = array(); if (is_array($id)) { $user_id = $id['id']; $u = $users[$user_id]; if (isset($id['count'])) { $count = $id['count']; } else { $count = $u['image_count']; } } else { if ($id == 0) { return ''; } else { $user_id = $id; $u = $users[$user_id]; $count = $u['image_count']; } } $externals = unserialize($u['externals']); $ex_str = ''; if (!empty($externals)) { $data['externals'] = array(); foreach ($externals as $a) { $data['externals'][] = array('name' => $a['name'], 'url' => $a['url']); } } $originals = glob(AVATARS . DS . $user_id . DS . 'original.*'); $size_str = ''; if (!empty($size) && count($originals) != 0) { $data['photos'] = array(); foreach ($size as $s) { $s = explode(',', $s); $data['photos'][$s[0]] = array(); $arr = unserialize($u['anchor']); if (empty($arr)) { $x = $y = 50; } else { $x = $arr['x']; $y = $arr['y']; } list($w, $h) = computeSize($originals[0], $s[1], $s[2], $s[3]); $data['photos'][$s[0]]['url'] = __p(array('src' => basename($originals[0]), 'album_id' => "avatar-{$user_id}", 'width' => $s[1], 'height' => $s[2], 'square' => $s[3], 'quality' => $s[4], 'sharpening' => $s[5], 'anchor_x' => $x, 'anchor_y' => $y)); $data['photos'][$s[0]]['width'] = $w; $data['photos'][$s[0]]['height'] = $h; } } $data['id'] = $user_id; $data['username'] = $u['usr']; $data['first'] = $u['first_name']; $data['last'] = $u['last_name']; $data['display_name'] = $u['display_name']; $data['profile'] = $u['profile']; $data['content_count'] = $count; return $data; }
function avatar_focal($id) { $this->User->id = $id; $this->User->saveField('anchor', serialize($this->data)); if (CUR_USER_ID == $id) { $u = $this->User->find(aa('id', $id)); $this->Session->write('User', $u['User']); } $avs = glob(AVATARS . DS . $id . DS . 'original.*'); $t = filemtime($avs[0]); $url = __p(array('src' => basename($avs[0]), 'album_id' => "avatar-{$id}", 'width' => 100, 'height' => 100, 'anchor_x' => $this->data['x'], 'anchor_y' => $this->data['y'])); die('<img src="' . $url . '" />'); }
} } } $message = ""; if (!isset($statements)) { $message .= __("Either the file could not be read or it was empty") . "<br />"; } else { if ($format == "SQL") { $message .= sprintf(__p("%d statement was executed from the file", "%d statements were executed from the file", $insertCount), $insertCount) . ".<br />"; } else { if ($format == "CSV") { if (isset($insertCount) && $insertCount > 0) { $message .= sprintf(__p("%d row was inserted into the database from the file", "%d rows were inserted into the database from the file", $insertCount), $insertCount) . ".<br />"; } if (isset($skipCount) && $skipCount > 0) { $message .= sprintf(__p("%d row had to be skipped because the number of values was incorrect", "%d rows had to be skipped because the number of values was incorrect", $skipCount), $skipCount) . ".<br />"; } } } } if (isset($dbErrors)) { $message .= __("The following errors were reported") . ":<br />"; foreach ($dbErrors as $merr) { $message .= " - " . $merr . "<br />"; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" version="-//W3C//DTD XHTML 1.1//EN" xml:lang="en">
function avatar_uri($id, $width = 50, $height = 50, $square = 1) { $path = PRODUCTIMAGES . DS . $id . DS . 'original.*'; $options = array('width' => $width, 'height' => $height, 'square' => $square); if ($id != 'tmp') { $this->_use_preview($id, true); } else { sleep(4); } $files = glob($path); if (!empty($files[0])) { //&$this->log($files[0], LOG_DEBUG); $src = basename($files[0]); extract($options); $tmp_options = compact(array('src', 'id', 'width', 'height', 'square')); $src_tmp = __p($tmp_options); extract($this->_previewOptions(300, 300)); $prv_options = compact(array('src', 'id', 'width', 'height', 'square')); $src_prv = __p($prv_options); $value = array('src_tmp' => $src_tmp, 'src_prv' => $src_prv); } else { $value = array('src_tmp' => 'nofile'); } $this->set(compact('value')); $this->render(SIMPLE_JSON, 'ajax'); }
<?php $selectvalues = $mailform->getSelectValues('interesting_items'); $selectedvalues = $mailform->getValue('interesting_items'); if (!$selectedvalues) { $selectedvalues = []; } foreach ($selectvalues as $key => &$value) { ?> <label><input type="checkbox" name="interesting_items[]" value="<?php __e($key); ?> " <?php __pchecked(in_array($key, $selectedvalues)); ?> ><?php __p($value); ?> </label><br /> <?php } ?> </td> </tr> <tr> <th><p>ご希望の時間帯</p></th> <td> <input type="radio" name="time" value="1" <?php __pchecked($mailform->isSelectedValue('time', '1', true)); ?> /><span><label for="timeno"><?php echo $mailform->getSelectValue('time', '1');
function create_display_table($heading, $contents) { $heading_html = tag('tr', attrs('class="ui-widget-header"')); $heading_html->add(tag('th', __p('Week', 'W'))); for ($i = 0; $i < 7; $i++) { $d = ($i + day_of_week_start()) % 7; $heading_html->add(tag('th', day_name($d))); } return tag('div', tag("div", attributes('id="phpc-summary-view"'), tag("div", attributes('id="phpc-summary-head"'), tag("div", attributes('id="phpc-summary-title"'), ''), tag("div", attributes('id="phpc-summary-author"'), ''), tag("div", attributes('id="phpc-summary-category"'), ''), tag("div", attributes('id="phpc-summary-time"'), '')), tag("div", attributes('id="phpc-summary-body"'), '')), tag('div', attrs('class="phpc-sub-title phpc-month-title ui-widget-content"'), $heading), tag('table', attrs('class="phpc-month-view"'), tag('colgroup', tag('col', attributes('class="phpc-week"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"'))), tag('thead', $heading_html), tag('tbody', $contents))); }
/** * @see __p() */ public function __p(\Twig_Environment $env, $context, $message, $domain = null) { return \__p($context, $message, $domain); }
</head> <body> <div id="content"> <h1>お問い合わせ添付ファイルのサンプル</h1> <div id="formarea"> <form method="post" action="form.php" name="contactform" enctype="multipart/form-data"> <?php if ($mailform->isError()) { ?> <div class="errorbox"> <p>エラー</p> <ul> <?php $errors = $mailform->getErrorMessages(); foreach ($errors as $message) { __p("\t\t\t\t\t<li>" . $message . "</li>"); } ?> </ul> </div> <?php } ?> </select> <div class="inputbox"> <strong>※印は、必須</strong> <table> <tr> <th><p>名前<strong>※</strong></p></th> <td><div><input type="text" name="username" value="<?php __e($mailform->getValue('username'));
public function uri($width = 550, $height = 550, $square = 2) { $json = array(); if ($this->Auth->user('id')) { $user_id = $uid = $this->Auth->user('id'); if (!empty($this->data)) { foreach ($this->data as $data) { $id = $data['id']; $path = PHOTOS . DS . $uid . DS . $id . DS . 'lg' . DS . '*.*'; $files = glob($path); if (!empty($files[0])) { $fn = basename($files[0]); $options = compact(array('uid', 'id', 'fn', 'width', 'height', 'square')); if ($square == 4) { $src = p($options); } else { $src = __p($options); } $return = array($id => array('src' => $src)); $json[] = $return; } } } } else { $json = array('flash' => '<strong style="color:red">No valid user</strong>'); $this->response->header("WWW-Authenticate: Negotiate"); } $this->set('_serialize', $json); $this->render(SIMPLE_JSON); }