public static function capitalize_words($str, $join = '') { $spl = preg_split('/[^A-Za-z0-9]/', $str); $res = array(); foreach ($spl as $part) { $res[] = capitalize($part); } return join($join, $res); }
<?php /* * Module: process_styles_edit.inc.php * Description: This module does all the heavy lifting for adding/editing info in the "sponsors" table */ if (isset($_SESSION['loginUsername']) && $_SESSION['userLevel'] <= 1) { $sponsorURL = check_http($_POST['sponsorURL']); $sponsor_name = capitalize($_POST['sponsorName']); if (NHC) { // Place NHC SQL calls below } else { if ($action == "update") { foreach ($_POST['id'] as $id) { if ($_POST['sponsorEnable' . $id] == 1) { $enable = 1; } else { $enable = 0; } $updateSQL = sprintf("UPDATE %s SET sponsorEnable='%s' WHERE id='%s'", $sponsors_db_table, $enable, $id); mysql_real_escape_string($updateSQL); $result1 = mysql_query($updateSQL, $brewing) or die(mysql_error()); } $massUpdateGoTo = $base_url . "index.php?section=admin&go=sponsors&msg=9"; $pattern = array('\'', '"'); $massUpdateGoTo = str_replace($pattern, "", $massUpdateGoTo); header(sprintf("Location: %s", stripslashes($massUpdateGoTo))); } if ($action == "add") { $insertSQL = sprintf("INSERT INTO {$sponsors_db_table} (sponsorName, sponsorURL, sponsorImage, sponsorText, sponsorLocation, sponsorLevel, sponsorEnable) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($sponsor_name, "text"), GetSQLValueString($sponsorURL, "text"), GetSQLValueString($_POST['sponsorImage'], "text"), GetSQLValueString($_POST['sponsorText'], "text"), GetSQLValueString($_POST['sponsorLocation'], "text"), GetSQLValueString($_POST['sponsorLevel'], "int"), GetSQLValueString($_POST['sponsorEnable'], "int")); mysql_select_db($database, $brewing);
$updateSQL .= "brewFG=" . GetSQLValueString($_POST['brewFG'], "text") . ", "; $updateSQL .= "brewPrimary=" . GetSQLValueString($_POST['brewPrimary'], "text") . ", "; $updateSQL .= "brewPrimaryTemp=" . GetSQLValueString($_POST['brewPrimaryTemp'], "text") . ", "; $updateSQL .= "brewSecondary=" . GetSQLValueString($_POST['brewSecondary'], "text") . ", "; $updateSQL .= "brewSecondaryTemp=" . GetSQLValueString($_POST['brewSecondaryTemp'], "text") . ", "; $updateSQL .= "brewOther=" . GetSQLValueString($_POST['brewOther'], "text") . ", "; $updateSQL .= "brewOtherTemp=" . GetSQLValueString($_POST['brewOtherTemp'], "text") . ", "; $updateSQL .= "brewFinings=" . GetSQLValueString($_POST['brewFinings'], "text") . ", "; $updateSQL .= "brewWaterNotes=" . GetSQLValueString($_POST['brewWaterNotes'], "text") . ", "; $updateSQL .= "brewCarbonationMethod=" . GetSQLValueString($_POST['brewCarbonationMethod'], "text") . ", "; $updateSQL .= "brewCarbonationVol=" . GetSQLValueString($_POST['brewCarbonationVol'], "text") . ", "; $updateSQL .= "brewCarbonationNotes=" . GetSQLValueString($_POST['brewCarbonationNotes'], "text") . ", "; $updateSQL .= "brewBoilHours=" . GetSQLValueString($_POST['brewBoilHours'], "text") . ", "; $updateSQL .= "brewBoilMins=" . GetSQLValueString($_POST['brewBoilMins'], "text") . ", "; } $updateSQL .= "brewName=" . GetSQLValueString(capitalize($brewName), "text") . ", "; $updateSQL .= "brewStyle=" . GetSQLValueString($row_style_name['brewStyle'], "text") . ", "; $updateSQL .= "brewCategory=" . GetSQLValueString($styleTrim, "text") . ", "; $updateSQL .= "brewCategorySort=" . GetSQLValueString($styleFix, "text") . ", "; $updateSQL .= "brewSubCategory=" . GetSQLValueString($style[1], "text") . ", "; $updateSQL .= "brewInfo=" . GetSQLValueString($brewInfo, "text") . ", "; $updateSQL .= "brewMead1=" . GetSQLValueString($brewMead1, "text") . ", "; $updateSQL .= "brewMead2=" . GetSQLValueString($brewMead2, "text") . ", "; $updateSQL .= "brewMead3=" . GetSQLValueString($brewMead3, "text") . ", "; $updateSQL .= "brewComments=" . GetSQLValueString(strip_newline($_POST['brewComments']), "text") . ", "; $updateSQL .= "brewBrewerID=" . GetSQLValueString($brewBrewerID, "text") . ", "; $updateSQL .= "brewBrewerFirstName=" . GetSQLValueString($brewBrewerFirstName, "text") . ", "; $updateSQL .= "brewBrewerLastName=" . GetSQLValueString($brewBrewerLastName, "text") . ", "; $updateSQL .= "brewJudgingLocation=" . GetSQLValueString($row_style_name['brewStyleJudgingLoc'], "text") . ", "; $updateSQL .= "brewCoBrewer=" . GetSQLValueString(ucwords($_POST['brewCoBrewer']), "text") . ", "; $updateSQL .= "brewUpdated=" . "NOW( ), ";
$location_pref2 = implode(",", $_POST['brewerStewardLocation']); } elseif ($_POST['brewerJudgeLocation'] != "" && !is_array($_POST['brewerStewardLocation'])) { $location_pref2 = $_POST['brewerStewardLocation']; } } else { $location_pref2 = ""; } // Add the user's info to the "brewer" table // Numbers 999999994 through 999999999 are reserved for NHC applications. if ($_POST['brewerAHA'] < "999999994" || $_POST['brewerAHA'] == "") { $insertSQL = sprintf("INSERT INTO {$brewer_db_table} (\r\n\t\t\t uid,\r\n\t\t\t brewerFirstName, \r\n\t\t\t brewerLastName, \r\n\t\t\t brewerAddress, \r\n\t\t\t brewerCity, \r\n\t\t\t brewerState, \r\n\t\t\t \r\n\t\t\t brewerZip,\r\n\t\t\t brewerCountry,\r\n\t\t\t brewerPhone1, \r\n\t\t\t brewerPhone2, \r\n\t\t\t brewerClubs, \r\n\t\t\t brewerEmail, \r\n\t\t\t \r\n\t\t\t brewerSteward, \r\n\t\t\t brewerJudge,\r\n\t\t\t brewerJudgeID,\r\n\t\t\t brewerJudgeMead,\r\n\t\t\t brewerJudgeRank,\r\n\t\t\t brewerJudgeLocation,\r\n\t\t\t brewerStewardLocation,\r\n\t\t\t brewerAHA\r\n\t\t\t) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($row_user['id'], "int"), GetSQLValueString(capitalize($_POST['brewerFirstName']), "text"), GetSQLValueString(capitalize($_POST['brewerLastName']), "text"), GetSQLValueString(capitalize($_POST['brewerAddress']), "text"), GetSQLValueString(capitalize($_POST['brewerCity']), "text"), GetSQLValueString($_POST['brewerState'], "text"), GetSQLValueString($_POST['brewerZip'], "text"), GetSQLValueString($_POST['brewerCountry'], "text"), GetSQLValueString($_POST['brewerPhone1'], "text"), GetSQLValueString($_POST['brewerPhone2'], "text"), GetSQLValueString($_POST['brewerClubs'], "text"), GetSQLValueString($username, "text"), GetSQLValueString($_POST['brewerSteward'], "text"), GetSQLValueString($_POST['brewerJudge'], "text"), GetSQLValueString($_POST['brewerJudgeID'], "text"), GetSQLValueString($_POST['brewerJudgeMead'], "text"), GetSQLValueString($_POST['brewerJudgeRank'], "text"), GetSQLValueString($location_pref1, "text"), GetSQLValueString($location_pref2, "text"), GetSQLValueString($_POST['brewerAHA'], "int")); } else { $insertSQL = sprintf("INSERT INTO {$brewer_db_table} (\r\n\t\t\t uid,\r\n\t\t\t brewerFirstName, \r\n\t\t\t brewerLastName, \r\n\t\t\t brewerAddress, \r\n\t\t\t brewerCity, \r\n\t\t\t brewerState, \r\n\t\t\t \r\n\t\t\t brewerZip,\r\n\t\t\t brewerCountry,\r\n\t\t\t brewerPhone1, \r\n\t\t\t brewerPhone2, \r\n\t\t\t brewerClubs, \r\n\t\t\t brewerEmail, \r\n\t\t\t \r\n\t\t\t brewerSteward, \r\n\t\t\t brewerJudge,\r\n\t\t\t brewerJudgeID,\r\n\t\t\t brewerJudgeMead,\r\n\t\t\t brewerJudgeRank,\r\n\t\t\t brewerJudgeLocation,\r\n\t\t\t brewerStewardLocation\r\n\t\t\t) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($row_user['id'], "int"), GetSQLValueString(capitalize($_POST['brewerFirstName']), "text"), GetSQLValueString(capitalize($_POST['brewerLastName']), "text"), GetSQLValueString(capitalize($_POST['brewerAddress']), "text"), GetSQLValueString(capitalize($_POST['brewerCity']), "text"), GetSQLValueString($_POST['brewerState'], "text"), GetSQLValueString($_POST['brewerZip'], "text"), GetSQLValueString($_POST['brewerCountry'], "text"), GetSQLValueString($_POST['brewerPhone1'], "text"), GetSQLValueString($_POST['brewerPhone2'], "text"), GetSQLValueString($_POST['brewerClubs'], "text"), GetSQLValueString($username, "text"), GetSQLValueString($_POST['brewerSteward'], "text"), GetSQLValueString($_POST['brewerJudge'], "text"), GetSQLValueString($_POST['brewerJudgeID'], "text"), GetSQLValueString($_POST['brewerJudgeMead'], "text"), GetSQLValueString($_POST['brewerJudgeRank'], "text"), GetSQLValueString($location_pref1, "text"), GetSQLValueString($location_pref2, "text")); } if (NHC) { $updateSQL = sprintf("INSERT INTO nhcentrant (\r\n\t\t\tuid, \r\n\t\t\tfirstName, \r\n\t\t\tlastName, \r\n\t\t\temail,\r\n\t\t\tAHAnumber,\r\n\t\t\tregionPrefix\r\n\t\t\t) \r\n\t\t\tVALUES \r\n\t\t\t(%s, %s, %s, %s, %s, %s)", GetSQLValueString($row_user['id'], "int"), GetSQLValueString(capitalize($_POST['brewerFirstName']), "text"), GetSQLValueString(capitalize($_POST['brewerLastName']), "text"), GetSQLValueString($username, "text"), GetSQLValueString($_POST['brewerAHA'], "text"), GetSQLValueString($prefix, "text")); mysql_real_escape_string($updateSQL); $result = mysql_query($updateSQL, $brewing) or die(mysql_error()); } //echo $insertSQL; mysql_select_db($database, $brewing); mysql_real_escape_string($insertSQL); $result1 = mysql_query($insertSQL, $brewing) or die(mysql_error()); // Stop Gap for random staff assignments $updateSQL1 = sprintf("UPDATE %s SET staff_judge='0', staff_judge_bos='0', staff_steward='0', staff_organizer='0', staff_staff='0' WHERE uid=%s", $prefix . "staff", $row_user['id']); mysql_real_escape_string($updateSQL1); $result1 = mysql_query($updateSQL1, $brewing) or die(mysql_error()); if ($filter == "default") { // Log in the user and redirect session_start(); $_SESSION['loginUsername'] = $username;
?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title> Pass by reference </title> <meta name="description" content="Pass by reference "> <meta name="author" content="Nermin Sehic"> <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <?php $first = 'musa'; $middle = 'cazim'; $last = 'catic'; printf('<br />NAME BEFORE: %s %s %s', $first, $middle, $last); capitalize($first, $middle, $last); printf('<br />NAME AFTER: %s %s %s', $first, $middle, $last); ?> </body> </html>
function text_capitalize() { $this->assertEqual("Selected", capitalize("selected")); $this->assertEqual("One two", capitalize("ONE TWO")); $this->assertEqual("Three four", capitalize("three four")); }
/** * Builds a valid \<img /\> HTML tag. * * @param string $source * The source path to the image. * @param string|array $attributes * (optional) A single HTML attribute or an array of HTML attributes to be * added to the rendered tag. * @return @e string * A valid \<img /\> HTML tag. * * @ingroup helperfunc * * @see TagHelper::content_tag() * */ public function image_tag($source, $attributes = NULL) { if (!(is_absolute_url($source) || is_root_relative_url($source))) { $source = image_url($source); } $info = pathinfo($source); $extension = isset($info['extension']) ? $info['extension'] : ''; $options = array("src" => $this->asset_version($source), "alt" => capitalize(basename($source, '.' . $extension))); if (is_array($attributes)) { $options = array_merge($options, $attributes); } return content_tag("img", NULL, $options); }
function generateClass($tableName, $fields) { $className = capitalize($tableName); $output = generateClassHead($className); // Done $output .= generateClassVars($className); // Done $output .= generateClassConstructor($className, $fields); // Done $output .= generateClassObjectCreator($tableName, $className, $fields); // Done $output .= generateClassFetchData($tableName, $className, $fields); // Done $output .= generateClassGetID($className, $fields); // DONE foreach ($fields as $fieldName => $field) { $output .= generateClassGetField($className, $fieldName, $field); // Done } $output .= generateClassDelete($tableName, $fields); $output .= generateClassUpdate($tableName, $className, $fields); // Done $output .= generateClassBottom($className); // Done return $output; }
function compare_part($s, $i, $flags, $dist = 0) { global $DEBUG_STRING_PHP; if (strpos($s, "\\") === false) { if ($DEBUG_STRING_PHP) { echo "Simple:<ol>"; } if (match($i, $s, $flags, $dist) === null) { if ($DEBUG_STRING_PHP) { echo "</ol>False"; } return null; } else { if ($DEBUG_STRING_PHP) { echo "</ol>True ('{$s}')"; } return $s; } } if ($DEBUG_STRING_PHP) { echo "compare part: '{$s}' and '{$i}'<ol>"; } $opts = []; $l = 0; $arr = []; $lens = strlen($s); $capitals = []; // Pre-scan for (first-level) curly brace expressions while ($l < $lens) { $j2 = $j1 = $l; $r0 = str_between("\\{", "\\}", $s, $l); $r1 = str_between("\\(", "\\)", $s, $j1); $r2 = str_between("\\[", "\\]", $s, $j2); if ($r0 === null) { break; } if ($r1 and $j1 < $l) { //if ($DEBUG_STRING_PHP) echo "Parentheses at $j1 beat $l<br>"; $l = $j1 + strlen($r1) + 4; continue; } if ($r2 and $j2 < $l) { //if ($DEBUG_STRING_PHP) echo "Brackets at $j2 beat $l<br>"; $l = $j2 + strlen($r2) + 4; continue; } if ($r0 and ($r0[0] === "*" or $r0[0] === "\\" and $r0[1] === "*")) { $capitalize = $r0[0] === "*"; $r0 = substr($r0, 1); } else { $capitalize = false; } $capitals[] = $capitalize; $opts[] = $r0; $arr[] = [$r0, $l]; // cache for later $l += strlen($r0) + 4; } if ($DEBUG_STRING_PHP and $arr) { var_dump($arr); } if ($DEBUG_STRING_PHP and $capitals) { var_dump($capitals); } //if ($DEBUG_STRING_PHP and $opts) var_dump($opts); $r = ""; $l = 0; $backtrack = []; $failed_backtrack = []; $saved = NULL; $back = function ($forwards = false) use($s, &$i, &$r, &$l, &$next, &$arr, &$opts, &$capitals, &$backtrack, &$dist, &$failed_backtrack, &$saved, $DEBUG_STRING_PHP) { if (!$forwards and $forwards !== NULL) { if ($saved !== NULL) { list($i, $r, $l, $arr, $opts, $capitals, $dist) = $saved; $saved = NULL; return true; } while ($backtrack and in_array(sanitize2($backtrack[count($backtrack) - 1]), $failed_backtrack)) { array_pop($backtrack); } if (!$backtrack) { return false; } $failed_backtrack[] = sanitize2($backtrack[count($backtrack) - 1]); if (count($failed_backtrack) > 6) { return false; } list($i, $r, $l, $arr, $opts, $capitals, $dist) = array_pop($backtrack); if ($DEBUG_STRING_PHP) { $remaining = substr($s, $l); if ($l) { $remaining = "...{$remaining}"; } echo "<hr style='height: 6px'>!! Backtracking to {$l} '{$remaining}' (match so far '{$r}', trying to match '{$i}') !!<hr style='height: 6px'>"; var_dump($arr); var_dump($capitals); var_dump($opts); foreach ($failed_backtrack as $f) { var_dump($f); } } return true; } else { $backtrack[] = [$i, $r, $l, $arr, $opts, $capitals, $dist]; if ($forwards === 2 or $forwards === null) { $saved = array_pop($backtrack); } } }; while ($l < $lens) { $capitalize = false; $j0 = $j1 = $j2 = $l; /* set to indices of opening elements */ if ($arr) { list($r0, $j0) = $arr[0]; } else { $r0 = null; } $r1 = str_between("\\(", "\\)", $s, $j1); $r2 = str_between("\\[", "\\]", $s, $j2); if ($r0 === null) { $r0 = $j0 = $lens; } if ($r1 === null) { $r1 = $j1 = $lens; } if ($r2 === null) { $r2 = $j2 = $lens; } $t = null; if ($j0 < $j1 and $j0 < $j2) { $j = $j0; $rn = $r0; $t = 0; $capitalize = array_shift($capitals) ? 1 : 0; } else { if ($j1 < $j0 and $j1 < $j2) { $j = $j1; $rn = $r1; $t = 1; } else { if ($j2 < $j0 and $j2 < $j1) { $j = $j2; $rn = $r2; $t = 2; } else { $j = $lens; } } } $rr = substr($s, $l, $j - $l); if ($DEBUG_STRING_PHP) { echo "<br>Fixed ({$l} to {$j}):"; } if ($DEBUG_STRING_PHP) { var_dump($rr); } if ($rr) { $i = match($i, $rr, $flags, $dist); if ($i === null) { if ($back()) { continue; } else { if ($DEBUG_STRING_PHP) { echo "</ol>No match"; } return null; } } else { $r .= $rr; } } if ($j === $lens) { break; } else { if ($DEBUG_STRING_PHP) { echo "<br>Variable (" . ($j + 2) . " to " . ($j + 2 + strlen($rn)) . ", type {$t}):"; } } if ($DEBUG_STRING_PHP) { var_dump($rn); } $next = $j + strlen($rn) + 4 + $capitalize; $other = []; if ($t) { // Parentheses and brackets $rr = compare_syntax($rn, $i, $flags, $other, $dist); } else { // Curly braces: try each pair $rr = null; $match_idx = null; $match_opt = null; $first = true; $cont = false; foreach ($opts as $idx => $opt) { if (!$first) { if ($opt === "\\|") { break; } if ($opt === "" and array_key_exists($idx - 1, $opts)) { $cont = true; continue; } if ($cont) { $cont = false; continue; } } else { $first = false; } $o = []; // $other $rrr = compare_syntax($opt, $i, $flags, $o, $dist); if ($DEBUG_STRING_PHP) { echo "<hr>"; } if ($rrr === null) { continue; } else { if ($rr === null) { // First result: use it $rr = $rrr; $match_idx = $idx; $match_opt = $opt; $other = $o; unset($opts[$idx]); ksort($opts); } else { $back(null); $opts[$match_idx] = $opt; $opts[$idx] = $match_opt; ksort($opts); $capitals[] = !!$capitalize; $l = $j; // Extra result if ($DEBUG_STRING_PHP) { echo "Extra result: {$rrr}<br>"; } $back(true); $back(); if ($o and $DEBUG_STRING_PHP) { echo "<br>Some other results:"; var_dump($o); } foreach ($o as $aliud) { $back(null); $opts[$match_idx] = $opt; unset($opts[$idx]); ksort($opts); $l = $next; $r .= $aliud; $i = match($i, $aliud, $flags, $dist, true); $back(true); $back(); } } } } array_shift($arr); } if ($DEBUG_STRING_PHP and $rr === null) { echo "<br>No match ({$t})"; } if ($rr === null) { if ($t === 2) { $l = $next; continue; } else { if ($back()) { continue; } else { if ($DEBUG_STRING_PHP) { echo "</ol>No match"; } return null; } } } else { $l = $next; } if ($t === 2) { $back(true); } foreach ($other as $aliud) { $back(null); $r .= $aliud; $i = match($i, $aliud, $flags, $dist, true); $back(true); $back(); } if ($capitalize) { $rr = capitalize($rr); } $r .= $rr; $iii = $i; $i = match($i, $rr, $flags, $dist, true); if ($i === null) { $d = $DEBUG_STRING_PHP; $DEBUG_STRING_PHP = true; match($iii, $rr, $flags, $dist); /*go ballastic*/ echo "<div>internal error</div>"; $DEBUG_STRING_PHP = $d; return null; } if ($DEBUG_STRING_PHP) { echo "<br>Remaining (dist {$dist}):"; } if ($DEBUG_STRING_PHP) { var_dump($i); } if ($t === 2) { $back(true); } } if ($DEBUG_STRING_PHP) { echo "</ol>"; } return $r; }
<?php function capitalize(&$str) { $str = strtolower($str); $str[0] = strtoupper($str[0]); echo $str; } $str = "fengjie"; capitalize($str); echo $str;
function display_word_info($w, $can_edit = FALSE) { $id = $w->id(); $lang = $w->lang(); $spart = $w->speechpart(); $common = false; $w->clear_connections(); $connections = $w->connections(); $w->read_paths(); $w->read_attrs(); display_lang($w); ?> <span class="word-name" id="word<?php echo $w->id(); ?> _name"><?php echo display_word_name($w, $common); ?> </span> <?php if ($common) { echo format_abbr("c.", "Common Gender") . " "; } elseif ($lang === "la" and $spart === "noun" and $genders = $w->path()->iterate("gender")) { foreach ($genders as $g) { echo format_abbr($g[0] . ".", capitalize($g)); } echo " "; } $infos = []; /* $stem = $w->path(); if ($stem->hasvalue()) $infos[] = format_word(str_replace("\n", ", ", $stem->get())); */ $infos[] = $spart; foreach ($w->read_attrs() as $attr) { if ($attr->tag()[0] != "-") { $infos[] = format_attr($attr->tag(), $attr->value()); } } ?> (<?php echo implode("; ", $infos); ?> )<?php if ($can_edit !== NULL and $can_edit) { $slug = slugify($w, $lang); $class = "word{$id}_toolbox"; ?> <?php display_icon("tools", "Tools", "word{$id}_tools", NULL, "hider hiding2"); ?> <script type="text/javascript"> $(function() { var id = <?php echo $id; ?> ; var state = -1; $('#word'+id+'_tools').on('mousedown', function(e) { if (state === -1) { $(this).removeClass('hiding2'); state = 0; } e.preventDefault(); return false; }).on('mouseup', function(e) { if (state === 0) state = 1; else if (state === 1) { $(this).addClass('hiding2'); state = -1; } e.preventDefault(); return false; }).on('click', function(e){e.preventDefault();return false;}); }); </script> <span class="<?php echo $class; ?> "> <?php display_icon("hardlink", "Link by ID", NULL, "dictionary.php?id={$id}"); ?> <?php display_icon("del", "Delete", "word{$id}_delete"); ?> <script type="text/javascript"> $(function() { var id = <?php echo $id; ?> ; $('#word'+id+'_delete').on("click", function() { dict.word_delete(id); }); }); </script> <?php display_icon("rename", "Rename", "word{$id}_rename"); ?> <script type="text/javascript"> $(function() { var id = <?php echo $id; ?> ; $('#word'+id+'_rename').on("mouseup.rename", function() { dict.word_rename(id, "<?php echo $w->name(); ?> "); }); }); </script> <?php display_icon("refresh", "Refresh", "word{$id}_refresh"); ?> <script type="text/javascript"> $(function() { var id = <?php echo $id; ?> ; $('#word'+id+'_refresh').on("mouseup.refresh", function() { dict.word_refresh(id); }); }); </script> <?php display_icon("change POS", "Change Part of Speech", "word{$id}_change_POS"); ?> <script type="text/javascript"> $(function() { var id = <?php echo $id; ?> ; $('#word'+id+'_change_POS').on('mouseup', function() { var pos = prompt('What part of speech?', '<?php echo $spart; ?> '); if (pos) dict.word_change_POS(id, pos); }); }); </script> </span> (size: <?php echo count($w->paths()); ?> ) <div class="<?php echo $class; ?> "> <a href="http://en.wiktionary.org/wiki/<?php echo $slug; ?> #<?php echo format_lang($w); ?> " target="_blank">Wiktionary</a> <?php if ($w->lang() === "la") { ?> – <a href="http://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:1999.04.0059:entry=<?php echo $slug; ?> " target="_blank">Lewis & Short</a> <?php } ?> <br> Pronunciation: <input id="word<?php echo $id; ?> _pronunciation_tool"> <span></span> </div> <script> $(function() { var transform = la_ipa.transforms["IPA transcription"]; $('#word<?php echo $id; ?> _pronunciation_tool').on('keyup', function() { var $this=$(this); $this.next().text(transform($this.val())); }); }); </script> <?php } $made_div = FALSE; $first = TRUE; $last_type = NULL; $using = []; $from = []; $sep = ""; foreach ($connections as $c) { if (!$made_div) { ?> <div class="word-more-info"><?php $made_div = TRUE; } if ($c->type() === "prefix") { $using[] = $c->to(); } elseif ($c->type() === "etymon") { $from[] = $c->to(); } } if ($from) { if (!$made_div) { ?> <div class="word-more-info"><?php $made_div = TRUE; } echo "From "; foreach ($using as $u) { word_link($u, $u->lang() === $w->lang()); echo " + "; } $sep = ""; foreach ($from as $u) { word_link($u, $u->lang() === $w->lang()); echo $sep; $sep = ", from "; } ?> <br><?php } if ($sep === ", from ") { ?> <br><?php } foreach ($w->pronunciations() as $pron) { if ((string) $pron->path()) { continue; } if (!$pron->value()) { continue; } if (!$made_div) { ?> <div class="word-more-info"><?php $made_div = TRUE; } if (!$first and $pron->type() === $last_type) { ?> ; <?php } else { if (!$first) { ?> <br><?php } echo $pron->type() . ": "; } $last_type = $pron->type(); if ($pron->sublang()) { ?> <sup>[<?php echo $pron->sublang(); ?> ]</sup><?php } ?> [<?php echo format_pron($pron->value()); ?> ]<?php $first = FALSE; } if ($made_div) { ?> </div><?php } if ($can_edit) { ?> <div> <input id="word<?php echo $id; ?> _value_attr" type="text" placeholder="[!]attr[=value]; ..." required> <button id="word<?php echo $id; ?> _button_enter_attr" onclick="dict.word_add_attr(<?php echo $id; ?> )">Add</button> <button id="word<?php echo $id; ?> _button_clear_attr" onclick="$('#word<?php echo $id; ?> _value_attr').val('')">Clear</button> </div> <script type="text/javascript"> $(function() { var id = <?php echo $id; ?> ; $('#word'+id+'_value_attr').keypress(function(e){if (e.which == 13)dict.word_add_attr(<?php echo $id; ?> )}); var lock=false; var splitter = /,\s*/; var last1 = $('#enter-names').val().split(splitter); var last2 = $('#enter-attrs').val().split(splitter); function getcheckbox(name) { var ret=[]; $('input:checkbox[name="'+name+'"]:checked:visible').each(function() { ret.push($(this).val()); }); return ret.join(); } $('#word'+id+'_value_attr').autocomplete(autocompletions['word-attributes'](id,'<?php echo $lang; ?> ','<?php echo $spart; ?> ')); }); </script> <?php } }
/** * Capitalizes all the words and replaces some characters in the string to create a nicer * looking title. {@link titleize()} is meant for creating pretty output. It is not used in * the Rails internals. * * <pre> * $this->titleize('man from the boondocks'); // "Man From The Boondocks" * $this->titleize('x-men: the last stand'); // "X Men: The Last Stand" * $this->titleize('TheManWithoutAPast'); // "The Man Without A Past" * $this->titleize('raiders_of_the_lost_ark'); // "Raiders Of The Lost Ark" * </pre> * * @param string $str * * @return string */ public function titleize($str) { $str = $this->underscore($str); $str = $this->humanize($str); $str = preg_replace_callback('/\\b(?<![\'’`])[a-z]/', function ($matches) { return capitalize($matches[0]); }, $str); return $str; }
$def_expr = NULL; foreach ($word->definitions() as $def) { if ($def->lang() !== "en") { continue; } $_path = $def->path(); if ($_path and !$path->issub($_path, TRUE)) { continue; } if ($def->type() === "expr") { $def_expr = $def->value(); } else { $defs = array_merge($defs, explode("\n", $def->value())); } } $defs = array_map("trim", $defs); if ($number === "plural") { $defs = array_map("pluralize", $defs); $defs = flatten($defs); $art = "[the|some]"; } else { $art = "[a[n]|the]"; } if (!$def_expr) { $def_expr = make_expr($defs); } $correct = [capitalize(implode(" ", [$pron[0], $be[0], "(the)", $defs[0]]))]; $expr = "{*" . implode("} {", array_map("make_expr", [$pron, $be, $art])) . " {$def_expr}}"; error_log($expr); return ["correct" => $correct, "expr" => $expr]; }, "answer0-tooltip" => "English translation", "answer0-language" => "en"]]]]);
<?php include 'function_capitalize.php'; include_once 'function_capitalize.php'; $s = "fengjie"; capitalize($s); echo $s;
/** * Capitalizes the first letter of every word. * * @param string $text * The text to be capitalized. * * @return string * The text with every word capitalized. * * @ingroup helperfunc */ function titleize($text) { $words = explode(" ", $text); $capitalized_words = array(); foreach ($words as $word) { $capitalized_words[] = capitalize($word); } return join(" ", $capitalized_words); }
<?php /* * Module: process_style_types.inc.php * Description: This module does all the heavy lifting for adding/editing info in the "style_types" table */ if (isset($_SESSION['loginUsername']) && $_SESSION['userLevel'] <= 1) { if (NHC) { // Place NHC SQL calls below } else { if ($action == "add") { $insertSQL = sprintf("INSERT INTO {$style_types_db_table} (\r\n\t\t\tstyleTypeName, \r\n\t\t\tstyleTypeOwn, \r\n\t\t\tstyleTypeBOS, \r\n\t\t\tstyleTypeBOSMethod\r\n\t\t\t) \r\n\t\t\tVALUES \r\n\t\t\t(%s, %s, %s, %s)", GetSQLValueString(capitalize($_POST['styleTypeName']), "text"), GetSQLValueString($_POST['styleTypeOwn'], "text"), GetSQLValueString($_POST['styleTypeBOS'], "text"), GetSQLValueString($_POST['styleTypeBOSMethod'], "text")); //echo $insertSQL; mysql_select_db($database, $brewing); mysql_real_escape_string($insertSQL); $result1 = mysql_query($insertSQL, $brewing) or die(mysql_error()); $pattern = array('\'', '"'); $insertGoTo = str_replace($pattern, "", $insertGoTo); header(sprintf("Location: %s", stripslashes($insertGoTo))); } if ($action == "edit") { $updateSQL = sprintf("UPDATE {$style_types_db_table} SET\r\n\t\t\tstyleTypeName=%s, \r\n\t\t\tstyleTypeOwn=%s, \r\n\t\t\tstyleTypeBOS=%s, \r\n\t\t\tstyleTypeBOSMethod=%s\r\n\t\t\tWHERE id=%s", GetSQLValueString($_POST['styleTypeName'], "text"), GetSQLValueString($_POST['styleTypeOwn'], "text"), GetSQLValueString($_POST['styleTypeBOS'], "text"), GetSQLValueString($_POST['styleTypeBOSMethod'], "text"), GetSQLValueString($id, "int")); //echo $updateSQL."<br>"; mysql_select_db($database, $brewing); mysql_real_escape_string($updateSQL); $result1 = mysql_query($updateSQL, $brewing) or die(mysql_error()); //echo $updateSQL; $pattern = array('\'', '"'); $updateGoTo = str_replace($pattern, "", $updateGoTo); header(sprintf("Location: %s", stripslashes($updateGoTo))); }
/** * Adds a contact's info to the Skarabee database. To be used whenever a visitor fills out a contact form. * * @param string $user_firstname * The user's first name * @param string $user_lastname * The user's last name * @param string $user_email * The user's e-mail address * @param string $user_message * The message the user sent to the realtor * @param Skarabeeproperty $property optional * The property the user is contacting the realtor about * @param string $user_phone optional * The user's phone number * @param string $user_mobile_phone optional * The user's mobile phone number * @param string $user_postal optional * The postal code of the user's address * @param string $user_city optional * The city of the user's address * @param string $user_street optional * The street of the user's address * @param string $user_house_number optional * The house number of the user's address * * @return boolean Returns whether or not the data was accepted by Skarabee */ public static function save_contact($user_firstname, $user_lastname, $user_email, $user_message, $property = false, $user_phone = false, $user_mobile_phone = false, $user_postal = false, $user_city = false, $user_street = false, $user_house_number = false) { $client = self::get_client(); use_library('libphonenumber'); $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); $data = array('FirstName' => capitalize(trim($user_firstname)), 'LastName' => capitalize(trim($user_lastname)), 'Comments' => trim($user_message), 'Email' => strtolower(trim($user_email))); if ($property && isset($property->software_id)) { $data['PublicationID'] = $property->software_id; } if ($user_phone) { try { $phone = $phoneUtil->parse($user_phone, strtoupper('be')); $data['Phone'] = $phoneUtil->format($phone, \libphonenumber\PhoneNumberFormat::NATIONAL); } catch (\libphonenumber\NumberParseException $e) { $data['Phone'] = $user_phone; } } if ($user_mobile_phone) { try { $phone = $phoneUtil->parse($user_mobile_phone, strtoupper('be')); $data['CellPhone'] = $phoneUtil->format($phone, \libphonenumber\PhoneNumberFormat::NATIONAL); } catch (\libphonenumber\NumberParseException $e) { $data['CellPhone'] = $user_mobile_phone; } } if ($user_city) { $data['City'] = capitalize(trim($user_city)); } if ($user_postal) { $data['ZipCode'] = strtoupper(trim($user_postal)); } if ($user_street) { $data['Street'] = capitalize(trim($user_street), false); } if ($user_house_number) { $data['HouseNumber'] = capitalize(trim($user_house_number)); } $result = $client->InsertContactMes(array('ContactMes' => array($data))); return !isset($result->InsertContactMesResult->InvalidContactMes->InvalidContactMe); }
* Description: This module does all the heavy lifting for adding/editing info in the "style_types" table */ if (isset($_SESSION['loginUsername']) && $_SESSION['userLevel'] <= 1) { if (NHC) { // Place NHC SQL calls below } else { if ($action == "add") { $insertSQL = sprintf("INSERT INTO {$style_types_db_table} (\r\n\t\t\tstyleTypeName, \r\n\t\t\tstyleTypeOwn, \r\n\t\t\tstyleTypeBOS, \r\n\t\t\tstyleTypeBOSMethod\r\n\t\t\t) \r\n\t\t\tVALUES \r\n\t\t\t(%s, %s, %s, %s)", GetSQLValueString(capitalize($_POST['styleTypeName']), "text"), GetSQLValueString($_POST['styleTypeOwn'], "text"), GetSQLValueString($_POST['styleTypeBOS'], "text"), GetSQLValueString($_POST['styleTypeBOSMethod'], "text")); //echo $insertSQL; mysql_select_db($database, $brewing); mysql_real_escape_string($insertSQL); $result1 = mysql_query($insertSQL, $brewing) or die(mysql_error()); $pattern = array('\'', '"'); $insertGoTo = str_replace($pattern, "", $insertGoTo); header(sprintf("Location: %s", stripslashes($insertGoTo))); } if ($action == "edit") { $updateSQL = sprintf("UPDATE {$style_types_db_table} SET\r\n\t\t\tstyleTypeName=%s, \r\n\t\t\tstyleTypeOwn=%s, \r\n\t\t\tstyleTypeBOS=%s, \r\n\t\t\tstyleTypeBOSMethod=%s\r\n\t\t\tWHERE id=%s", GetSQLValueString(capitalize($_POST['styleTypeName']), "text"), GetSQLValueString($_POST['styleTypeOwn'], "text"), GetSQLValueString($_POST['styleTypeBOS'], "text"), GetSQLValueString($_POST['styleTypeBOSMethod'], "text"), GetSQLValueString($id, "int")); //echo $updateSQL."<br>"; mysql_select_db($database, $brewing); mysql_real_escape_string($updateSQL); $result1 = mysql_query($updateSQL, $brewing) or die(mysql_error()); $pattern = array('\'', '"'); $updateGoTo = str_replace($pattern, "", $updateGoTo); header(sprintf("Location: %s", stripslashes($updateGoTo))); } } // end else NHC } else { echo "<p>Not available.</p>"; }
header(sprintf("Location: %s", $base_url . "index.php?section=contact&action=email&id=" . $row_contact['id'] . "&msg=1")); } // end else if (!$resp->is_valid) } elseif (isset($_SESSION['loginUsername']) && isset($_SESSION['userLevel'])) { if (NHC) { // Place NHC SQL calls below } else { if ($action == "add") { $insertSQL = sprintf("INSERT INTO {$contacts_db_table} (\n\t\t\tcontactFirstName, \n\t\t\tcontactLastName, \n\t\t\tcontactPosition, \n\t\t\tcontactEmail\n\t\t\t) \n\t\t\tVALUES \n\t\t\t(%s, %s, %s, %s)", GetSQLValueString(capitalize($_POST['contactFirstName']), "text"), GetSQLValueString(capitalize($_POST['contactLastName']), "text"), GetSQLValueString(capitalize($_POST['contactPosition']), "text"), GetSQLValueString(strtolower($_POST['contactEmail']), "text")); //echo $insertSQL; mysql_select_db($database, $brewing); mysql_real_escape_string($insertSQL); $result1 = mysql_query($insertSQL, $brewing) or die(mysql_error()); $pattern = array('\'', '"'); $insertGoTo = str_replace($pattern, "", $insertGoTo); header(sprintf("Location: %s", stripslashes($insertGoTo))); } if ($action == "edit") { $updateSQL = sprintf("UPDATE {$contacts_db_table} SET \n\t\t\tcontactFirstName=%s, \n\t\t\tcontactLastName=%s, \n\t\t\tcontactPosition=%s, \n\t\t\tcontactEmail=%s\n\t\t\tWHERE id=%s", GetSQLValueString(capitalize($_POST['contactFirstName']), "text"), GetSQLValueString(capitalize($_POST['contactLastName']), "text"), GetSQLValueString(capitalize($_POST['contactPosition']), "text"), GetSQLValueString(strtolower($_POST['contactEmail']), "text"), GetSQLValueString($id, "int")); mysql_select_db($database, $brewing); mysql_real_escape_string($updateSQL); $result1 = mysql_query($updateSQL, $brewing) or die(mysql_error()); $pattern = array('\'', '"'); $updateGoTo = str_replace($pattern, "", $updateGoTo); header(sprintf("Location: %s", stripslashes($updateGoTo))); } } // end else NHC } else { echo "<p>Not available.</p>"; }
} else { $dislikes = $_POST['brewerJudgeDislikes']; } } else { $dislikes = ""; } if ($_POST['brewerJudgeRank'] != "") { if (is_array($_POST['brewerJudgeRank'])) { $rank = implode(",", $_POST['brewerJudgeRank']); } else { $rank = $_POST['brewerJudgeRank']; } } else { $rank = ""; } $updateSQL = sprintf("UPDATE {$brewer_db_table} SET \r\n\t\t\t\tuid=%s,\r\n\t\t\t\tbrewerFirstName=%s, \r\n\t\t\t\tbrewerLastName=%s, \r\n\t\t\t\tbrewerAddress=%s, \r\n\t\t\t\tbrewerCity=%s, \r\n\t\t\t\tbrewerState=%s, \r\n\t\t\t\t\r\n\t\t\t\tbrewerZip=%s, \r\n\t\t\t\tbrewerCountry=%s, \r\n\t\t\t\tbrewerPhone1=%s, \r\n\t\t\t\tbrewerPhone2=%s, \r\n\t\t\t\tbrewerClubs=%s, \r\n\t\t\t\tbrewerEmail=%s, \r\n\t\t\t\t\r\n\t\t\t\tbrewerSteward=%s, \r\n\t\t\t\tbrewerJudge=%s, \r\n\t\t\t\tbrewerJudgeID=%s, \r\n\t\t\t\tbrewerJudgeMead=%s, \r\n\t\t\t\tbrewerJudgeRank=%s, \r\n\t\t\t\tbrewerJudgeLikes=%s, \r\n\t\t\t\tbrewerJudgeDislikes=%s, \r\n\t\t\t\tbrewerJudgeLocation=%s, \r\n\t\t\t\tbrewerStewardLocation=%s,\r\n\t\t\t\tbrewerDropOff=%s,\r\n\t\t\t\tbrewerJudgeExp=%s,\r\n\t\t\t\tbrewerJudgeNotes=%s", GetSQLValueString($_POST['uid'], "int"), GetSQLValueString(capitalize($_POST['brewerFirstName']), "text"), GetSQLValueString(capitalize($_POST['brewerLastName']), "text"), GetSQLValueString(capitalize($_POST['brewerAddress']), "text"), GetSQLValueString(capitalize($_POST['brewerCity']), "text"), GetSQLValueString($_POST['brewerState'], "text"), GetSQLValueString($_POST['brewerZip'], "text"), GetSQLValueString($_POST['brewerCountry'], "text"), GetSQLValueString($_POST['brewerPhone1'], "text"), GetSQLValueString($_POST['brewerPhone2'], "text"), GetSQLValueString($_POST['brewerClubs'], "text"), GetSQLValueString($_POST['brewerEmail'], "text"), GetSQLValueString($_POST['brewerSteward'], "text"), GetSQLValueString($_POST['brewerJudge'], "text"), GetSQLValueString($_POST['brewerJudgeID'], "text"), GetSQLValueString($_POST['brewerJudgeMead'], "text"), GetSQLValueString($rank, "text"), GetSQLValueString($likes, "text"), GetSQLValueString($dislikes, "text"), GetSQLValueString($location_pref1, "text"), GetSQLValueString($location_pref2, "text"), GetSQLValueString($_POST['brewerDropOff'], "int"), GetSQLValueString($_POST['brewerJudgeExp'], "text"), GetSQLValueString($_POST['brewerJudgeNotes'], "text")); // Numbers 999999994 through 999999999 are reserved for NHC applications. if ($_POST['brewerAHA'] < "999999994" || $_POST['brewerAHA'] == "") { $updateSQL .= sprintf(", brewerAHA=%s", GetSQLValueString($_POST['brewerAHA'], "text")); } $updateSQL .= sprintf(" WHERE id=%s", GetSQLValueString($id, "int")); if ($_POST['brewerAssignment'] == "J") { $updateSQL2 = "UPDATE {$brewer_db_table} SET brewerNickname='judge' WHERE id='" . $id . "'"; } elseif ($_POST['brewerAssignment'] == "S") { $updateSQL2 = "UPDATE {$brewer_db_table} SET brewerNickname='steward' WHERE id='" . $id . "'"; } else { $updateSQL2 = "UPDATE {$brewer_db_table} SET brewerNickname=NULL WHERE id='" . $id . "'"; } mysql_select_db($database, $brewing); mysql_real_escape_string($updateSQL); $result1 = mysql_query($updateSQL, $brewing) or die(mysql_error());
public function guardarMuestraMedico() { $id = $this->input->post('id'); $telefono_id = $this->input->post('telefono_id'); $correo = $this->input->post('correo'); $correo2 = $this->input->post('correo2'); $aut = $this->input->post('aut'); $usuario_capt_id = intval($_SESSION['id']); $medico_id = $this->Capmuestramed_model->get_muestraMedicoId($id); if ($correo != "") { //Actualizar correo del medico $this->Capmedicos_model->update_medico($medico_id, $correo); } $result = false; if ($aut == "true") { $result = $this->Capmuestramed_model->update_muestra($id, $telefono_id, $usuario_capt_id); $nombre = capitalize($this->Capmedicos_model->get_nombreMedico($medico_id)); if ($result) { if ($correo == "") { $this->enviarCodigo($correo2, $nombre); } else { $this->enviarCodigo($correo, $nombre); } } } else { //Eliminar de muestra el id $result = $this->Capmuestramed_model->update_muestra_NoAut($id, $usuario_capt_id); } $array = array('success' => $result); echo json_encode($array); }
/** * Builds a valid \<img /\> HTML tag. * * @param string $source * The source path to the image. * @param string|array $attributes * (optional) A single HTML attribute or an array of HTML attributes to be * added to the rendered tag. * @return @e string * A valid \<img /\> HTML tag. * * @ingroup helperfunc * * @see TagHelper::content_tag() * */ public function image_tag($source, $attributes = NULL) { if (!preg_match("/^(https?|\\/)/", $source)) { $source = image_url($source); } $info = pathinfo($source); $options = array("src" => $source, "alt" => capitalize(basename($source, '.' . $info['extension']))); if (is_array($attributes)) { $options = array_merge($options, $attributes); } return content_tag("img", NULL, $options); }
$args += array("label" => "total " . get_currency_abbr($currency) . " hashrate"); } else { if (substr($account['summary_type'], 0, strlen('total')) == 'total') { $currency = substr($account['summary_type'], strlen('total')); $args += array("label" => "total " . get_currency_abbr($currency)); } else { if (substr($account['summary_type'], 0, strlen('all2')) == 'all2') { $summary_type = substr($account['summary_type'], strlen('all2')); $summary_types = get_total_conversion_summary_types(); $args += array("label" => "converted " . $summary_types[$summary_type]['short_title']); } else { throw new JobException("Unknown summary_instance summary_type '" . htmlspecialchars($account['summary_type']) . "'"); } } } $args['label_uc'] = capitalize($args['label']); break; default: throw new JobException("Unknown notification type for email '" . $notification['notification_type'] . "'"); } send_user_email($user, $email_template, $args); crypto_log("Sent notification e-mail to " . htmlspecialchars($user['email']) . "."); // update user stats $q = db()->prepare("UPDATE user_properties SET notifications_sent=notifications_sent+1 WHERE id=?"); $q->execute(array($user['id'])); } // update the notification $q = db()->prepare("UPDATE notifications SET is_notified=1,last_notification=NOW(),last_value=?,notifications_sent=notifications_sent+1 WHERE id=?"); $q->execute(array($current_value, $notification['id'])); } else { crypto_log("Trigger not successful.");
} else { $dropLocationWebsite = check_http($_POST['dropLocationWebsite']); $dropLocationName = strtr($_POST['dropLocationName'], $html_string); if ($action == "add") { $insertSQL = sprintf("INSERT INTO {$drop_off_db_table} (dropLocationName, dropLocation, dropLocationPhone, dropLocationWebsite, dropLocationNotes) VALUES (%s, %s, %s, %s, %s)", GetSQLValueString(capitalize($dropLocationName), "text"), GetSQLValueString(strtr($_POST['dropLocation'], $html_string), "text"), GetSQLValueString($_POST['dropLocationPhone'], "text"), GetSQLValueString(strtolower($dropLocationWebsite), "text"), GetSQLValueString(strtr($_POST['dropLocationNotes'], $html_string), "text")); mysql_select_db($database, $brewing); mysql_real_escape_string($insertSQL); $result1 = mysql_query($insertSQL, $brewing) or die(mysql_error()); if ($section == "setup") { $insertGoTo = "../setup.php?section=step6&msg=11"; } else { $insertGoTo = $insertGoTo; } $pattern = array('\'', '"'); $insertGoTo = str_replace($pattern, "", $insertGoTo); header(sprintf("Location: %s", stripslashes($insertGoTo))); } if ($action == "edit") { $updateSQL = sprintf("UPDATE {$drop_off_db_table} SET dropLocationName=%s, dropLocation=%s, dropLocationPhone=%s, dropLocationWebsite=%s, dropLocationNotes=%s WHERE id=%s", GetSQLValueString(capitalize($dropLocationName), "text"), GetSQLValueString(strtr($_POST['dropLocation'], $html_string), "text"), GetSQLValueString($_POST['dropLocationPhone'], "text"), GetSQLValueString(strtolower($dropLocationWebsite), "text"), GetSQLValueString(strtr($_POST['dropLocationNotes'], $html_string), "text"), GetSQLValueString($id, "int")); mysql_select_db($database, $brewing); mysql_real_escape_string($updateSQL); $result1 = mysql_query($updateSQL, $brewing) or die(mysql_error()); $pattern = array('\'', '"'); $updateGoTo = str_replace($pattern, "", $updateGoTo); header(sprintf("Location: %s", stripslashes($updateGoTo))); } } // end else NHC } else { echo "<p>Not available.</p>"; }
/** * By default, {@link camelize} converts strings to UpperCamelCase. * * {@link camelize} will also convert "/" to "\" which is useful for converting paths to * namespaces. * * <pre> * $this->camelize('active_model'); // 'ActiveModel' * $this->camelize('active_model', true); // 'activeModel' * $this->camelize('active_model/errors'); // 'ActiveModel\Errors' * $this->camelize('active_model/errors', true); // 'activeModel\Errors' * </pre> * * As a rule of thumb you can think of {@link camelize} as the inverse of {@link underscore}, * though there are cases where that does not hold: * * <pre> * $this->camelize($this->underscore('SSLError')); // "SslError" * </pre> * * @param string $term * @param bool $downcase_first_letter One of {@link UPCASE_FIRST_LETTER}, * {@link DOWNCASE_FIRST_LETTER}. * * @return string */ public function camelize($term, $downcase_first_letter = self::UPCASE_FIRST_LETTER) { $string = (string) $term; $acronyms = $this->inflections->acronyms; if ($downcase_first_letter) { $string = preg_replace_callback('/^(?:' . trim($this->inflections->acronym_regex, '/') . '(?=\\b|[[:upper:]_])|\\w)/u', function ($matches) { return downcase($matches[0]); }, $string, 1); } else { $string = preg_replace_callback('/^[[:lower:]\\d]*/u', function ($matches) use($acronyms) { $m = $matches[0]; return !empty($acronyms[$m]) ? $acronyms[$m] : capitalize($m); }, $string, 1); } $string = preg_replace_callback('/(?:_|-|(\\/))([[:alnum:]]*)/u', function ($matches) use($acronyms) { list(, $m1, $m2) = $matches; return $m1 . (isset($acronyms[$m2]) ? $acronyms[$m2] : capitalize($m2)); }, $string); $string = str_replace('/', '\\', $string); return $string; }
public function get_reenvios() { $result = array(); $fecha = date('Y-m-j'); $fecha = strtotime('-3 day', strtotime($fecha)); $fecha = date('Y-m-j', $fecha); $this->db_capturista->where(array('medico_id<>' => null, 'tipoCanal<>' => 4, 'correo<>' => '', 'aut<>' => 2, 'fechaEnviado<' => $fecha)); $this->db_capturista->from('medicos'); $this->db_capturista->join('muestraMedicos', 'muestraMedicos.medico_id = medicos.id', 'left'); $result = $this->db_capturista->get()->result_array(); $resultado = array(); foreach ($result as $med) { if ($med['fechaEnviado'] != "0000-00-00") { //Revisar si encuesta con id $med['codigo_id'] !codigoUsado or !canalUsado $encuesta = $this->db_encuesta->get_where('encuestasM', array('id' => $med['codigo_id']))->row_array(); if ($encuesta['canalUsado'] == 0 || $encuesta['codigoUsado'] == 0) { $resultado[] = array('id' => $med['id'], 'nombre' => capitalize($med['nombre'] . ' ' . $med['apellidop'] . ' ' . $med['apellidom']), 'correo' => $med['correo'], 'codigo' => $encuesta['codigo'], 'tipoCodigo' => $encuesta['tipoCodigo'], 'fechaEnviado' => $med['fechaEnviado'], 'codigoUsado' => $encuesta['codigoUsado'], 'canalUsado' => $encuesta['canalUsado'], 'usada' => $encuesta['usada']); } } } return $resultado; }