本文整理汇总了PHP中prompt函数的典型用法代码示例。如果您正苦于以下问题:PHP prompt函数的具体用法?PHP prompt怎么用?PHP prompt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prompt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
function build($argv)
{
global $_plugin;
global $success;
global $error;
global $errors;
plugin_is_installed($_plugin['name']) or $error = $error['not_installed'];
isset($argv[3]) or $error = $errors['usage'];
prompt('WARNING: Building a table from a definition will clear all data from your table; are you sure you want to do this?') or $error = $errors['aborted'];
if (!$error) {
# Let's get connected!
db_connect();
use_db();
# Get definition config.
$_definition = get_plugin_config('definitions');
# At this point, $_definition is overwritten with the defined $_definition in the require.
require $_definition['dir']['definitions'] . $argv[3] . '.php';
# Drop the current table. Should really be its own script, no?
# Check for table existence.
if (mysql_query('SELECT * FROM ' . $_definition['name'])) {
mysql_query('DROP TABLE ' . $_definition['name']);
}
# Let's build this noise!
$query = 'CREATE TABLE ' . $_definition['name'] . '(' . "\n";
# We'll foreach through the table def and build the SQL string as needed.
foreach ($_definition['fields'] as $field => $data) {
$query .= $field . ' ' . strtoupper($data['type']);
if ($data['length']) {
$query .= '(' . $data['length'] . ')';
}
if (!$data['null']) {
$query .= ' NOT NULL';
}
if ($data['auto_inc']) {
$query .= ' AUTO_INCREMENT';
}
# Add a comma and line break.
$query .= ",\n";
# Output relational data.
if (isset($data['relation'])) {
$query .= 'INDEX ' . $data['relation']['name'] . '_rel(' . $data['relation']['name'] . '_id)';
$query .= ',' . "\n" . 'FOREIGN KEY(' . $data['relation']['name'] . '_id) REFERENCES ' . $data['relation']['name'] . '(id) ON DELETE CASCADE';
$query .= ",\n";
}
}
if ($_definition['primary']) {
$query .= 'PRIMARY KEY(' . $_definition['primary'] . ')';
}
# End query here.
$query .= "\n" . ')';
//add option to display this!
echo 'Executing the following query:' . "\n" . $query . "\n\n";
if (mysql_query($query)) {
//$success = 'Created ' . $_definition['name'] . ' with the following query: ' . "\n" . $query;
$success = 'Created "' . $_definition['name'] . '"';
} else {
$error = mysql_error();
}
}
}
示例2: build
function build($argv)
{
global $_plugin;
global $success;
global $error;
global $errors;
prompt('WARNING: Building fixtures clear all data from your table; are you sure you want to do this?') or $error = $errors['aborted'];
if (!$error) {
require_once $_plugin['dir']['fixtures'] . $argv[3] . '.php';
# Let's get connected!
db_connect();
use_db();
# Truncate table.
echo 'Truncating ' . $argv[3] . ' table...' . "\n\n";
$query = mysql_query('TRUNCATE ' . $argv[3]);
foreach ($_fixtures as $_fixture) {
$query = '
INSERT INTO ' . $argv[3] . ' (' . implode(',', array_keys($_fixture)) . ')
VALUES (' . implode(',', array_values(enquote($_fixture))) . ')
';
//add option to display this?
echo 'Running the following query:';
echo "\n" . $query . "\n\n";
if (mysql_query($query)) {
$success = 'fixtures for the table: ' . $argv[3] . ' have been succesfully built!';
} else {
$error = mysql_error();
}
}
}
}
示例3: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$name = prompt("Name");
$this->descr["description"] = prompt("Description");
if (!$name) {
$output->writeln("Error, name is not supplied.");
exit;
}
if ($input->getOption("controller")) {
$this->controller($name, $output);
}
if ($input->getOption("model")) {
$this->model($name, $output);
}
if ($input->getOption("libs")) {
$this->libs($name, $output);
}
if ($input->getOption("task")) {
$this->task($name, $output);
}
if ($input->getOption("cronjob")) {
$this->cronjob($name, $output);
}
if ($input->getOption("resque")) {
$this->resque($name, $output);
}
$output->writeln("Please run update to update MiraApp and Composer");
}
示例4: customerFields
function customerFields($data, $badFields)
{
global $states;
global $COUNTRIES;
if (userLoggedIn() && array_key_exists("CID", $data) && $data["CID"] != "") {
tableRow(array(tableData(prompt("<b>CID:</b>"), "right", "top"), tableData(prompt($data["CID"]), "left", "top")));
prepDatePicker();
tableRow(array(tableData(prompt("<b>Met Date:</b>"), "right", "top"), tableData(text($data, "metDate", "", "", "datepicker"), "left", "middle")));
}
tableRow(array(tableData(prompt("<b>First name*:</b>", in_array("fname", $badFields)), "right"), tableData(text($data, "fname"), "left", "middle"), tableData(prompt("<b>Last name*:</b>", in_array("lname", $badFields)), "right"), tableData(text($data, "lname"), "left", "middle")));
tableRow(array(tableData(prompt("<b>Email*:</b>", in_array("email", $badFields)), "right"), tableData(text($data, "email"), "left", "middle"), tableData(prompt("<b>Phone Number:</b>", in_array("phoneNum", $badFields)), "right"), tableData(text($data, "phoneNum"), "left", "middle")));
tableRow(array(tableData(prompt("<b>Title:</b>", in_array("title", $badFields)), "right"), tableData(radioButton($data, "title", "Mr.", false, "Mr."), "center", "middle"), tableData(radioButton($data, "title", "Ms.", false, "Ms."), "center", "middle"), tableData(radioButton($data, "title", "Mrs.", false, "Mrs."), "center", "middle"), tableData(radioButton($data, "title", "Dr.", false, "Dr."), "center", "middle")));
if (!userLoggedIn()) {
if ($data["charity"] == true) {
tableRow(array(tableData(prompt("Tell us about your situtation, your team and why you need a ChapR. The more information the better!"), "middle", "top", 6)));
} else {
tableRow(array(tableData(prompt("Write anything else you would like us to know about you below: <br> team info (type, name, number), how you heard about us (where, from who?) etc."), "middle", "top", 6)));
}
}
tableRow(array(tableData(prompt("<b>Comments:</b>", in_array("customerCNotes", $badFields), ""), "right", "top"), tableData(textArea($data, "customerCNotes", 3), "center", "", 5)));
tableRow(array(tableData(prompt("<b>Street1*:</b>", in_array("street1", $badFields)), "right"), tableData(text($data, "street1"), "left", "middle", 3)));
tableRow(array(tableData(prompt("<b>Street2:</b>", in_array("street2", $badFields)), "right"), tableData(text($data, "street2"), "left", "middle", 3)));
$stateDirections = 'only applicable for domestic teams';
tableRow(array(tableData(prompt("<b>City*:</b>", in_array("city", $badFields)), "right"), tableData(text($data, "city"), "left", "middle"), tableData(prompt("<b>State*:</b>", in_array("state", $badFields), "", $stateDirections), "right"), tableData(dropDown($data, "state", $states, "--------Choose Your State-------"), "left", "middle")));
tableRow(array(tableData(prompt("<b>Zip*:</b>", in_array("zip", $badFields)), "right"), tableData(text($data, "zip"), "left", "middle"), tableData(prompt("<b>Country:</b>", in_array("country", $badFields)), "right"), tableData(dropDown($data, "country", $COUNTRIES), "left", "middle")));
if (userLoggedIn()) {
tableRow(array(tableData(prompt("<b>Admin Comments:</b>", in_array("adminCNotes", $badFields), "", $commentDirections), "right", "top"), tableData(textArea($data, "adminCNotes", 3), "center", "", 5)));
}
tableRow(array(tableData(hiddenField("CID", $data["CID"])), tableData(hiddenField("OID", $data["OID"]))));
}
示例5: promptDivide
function promptDivide()
{
$a = prompt("Enter a number (a) that you'd like to divide:");
$b = prompt("Enter a number (b) that you'd like to divide by:");
$c = prompt("Enter a number (c) that you'd like to multiply by:");
return Attempt::call('divide', array($a, $b))->map(function ($elem) use($c) {
return multiply($elem, $c);
});
}
示例6: shippingFields
function shippingFields($data, $badFields)
{
tableRow(array(tableData(prompt("<b>OID*: </b>"), "right"), tableData(prompt($data["OID"]), "left")));
$carriers = array("UPS" => "1 - UPS", "FedEx" => "2 - FedEx", "US Postal" => "3 - US Postal", "Other" => "4 - Other");
tableRow(array(tableData(prompt("<b>Carrier*:</b>", in_array("carrier", $badFields)), "right"), tableData(dropDown($data, "carrier", $carriers, "--------Choose The Carrier-------"), "left", "middle")));
tableRow(array(tableData(prompt("<b>Shipping Info (Tracking Num)*:</b>", in_array("trackingNum", $badFields)), "right"), tableData(text($data, "trackingNum"), "left", "middle")));
tableRow(array(tableData(prompt("<b>Shipped Date*:</b>", in_array("shippedDate", $badFields)), "right"), tableData(text($data, "shippedDate", date("m/d/Y"), "", "datepicker"), "left", "middle")));
tableRow(array(tableData(prompt("<b>Admin Order Notes:</b>", in_array("adminONotes", $badFields)), "right"), tableData(textArea($data, "adminONotes", 5), "left", "", 5)));
hiddenField("OID", $data["OID"]);
}
示例7: openMapFile
function openMapFile($prompt = "")
{
$mapFile = prompt($prompt);
try {
$map = @fopen($mapFile, "r");
return $map;
} catch (Exception $ex) {
print "\nMap file does not exist!\n";
return false;
}
}
示例8: showForm
function showForm($err_msgs = null)
{
// generate error messages
if ($err_msgs != null) {
foreach ($err_msgs as $emsg) {
echo '<i>';
echo "{$emsg}";
echo ' </h4>';
}
}
echo '<form action="file2.php" method="get">
<table class="table2" frame="border">';
tableRow(array(tableData("right", prompt("<h1>Title!</h1>"))));
tableRow(array(tableData("right", prompt("First name:")), tableData("right", text("fname")), tableData("right", prompt("Last name:")), tableData("right", text("lname"))));
tableRow(array(tableData("right", prompt("City:")), tableData("right", text("city")), tableData("right", prompt("State:")), tableData("right", text("state"))));
tableRow(array(tableData("right", prompt("<b>Gender:</b>")), tableData("center", radioButton("gender", "male", false, "Male")), tableData("center", radioButton("gender", "female", false, "Female")), tableData("center", radioButton("gender", "other", true, "Other"))));
tableRow(array(tableData("right", prompt("<b>Grade:</b>")), tableData("center", radioButton("grade", "freshman", false, "9<sup>th</sup>")), tableData("center", radioButton("grade", "sohpomore", false, "10<sup>th</sup>")), tableData("center", radioButton("grade", "junior", false, "11<sup>th</sup>")), tableData("center", radioButton("grade", "senior", false, "12<sup>th</sup>"))));
tableRow(array(tableData("right", prompt("<b>Product:</b>")), tableData("center", checkBox("product", "ChapR", false, "ChapR")), tableData("center", checkBox("product", "Kit", false, "Kit")), tableData("center", checkBox("product", "USB", false, "USB")), tableData("center", checkBox("product", "Programmer", false, "Programmer"))));
echo '</table> <input type="hidden" name="filled" value="true"> </form>';
/* echo '
<tr>
<td align="right"><b>Product:</b></td>
p <td colspan="3">
<table style="width:100%">
<tr>
<td align="center"><input type="checkbox" name="product" value="ChapR">ChapR</td>
<td align="center"><input type="checkbox" name="product" value="Programmer">Programmer</td>
<td align="center"><input type="checkbox" name="product" value="Kit">Kit</td>
<td align="center"><input type="checkbox" name="product" value="USB">USB</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" align="right"><b>Comments:</b></td>
<td colspan="3"><textarea rows="4" style="width:100%" name="comments">'; echo $_GET["comments"]; echo '</textarea></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td align="right"><input type="submit" value="Submit!"></td>
</tr>
</table>
<input type="hidden" name="filled" value="true">
</form>';*/
}
示例9: prompt
function prompt()
{
echo 'How many meows would you like? ';
$input = fgets(STDIN);
if (trim($input) == 'exit') {
exit(0);
}
if ($num = filter_var($input, FILTER_VALIDATE_INT)) {
if ($facts = getCatMeowArray($num)) {
meow($facts);
} else {
echo "I don't want your love right meow. \n";
}
} else {
echo "Don't be silly hooman, kittehs only know integers. \n";
}
prompt();
}
示例10: packageFields
function packageFields($data, $badFields)
{
print_r("data");
print_r($data);
tableRow(array(tableData(prompt("<b>Package Name:</b>", in_array("packname", $badFields)), "right"), tableData(text($data, "packname", "", "30"), "left", "middle"), tableData(prompt("<b>Package Price:</b>", in_array("packprice", $badFields)), "right"), tableData(text($data, "packprice", "", "10"), "left", "middle"), tableData(prompt("<b>Active?</b>", in_array("active", $badFields)), "right"), tableData(checkBox($data, "active", "false", "YES"), "left", "middle", 3)));
$pieces = $data["pieces"];
// the list of all the pieces included in the package (as pulled from the pvp table)
$i = 1;
foreach ($pieces as $piece) {
$pieceInfo = dbGetPiece($piece["PID"]);
// get the info for the piece with that PID
$pieceInfo["PID{$i}"] = $pieceInfo["PID"];
$piecesOptions = dbGetPiecesNames();
print_r("piecesOptions");
print_r($piecesOptions);
tableRow(array(tableData(prompt("<b>Piece{$i}:</b>", in_array("piece{$i}", $badFields)), "right"), tableData(dropDown($pieceInfo, "PID{$i}", $piecesOptions))));
$i++;
}
hiddenField("PKID", $data["PKID"]);
print "\n\n";
}
示例11: answer
<?php
answer();
$result = prompt("Hello. Please enter any number", array("choices" => "[DIGITS]"));
if ($result->name == 'choice') {
say("Great, you said " . $result->value);
}
hangup();
?>
示例12: orderFields
function orderFields($data, $badFields)
{
global $SETTINGS;
// display data not supposed to be visible for customers
if (userLoggedIn()) {
if (array_key_exists("OID", $data) && $data["OID"] != "") {
tableRow(array(tableData(prompt("<b>OID: </b>"), "right", "top"), tableData(prompt($data["OID"]), "left", "top")));
}
tableRow(array(tableData(prompt("<b>Expedite:</b>"), "right", "top"), tableData(checkBox($data, "isExpedited", "true", "YES"), "left", "middle", 3)));
prepDatePicker();
tableRow(array(tableData(prompt("<b>Ordered Date:</b>"), "right", "top"), tableData(text($data, "orderedDate", "", "", "datepicker"), "left", "middle")));
}
// show the order amount change fields if the user has permission (and in WordPress)
if (inWordPress() && current_user_can("can_change_amounts")) {
tableRow(array(tableData(prompt("<b>Shipping Fee:</b>", in_array("shippingFee", $badFields)), "right"), tableData(text($data, "shippingFee", null, "10"), "left"), tableData(prompt("<b>Expedite Fee:</b>", in_array("expediteFee", $badFields)), "right"), tableData(text($data, "expediteFee", null, "10"), "left"), tableData(prompt("<b>Discount:</b>", in_array("discount", $badFields)), "right"), tableData(text($data, "discount", null, "10"), "left")));
}
// figure out how many rows to display initially ($i is set to that value)
for ($i = $SETTINGS["MaxItems"]; $i > 1; $i--) {
if (array_key_exists("packages{$i}", $data) && $data["packages{$i}"] != "" && $data["packages{$i}"] != 0 || array_key_exists("personality{$i}", $data) && $data["personality{$i}"] != "" && $data["personality{$i}"] != 0 || array_key_exists("quantity{$i}", $data) && $data["quantity{$i}"] != "" && $data["quantity{$i}"] != 0) {
break;
}
}
$initialRows = $i;
// get currently available packages (from database) for display
$rows = dbGetPackages();
$displayPackages = array();
foreach ($rows as $row) {
if ($row["Active"]) {
$displayPackages[$row["PackageName"]] = $row["PKID"];
}
}
// get currently available personalities (from database) for display
$rows = dbGetPersonalities();
$displayPersonalities = array();
foreach ($rows as $row) {
if ($row["Active"]) {
$displayPersonalities[$row["PieceName"]] = $row["PID"];
}
}
if (!userLoggedIn()) {
tableRow(array(tableData(prompt("Note: \"personality\" refers to the type of software or platform the firmware is compatible with.\n<br> It can be changed later using a USB stick, but we might as well set it for you."), "middle", "top", 6)));
}
for ($i = 1; $i <= $SETTINGS["MaxItems"]; $i++) {
// note that the "table-row" setting for display is controversial and may
// not work well in Microsoft IE
// note, too, that the reason while rows 2 through 5 don't initially display
// is that they are set as display = 'none' in the style sheet - if that
// is turned off, then they will display right away
$magicClick = "";
if ($i != $SETTINGS["MaxItems"]) {
$magicClick = "<button id=\"prodrowclick-";
$magicClick .= $i;
$magicClick .= "\"";
if ($i != $initialRows) {
$magicClick .= " style=\"visibility:hidden;\"";
}
$magicClick .= " type=\"button\" onclick=\"";
$magicClick .= "document.getElementById('prodrow-";
$magicClick .= $i + 1;
// sets the next row to visible
$magicClick .= "').style.display = 'table-row';";
if ($i < $SETTINGS["MaxItems"] - 1) {
$magicClick .= "document.getElementById('prodrowclick-";
$magicClick .= $i + 1;
// sets the next button to visible
$magicClick .= "').style.visibility = 'visible';";
}
$magicClick .= "document.getElementById('prodrowclick-";
$magicClick .= $i;
// sets its own button to hidden
$magicClick .= "').style.visibility = 'hidden';";
$magicClick .= "\">+</button>";
}
if (userLoggedIn() && array_key_exists("iid{$i}", $data) && $data["IID"] != "") {
tableRow(array(tableData(prompt("<b>IID{$i}:</b>"), "right", "top"), tableData(prompt($data["iid{$i}"]), "left", "top")));
}
tableRow(array(tableData(prompt("<b>Product*:</b>", in_array("product{$i}", $badFields)), "right"), tableData(dropDown($data, "packages{$i}", $displayPackages, "----------Select Product----------")), tableData(prompt("<b>Personality:</b>", in_array("personality{$i}", $badFields)), "right"), tableData(dropDown($data, "personality{$i}", $displayPersonalities, " ")), tableData(prompt("<b>Quantity*:</b>", in_array("quantity{$i}", $badFields)), "right"), tableData(text($data, "quantity{$i}", "", "2"), "left"), tableData($magicClick)), "prodrow-" . $i, $i <= $initialRows);
hiddenField("iid{$i}", $data["iid{$i}"]);
}
if (!userLoggedIn()) {
tableRow(array(tableData(prompt("Write anything you would like us to know about the order: <br> a deadline you need to meet, some option you want that isn't offered etc."), "middle", "top", 6)));
}
tableRow(array(tableData(prompt("<b>Order Notes:</b>"), "right", "top"), tableData(textArea($data, "customerONotes", 5), "left", "", 5)));
if (userLoggedIn()) {
tableRow(array(tableData(prompt("<b>Admin Order Notes:</b>"), "right", "top"), tableData(textArea($data, "adminONotes", 5), "left", "", 5)));
}
hiddenField("charity", $data["charity"]);
hiddenField("OID", $data["OID"]);
}
示例13: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$table = prompt("Table to create model for");
$this->description["description"] = prompt("Description");
if (!$table) {
$output->writeln("Error, table name is not supplied.");
exit;
}
// Setup the path and make sure it doesn't already exist
$path = __DIR__ . "/../Model/Database/{$table}.php";
if (file_exists($path)) {
return $output->writeln("Error, file already exists");
}
// Load app
$app = \ProjectRena\RenaApp::getInstance();
// Load the table, if it exists in the first place
$tableColums = $app->Db->query("SHOW COLUMNS FROM {$table}");
// Generate the start of the model code
$class = new PhpClass();
$class->setQualifiedName("ProjectRena\\Model\\Database\\{$table}")->setProperty(PhpProperty::create("app")->setVisibility("private")->setDescription("The Slim Application"))->setProperty(PhpProperty::create("db")->setVisibility("private")->setDescription("The database connection"))->setMethod(PhpMethod::create("__construct")->addParameter(PhpParameter::create("app")->setType("RenaApp"))->setBody("\$this->app = \$app;\n\r\n \$this->db = \$app->Db;\n"))->setDescription($this->description)->declareUse("ProjectRena\\RenaApp");
$nameFields = array();
$idFields = array();
foreach ($tableColums as $get) {
// This is for the getByName selector(s)
if (stristr($get["Field"], "name")) {
$nameFields[] = $get["Field"];
}
// This is for the getByID selector(s)
if (strstr($get["Field"], "ID")) {
$idFields[] = $get["Field"];
}
}
// Get generator
foreach ($nameFields as $name) {
// get * by Name
$class->setMethod(PhpMethod::create("getAllBy" . ucfirst($name))->addParameter(PhpParameter::create($name))->setVisibility("public")->setBody("return \$this->db->query(\"SELECT * FROM {$table} WHERE {$name} = :{$name}\", array(\":{$name}\" => \${$name}));"));
}
foreach ($idFields as $id) {
// get * by ID,
$class->setMethod(PhpMethod::create("getAllBy" . ucfirst($id))->addParameter(PhpParameter::create($id)->setType("int"))->setVisibility("public")->setBody("return \$this->db->query(\"SELECT * FROM {$table} WHERE {$id} = :{$id}\", array(\":{$id}\" => \${$id}));"));
}
foreach ($nameFields as $name) {
foreach ($tableColums as $get) {
// If the fields match, skip it.. no reason to get/set allianceID where allianceID = allianceID
if ($get["Field"] == $name) {
continue;
}
// Skip the id field
if ($get["Field"] == "id") {
continue;
}
$class->setMethod(PhpMethod::create("get" . ucfirst($get["Field"]) . "By" . ucfirst($name))->addParameter(PhpParameter::create($name))->setVisibility("public")->setBody("return \$this->db->queryField(\"SELECT {$get["Field"]} FROM {$table} WHERE {$name} = :{$name}\", \"{$get["Field"]}\", array(\":{$name}\" => \${$name}));"));
}
}
foreach ($idFields as $id) {
foreach ($tableColums as $get) {
// If the fields match, skip it.. no reason to get/set allianceID where allianceID = allianceID
if ($get["Field"] == $id) {
continue;
}
// Skip the id field
if ($get["Field"] == "id") {
continue;
}
$class->setMethod(PhpMethod::create("get" . ucfirst($get["Field"]) . "By" . ucfirst($id))->addParameter(PhpParameter::create($id))->setVisibility("public")->setBody("return \$this->db->queryField(\"SELECT {$get["Field"]} FROM {$table} WHERE {$id} = :{$id}\", \"{$get["Field"]}\", array(\":{$id}\" => \${$id}));"));
}
}
// Update generator
foreach ($nameFields as $name) {
foreach ($tableColums as $get) {
// If the fields match, skip it.. no reason to get/set allianceID where allianceID = allianceID
if ($get["Field"] == $name) {
continue;
}
// Skip the id field
if ($get["Field"] == "id") {
continue;
}
$class->setMethod(PhpMethod::create("update" . ucfirst($get["Field"]) . "By" . ucfirst($name))->addParameter(PhpParameter::create($get["Field"]))->addParameter(PhpParameter::create($name))->setVisibility("public")->setBody("\$exists = \$this->db->queryField(\"SELECT {$get["Field"]} FROM {$table} WHERE {$name} = :{$name}\", \"{$get["Field"]}\", array(\":{$name}\" => \${$name}));\r\n if(!empty(\$exists)){\r\n \$this->db->execute(\"UPDATE {$table} SET {$get["Field"]} = :{$get["Field"]} WHERE {$name} = :{$name}\", array(\":{$name}\" => \${$name}, \":{$get["Field"]}\" => \${$get["Field"]}));}\r\n "));
}
}
foreach ($idFields as $id) {
foreach ($tableColums as $get) {
// If the fields match, skip it.. no reason to get/set allianceID where allianceID = allianceID
if ($get["Field"] == $id) {
continue;
}
// Skip the id field
if ($get["Field"] == "id") {
continue;
}
$class->setMethod(PhpMethod::create("update" . ucfirst($get["Field"]) . "By" . ucfirst($id))->addParameter(PhpParameter::create($get["Field"]))->addParameter(PhpParameter::create($id))->setVisibility("public")->setBody("\$exists = \$this->db->queryField(\"SELECT {$get["Field"]} FROM {$table} WHERE {$id} = :{$id}\", \"{$get["Field"]}\", array(\":{$id}\" => \${$id}));\r\n if(!empty(\$exists))\r\n {\r\n \$this->db->execute(\"UPDATE {$table} SET {$get["Field"]} = :{$get["Field"]} WHERE {$id} = :{$id}\", array(\":{$id}\" => \${$id}, \":{$get["Field"]}\" => \${$get["Field"]}));}\r\n "));
}
}
//.........这里部分代码省略.........
示例14: array
}
}
$new_translations = array();
foreach ($old_translations as $key => $vals) {
if ($key == $old_src) {
$new_translations[$key] = $new_src;
} else {
$new_translations[$key] = $key;
}
}
$change_template = null;
if (array_key_exists($module, $templates)) {
foreach ($templates[$module] as $basePath => $template_files) {
//basePath ends in en_US;
foreach ($template_files as $template_file) {
if (!prompt("Change template file {$template_file}?", $change_template)) {
continue;
}
$translations = $new_translations;
$new_template = translateTemplate($template_file);
if (false === $new_template) {
I2CE::raiseError("WARNING: Could not translate {$template_file}");
}
if (!trim($new_template)) {
//empty contents
continue;
}
file_put_contents($template_file, $new_template);
}
}
}
示例15: trim
if (!($res = $template->query('/I2CEConfiguration/metadata/version')) instanceof DOMNodeList || $res->length == 0) {
echo "\tVersion not found\n";
continue;
}
$versNode = $res->item(0);
$vers = trim($versNode->textContent);
$vers_comps = explode('.', $vers);
//first we check to see if the major/minor/fanastic versions match. if not,we don't update.
$exis_vers = implode('.', array_slice(array_pad($vers_comps, $bump_type + 1, 0), 0, $bump_type + 1));
if ($exis_vers != $check_vers) {
//if the base versions and e
if ($check_short_vers && I2CE_Validate::checkVersion($vers, 'greaterThan', $check_short_vers) && I2CE_Validate::checkVersion($vers, 'lessThan', $base_vers)) {
if (!array_key_exists($module, $always_update)) {
$always_update[$module] = null;
}
if (!prompt("Would you like to update {$module} from {$vers} to {$new_vers}?", $always_update[$module])) {
continue;
}
} else {
continue;
}
}
if ($file == $mod_file) {
echo "{$red}BUMPING{$black}: {$module} from " . trim($versNode->textContent) . " to {$new_vers}\n";
} else {
$locale = basename(dirname($file));
echo "{$red}BUMPING{$black}: {$module} localized to {$blue}{$locale}{$black} from " . trim($versNode->textContent) . " to {$new_vers}\n";
}
while ($versNode->hasChildNodes()) {
$versNode->removeChild($versNode->firstChild);
}