本文整理汇总了PHP中Parser::first_comma方法的典型用法代码示例。如果您正苦于以下问题:PHP Parser::first_comma方法的具体用法?PHP Parser::first_comma怎么用?PHP Parser::first_comma使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parser
的用法示例。
在下文中一共展示了Parser::first_comma方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* @access public
* @param commaId
* @param value
* @ParamType commaId
* @ParamType value
*/
public function update($commaId, $value)
{
$date = explode("/", $value);
$value = $date[2] . $date[1] . $date[0];
$query .= Parser::first_comma($commaId, ", ") . "{$this->name}='{$value}'";
return $query;
}
示例2: update
/**
* @access public
* @param commaId
* @param value
* @ParamType commaId
* @ParamType value
*/
public function update($commaId, $value)
{
if (empty($value)) {
$value = 0;
}
$query .= Parser::first_comma($commaId, ", ") . "{$this->name}='{$value}'";
return $query;
}
示例3: connect
/**
*
* (non-PHPdoc)
* @see baseType::connect()
* @access public
* @param entity_name
* @ParamType entity_name
*/
public function connect($entity_name)
{
$notNull = "";
if ($this->mandatory == MANDATORY) {
$notNull = "NOT NULL";
}
$query = Parser::first_comma("create" . $entity_name, ", ") . "{$this->name} {$this->type}({$this->length}) {$notNull}";
return $query;
}
示例4: update
/**
* @access public
* @param commaId
* @param value
* @ParamType commaId
* @ParamType value
*/
public function update($commaId, $value)
{
$date = explode("/", $value);
$value = $date[2] . "-" . $date[1] . "-" . $date[0] . " ";
$time = explode(":", $_REQUEST[$this->name . "_time"]);
$value .= $time[0] . ":" . $time[1] . ":00";
$query .= Parser::first_comma($commaId, ", ") . "{$this->name}='{$value}'";
return $query;
}
示例5: update
/**
* @access public
* @param commaId
* @param value
* @ParamType commaId
* @ParamType value
*/
public function update($commaId, $value)
{
if (empty($value)) {
$value = 0;
}
$query .= Parser::first_comma($commaId, ", ") . "{$this->name}='{$value}'";
$this->positions[$this->name]['index'] = $i;
$this->positions[$this->name]['all'] = $_REQUEST["{$this->name}_all"];
$this->positions[$this->name]['value'] = $value;
return $query;
}
示例6: connect
/**
*
* (non-PHPdoc)
* @see baseType::connect()
* @access public
* @param entity_name
* @ParamType entity_name
*/
public function connect($entity_name)
{
if ($this->primary_key) {
$query = Parser::first_comma("create" . $entity_name, ", ") . "{$this->name} INT UNSIGNED AUTO_INCREMENT";
} else {
$query = Parser::first_comma("create" . $entity_name, ", ") . "{$this->name} INT UNSIGNED NOT NULL";
}
/**
* The id type could be used as foreign key, in this case the AUTO_INCREMENT statement has to be omitted
*/
return $query;
}
示例7: build
/**
*
* (non-PHPdoc)
* @see FormWidget::build()
* @access public
* @param v
* @param preload
* @ParamType v
* @ParamType preload
*/
public function build($preload)
{
$content .= " <td valign=\"TOP\"></td>\n";
switch ($v['orientation']) {
case RIGHT:
$mainEntity = $this->form->entity->entity_1;
$secondaryEntity = $this->form->entity->entity_2;
break;
case LEFT:
$mainEntity =& $this->form->entity->entity_2;
$secondaryEntity =& $this->form->entity->entity_1;
break;
}
//setto i valori necessari in caso di gestione degli Rss
if ($this->form->mainFormEntity->rss) {
$query1 = "SELECT bc_channel.title FROM bc_channel\n\t\t\t\t\tLEFT JOIN channel_entity\n\t\t\t\t\tON bc_channel.id=channel_entity.id_bc_channel\n\t\t\t\t\tWHERE entity=\"{$this->form->mainFormEntity->name}\"";
$listChannel = Parser::getResultArray($query1, 'title');
if (!is_array($listChannel)) {
$listChannel = array();
}
$cont = count($listChannel);
$query1 = "SELECT modality FROM bc_rss_mod WHERE entity=\"{$this->form->mainFormEntity->name}\"";
$rssMod = Parser::getResultArray($query1, 'modality');
}
/* this fetches all the item which should be put into checkboxes */
$data = $secondaryEntity->getReferenceWithCondition($v['condition']);
$content .= "<td>\n";
#print_r($_REQUEST);
#echo "<hr>";
if ($this->form->entity->entity_2->owner and $v['orientation'] == RIGHT or $this->form->entity->entity_1->owner and $v['orientation'] == LEFT) {
$your = Message::getInstance()->getMessage(FIELDSET);
} else {
$your = "";
}
$id = uniqid(time());
if ($preload) {
$content .= "<fieldset><legend>{$your} {$v["label"]}</legend>\n";
if ($this->form->description != "") {
$content .= "{$this->form->description}<br/><br/>\n";
}
$content .= "<table width=\"90%\">";
$counter = 0;
if (count($data) > 0 and $data != "") {
$first = true;
$c = 0;
foreach ($data as $key => $value) {
$counter++;
if (isset($_REQUEST["{$v['name']}_{$value['value']}"])) {
if ($this->form->mainFormEntity->rss) {
if (in_array($value['text'], $listChannel)) {
switch ($rssMod[0]) {
case MOD3:
$content .= " <input class=\"clear\" type=\"checkbox\" name=\"{$v['name']}_{$value['value']}\" value=\"{$value['value']}\" CHECKED> {$value['text']}<br>\n";
break;
case MOD2:
$c++;
if ($first) {
$first = false;
$content .= " <input id=\"0\"class=\"clear\" type=\"checkbox\" name=\"rss_mod2\" value=\"0\" onClick=\"reload({$cont});\" CHECKED> " . Message::getInstance()->getMessage(RSS_MODALITY2_MSG) . "\n";
}
$content .= " <input id=\"{$c}\" style=\"display : none\" type=\"checkbox\" name=\"{$v['name']}_{$value['value']}\" value=\"{$value['value']}\" CHECKED>\n";
break;
case MOD1:
$content .= " <input style=\"display : none\" type=\"checkbox\" name=\"{$v['name']}_{$value['value']}\" value=\"{$value['value']}\" CHECKED>\n";
if ($first) {
$content .= Message::getInstance()->getMessage(RSS_MODALITY1_MSG);
$first = false;
}
break;
}
}
} else {
if ($counter % 2 == 1) {
$content .= Parser::first_comma($id, "</td></tr>");
$content .= "<tr><td>";
} else {
$content .= "</td><td>";
}
$name = "{$v['name']}_" . Parser::encode_name($value['value']);
$content .= " <input class=\"\" type=\"checkbox\" name=\"{$name}\" value=\"{$value['value']}\" CHECKED> {$value['text']}\n";
}
} else {
if ($this->form->mainFormEntity->rss) {
if (in_array($value['text'], $listChannel)) {
switch ($rssMod[0]) {
case MOD3:
$content .= " <input class=\"clear\" type=\"checkbox\" name=\"{$v['name']}_{$value['value']}\" value=\"{$value['value']}\"> {$value['text']}<br>\n";
break;
case MOD2:
$c++;
//.........这里部分代码省略.........
示例8: update
/**
* @access public
* @param commaId
* @param value
* @ParamType commaId
* @ParamType value
*/
public function update($commaId, $value)
{
if ($_REQUEST[$this->name . "_delete"]) {
$query .= Parser::first_comma($commaId, ", ") . "{$this->name}=''";
$query .= ", {$this->name}_filename=''";
$query .= ", {$this->name}_size=''";
$query .= ", {$this->name}_type=''";
} else {
if (is_uploaded_file($_FILES[$this->name]['tmp_name'])) {
$filename = $_FILES[$this->name]['name'];
$filesize = $_FILES[$this->name]['size'];
$filetype = $_FILES[$this->name]['type'];
$fp = fopen($_FILES[$this->name]['tmp_name'], "r");
$buffer = fread($fp, filesize($_FILES[$this->name]['tmp_name']));
if ($this->addslashes) {
$filename = addslashes($filename);
} else {
#$buffer = file_get_contents($_FILES[$this->name]['tmp_name']);
}
if (get_magic_quotes_gpc()) {
/*
Here instead of trim one should use stripslashes but doesn't work.
*/
$buffer = mysql_real_escape_string(trim($buffer));
} else {
/*
It could be that here something different is required.
*/
$buffer = mysql_real_escape_string(trim($buffer));
}
fclose($fp);
$query .= Parser::first_comma($commaId, ", ") . "{$this->name}='{$buffer}'";
$query .= ", {$this->name}_filename='{$filename}'";
$query .= ", {$this->name}_size='{$filesize}'";
$query .= ", {$this->name}_type='{$filetype}'";
}
}
return $query;
}
示例9: addYear
function addYear($name, $label, $start = -15, $end = 1)
{
$year = date("Y");
$values = "";
for ($y = $year + $start; $y <= $year + $end; $y++) {
if ($y == $year) {
$values .= Parser::first_comma($name, ",") . "{$y}:{$y}:CHECKED";
} else {
$values .= Parser::first_comma($name, ",") . "{$y}:{$y}";
}
}
$this->addSelect($name, $label, $values);
}
示例10: getEntityFields
function getEntityFields()
{
if ($this->debugmode) {
echo "<br> Entity::getEntityFields for {$this->entities[0]->name} instance";
}
$result = "";
$id = uniqid(time());
foreach ($this->entities[0]->fields as $field) {
if (ereg("_{Config::getInstance()->getConfigurations()['currentlanguage']}\$", $field->name)) {
$result .= Parser::first_comma($id, ", ");
$result .= "{$this->entity_name}.{$field->name} AS {$this->entity_name}_";
$result .= substr($field->name, 0, strlen($field->name) - 3);
} else {
switch ($field->type) {
case FILE:
$result .= Parser::first_comma($id, ", ");
$result .= "{$this->entity_name}.{$field->name}_filename AS {$this->entity_name}_{$field->name}_filename";
$result .= Parser::first_comma($id, ", ");
$result .= "{$this->entity_name}.{$field->name}_size AS {$this->entity_name}_{$field->name}_size";
$result .= Parser::first_comma($id, ", ");
$result .= "{$this->entity_name}.{$field->name}_type AS {$this->entity_name}_{$field->name}_type";
break;
default:
$result .= Parser::first_comma($id, ", ");
$result .= "\n";
$result .= "{$this->entity_name}.{$field->name} AS {$this->entity_name}_{$field->name}";
break;
}
}
}
if (is_array($this->join_entities_2)) {
foreach ($this->join_entities_2 as $name) {
$join_entities[$name][] = true;
if (count($join_entities[$name]) == 1) {
$postfix = "";
} else {
$postfix = "_" . count($join_entities[$name]);
}
$entity = DB::getInstance()->getEntityByName($name);
foreach ($entity->fields as $field) {
if (ereg("_{Config::getInstance()->getConfigurations()['currentlanguage']}\$", $field->name)) {
$result .= Parser::first_comma($id, ", ");
$result .= "{$entity->name}.{$field->name} AS {$entity->name}{$postfix}_";
$result .= substr($field->name, 0, strlen($field->name) - 3);
} else {
switch ($field->type) {
case FILE:
$result .= Parser::first_comma($id, ", ");
$result .= "{$entity->name}{$postfix}.{$field->name}_filename AS {$entity->name}{$postfix}_{$field->name}_filename";
$result .= Parser::first_comma($id, ", ");
$result .= "{$entity->name}{$postfix}.{$field->name}_size AS {$entity->name}{$postfix}_{$field->name}_size";
$result .= Parser::first_comma($id, ", ");
$result .= "{$entity->name}{$postfix}.{$field->name}_type AS {$entity->name}{$postfix}_{$field->name}_type";
break;
default:
$result .= Parser::first_comma($id, ", ");
$result .= "\n";
$result .= "{$entity->name}{$postfix}.{$field->name} AS {$entity->name}{$postfix}_{$field->name}";
break;
}
#$result .= "{$entity->name}.{$field['name']} AS {$entity->name}_{$field['name']}";
}
}
}
}
return $result;
}
示例11: administrationmenu
function administrationmenu($name, $data, $pars)
{
$content = "";
#$content .= "<div id=\"administrationMenu\">\n";
$content .= "<ul id=\"adminMenu\">\n";
if (is_array($_SESSION['user']['services'])) {
foreach ($_SESSION['user']['services'] as $service) {
if ($service['visible'] == "*") {
$items[$service['script']] = $service;
}
}
$category = "";
$first_one = false;
foreach ($items as $v) {
if ($category != $v['category']) {
$content .= Parser::first_comma("hiermenu", "</ul>\n</li>\n");
$content .= "<li><strong>{$v['category']}</strong>";
$content .= "<ul>\n";
$category = $v['category'];
}
if (ereg("manager", $v['script'])) {
$content .= "<li><a href=\"{$v['script']}?action=report\">{$v['serviceName']}</a> <a href=\"{$v['script']}?action=emit\" title=\"Add\"><img src=\"img/add.png\"></a></li>\n";
} else {
$content .= "<li><a href=\"{$v['script']}\">{$v['serviceName']}</a></li>\n";
}
}
}
$content .= "</ul></ul>\n";
#$content .= "</div>\n";
#$content .= "<div id=\"administrationMenuBottom\"></div>\n";
return $content;
}
示例12: insertItem
/**
* @access public
*/
public function insertItem()
{
if ($this->debugmode) {
echo "<br> Entity::insertItem for {$this->name} instance";
}
/**
* called only from logs
*/
$id = md5(uniqid(mt_rand()));
$query = "INSERT INTO {$this->name} VALUES(";
$args = func_get_args();
if (is_array($args[0])) {
foreach ($this->fields as $k => $field) {
switch ($field->type) {
case FILE:
$query .= Parser::first_comma("{$id}", ", ") . "'{$args[0][$field->name]}'";
$query .= Parser::first_comma("{$id}", ", ") . "'" . $args[0][$field->name . "_filename"] . "'";
$query .= Parser::first_comma("{$id}", ", ") . "'" . $args[0][$field->name . "_size"] . "'";
$query .= Parser::first_comma("{$id}", ", ") . "'" . $args[0][$field->name . "_type"] . "'";
break;
default:
$query .= Parser::first_comma("{$id}", ", ") . "'{$args[0][$field->name]}'";
break;
}
}
} else {
foreach ($args as $k => $field) {
$query .= Parser::first_comma("{$id}", ", ") . "'{$field}'";
}
}
$query .= ")";
$oid = mysql_query($query);
if (!$oid) {
if (mysql_errno() != "1062") {
if (mysql_errno() == "1136") {
echo Message::getInstance()->getMessage(MSG_ERROR_DATABASE_INIT) . " {$this->name} " . " (" . basename(__FILE__) . ":" . __LINE__ . ")";
exit;
}
} else {
echo Message::getInstance()->getMessage(MSG_ERROR_DATABASE_PRESENTATION) . " {$this->name} " . " (" . basename(__FILE__) . ":" . __LINE__ . ")";
exit;
}
}
}
示例13: generateSelectQueryPart
/**
*
* This method generates the specific where condition for the basetype
*
*
*
* @access public
* @param where_value
* @param entity_name
* @param commaId
* @ParamType where_value
* @ParamType entity_name
* @ParamType commaId
*/
public function generateSelectQueryPart($where_value, $entity_name, $commaId, $postfix = "", $conditionType = "AND")
{
if ($postfix != "") {
$postfix_string = "{$postfix}";
} else {
$postfix_string = "";
}
$where_value = mysql_real_escape_string($where_value);
$query = Parser::first_comma("select" . $commaId, "{$conditionType} ") . "{$entity_name}{$postfix_string}.{$this->name} = '{$where_value}' ";
return $query;
}
示例14: update
/**
* @access public
* @param commaId
* @param value
* @ParamType commaId
* @ParamType value
*/
public function update($commaId, $value)
{
if ($_REQUEST[$this->name . "_delete"]) {
if (file_exists("{Config::getInstance()->getConfigurations()['upload_folder']}/{$_REQUEST[$this->name . "_reference"]}")) {
unlink("{Config::getInstance()->getConfigurations()['upload_folder']}/{$_REQUEST[$this->name . "_reference"]}");
}
$query .= Parser::first_comma($commaId, ", ") . "{$this->name}_reference = ''";
$query .= ", {$this->name}_filename = ''";
$query .= ", {$this->name}_size = ''";
$query .= ", {$this->name}_type = ''";
} else {
if (is_uploaded_file($_FILES[$this->name]['tmp_name'])) {
if ($_REQUEST[$this->name . "_reference"] != "") {
if (file_exists("{Config::getInstance()->getConfigurations()['upload_folder']}/{$_REQUEST[$this->name . "_reference"]}")) {
unlink("{Config::getInstance()->getConfigurations()['upload_folder']}/{$_REQUEST[$this->name . "_reference"]}");
}
}
$filename_local = md5(uniqid(time()));
$filename = $_FILES[$this->name]['name'];
$filesize = $_FILES[$this->name]['size'];
$filetype = $_FILES[$this->name]['type'];
if (ereg("\\.([[:alnum:]]*)\$", $filename, $token)) {
if (isset($this['exts'][$token[1]])) {
if ($this['exts'][$token[1]] == AUTO) {
$extension = ".{$token[1]}";
} else {
$extension = ".{$this['exts'][$token[1]]}";
}
} else {
$extension = "";
}
}
$filename_local = $filename_local . $extension;
$config = Config::getInstance()->getConfigurations();
move_uploaded_file($_FILES[$this->name]['tmp_name'], $config['upload_folder'] . "/{$filename_local}");
if ($this->addslashes) {
$filename = addslashes($filename);
}
$query .= Parser::first_comma($commaId, ", ") . "{$this->name}_reference='{$filename_local}'";
$query .= ", {$this->name}_filename='{$filename}'";
$query .= ", {$this->name}_size='{$filesize}'";
$query .= ", {$this->name}_type='{$filetype}'";
}
}
return $query;
}
示例15: update
/**
* @access public
* @param commaId
* @param value
* @ParamType commaId
* @ParamType value
*/
public function update($commaId, $value)
{
if ($_REQUEST[$this->name . "_delete"]) {
$query .= Parser::first_comma($commaId, ", ") . "{$this->name}=''";
$query .= ", {$this->name}_thumb=''";
$query .= ", {$this->name}_filename=''";
$query .= ", {$this->name}_size=''";
$query .= ", {$this->name}_type=''";
} else {
if (is_uploaded_file($_FILES[$this->name]['tmp_name'])) {
$filename = $_FILES[$this->name]['name'];
$filesize = $_FILES[$this->name]['size'];
$filetype = $_FILES[$this->name]['type'];
$fp = fopen($_FILES[$this->name]['tmp_name'], "r");
$buffer = fread($fp, filesize($_FILES[$this->name]['tmp_name']));
if ($this->addslashes) {
$filename = addslashes($filename);
} else {
#$buffer = file_get_contents($_FILES[$this->name]['tmp_name']);
}
if (get_magic_quotes_gpc()) {
/*
Here instead of trim one should use stripslashes but doesn't work.
*/
$buffer = mysql_real_escape_string(trim($buffer));
} else {
/*
It could be that here something different is required.
*/
$buffer = mysql_real_escape_string(trim($buffer));
}
fclose($fp);
/* ** */
#list($width, $height) = getimagesize($_FILES[$this->name]['tmp_name']);
$newwidth = 100;
// $width * $percent;
$newheight = 100;
//$height * $percent;
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($_FILES[$this->name]['tmp_name']);
// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($thumb, $_FILES[$this->name]['tmp_name']);
$fp = fopen($_FILES[$this->name]['tmp_name'], "r");
$buffer_thumb = fread($fp, filesize($_FILES[$this->name]['tmp_name']));
/* ** */
$query .= Parser::first_comma($commaId, ", ") . "{$this->name}='{$buffer}'";
$query .= ", {$this->name}_thumb='{$buffer_thumb}}'";
$query .= ", {$this->name}_filename='{$filename}'";
$query .= ", {$this->name}_size='{$filesize}'";
$query .= ", {$this->name}_type='{$filetype}'";
}
}
return $query;
}