本文整理汇总了PHP中UTIL_String::arrayToDelimitedString方法的典型用法代码示例。如果您正苦于以下问题:PHP UTIL_String::arrayToDelimitedString方法的具体用法?PHP UTIL_String::arrayToDelimitedString怎么用?PHP UTIL_String::arrayToDelimitedString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UTIL_String
的用法示例。
在下文中一共展示了UTIL_String::arrayToDelimitedString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
public function upload()
{
if (!OW::getUser()->isAuthorized('ivideo', 'add')) {
$this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCtrlViewDir() . 'authorization_failed.html');
return;
}
$eventParams = array('pluginKey' => 'ivideo', 'action' => 'upload_video');
$credits = OW::getEventManager()->call('usercredits.check_balance', $eventParams);
if ($credits === false) {
$this->assign('authMsg', OW::getEventManager()->call('usercredits.error_message', $eventParams));
return;
} else {
$this->assign('authMsg', null);
}
$language = OW::getLanguage();
$config = OW::getConfig();
$uploadForm = new Form('uploadForm');
$uploadForm->setId('THEFORM');
$uploadForm->setEnctype('multipart/form-data');
$element = new TextField('videoName');
$element->setRequired(true);
$element->addValidator(new uploadValidator());
$element->setLabel($language->text('ivideo', 'upload_video_name'));
$uploadForm->addElement($element);
$element = new WysiwygTextarea('videoDescription');
$element->setRequired(true);
$element->setLabel($language->text('ivideo', 'upload_video_desc'));
$uploadForm->addElement($element);
$element = new Selectbox('videoCategory');
$element->setRequired(true);
$element->setLabel($language->text('ivideo', 'admin_video_category'));
foreach (IVIDEO_BOL_CategoryDao::getInstance()->findAll() as $category) {
$element->addOption($category->id, $category->name);
}
$uploadForm->addElement($element);
$tagService = BOL_TagService::getInstance();
$tf = new TagsField('tf');
$tf->setLabel($language->text('ivideo', 'tags_field_label'));
$uploadForm->addElement($tf);
$element = new Submit('uploadVideo');
$element->setValue($language->text('ivideo', 'user_upload_video'));
$uploadForm->addElement($element);
if (OW::getRequest()->isPost()) {
if ($uploadForm->isValid($_POST) && isset($_POST['ax-uploaded-files'])) {
$values = $uploadForm->getValues();
$fileName = OW::getSession()->get('ivideo.filename');
if (is_null($fileName)) {
OW::getFeedback()->error($language->text('ivideo', 'admin_video_not_uploaded_error'));
} else {
$video = new IVIDEO_BOL_Video();
$video->name = ucwords(UTIL_HtmlTag::stripTags($values['videoName']));
$description = UTIL_HtmlTag::stripJs($values['videoDescription']);
$description = UTIL_HtmlTag::stripTags($description, array('frame', 'style'), array(), true);
$video->description = $description;
$video->owner = OW::getuser()->getId();
$video->timestamp = time();
$video->status = $config->getValue('ivideo', 'videoApproval') == 'auto' ? 'approved' : 'pending';
$video->filename = $fileName;
$videoId = IVIDEO_BOL_Service::getInstance()->addVideo($video);
if ($videoId) {
$fullFileName = OW::getPluginManager()->getPlugin('ivideo')->getUserFilesDir() . $fileName;
$imageFileName = OW::getPluginManager()->getPlugin('ivideo')->getUserFilesDir() . $fileName . ".png";
$ffmpegPath = $config->getValue('ivideo', 'ffmpegPath');
if (!empty($ffmpegPath) && file_exists($ffmpegPath)) {
exec("{$ffmpegPath} -y -itsoffset -4 -i '{$fullFileName}' -r 1 -f image2 '{$imageFileName}'");
}
IVIDEO_BOL_VideoCategoryService::getInstance()->setVideoCategories($videoId, $values['videoCategory']);
BOL_TagService::getInstance()->updateEntityTags($video->id, 'ivideo-video', TagsField::getTags($values['tf']));
$event = new OW_Event('feed.action', array('pluginKey' => 'ivideo', 'entityType' => 'ivideo-comments', 'entityId' => $video->id, 'userId' => $video->owner));
OW::getEventManager()->trigger($event);
$this->redirect(OW::getRouter()->urlForRoute('ivideo_view_list', array('type' => 'latest')));
OW::getFeedback()->info($language->text('ivideo', 'admin_upload_video_ok'));
} else {
OW::getFeedback()->error($language->text('ivideo', 'admin_upload_video_fail'));
}
}
}
}
$this->addForm($uploadForm);
if (OW::getSession()->isKeySet('ivideo.filename')) {
OW::getSession()->delete('ivideo.filename');
}
$jsURL = OW::getPluginManager()->getPlugin('ivideo')->getStaticUrl() . 'ajaxupload' . '/';
$this->assign('filesDir', json_encode(OW::getPluginManager()->getPlugin('ivideo')->getUserFilesDir()));
$this->assign('uploadAction', json_encode(OW::getRouter()->urlFor('IVIDEO_CTRL_Upload', 'action')));
$this->assign('maxSize', $config->getValue('ivideo', 'allowedFileSize'));
$this->assign('allowedExtn', UTIL_String::arrayToDelimitedString(explode(",", $config->getValue('ivideo', 'allowedExtensions')), ",", "'", "'"));
$this->assign('allowedExtnText', UTIL_String::arrayToDelimitedString(explode(",", $config->getValue('ivideo', 'allowedExtensions')), ","));
$this->assign('flashURL', $jsURL);
$this->assign('videoApproval', $config->getValue('ivideo', 'videoApproval'));
$theme = $config->getValue('ivideo', 'theme');
OW::getDocument()->addStyleSheet($jsURL . 'css/' . $theme . '/style.css');
OW::getDocument()->addScript($jsURL . "js/ajaxupload-min.js");
$this->setPageHeading(OW::getLanguage()->text('ivideo', 'video_user_upload'));
$this->setPageTitle(OW::getLanguage()->text('ivideo', 'video_user_upload'));
$this->setPageHeadingIconClass('ow_ic_video');
}
示例2: batchInsertOrUpdateObjectList
public function batchInsertOrUpdateObjectList($tableName, $objects, $batchSize = 50)
{
if ($objects != null && is_array($objects)) {
if (count($objects) > 0) {
$columns = '';
$paramNames = array();
if (is_object($objects[0])) {
$params = get_object_vars($objects[0]);
$paramNames = array_keys($params);
$columns = UTIL_String::arrayToDelimitedString($paramNames, ',', '`', '`');
} else {
throw new InvalidArgumentException('Array of objects expected');
}
$i = 0;
$totalInsertsCount = 0;
$objectsCount = count($objects);
$batchSize = (int) $batchSize;
$inserts = array();
foreach ($objects as $obj) {
$values = '(';
foreach ($paramNames as $property) {
if ($obj->{$property} !== null) {
$values .= '\'' . $this->escapeString($obj->{$property}) . '\',';
} else {
$values .= 'NULL,';
}
}
$values = mb_substr($values, 0, mb_strlen($values) - 1);
$values .= ')';
$inserts[] = $values;
$i++;
$totalInsertsCount++;
if ($i === $batchSize || $totalInsertsCount === $objectsCount) {
$sql = "REPLACE INTO `{$tableName}` ({$columns}) VALUES" . implode(',', $inserts);
$inserts = array();
$i = 0;
$this->execute($sql)->closeCursor();
//$this->connection->query($sql)->closeCursor();
}
}
}
} else {
throw new InvalidArgumentException('Array expected');
}
}
示例3: calendar
public function calendar()
{
$language = OW::getLanguage();
$config = OW::getConfig();
if (!OW::getUser()->isAuthorized('eventx', 'view_event') && !OW::getUser()->isAuthorized('eventx')) {
$this->assign('authErrorText', $language->text('event', 'event_view_permission_error_message'));
return;
}
$eventsCount = (int) $config->getValue('eventx', 'eventsCount');
$showPast = $config->getValue('eventx', 'showPastEvents') == '1' ? true : false;
$events = $this->eventService->findPublicEvents(null, $eventsCount, $showPast);
$resultArray = array();
foreach ($events as $eventItem) {
$resultArray[$eventItem->getId()] = array('title' => addslashes(UTIL_String::truncate(strip_tags($eventItem->getTitle()), 80, "...")), 'startTimeStamp' => date("Y-m-d H:i:s", $eventItem->startTimeStamp), 'endTimeStamp' => date("Y-m-d H:i:s", $eventItem->endTimeStamp), 'endDateFlag' => $eventItem->endDateFlag, 'eventUrl' => OW::getRouter()->urlForRoute('eventx.view', array('eventId' => $eventItem->getId())));
}
$this->assign('events', $resultArray);
$this->assign('openLinksType', $config->getValue('eventx', 'openLinksType'));
$this->assign('isRTLLanguage', $config->getValue('eventx', 'isRTLLanguage'));
$this->assign('showWeekends', $config->getValue('eventx', 'showWeekends'));
$this->assign('calendarHeight', $config->getValue('eventx', 'calendarHeight'));
$this->assign('firstWeekDay', $config->getValue('eventx', 'firstWeekDay'));
$this->assign('militaryTime', (bool) OW::getConfig()->getValue('base', 'military_time') ? '1' : '0');
OW::getDocument()->addStyleSheet(OW::getPluginManager()->getPlugin("eventx")->getStaticCssUrl() . 'fullcalendar.css');
OW::getDocument()->addScript(OW::getPluginManager()->getPlugin("eventx")->getStaticJsUrl() . 'fullcalendar.min.js');
$fullMonth = $halfMonth = $fullWeek = $halfWeek = array();
for ($i = 0; $i <= 6; $i++) {
$fullWeek[] = $language->text('base', 'date_time_week_' . $i);
$halfWeek[] = $language->text('eventx', 'half_week_' . $i);
}
for ($i = 1; $i <= 12; $i++) {
$fullMonth[] = $language->text('base', 'month_' . $i);
$halfMonth[] = $language->text('base', 'date_time_month_short_' . $i);
}
$this->assign('fullWeek', UTIL_String::arrayToDelimitedString($fullWeek, ",", "'", "'"));
$this->assign('halfWeek', UTIL_String::arrayToDelimitedString($halfWeek, ",", "'", "'"));
$this->assign('fullMonth', UTIL_String::arrayToDelimitedString($fullMonth, ",", "'", "'"));
$this->assign('halfMonth', UTIL_String::arrayToDelimitedString($halfMonth, ",", "'", "'"));
$contentMenu = $this->eventService->getContentMenu();
$this->addComponent('contentMenu', $contentMenu);
if (!OW::getUser()->isAuthorized('eventx', 'add_event')) {
$this->assign('noButton', true);
}
$this->setPageTitle($language->text('eventx', 'calendar_page_title'));
$this->setPageHeading($language->text('eventx', 'calendar_page_heading'));
$this->setPageHeadingIconClass('ow_ic_calendar');
}