本文整理汇总了PHP中JCckPluginField::g_onCCK_FieldPrepareStore方法的典型用法代码示例。如果您正苦于以下问题:PHP JCckPluginField::g_onCCK_FieldPrepareStore方法的具体用法?PHP JCckPluginField::g_onCCK_FieldPrepareStore怎么用?PHP JCckPluginField::g_onCCK_FieldPrepareStore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JCckPluginField
的用法示例。
在下文中一共展示了JCckPluginField::g_onCCK_FieldPrepareStore方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onCCK_FieldPrepareStore
public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
// Init
if (count($inherit)) {
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$name = $field->name;
}
// Validate
parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
// Set or Return
if ($return === true) {
return $value;
}
$field->value = $value;
parent::g_onCCK_FieldPrepareStore($field, $name, $value, $config);
}
示例2: onCCK_FieldPrepareStore
public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
// Init
if (count($inherit)) {
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
$xk = isset($inherit['xk']) ? $inherit['xk'] : -1;
$value = isset($inherit['post']) ? $inherit['post'][$name . '_hidden'] : @$config['post'][$name . '_hidden'];
} else {
$name = $field->name;
$xk = -1;
$value = @$config['post'][$name . '_hidden'];
}
if (is_array($value)) {
$value = trim($value[$xk]);
}
$options2 = JCckDev::fromJSON($field->options2);
$options2['storage_format'] = isset($options2['storage_format']) ? $options2['storage_format'] : '0';
$value = $options2['storage_format'] == '0' ? $value : strtotime($value);
// Validate
parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
// Set or Return
if ($return === true) {
return $value;
}
$field->value = $value;
parent::g_onCCK_FieldPrepareStore($field, $name, $value, $config);
}
示例3: onCCK_FieldPrepareStore
public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
// Init
if (count($inherit)) {
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$name = $field->name;
}
$doTranslation = $config['doTranslation'];
if ($config['doTranslation']) {
$config['doTranslation'] = $field->bool8;
}
// Prepare
$divider = $field->divider != '' ? $field->divider : ',';
if ($divider) {
$nb = count($value);
if (is_array($value) && $nb > 0) {
$value = implode($divider, $value);
}
}
// Validate
$text = parent::g_getOptionText($value, $field->options, $divider, $config);
$config['doTranslation'] = $doTranslation;
parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
// Set or Return
if ($return === true) {
return $value;
}
$field->text = $text;
$field->value = $value;
parent::g_onCCK_FieldPrepareStore($field, $name, $value, $config);
}
示例4: onCCK_FieldPrepareStore
public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
// Init
if (count($inherit)) {
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$name = $field->name;
}
$options2 = JCckDev::fromJSON($field->options2);
$siteName = JFactory::getConfig()->get('sitename');
$valid = 0;
$send = isset($options2['send']) && $field->state != 'disabled' ? $options2['send'] : 0;
$send_field = isset($options2['send_field']) && strlen($options2['send_field']) > 0 ? $options2['send_field'] : 0;
$isNew = $config['pk'] ? 0 : 1;
$sender = 0;
switch ($send) {
case 0:
$sender = 0;
break;
case 1:
if (!$config['pk']) {
$sender = 1;
}
break;
case 2:
if ($config['pk']) {
$sender = 1;
}
break;
case 3:
$sender = 1;
break;
}
$subject = isset($options2['subject']) && $options2['subject'] ? $options2['subject'] : $siteName . '::' . JText::_('COM_CCK_EMAIL_GENERIC_SUBJECT');
$message = isset($options2['message']) && $options2['message'] ? htmlspecialchars_decode($options2['message']) : JText::sprintf('COM_CCK_EMAIL_GENERIC_MESSAGE', $siteName);
$message = strlen($options2['message']) > 0 ? htmlspecialchars_decode($options2['message']) : JText::sprintf('COM_CCK_EMAIL_GENERIC_MESSAGE', $siteName);
$new_message = strlen($options2['message_field']) > 0 ? $options2['message_field'] : '';
$dest = array();
$from = isset($options2['from']) ? $options2['from'] : 0;
$from_param = isset($options2['from_param']) ? $options2['from_param'] : '';
$from_name = isset($options2['from_name']) ? $options2['from_name'] : 0;
$from_name_param = isset($options2['from_name_param']) ? $options2['from_name_param'] : '';
$cc = isset($options2['cc']) ? $options2['cc'] : 0;
$cc_param = isset($options2['cc_param']) ? $options2['cc_param'] : '';
$bcc = isset($options2['bcc']) ? $options2['bcc'] : 0;
$bcc_param = isset($options2['bcc_param']) ? $options2['bcc_param'] : '';
$moredest = isset($options2['to_field']) ? $options2['to_field'] : '';
$send_attach = isset($options2['send_attachment_field']) && strlen($options2['send_attachment_field']) > 0 ? $options2['send_attachment_field'] : 1;
$moreattach = isset($options2['attachment_field']) && strlen($options2['attachment_field']) > 0 ? $options2['attachment_field'] : '';
// Prepare
if ($options2['to'] != '') {
$to = self::_split($options2['to']);
$dest = array_merge($dest, $to);
$valid = 1;
}
if ($moredest) {
$valid = 1;
}
if ($options2['to_admin'] != '') {
$to_admin = count($options2['to_admin']) ? implode(',', $options2['to_admin']) : $options2['to_admin'];
if (strpos($to_admin, ',') !== false) {
$recips = explode(',', $to_admin);
foreach ($recips as $recip) {
$recip_mail = JCckDatabase::loadResult('SELECT email FROM #__users WHERE block=0 AND id=' . $recip);
if ($recip_mail) {
$dest[] = $recip_mail;
$valid = 1;
}
}
} else {
$recip_mail = JCckDatabase::loadResult('SELECT email FROM #__users WHERE block=0 AND id=' . $to_admin);
if ($recip_mail) {
$dest[] = $recip_mail;
$valid = 1;
}
}
}
if ($value) {
// if () TODO check multiple
$m_value = self::_split($value);
$m_value_size = count($m_value);
if ($m_value_size > 1) {
for ($i = 0; $i < $m_value_size; $i++) {
$dest[] = $m_value[$i];
}
} else {
$dest[] = $value;
}
$valid = 1;
}
// Validate
parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
// Add Process
if (($sender || $send_field) && $valid) {
parent::g_addProcess('afterStore', self::$type, $config, array('isNew' => $isNew, 'sender' => $sender, 'send_field' => $send_field, 'name' => $name, 'valid' => $valid, 'subject' => $subject, 'message' => $message, 'new_message' => $new_message, 'dest' => $dest, 'from' => $from, 'from_param' => $from_param, 'from_name' => $from_name, 'from_name_param' => $from_name_param, 'cc' => $cc, 'cc_param' => $cc_param, 'bcc' => $bcc, 'bcc_param' => $bcc_param, 'moredest' => $moredest, 'send_attach' => $send_attach, 'moreattach' => $moreattach, 'format' => @(string) $options2['format']));
}
// Set or Return
//.........这里部分代码省略.........
示例5: onCCK_FieldPrepareStore
public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
// Init
if (count($inherit)) {
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$name = $field->name;
}
// Validate
parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
if ($field->state != 'disabled') {
parent::g_addProcess('afterStore', self::$type, $config, array('name' => $field->storage_field2 ? $field->storage_field2 : $field->storage_field, 'value' => $value));
}
// Set or Return
if ($return === true) {
return $value;
}
if ($value > 0) {
$field->text = JCckDatabase::loadResult('SELECT title FROM ' . self::$table . ' WHERE id =' . (int) $value);
}
$field->value = $value;
parent::g_onCCK_FieldPrepareStore($field, $name, $value, $config);
}
示例6: onCCK_FieldPrepareStore
public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
// Init
if (count($inherit)) {
$xk = isset($inherit['xk']) ? $inherit['xk'] : -1;
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
$itemLink = isset($inherit['post']) ? $inherit['post'][$name] : @$config['post'][$name][$xk];
$itemText = isset($inherit['post']) ? @$inherit['post'][$name . '_text'] : @$config['post'][$name . '_text'][$xk];
$itemClass = isset($inherit['post']) ? @$inherit['post'][$name . '_class'] : @$config['post'][$name . '_class'][$xk];
$itemTarget = isset($inherit['post']) ? @$inherit['post'][$name . '_target'] : @$config['post'][$name . '_target'][$xk];
} else {
$name = $field->name;
$itemLink = @$config['post'][$name];
$itemText = @$config['post'][$name . '_text'];
$itemClass = @$config['post'][$name . '_class'];
$itemTarget = @$config['post'][$name . '_target'];
}
// Validate
$value = $itemLink;
$value = str_replace(array('<', '>', '"'), '', $value);
parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
$value = array_filter(array('link' => $itemLink, 'text' => $itemText, 'class' => $itemClass, 'target' => $itemTarget));
if (count($value) > 0 && ($value['link'] || $value['text'])) {
$value = JCckDev::toJSON($value);
} else {
$value = NULL;
}
// Set or Return
if ($return === true) {
return $value;
}
$field->value = $value;
parent::g_onCCK_FieldPrepareStore($field, $name, $value, $config);
}
示例7: onCCK_FieldPrepareStore
public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
// Init
if (count($inherit)) {
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$name = $field->name;
}
$divider = '';
$value2 = '';
// Prepare
if ($field->bool3) {
// Set Multiple
$divider = $field->divider != '' ? $field->divider : ',';
if ($divider) {
$nb = count($value);
if (is_array($value) && $nb > 0) {
$value = implode($divider, $value);
}
}
}
/* tmp */
$jtext = $config['doTranslation'];
$config['doTranslation'] = 0;
/* tmp */
$options2 = JCckDev::fromJSON($field->options2);
self::_languageDetection($lang_code, $value2, $options2);
$options_2 = self::_getOptionsList($options2, $field->bool2, $lang_code);
$field->options = $field->options ? $field->options . '||' . $options_2 : $options_2;
// Validate
$text = parent::g_getOptionText($value, $field->options, $divider, $config);
parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
/* tmp */
$config['doTranslation'] = $jtext;
/* tmp */
// Set or Return
if ($return === true) {
return $value;
}
$field->text = $text;
$field->value = $value;
parent::g_onCCK_FieldPrepareStore($field, $name, $value, $config);
}
示例8: onCCK_FieldPrepareStore
//.........这里部分代码省略.........
$unit_prod = 1000;
break;
case '2':
$unit_prod = 1000000;
break;
default:
$unit_prod = 1;
break;
}
$maxsize = floatval($options2['max_size']) * $unit_prod;
$filename = JFile::stripExt($userfile['name']);
$userfile['name'] = str_replace($filename, JCckDev::toSafeSTRING($filename, JCck::getConfig_Param('media_characters', '-'), JCck::getConfig_Param('media_case', 0)), $userfile['name']);
if (!$maxsize || $maxsize && $userfile['size'] < $maxsize) {
if ($userfile && $userfile['name'] && $userfile['tmp_name']) {
$ImageCustomName = $userfile['name'];
$ImageCustomPath = '';
if (@$options2['custom_path']) {
if (strrpos($imageCustomDir, '.') === false) {
$ImageCustomPath = $imageCustomDir == '' ? substr($itemPath, 0, strrpos($itemPath, '/') + 1) : ($imageCustomDir[strlen($imageCustomDir) - 1] == '/' ? $imageCustomDir : $imageCustomDir . '/');
} else {
$ImageCustomPath = substr($itemPath, 0, strrpos($itemPath, '/') + 1);
}
}
if (count($legal_ext)) {
$old_legal = strrpos($userfile['name'], '.') ? substr($userfile['name'], strrpos($userfile['name'], '.') + 1) : '';
$legal = $ImageCustomName == $userfile['name'] ? $old_legal : substr($ImageCustomName, strrpos($ImageCustomName, '.') + 1);
if ($old_legal && array_search($old_legal, $legal_ext) === false) {
JFactory::getApplication()->enqueueMessage($ImageCustomName . ' - ' . JText::_('COM_CCK_ERROR_LEGAL_EXTENSIONS'), 'notice');
$field->error = true;
} else {
if (trim($legal) != trim($old_legal)) {
$ImageCustomName .= '.' . trim($old_legal);
}
}
}
$file_path = $ImageCustomPath ? $ImageCustomPath : $options2['path'];
$current_user = JFactory::getUser();
$current_user_id = $current_user->id;
if (strpos($file_path, '/' . $current_user_id . '/') === false) {
$file_path .= $options2['path_user'] && $current_user_id ? $current_user_id . '/' : '';
}
if (strpos($file_path, '/' . $config['pk'] . '/') === false) {
$file_path .= $options2['path_content'] && $config['pk'] > 0 ? $config['pk'] . '/' : '';
}
$value = $file_path . $ImageCustomName;
$process = true;
} else {
if ($deleteBox == 1) {
$imageTitle = '';
$imageDesc = '';
}
if ($imageCustomDir != '' && strrpos($imageCustomDir, '.') > 0 && JFile::exists(JPATH_SITE . '/' . $imageCustomDir)) {
if (count($legal_ext)) {
$legal = strrpos($imageCustomDir, '.') ? substr($imageCustomDir, strrpos($imageCustomDir, '.') + 1) : '';
if ($legal && array_search($legal, $legal_ext) === false) {
JFactory::getApplication()->enqueueMessage($imageCustomDir . ' - ' . JText::_('COM_CCK_ERROR_LEGAL_EXTENSIONS'), 'notice');
$field->error = true;
}
}
$value = $imageCustomDir;
} else {
if ($userfile['name']) {
JFactory::getApplication()->enqueueMessage(JText::_('COM_CCK_ERROR_INVALID_FILE'), "error");
$field->error = true;
}
if ($options2['path'] == $itemPath) {
$value = '';
} else {
if ($xk != -1 && !$array_x) {
$value = $itemPath == $options2['path'] ? '' : $itemPath;
} else {
$value = $itemPath;
}
}
}
}
} else {
JFactory::getApplication()->enqueueMessage($userfile['name'] . ' - ' . JText::_('COM_CCK_ERROR_MAX_SIZE'), 'notice');
$field->error = true;
}
// Validate
parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
if (isset($field->error) && $field->error === true) {
return;
}
$imageTitle = $imageTitle ? addcslashes($imageTitle, '"') : '';
$imageDesc = $imageDesc ? addcslashes($imageDesc, '"') : '';
// Add Process
if ($process === true) {
$content_folder = $options2['path_content'] ? $options2['path_content'] : 0;
$process_params = array('field_name' => $name, 'true_name' => $field->name, 'array_x' => $array_x, 'parent_name' => $parent, 'field_type' => $field->type, 'file_path' => $file_path, 'file_name' => $ImageCustomName, 'tmp_name' => $userfile['tmp_name'], 'xi' => $xi, 'content_folder' => $content_folder, 'options2' => $options2, 'storage' => $field->storage, 'storage_field' => $field->storage_field, 'storage_field2' => $field->storage_field2 ? $field->storage_field2 : $field->name, 'storage_table' => $field->storage_table, 'file_title' => $imageTitle, 'file_descr' => $imageDesc);
parent::g_addProcess('afterStore', self::$type, $config, $process_params);
}
$value = !$options2['multivalue_mode'] || $imageTitle == '' && $imageDesc == '' ? $value : '{"image_location":"' . $value . '","image_title":"' . $imageTitle . '","image_description":"' . $imageDesc . '"}';
if ($return === true) {
return $value;
}
$field->value = $value;
parent::g_onCCK_FieldPrepareStore($field, $name, $value, $config);
}
示例9: onCCK_FieldPrepareStore
public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
// Init
if (count($inherit)) {
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$name = $field->name;
}
$doTranslation = $config['doTranslation'];
if ($config['doTranslation']) {
$config['doTranslation'] = $field->bool8;
}
// Validate
$text = parent::g_getOptionText($value, $field->options, '', $config);
$config['doTranslation'] = $doTranslation;
parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
// Set or Return
// $field->text = $text;
// $field->value = $value;
if ($return === true) {
return $value;
}
$field->text = $text;
//todo: move up
$field->value = $value;
//todo: move up
parent::g_onCCK_FieldPrepareStore($field, $name, $value, $config);
}
示例10: onCCK_FieldPrepareStore
public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
// Init
if (count($inherit)) {
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
} else {
$name = $field->name;
}
// Prepare
$options2 = JCckDev::fromJSON($field->options2);
if (isset($options2['preparestore']) && $options2['preparestore'] != '') {
$value = self::_eval($options2['preparestore'], 'value', $field, $value, $name, $id, $config);
}
// Validate
parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
// Set or Return
if ($return === true) {
return $value;
}
$field->value = $value;
parent::g_onCCK_FieldPrepareStore($field, $name, $value, $config);
}