/** * Standard init function to instantiate language object * and create title, etc */ public function init() { try { $this->objLanguage = $this->getObject('language', 'language'); $this->title = ucWords($this->objLanguage->code2Txt('mod_context_learneroutcomes', 'context')); } catch (customException $e) { customException::cleanUp(); } }
/** * Converts given string into CamelCased class name * * @return string * @param string $string */ public static function stringToName($string) { $result = strToLower($string); $result = str_replace('-', ' ', $result); $result = ucWords($result); $result = str_replace(' ', '', $result); $result = trim($result); return $result; }
function getBlankXml($type) { $function = 'Pulsestorm\\Magento2\\Cli\\Xml_Template'; $function .= '\\getBlankXml' . ucWords(strToLower($type)); if (function_exists($function)) { return call_user_func($function); } throw new Exception("No such type, {$type}"); }
/** * Выполняет общее преобразование короткого имени в имя класса: * - Приводит переданное значение к CamelCase * - Удаляет знак "минус" * - Заменяет знак "слеш" на разделитель пространства имён * * @return string * @param string $value */ public static function common($value) { $result = preg_replace('/\\s+/', '', trim($value)); $result = strToLower($result); $result = str_replace(array('-', '/'), array(' ', '. '), $result); $result = ucWords($result); $result = str_replace(array(' ', '.'), array('', NS), $result); return trim($result); }
/** * Standard init function to instantiate language object * and create title, etc */ public function init() { try { $this->loadClass('link', 'htmlelements'); $this->objLanguage = $this->getObject('language', 'language'); $this->title = ucWords($this->objLanguage->code2Txt('mod_context_aboutcontext', 'context')); } catch (customException $e) { customException::cleanUp(); } }
function mb_convert_case($str, $mode, $enc = '') { switch ($mode) { case MB_CASE_LOWER: return strToLower($str); case MB_CASE_UPPER: return strToUpper($str); case MB_CASE_TITLE: return ucWords(strToLower($str)); default: return $str; } }
/** * Standard init function to instantiate language object * and create title, etc */ public function init() { try { $this->objLanguage = $this->getObject('language', 'language'); $this->title = ucWords($this->objLanguage->code2Txt('mod_context_allcontexts', 'context', NULL, 'All [-contexts-]')); // HTML Elements $this->loadClass('form', 'htmlelements'); $this->loadClass('dropdown', 'htmlelements'); $this->loadClass('button', 'htmlelements'); } catch (customException $e) { customException::cleanUp(); } }
function Radio($name, $value = '', $class = 'check_radio', $js_event_str = '') { $data = $this->getStatusCodes(); $str = ''; foreach ($data as $k => $v) { $slcted = ''; if ($v == $value) { $slcted .= " checked='checked'"; } $str .= "<input type='radio' name='" . $name . "' value='" . $v . "'" . $slcted . " class='" . $class . "'" . $js_event_str . "> " . ucWords($v) . " "; } return $str; }
public static function formatName($name, $controller = true) { $result = strToLower($name); $result = str_replace('-', ' ', $result); $result = ucWords($result); $result = str_replace(' ', '', $result); $result = trim($result); if ($controller) { $result .= self::SUFFIX_CONTROLLER; } else { $result = strToLower($result[0]) . subStr($result, 1); $result .= self::SUFFIX_ACTION; } return $result; }
public function request($url, $post = null) { $method = $this->getUse(); if (in_array($method, $this->_methods)) { $method_name = '_request' . ucWords($method); if (!method_exists($this, $method_name)) { throw new Exception("Method {$method_name} does not exists."); } if ($this->debug()) { echo "\nTrying to get '{$url}' using " . strtoupper($method); } return call_user_func(array($this, $method_name), $url, $post); } else { throw new Exception('Method not seted.'); } }
/** * 呼び出し元のコントローラーから呼び出すモデルを判定しrun()を実行します。 * * 実行モデル: * 同一Bundle内にコントローラー名のControllerを省く文字のディレクトリ内にある * 実行したActionをCamel式で表したファイル名 */ protected final function run($inputParam = array()) { $backtrace = debug_backtrace(); $controllerClass = get_class($this); $functionName = $backtrace[1]['function']; $serviceName = preg_replace('/Controller$/', '', preg_replace('/^.*\\\\/', '', $controllerClass)); $actionName = ucWords(preg_replace('/Action$/', '', $functionName)); $tmp = '\\Service\\' . $serviceName . '\\' . $actionName; $classPath = preg_replace('/\\\\Controller.*$/', $tmp, $controllerClass); $service = new $classPath($this->container); if (is_null($service)) { throw new \ErrorException('Service is not found.'); } $result = $service->run($inputParam); return $result; }
/** * Standard init function to instantiate language object * and create title, etc */ public function init() { try { $this->objLanguage = $this->getObject('language', 'language'); $this->objUserContext = $this->getObject('usercontext', 'context'); $this->objUser = $this->getObject('user', 'security'); $this->objContext = $this->getObject('dbcontext'); $this->objGroups = $this->getObject('groupAdminModel', 'groupadmin'); $this->title = ucWords($this->objLanguage->code2Txt('phrase_mycourses', 'system', NULL, 'My [-contexts-]')); // HTML Elements $this->loadClass('form', 'htmlelements'); $this->loadClass('dropdown', 'htmlelements'); $this->loadClass('button', 'htmlelements'); } catch (customException $e) { customException::cleanUp(); } }
function letrasIniciais($nome, $minusculas = true) { $nome = ucWords(strtolower($nome)); #ESSA LINHA $nome = ereg_replace("Da|De|Di|Do|Du", "", $nome); # ESSA Tambem preg_match_all('/\\s?([A-Z])/', $nome, $matches); $ret = implode('', $matches[1]); return $minusculas ? strtoupper($ret) : $ret; }
function _get_request_headers_as_string() { global $_SERVER, $orig_url; $ret = ''; $ret .= $_SERVER['REQUEST_METHOD'] . ' ' . $orig_url . ' ' . $_SERVER['SERVER_PROTOCOL'] . "\r\n"; foreach ($_SERVER as $k => $v) { if (subStr($k, 0, 5) === 'HTTP_') { $k = str_replace(' ', '-', ucWords(str_replace('_', ' ', strToLower(subStr($k, 5))))); $ret .= $k . ': ' . $v . "\r\n"; } } $ret .= "\r\n"; return $ret; }
function execute(&$data, &$parent) { if (!array_key_exists($this->data, $data)) { //echo "did not find " . $this->data; return ""; } $result = $data[$this->data]; if ($this->args) { // print "[[" . $this->args . "]]"; $modifiers = preg_split("!\\s!", $this->args); //print count($modifiers) . "modifiers"; // print_r($modifiers); foreach ($modifiers as $modifierString) { preg_match("!(\\w*)(.*)!", $modifierString, $matches); //print_r($matches); $modifier = $matches[1]; //print "[$modifier]"; $argumentString = $matches[2]; $arguments = array(); if ($argumentString) { $delim = $argumentString[0]; $arguments = explode($delim, substr($argumentString, 1)); } switch ($modifier) { case 'capUpper': $result = strtoupper($result); break; case 'capLower': $result = strtolower($result); break; case 'capWord': $result = ucWords($result); break; case 'capSentence': $result = ucFirst($result); break; case 'trim': $result = trim($result); break; case 'htmlencode': $result = htmlentities($result); break; case 'htmldecode': $result = html_entity_decode($result); break; case 'makesafe': $result = mysql_real_escape_string($result); break; case 'utf8decode': $result = utf8_decode($result); break; case 'utf8encode': $result = utf8_encode($result); break; case 'strtotime': $result = strtotime($result); break; case 'stripslashes': $result = stripslashes($result); break; case 'addslashes': $result = addslashes($result); break; case 'addone': $result++; break; case 'number': //print_r($arguments); $dec = 2; if (count($arguments) > 0) { $dec = $arguments[0]; } $dot = ","; if (count($arguments) > 1) { $dot = $arguments[1]; } $sep = "."; if (count($arguments) > 2) { $sep = $arguments[2]; } $result = number_format($result, $dec, $dot, $sep); break; case 'printf': $format = ""; if (count($arguments) == 0) { break; } $format = $arguments[0]; $result = sprintf($format, $result); break; case 'date': $format = ""; if (count($arguments) == 0) { break; } $format = $arguments[0]; $result = date($format, $result); break; default: } } } return $result; }
public function setJSVars() { $objSysConfig = $this->getObject('altconfig', 'config'); $this->appendArrayVar('headerParams', ' <script type="text/javascript"> var pageSize = 500; var lang = new Array(); lang["mycontext"] = "' . ucWords($this->objLanguage->code2Txt('phrase_mycourses', 'system', NULL, 'My [-contexts-]')) . '"; lang["contexts"] = "' . ucWords($this->objLanguage->code2Txt('wordcontext', 'system', NULL, '[-contexts-]')) . '"; lang["context"] = "' . ucWords($this->objLanguage->code2Txt('wordcontext', 'system', NULL, '[-context-]')) . '"; lang["othercontext"] = "' . ucWords($this->objLanguage->code2Txt('phrase_othercourses', 'system', NULL, 'Other [-contexts-]')) . '"; lang["searchcontext"] = "' . ucWords($this->objLanguage->code2Txt('phrase_allcourses', 'system', NULL, 'Search [-contexts-]')) . '"; lang["contextcode"] = "' . ucWords($this->objLanguage->code2Txt('mod_context_contextcode', 'system', NULL, '[-contexts-] Code')) . '"; lang["lecturers"] = "' . ucWords($this->objLanguage->code2Txt('word_lecturers', 'system', NULL, '[-authors-]')) . '"; lang["students"] = "' . ucWords($this->objLanguage->code2Txt('word_students', 'system', NULL, '[-readonly-]')) . '"; var baseUri = "' . $objSysConfig->getsiteRoot() . 'index.php"; var uri = "' . str_replace('&', '&', $this->uri(array('module' => 'context', 'action' => 'jsonlistcontext'))) . '"; var usercontexturi = "' . str_replace('&', '&', $this->uri(array('module' => 'context', 'action' => 'jsonusercontexts'))) . '"; var othercontexturi = "' . str_replace('&', '&', $this->uri(array('module' => 'context', 'action' => 'jsonusercontexts'))) . '"; contextPrivateMessage="' . $this->objLanguage->code2Txt('mod_context_privatecontextexplanation', 'context', NULL, 'This is a closed [-context-] only accessible to members') . '"; </script>'); }
<ul> <?php foreach ($posts as $row) { ?> <li class="cat-<?php echo $row->page_category; ?> "> <h4><?php echo anchor('blog/' . $row->page_url, $row->page_title); ?> </h4> <small> <span class="cat"><?php echo anchor('blog/category/' . $row->page_category, ucWords($row->page_category)); ?> </span> <time datetime="<?php echo date('Y-m-d H:i:s', strtotime($row->page_datetime)); ?> " pubdate class="pubdate"> <?php echo date('l jS F Y', strtotime($row->page_datetime)); ?> </time> </small> </li> <?php }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <title><?php echo isset($siteName) ? ucWords($siteName) : 'Tuts+'; ?> </title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.css" /> <link rel="apple-touch-icon" href="img/tutsTouchIcon.jpg" /> <link rel="stylesheet" href="css/mobile.css" /> <link rel="stylesheet" href="css/article.css" /> <script src="http://code.jquery.com/jquery-1.4.3.min.js"></script> <script src="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.js"></script> </head>
foreach ($articulos as $key => $value) { ?> <article class="post clear-fix"> <?php echo Html::a(Html::img('@web/img/categories/' . $value->categoria->seo_slug . '.png', ['alt' => $value->categoria->categoria, 'class' => 'img-thumbnail']), ['/categoria/' . Html::encode("{$value->categoria->seo_slug}")], ['class' => 'thumb pull-left']); ?> <h3 class="post-title"> <?php echo Html::a(Html::encode("{$value->titulo}"), ['/articulo/' . Html::encode("{$value->seo_slug}")], ['title' => Html::encode("{$value->titulo}")]); ?> </h3> <div class="post-date"> <span class="glyphicon glyphicon-user"> </span><span class="post-author"><?php echo ucWords(HTml::encode("{$value->createdBy->name}")); ?> </span> | <span class="glyphicon glyphicon-calendar"> </span><?php echo strftime("%c", strtotime($value->created_at)); ?> </div> <p class="post-content"> <?php if (empty($value->resumen)) { echo HtmlPurifier::process(Helper::myTruncate($value->detalle, 300, " ", "...")); } else { echo $value->resumen; }
<h1> <?php echo ucWords($siteName); ?> </h1> </header> <div data-role="content"> <h1> <?php echo $feed->title; ?> </h1> <div> <?php echo $feed->description; ?> </div> </div> <footer data-role="footer" "> <h4> <a href="<?php echo $feed->guid->content; ?> "> Leia em <?php echo ucWords($siteName); ?> </a></h4> </footer> </div> </body> </html>
?> </td> <td align="center"><?php echo $donation['email']; ?> </td> <td align="center"><?php echo CommonFunc::getFormatedDateTime($donation['donation_date']); ?> </td> <td align="center"><?php echo $donation['amount']; ?> </td> <td align="center"><?php echo ucWords($donation['status_id']); ?> </td> <td align="center"> <a title="View" onclick="return GB_showFullScreen('Request#<?php echo $donation['donation_id']; ?> ', '../../../php/view.php?id=<?php echo $donation['donation_id']; ?> ')" class="btn"><img src='../assets/images/edit.gif' /></a> <a Title="Delete" onclick="return confirm('Are you sure you wish to delete this entry?');" href="delete_donation.php?id=<?php echo $donation['donation_id']; ?> " class="btn"><img src='../assets/images/deleteicon.gif' /></a>
public static function displayJson($string) { $arr = json_decode($string); if ($arr) { $result = '<table>'; foreach ($arr as $key => $value) { $result .= '<tr><td>'; $result .= '<div align="left"><b>' . ucWords($key) . '</b> : ' . $value . '</div>'; $result .= '</td></tr>'; } $result .= '</table>'; return $result; } return ''; }
public function controller_footer($args) { // Assemble page-level args for Google Analytics -- global $webapp; $analytics = Analytics::singleton(); $componentmgr = ComponentManager::singleton(); $args['cobrand'] = $webapp->cobrand; $args['store_name'] = $this->sanitizeStrForGA($analytics->store_name); if ($webapp->request['referer']['host'] && !stristr($webapp->request['referer']['host'], $webapp->request['host'])) { $args['query'] = $this->getQueryFromURL($webapp->request['referrer'], $args['store_name']); } else { $args['query'] = $this->sanitizeStrForGA(any($analytics->search["input"]["query"], $analytics->qpmreq->query, 'none')); } $args['bs'] = $componentmgr->pagecfg; //testing $args['pagegroup'] = $componentmgr->pagecfg['pagegroup']; $args['pagetype'] = $componentmgr->pagecfg['pagename']; $args['status'] = any($analytics->status, $webapp->response['http_status']); $args['total'] = $analytics->total; $args['GAenabled'] = $args['pagegroup'] ? any(ConfigManager::get("tracking.googleanalytics.enabled"), $webapp->cfg->servers['tracking']['googleanalytics']['enabled']) : 0; $args['GAalerts'] = $webapp->GAalerts; $args['trackingcode'] = any(ConfigManager::get("tracking.googleanalytics.trackingcode"), $webapp->cfg->servers['tracking']['googleanalytics']['trackingcode']); $args['enable_native_tracking'] = ConfigManager::get("tracking.enable_native_tracking", NULL); $args['category'] = any($analytics->category, $analytics->pandora_result['top_category'], $analytics->item->category, $analytics->qpmquery['protocolheaders']['category'], 'none'); $args['subcategory'] = preg_replace("#\\s#", "_", any($analytics->subcategory, $analytics->pandora_result['top_subcategory'], 'none')); $args['city'] = "Mountain View"; $args['state'] = "CA"; $args['country'] = "USA"; if ($analytics->city && $analytics->state) { $args['city'] = ucWords($analytics->city); $args['state'] = $analytics->state; $args['country'] = "USA"; } if (in_array($args['cobrand'], array('paypaluk', 'thefinduk', 'paypalcanada'))) { $args['city'] = 'unknown'; $args['state'] = 'unknown'; $args['country'] = $args['cobrand'] == 'paypalcanada' ? "Canada" : "UK"; } $args['pagenum'] = any($analytics->pandora_result['page_num'], 1); $args['version'] = any(ABTestManager::getVersion(), "unknown"); $args['filters'] = $analytics->qpmreq->filter['brand'] ? '1' : '0'; $args['filters'] .= $analytics->qpmreq->filter['color'] ? '1' : '0'; $args['filters'] .= $analytics->qpmreq->filter['storeswithdeals'] ? '1' : '0'; //(coupons) $args['filters'] .= $analytics->qpmquery['headers']['localshopping'] ? '1' : '0'; //(local) $args['filters'] .= $analytics->qpmquery['headers']['market'] == 'green' ? '1' : '0'; //(green) $args['filters'] .= $analytics->qpmreq->filter['minimall'] ? '1' : '0'; //(marketplaces) $args['filters'] .= $analytics->qpmreq->filter['filter']['price'] ? '1' : '0'; $args['filters'] .= $analytics->qpmreq->filter['sale'] ? '1' : '0'; $args['filters'] .= $analytics->qpmreq->filter['store'] ? '1' : '0'; $args['filters'] .= $analytics->qpmreq->filter['freeshipping'] ? '1' : '0'; $args['alpha'] = $analytics->alpha; $args['browse'] = $analytics->browse; $session = SessionManager::singleton(); $args['is_new_user'] = $session->is_new_user; $args['is_new_session'] = $session->is_new_session; $user = User::singleton(); $args['is_logged_in'] = $user->isLoggedIn(); $args['usertype'] = $user->usertype; $args['userid'] = $user->userid; $args['useremail'] = $user->email; $estimated_birth_year = $user->getUserSetting('estimated_birth_year'); $gender = $user->gender; $user_gender = $gender == 'F' ? 'female' : 'male'; //if($user->getUserSetting("tracking.user.demographics_dimension") != 1) { $args['birth_year'] = $estimated_birth_year; $args['user_gender'] = $user_gender; $location = $user->GetLocation(); if ($location['city'] && $location['state']) { $args['demo_location'] = $location['city'] . ',' . $location['state']; } //$user->setUserSetting("tracking.user.demographics_dimension", "1"); //} $args['cfg_cobrand'] = $webapp->cfg->servers["cobrand"]; $args['request_cobrand'] = $webapp->request["args"]["cobrand"]; //$args['GAenabled'] = 1; //testing only if (empty($this->shown["footer"])) { // Only allow footer once per page $this->shown["footer"] = true; return $this->GetComponentResponse("./footer.tpl", $args); } return ""; }
/* [ c-article ] / / [ $article ] / [ $article_type ] / / DEFAULT_ARTICLE_TYPE / SUMMARY_ARTICLE_TYPE / EXPECTED_ARTICLE_TYPE (TODO) / RECOMMENDED_ARTICLE_TYPE (TODO) / */ // Article Type !isset($article_type) ? $article_type = 'DEFAULT_ARTICLE_TYPE' : ''; // Date $date = new Date($article->published_at); $date = ucWords(substr($date->format('F'), 0, 3) . $date->format(' j, Y')); // Author $user_thumbnail = NULL; $user = NULL; if ($article->user_id) { $user = User::find($article->user_id); $user_thumbnail = View::make('partial.c-user-picture')->with(["user" => $user, "size" => 36]); } ?> <article class="[ grid ] [ c-article @if(isset($class)) {{ $class }} @endif{{ Writing::articleCategoryClass($article->tagNames(), 'c-article') }}{{ (count($article->tagNames()) > 0) ? 'is-tagged' : '' }} ]"><!-- --><div class="[ grid__item one-quarter portable--one-whole ] [ c-article__header ] [ -u-border ]"> {{-- Title --}}
function my_http_handle_response($response, $errout) { $tmp = @explode("\r\n\r\n", $response, 2); if (count($tmp) != 2) { my_internal_server_error($response); } if (!preg_match('/^HTTP\\/1\\.\\d\\s+(\\d{3})\\s+([^\\r\\n]*)\\r\\n/', $response, $m)) { my_internal_server_error($response); } $respStatusCode = $m[1]; $respStatusMsg = $m[2]; $headersStr = subStr($tmp[0], strLen($m[0])); $body = $tmp[1]; unset($tmp); $headers = array(); preg_match_all('/^([a-zA-Z\\-]+):\\s*([^\\r\\n]*)/m', $headersStr, $m, PREG_SET_ORDER); foreach ($m as $ignore => $match) { $headers[strToLower($match[1])] = $match[2]; } $headers['connection'] = 'close'; unset($headers['keep-alive']); header('HTTP/1.0 ' . $respStatusCode . ' ' . $respStatusMsg, true, $respStatusCode); foreach ($headers as $k => $v) { header(ucWords($k) . ': ' . $v); } echo my_modify_html($body); if ($errout != '') { echo '<h1>', $errout, '</h1>'; } }
function content_54a1ea58be94c4_95020624($_smarty_tpl) { if (!$_POST) { ?> <form id = "siteSearchForm" action="<?php echo $_smarty_tpl->smarty->registered_objects['zf'][0]->url('search'); ?> " class="NWForm" method='POST'> <div> <label for="siteSearchForm-searchParam">What are you looking for? <span class="required">*</span></label> <select type="text" name="siteSearchForm[search_param]" data-validators="required" required> <?php $_smarty_tpl->tpl_vars['param'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['param']->_loop = false; $_from = $_smarty_tpl->tpl_vars['siteSearchParams']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['param']->key => $_smarty_tpl->tpl_vars['param']->value) { $_smarty_tpl->tpl_vars['param']->_loop = true; ?> <option {if $smarty.post && $smarty.post['siteSearchForm']['location']['state'] == 'CA'}selected='selected'{/if} value="<?php echo $_smarty_tpl->tpl_vars['param']->value; ?> "><?php echo ucWords($_smarty_tpl->tpl_vars['param']->value); ?> </option> <?php } ?> </select> </div> <div> <label for="siteSearchForm-danceStyle">Dance Style</label> <select name="siteSearchForm[dance_style]" id="siteSearchForm-danceStyle"> <option {if $smarty.post && $smarty.post['siteSearchForm']['location']['state'] == 'CA'}selected='selected'{/if} value=""></option> <?php $_smarty_tpl->tpl_vars['danceStyle'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['danceStyle']->_loop = false; $_from = $_smarty_tpl->tpl_vars['danceStyles']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['danceStyle']->key => $_smarty_tpl->tpl_vars['danceStyle']->value) { $_smarty_tpl->tpl_vars['danceStyle']->_loop = true; ?> <option {if $smarty.post && $smarty.post['siteSearchForm']['location']['state'] == 'CA'}selected='selected'{/if} value="<?php echo $_smarty_tpl->tpl_vars['danceStyle']->value['name']; ?> "><?php echo $_smarty_tpl->tpl_vars['danceStyle']->value['name']; ?> </option> <?php } ?> </select> </div> <div> <label for="siteSearchForm-locationType">Search for location by</label> <select name="siteSearchForm[location][type]" size="1" data-toggle-display='locationType_container' id="siteSearchForm-locationType" data-validators='required validate-notEmpty'> <option {if $smarty.post && $smarty.post['siteSearchForm']['location']['state'] == 'CA'}selected='selected'{/if} value="">--</option> <option {if $smarty.post && $smarty.post['siteSearchForm']['location']['state'] == 'CA'}selected='selected'{/if} value="city_state" data-display='locationCity'>City/State</option> <option {if $smarty.post && $smarty.post['siteSearchForm']['location']['state'] == 'CA'}selected='selected'{/if} value="postal_code" data-display='locationPostalCode'>Postal Code</option> </select> </div> <div id="locationType_container"> <div class='hidden' id='city_state_wrapper'> <div> <label for="siteSearchForm-locationCity">City</label> <input id="siteSearchForm-locationCity" type="text" name="siteSearchForm[location][city]" placeholder="City" data-validators='validate-notEmpty' /> </div> <div> <label for="siteSearchForm-locationState">State</label> <?php echo $_smarty_tpl->getSubTemplate('../partials/_state-options.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0); ?> </div> </div> <div class='hidden' id='postal_code_wrapper'> <label for="siteSearchForm-locationPostalCode">Postal Code</label> <input id="siteSearchForm-locationPostalCode" type="text" name="siteSearchForm[location][postal_code]" placeholder="Postal Code" data-validators='validate-numeric validate-notEmpty' minLength='5' /> </div> </div> <div> <label for="siteSearchForm-radius">Radius</label> <select name="siteSearchForm[radius]" size="1"> <option {if $smarty.post && $smarty.post['siteSearchForm']['location']['state'] == 'CA'}selected='selected'{/if} value="">--</option> <option {if $smarty.post && $smarty.post['siteSearchForm']['location']['state'] == 'CA'}selected='selected'{/if} value="5">5 miles</option> <option {if $smarty.post && $smarty.post['siteSearchForm']['location']['state'] == 'CA'}selected='selected'{/if} value="15">15 miles</option> <option {if $smarty.post && $smarty.post['siteSearchForm']['location']['state'] == 'CA'}selected='selected'{/if} value="25">25 miles</option> <option {if $smarty.post && $smarty.post['siteSearchForm']['location']['state'] == 'CA'}selected='selected'{/if} value="50">50 miles</option> <option {if $smarty.post && $smarty.post['siteSearchForm']['location']['state'] == 'CA'}selected='selected'{/if} value="100">100 miles</option> </select> </div> <div><button class='new btn'>Search</button></div> </form> <?php } else { ?> <div> <div class="col-desktop-12"> <?php if ($_smarty_tpl->tpl_vars['results']->value) { ?> <?php $_smarty_tpl->tpl_vars['result'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['result']->_loop = false; $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['results']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['result']->key => $_smarty_tpl->tpl_vars['result']->value) { $_smarty_tpl->tpl_vars['result']->_loop = true; $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['result']->key; ?> <div class='row'> <div class="col-desktop-1"><?php echo $_smarty_tpl->tpl_vars['key']->value + 1; ?> </div> <div class="col-desktop-11"> <?php echo $_smarty_tpl->tpl_vars['result']->value['name']; ?> </div> </div> <?php } ?> <?php } else { ?> <?php } ?> </div> </div> <?php } ?> <script> <?php echo $_smarty_tpl->getSubTemplate('./../../../public/js/application.js', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0); ?> $j('button').click(function() { $j('form').submit(); }); </script> <?php }
function PubDateVerify($userStr, $type) { $userStr = rTrim($userStr, ' '); $space = 32; $semicolon = 58; $comma = 44; $aError = array(); $aM = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); $aD = array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"); $thisTz = date('T', time()); $aError['valid'] = 'yes'; $aError['msg'] = ''; $aError['Day'] = ''; $aError['Day #'] = ''; $aError['month'] = ''; $aError['year'] = ''; $aError['tz'] = ''; $aError['hh'] = ''; $aError['mm'] = ''; $aError['ss'] = ''; $allErrorsMsg = 'All errors may be cause by a ' . 'single error in any part of the pubdate. For example: The date ' . 'is on Tue, not Mon, or a day 32 or misspelled day or month, '; $allErrorsMsg = '<span title="' . $allErrorsMsg . '">Note: (more></span>'; //pubdate is not required if ($userStr == '') { $aError['valid'] = 'yes'; $aError['msg'] .= ''; $aError['hd'] = ''; return $aError; } //get a working array of the attributes $userS = str_replace(',', '', $userStr); $aUser = explode(' ', $userS); //get the date and time that these functions think it is $compT = strToTime($userStr); $compS = date('D d M Y H:i:s T', $compT); $engS = date('l, F jS Y g:i:s A T', $compT); $aError['hd'] = $engS; if ($userS == $compS) { $aError['valid'] = 'yes'; $aError['msg'] .= 'Valid Pubdate: ' . $userS . '.' . '<br />or ' . $engS . '.'; $aError['hd'] = $engS; return $aError; } $tError = 0; $aChar = count_chars($userStr, 1); if (isset($aChar[$space])) { if ($aChar[$space] < 5) { $aError['msg'] .= 'There are too few spaces. ' . 'or the pubdate does not have all six components ' . '(DDD, dd MMM YYYY hh:mm:ss TZN).<br />'; $tError = 1; } if ($aChar[$space] > 5) { $aError['msg'] .= 'There are too many spaces.<br />'; $tError = 1; } } if (substr($userStr, 3, 1) != ',') { $aError['msg'] .= 'There should be a comma immediately after the 3 character, day abbreviation.<br />'; $tError = 1; } if (isset($aChar[$comma])) { if ($aChar[$comma] > 1) { $aError['msg'] .= 'There should only be a comma immediately after the 3 character, day abbreviation.<br />'; $tError = 1; } } if (isset($aChar[$semicolon])) { if ($aChar[$semicolon] != 2) { $aError['msg'] .= "The time components should be separated by a semicolon - :.<br />"; $tError = 1; } } if ($tError) { $aError['valid'] = 'no'; $aError['msg'] .= '<br />' . $allErrorsMsg; $aError['msg'] = cleanMsg($aError['msg']); return $aError; } //don't continue if all 6 attributes are not there if (count($aUser) != 6) { $aError['valid'] = 'no'; if ($type == 'v') { $aError['msg'] .= 'Invalid Pubdate: This validation only works when all six components of ' . 'the pubdate are entered (DDD, dd MMM YYYY hh:mm:ss TZN). ' . 'RSS Feed Validation will fail.'; } else { $aError['msg'] .= 'Invalid Pubdate: All six components of ' . 'the pubdate must be present (DDD, dd MMM YYYY hh:mm:ss TZN). ' . 'RSS Feed Validation will fail.'; } return $aError; } //gross errors $tError = 0; if (!in_array($aUser[0], $aD)) { $aError['Day'] .= "Invalid day abbreviation '" . $aUser[0] . "'.<br />"; $tError = 1; } else { if ($aUser[0] != ucWords($aUser[0])) { $tError = 1; $aError['Day'] .= "The day abbreviation '" . $aUser[0] . "' first character must be uppercase. (ex: Mon not MONor mon).<br />"; } } if ($aUser[1] < 1 || $aUser[1] > 31) { $tError = 1; $aError['Day #'] .= "The numeric day '" . $aUser[1] . "' is not in the range 01 - 31.<br />"; } if (strlen($aUser[1]) != 2) { $tError = 1; $aError['Day #'] .= "The numeric day '" . $aUser[1] . "' must be 2 digits (ex: 01 not 1).<br />"; } if (!in_array($aUser[2], $aM)) { $tError = 1; $aError['month'] .= "Invalid month abbreviation '" . $aUser[2] . "'.<br />"; } if ($aUser[2] != ucWords($aUser[2])) { $tError = 1; $aError['month'] .= "The month abbreviation '" . $aUser[2] . "' first character must be uppercase. (ex: Jan not JAN or jan).<br />"; } if (strlen($aUser[3]) != 4) { $tError = 1; $aError['year'] .= "The numeric year '" . $aUser[3] . "' must be 4 digits (ex: 2012 not 12).<br />"; } // time ranges $aT = explode(':', $aUser[4]); if ($aT[0] > 23) { $tError = 1; $aError['hh'] .= 'Hour(s) greater than 23' . '.<br />'; } if (strlen($aT[0]) != 2) { $tError = 1; $aError['hh'] .= 'Hour(s) ' . $aT[0] . ' must be 2 digits (ex: 01 not 1)<br />'; } if ($aT[1] > 59) { $tError = 1; $aError['mm'] .= 'Minute(s) greater than 59' . '.<br />'; } if (strlen($aT[1]) != 2) { $tError = 1; $aError['mm'] .= 'Minutes(s) ' . $aT[1] . ' must be 2 digits (ex: 01 not 1)<br />'; } if ($aT[2] > 59) { $tError = 1; $aError['ss'] .= 'Second(s) greater than 59' . '.<br />'; } if (strlen($aT[2]) != 2) { $tError = 1; $aError['ss'] .= 'Seconds(s) ' . $aT[2] . ' must be 2 digits (ex: 01 not 1)<br />'; } if (strlen($aUser[5]) < 2 || strlen($aUser[5]) > 5) { $tError = 1; $aError['tz'] .= 'The time zone must be from 2 to 5 characters.<br />'; } if ($aUser[5] != strToUpper($aUser[5])) { $tError = 1; $aError['tz'] .= 'The time zone must be upper case characters.<br />'; } //check for gross erros if ($tError) { $aError['valid'] = 'no'; $aError['msg'] .= $allErrorsMsg; $aError['msg'] = cleanMsg($aError['msg']); return $aError; } //check for different timezoe, files may have been moved to serve //in a different timezone if ($aUser[5] != $thisTz) { $aError['valid'] = 'wrn'; $tzWrn = 'The timezone entered ' . $aUser[5] . ' ' . 'is not equal to this servers timezone ' . $thisTz . '.<br />' . 'This may be an error or if editing a file, the file may have ' . 'been moved to this server having a differen timezone.<br />' . 'Care should be taken before changing the timezone, to avoid ' . 'republishing.'; $aError['msg'] .= 'Warning only: This servers TZ is ' . $thisTz . ', not ' . $aUser[5] . '. <span title="' . $tzWrn . '">(more)</span><br />'; } // ed if for different timezone //at this point we have all six attributs and the tiemzone agrees $aError['od'] = $userS; $aError['nd'] = $compS; $aError['hd'] = $engS; // check the parts //day if ($thisTz == $aUser[5]) { $aError['Day'] = ''; $tmpS = $aUser[1] . ' ' . $aUser[2] . ' ' . $aUser[3] . ' ' . $aUser[4] . ' ' . $aUser[5]; $tmpT = strToTime($tmpS); $tmpD = date('D', $tmpT); if ($aUser[0] != $tmpD) { $aError['valid'] = 'no'; $aError['Day'] = 'The day ' . $aUser[1] . ' ' . $aUser[2] . ' ' . $aUser[3] . ' is on ' . $tmpD . ' not ' . $aUser[0] . '.<br />'; } } //year $aError['year'] = ''; $tmpS = $aUser[1] . ' ' . $aUser[2] . ' ' . $aUser[5]; $tmpT = strToTime($tmpS); $tmpD = date('Y', $tmpT); if ($aUser[3] != $tmpD) { $aError['valid'] = 'no'; $aError['year'] = 'The year ' . $aUser[3] . ' is in ' . $tmpD . ' for ' . $aUser[0] . ' ' . $aUser[1] . ' in ' . $aUser[2] . '.<br />'; } else { if ($aUser[3] <= date('Y', time()) - 1) { $aError['valid'] = 'no'; $aError['year'] = 'Year ' . $aUser[3] . ' is previous to the current year.<br />'; } } if ($aError['valid'] == 'no') { $aError['valid'] = 'no'; $aError['msg'] .= '<br />' . $allErrorsMsg; $aError['msg'] = cleanMsg($aError['msg']); return $aError; } return $aError; }
/** * Standard block show method. It uses the renderform * class to render the login box */ public function show() { //$objTab = $this->newObject('jqtabs', 'htmlelements'); $objTab = $this->newObject('tabpane', 'htmlelements'); $objUtils = $this->getObject('utilities', 'context'); $objSysConfig = $this->getObject('altconfig', 'config'); $objNav = $this->getObject('contextadminnav', 'contextadmin'); $str = $this->objLanguage->languageText('word_browse', 'glossary', 'Browse') . ': ' . $objNav->getAlphaListingAjax(); $str2 = '<div id="browseusercontextcontent"></div>'; $str .= '<div id="browsecontextcontent"></div>'; $str3 = '<div id="browseallcontextcontent"></div>'; $siteUri = ""; $isAdmin = $this->objUser->isAdmin() ? "true" : "false"; $str .= $this->getJavaScriptFile('contextbrowser.js'); $this->appendArrayVar('headerParams', ' <script type="text/javascript"> var pageSize = 100; var lang = new Array(); lang["mycontext"] = "' . ucWords($this->objLanguage->code2Txt('phrase_mycourses', 'system', NULL, 'My [-contexts-]')) . '"; lang["contexts"] = "' . ucWords($this->objLanguage->code2Txt('wordcontext', 'system', NULL, '[-contexts-]')) . '"; lang["context"] = "' . ucWords($this->objLanguage->code2Txt('wordcontext', 'system', NULL, '[-context-]')) . '"; lang["othercontext"] = "' . ucWords($this->objLanguage->code2Txt('phrase_othercourses', 'system', NULL, 'Other [-contexts-]')) . '"; lang["searchcontext"] = "' . ucWords($this->objLanguage->code2Txt('phrase_allcourses', 'system', NULL, 'Search [-contexts-]')) . '"; lang["contextcode"] = "' . ucWords($this->objLanguage->code2Txt('mod_context_contextcode', 'system', NULL, '[-contexts-] Code')) . '"; lang["lecturers"] = "' . ucWords($this->objLanguage->code2Txt('word_lecturers', 'system', NULL, '[-authors-]')) . '"; var uri = "' . str_replace('&', '&', $this->uri(array('module' => 'context', 'action' => 'jsonlistcontext'))) . '"; var usercontexturi = "' . str_replace('&', '&', $this->uri(array('module' => 'context', 'action' => 'jsonusercontexts'))) . '"; var othercontexturi = "' . str_replace('&', '&', $this->uri(array('module' => 'context', 'action' => 'jsonusercontexts'))) . '"; var baseuri = "' . $siteUri . '"; var isAdmin = ' . $isAdmin . '; contextPrivateMessage="' . $this->objLanguage->code2Txt('mod_context_privatecontextexplanation', 'context', NULL, 'This is a closed [-context-] only accessible to members') . '"; </script>'); //Ext stuff $objExtJS = $this->getObject('extjs', 'ext'); $objExtJS->show(); $ext = $this->getJavaScriptFile('Ext.ux.grid.Search.js', 'context'); $ext .= $this->getJavaScriptFile('usercontextslist.js', 'context'); $ext .= $this->getJavaScriptFile('othercontexts.js', 'context'); $ext .= $this->getJavaScriptFile('search.js', 'context'); $ext .= $this->getJavaScriptFile('extcontexbrowser.js', 'context'); $this->appendArrayVar('headerParams', $ext); return '<div id="contextbrowser"></div> <p> </p>'; }
/** * Returns the class to apply to a control for an occurrence attribute, identified by an index. * @access private */ private static function species_checklist_occ_attr_class($options, $idx, $caption) { return array_key_exists('occAttrClasses', $options) && $idx < count($options['occAttrClasses']) ? $options['occAttrClasses'][$idx] : 'sc' . str_replace(' ', '', ucWords($caption)); // provide a default class based on the control caption }
private function createObject($path_array, $path, $base_path, &$params, $direct) { $path = ''; $rPath = array(); if (empty($path_array) && empty($this->object) && empty($base_path)) { if (empty($path_array)) { $path_array[] = "index"; } } while (count($path_array) > 0) { if (empty($base_path)) { if (is_dir(__OBRAY_SITE_ROOT__ . 'controllers/' . implode('/', $path_array))) { $path_array[] = $path_array[count($path_array) - 1]; } } $obj_name = array_pop($path_array); $this->controller_path = __OBRAY_SITE_ROOT__ . "controllers/" . implode('/', $path_array) . '/c' . str_replace(' ', '', ucWords(str_replace('-', ' ', $obj_name))) . '.php'; $this->model_path = $base_path . implode('/', $path_array) . '/' . $obj_name . '.php'; if (file_exists($this->model_path)) { $objectType = "model"; $this->path = $this->model_path; } else { if (file_exists($this->controller_path)) { $objectType = "controller"; $obj_name = "c" . str_replace(' ', '', ucWords(str_replace('-', ' ', $obj_name))); $this->path = $this->controller_path; // include the root controller if (file_exists(__OBRAY_SITE_ROOT__ . "controllers/cRoot.php")) { require_once __OBRAY_SITE_ROOT__ . "controllers/cRoot.php"; } if (empty($path)) { $path = "/index/"; } } } if (!empty($objectType)) { require_once $this->path; if (!class_exists($obj_name)) { $this->throwError("File exists, but could not find object: {$obj_name}", 404, 'notfound'); return $this; } else { try { // CREATE OBJECT $obj = new $obj_name($params, $direct, $rPath); $obj->objectType = $objectType; $obj->setObject(get_class($obj)); $obj->setContentType($obj->content_type); $obj->path_to_object = implode('/', $path_array); array_pop($rPath); $obj->rPath = $rPath; // CHECK PERMISSIONS $params = array_merge($obj->checkPermissions('object', $direct), $params); // SETUP DATABASE CONNECTION if (method_exists($obj, 'setDatabaseConnection')) { $obj->setDatabaseConnection(getDatabaseConnection()); } // ROUTE REMAINING PATH - function calls if (!empty($path)) { $obj->route($path, $params, $direct); } return $obj; } catch (Exception $e) { $this->throwError($e->getMessage()); } } break; } else { $rPath[] = strtolower($obj_name); $path = '/' . $obj_name; } } //exit(); $this->throwError('Route not found object: ' . $path, 404, 'notfound'); return $this; }