当前位置: 首页>>代码示例>>PHP>>正文


PHP acymailing::display方法代码示例

本文整理汇总了PHP中acymailing::display方法的典型用法代码示例。如果您正苦于以下问题:PHP acymailing::display方法的具体用法?PHP acymailing::display怎么用?PHP acymailing::display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在acymailing的用法示例。


在下文中一共展示了acymailing::display方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 function process()
 {
     if (!$this->isAllowed('lists', 'filter')) {
         return;
     }
     JRequest::checkToken() or die('Invalid Token');
     $filid = JRequest::getInt('filid');
     if (!empty($filid)) {
         $this->store();
     }
     $filterClass = acymailing::get('class.filter');
     $filterClass->subid = JRequest::getString('subid');
     $filterClass->execute(JRequest::getVar('filter'), JRequest::getVar('action'));
     if (!empty($filterClass->report)) {
         if (JRequest::getCmd('tmpl') == 'component') {
             echo acymailing::display($filterClass->report, 'info');
             $js = "setTimeout('redirect()',2000); function redirect(){window.top.location.href = 'index.php?option=com_acymailing&ctrl=subscriber'; }";
             $doc =& JFactory::getDocument();
             $doc->addScriptDeclaration($js);
             return;
         } else {
             $app =& JFactory::getApplication();
             foreach ($filterClass->report as $oneReport) {
                 $app->enqueueMessage($oneReport);
             }
         }
     }
     return $this->edit();
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:29,代码来源:filter.php

示例2: queue

 function queue($mailid, $time, $onlyNew = false)
 {
     $mailid = intval($mailid);
     if (empty($mailid)) {
         return false;
     }
     $classLists = acymailing::get('class.listmail');
     $lists = $classLists->getReceivers($mailid, false);
     if (empty($lists)) {
         return 0;
     }
     $config = acymailing::config();
     $querySelect = 'SELECT DISTINCT a.subid,' . $mailid . ',' . $time . ',' . (int) $config->get('priority_newsletter', 3);
     $querySelect .= ' FROM ' . acymailing::table('listsub') . ' as a ';
     $querySelect .= 'LEFT JOIN ' . acymailing::table('subscriber') . ' as b ON a.subid = b.subid ';
     $querySelect .= 'WHERE b.enabled = 1 AND b.accept = 1 ';
     $querySelect .= 'AND a.listid IN (' . implode(',', array_keys($lists)) . ') AND a.status = 1 ';
     $config = acymailing::config();
     if ($config->get('require_confirmation', '0')) {
         $querySelect .= 'AND b.confirmed = 1 ';
     }
     $query = 'INSERT IGNORE INTO ' . acymailing::table('queue') . ' (subid,mailid,senddate,priority) ' . $querySelect;
     $this->database->setQuery($query);
     if (!$this->database->query()) {
         acymailing::display($this->database->ErrorMsg(), 'error');
     }
     $totalinserted = $this->database->getAffectedRows();
     if ($onlyNew) {
         $this->database->setQuery('DELETE b.* FROM `#__acymailing_userstats` as a LEFT JOIN `#__acymailing_queue` as b on a.subid = b.subid WHERE a.mailid = ' . $mailid);
         $this->database->query();
         $totalinserted = $totalinserted - $this->database->getAffectedRows();
     }
     return $totalinserted;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:34,代码来源:queue.php

示例3: language

 function language()
 {
     $this->setLayout('default');
     $code = JRequest::getString('code');
     if (empty($code)) {
         acymailing::display('Code not specified', 'error');
         return;
     }
     $file = null;
     $file->name = $code;
     $path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_acymailing.ini';
     $file->path = $path;
     jimport('joomla.filesystem.file');
     $showLatest = true;
     $loadLatest = false;
     if (JFile::exists($path)) {
         $file->content = JFile::read($path);
         if (empty($file->content)) {
             acymailing::display('File not found : ' . $path, 'error');
         }
     } else {
         $loadLatest = true;
         acymailing::display(JText::_('LOAD_ENGLISH_1') . '<br/>' . JText::_('LOAD_ENGLISH_2') . '<br/>' . JText::_('LOAD_ENGLISH_3'), 'info');
         $file->content = JFile::read(JLanguage::getLanguagePath(JPATH_ROOT) . DS . 'en-GB' . DS . 'en-GB.com_acymailing.ini');
     }
     if ($loadLatest or JRequest::getString('task') == 'latest') {
         $doc =& JFactory::getDocument();
         $doc->addScript(ACYMAILING_UPDATEURL . 'languageload&code=' . JRequest::getString('code'));
         $showLatest = false;
     } elseif (JRequest::getString('task') == 'save') {
         $showLatest = false;
     }
     $this->assignRef('showLatest', $showLatest);
     $this->assignRef('file', $file);
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:35,代码来源:view.html.php

示例4: update

 function update()
 {
     $config = acymailing::config();
     if (!acymailing::isAllowed($config->get('acl_config_manage', 'all'))) {
         acymailing::display(JText::_('ACY_NOTALLOWED'), 'error');
         return false;
     }
     acymailing::setTitle(JText::_('UPDATE_ABOUT'), 'install', 'update');
     $bar =& JToolBar::getInstance('toolbar');
     $bar->appendButton('Link', 'back', JText::_('ACY_CLOSE'), acymailing::completeLink('dashboard'));
     return $this->_iframe(ACYMAILING_UPDATEURL . 'update');
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:12,代码来源:update.php

示例5: save

 function save()
 {
     JRequest::checkToken() or die('Invalid Token');
     $class = acymailing::get('class.url');
     $status = $class->saveForm();
     if ($status) {
         acymailing::display(JText::_('JOOMEXT_SUCC_SAVED'), 'success');
         return true;
     } else {
         acymailing::display(JText::_('ERROR_SAVING'), 'success');
     }
     return $this->edit();
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:13,代码来源:statsurl.php

示例6: send

 function send()
 {
     if (!$this->isAllowed('newsletters', 'send')) {
         return;
     }
     JRequest::checkToken() or die('Invalid Token');
     $mailid = acymailing::getCID('mailid');
     if (empty($mailid)) {
         exit;
     }
     $user =& JFactory::getUser();
     $time = time();
     $queueClass = acymailing::get('class.queue');
     $onlyNew = JRequest::getInt('onlynew');
     $totalSub = $queueClass->queue($mailid, $time, $onlyNew);
     if (empty($totalSub)) {
         acymailing::display(JText::_('NO_RECEIVER'), 'warning');
         return;
     }
     $mailObject = null;
     $mailObject->senddate = $time;
     $mailObject->published = 1;
     $mailObject->mailid = $mailid;
     $mailObject->sentby = $user->id;
     $db =& JFactory::getDBO();
     $db->updateObject(acymailing::table('mail'), $mailObject, 'mailid');
     $config =& acymailing::config();
     $queueType = $config->get('queue_type');
     if ($queueType == 'onlyauto') {
         $messages = array();
         $messages[] = JText::sprintf('ADDED_QUEUE', $totalSub);
         $messages[] = JText::_('AUTOSEND_CONFIRMATION');
         acymailing::display($messages, 'success');
         return;
     } else {
         JRequest::setVar('totalsend', $totalSub);
         $app =& JFactory::getApplication();
         $app->redirect(acymailing::completeLink('send&task=continuesend&mailid=' . $mailid . '&totalsend=' . $totalSub, true, true));
         exit;
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:41,代码来源:send.php

示例7: _savelanguage

 function _savelanguage()
 {
     jimport('joomla.filesystem.file');
     $code = JRequest::getString('code');
     JRequest::setVar('code', $code);
     $content = JRequest::getVar('content', '', '', 'string', JREQUEST_ALLOWRAW);
     if (empty($code) or empty($content)) {
         return;
     }
     $path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_acymailing.ini';
     $result = JFile::write($path, $content);
     if ($result) {
         acymailing::display(JText::_('JOOMEXT_SUCC_SAVED'), 'success');
         $js = "window.top.document.getElementById('image{$code}').src = '" . ACYMAILING_LIVE . "images/M_images/edit.png'";
         $doc =& JFactory::getDocument();
         $doc->addScriptDeclaration($js);
     } else {
         acymailing::display(JText::sprintf('FAIL_SAVE', $path), 'error');
     }
     return $result;
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:21,代码来源:file.php

示例8: process

 function process()
 {
     acymailing::increasePerf();
     $config = acymailing::config();
     $bounceClass = acymailing::get('helper.bounce');
     $bounceClass->report = true;
     if (!$bounceClass->init()) {
         return;
     }
     if (!$bounceClass->connect()) {
         acymailing::display($bounceClass->getErrors(), 'error');
         return;
     }
     acymailing::display(JText::sprintf('BOUNCE_CONNECT_SUCC', $config->get('bounce_username')), 'success');
     $nbMessages = $bounceClass->getNBMessages();
     acymailing::display(JText::sprintf('NB_MAIL_MAILBOX', $nbMessages), 'info');
     if (empty($nbMessages)) {
         return;
     }
     $bounceClass->handleMessages();
     $bounceClass->close();
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:22,代码来源:bounce.php

示例9: createTemplateFile

 function createTemplateFile($id)
 {
     if (file_exists(ACYMAILING_TEMPLATE . 'css' . DS . 'template_' . $id . '.css')) {
         return ACYMAILING_TEMPLATE . 'css' . DS . 'template_' . $id . '.css';
     }
     $classTemplate = acymailing::get('class.template');
     $template = $classTemplate->get($id);
     if (empty($template->tempid)) {
         return '';
     }
     $css = $classTemplate->buildCSS($template->styles, $template->stylesheet);
     if (empty($css)) {
         return '';
     }
     jimport('joomla.filesystem.file');
     acymailing::createDir(ACYMAILING_TEMPLATE . 'css');
     if (JFile::write(ACYMAILING_TEMPLATE . 'css' . DS . 'template_' . $id . '.css', $css)) {
         return ACYMAILING_TEMPLATE . 'css' . DS . 'template_' . $id . '.css';
     } else {
         acymailing::display('Could not create the file ' . ACYMAILING_TEMPLATE . 'css' . DS . 'template_' . $id . '.css', 'error');
         return '';
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:23,代码来源:editor.php

示例10: store

 function store()
 {
     JRequest::checkToken() or die('Invalid Token');
     $oldMailid = acymailing::getCID('mailid');
     $mailClass = acymailing::get('class.mail');
     if ($mailClass->saveForm()) {
         $data = JRequest::getVar('data');
         $type = @$data['mail']['type'];
         if (!empty($type) and in_array($type, array('unsub', 'welcome'))) {
             $subject = addslashes($data['mail']['subject']);
             $mailid = JRequest::getInt('mailid');
             if ($type == 'unsub') {
                 $js = "var mydrop = window.top.document.getElementById('datalistunsubmailid'); ";
                 $js .= "var type = 'unsub';";
             } else {
                 //type=welcome
                 $js = "var mydrop = window.top.document.getElementById('datalistwelmailid'); ";
                 $js .= "var type = 'welcome';";
             }
             if (empty($oldMailid)) {
                 $js .= 'var optn = document.createElement("OPTION");';
                 $js .= "optn.text = '[{$mailid}] {$subject}'; optn.value = '{$mailid}';";
                 $js .= 'mydrop.options.add(optn);';
                 $js .= 'lastid = 0; while(mydrop.options[lastid+1]){lastid = lastid+1;} mydrop.selectedIndex = lastid;';
                 $js .= 'window.top.changeMessage(type,' . $mailid . ');';
             } else {
                 $js .= "lastid = 0; notfound = true; while(notfound && mydrop.options[lastid]){if(mydrop.options[lastid].value == {$mailid}){mydrop.options[lastid].text = '[{$mailid}] {$subject}';notfound = false;} lastid = lastid+1;}";
             }
             $doc =& JFactory::getDocument();
             $doc->addScriptDeclaration($js);
         }
         acymailing::display(JText::_('JOOMEXT_SUCC_SAVED'), 'success');
     } else {
         acymailing::display(JText::_('ERROR_SAVING'), 'error');
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:36,代码来源:email.php

示例11: installExtensions

 function installExtensions()
 {
     $path = ACYMAILING_BACK . 'plugins';
     $dirs = JFolder::folders($path);
     $this->db->setQuery('SELECT max(`id`) FROM `#__plugins`');
     $pluginMax = $this->db->loadResult();
     $success = array();
     $error = array();
     ob_start();
     foreach ($dirs as $oneDir) {
         if ($this->_installOne($path . DS . $oneDir)) {
             $success[] = JText::sprintf('PLUG_INSTALLED', $oneDir);
         } else {
             $error[] = JText::sprintf('PLUG_ERROR', $oneDir);
         }
     }
     $data = ob_end_clean();
     $plugcompo = array('tagcbuser' => '#__comprofiler', 'tagvmcoupon' => '#__vm_coupons', 'tagvmproduct' => '#__vm_product', 'tagjomsocial' => '#__community_users');
     $listTables = $this->db->getTableList();
     $excludePlugins = array($this->db->Quote('vmacymailing'), $this->db->Quote('contentplugin'));
     foreach ($plugcompo as $tagname => $tablename) {
         if (!in_array(str_replace('#__', $this->db->getPrefix(), $tablename), $listTables)) {
             $excludePlugins[] = $this->db->Quote($tagname);
         }
     }
     $query = "UPDATE `#__plugins` SET `published` = 1 WHERE `id` > '.{$pluginMax}.' AND (`folder` LIKE '%acymailing%' OR `element` LIKE '%acymailing%')";
     $query .= ' AND `element` NOT IN (' . implode(',', $excludePlugins) . ')';
     $this->db->setQuery($query);
     $this->db->query();
     $order = array('tagsubscription' => 1, 'tagsubscriber' => 2, 'taguser' => 3, 'tagcbuser' => 4, 'tagjomsocial' => 4, 'tagtime' => 5, 'online' => 6, 'tagvmcoupon' => 7, 'tagvmproduct' => 8, 'tagcontent' => 11, 'tagmodule' => 12, 'contentplugin' => 15, 'template' => 25, 'urltracker' => 30, 'stats' => 50);
     foreach ($order as $name => $num) {
         $this->db->setQuery("UPDATE `#__plugins` SET `ordering` = {$num} WHERE `element` = " . $this->db->Quote($name) . " AND `id` > {$pluginMax}");
         $this->db->query();
     }
     $path = ACYMAILING_BACK . 'modules';
     $dirs = JFolder::folders($path);
     ob_start();
     foreach ($dirs as $oneDir) {
         if ($this->_installOne($path . DS . $oneDir)) {
             $success[] = JText::sprintf('MODULE_INSTALLED', $oneDir);
         } else {
             $error[] = JText::sprintf('MODULE_ERROR', $oneDir);
         }
     }
     $data = ob_end_clean();
     if (!empty($success)) {
         acymailing::display('<ul><li>' . implode('</li><li>', $success) . '</li></ul>', 'success');
     }
     if (!empty($error)) {
         acymailing::display('<ul><li>' . implode('</li><li>', $error) . '</li></ul>', 'error');
     } else {
         $app =& JFactory::getApplication();
         $app->_messageQueue = array();
     }
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:55,代码来源:update.php

示例12: optout

 function optout()
 {
     acymailing::checkRobots();
     $config = acymailing::config();
     $app =& JFactory::getApplication();
     $userClass = acymailing::get('class.subscriber');
     $my =& JFactory::getUser();
     $redirectUrl = urldecode(JRequest::getString('redirectunsub'));
     if (!empty($redirectUrl)) {
         $this->setRedirect($redirectUrl);
     }
     $formData = JRequest::getVar('user', array(), '', 'array');
     $email = trim(strip_tags($formData['email']));
     if (empty($email)) {
         if (!empty($my->email)) {
             $email = $my->email;
         }
     }
     $userHelper = acymailing::get('helper.user');
     if (empty($email) || !$userHelper->validEmail($email)) {
         echo "<script>alert('" . JText::_('VALID_EMAIL', true) . "'); window.history.go(-1);</script>";
         exit;
     }
     $alreadyExists = $userClass->get($email);
     if (empty($alreadyExists->subid)) {
         if (empty($redirectUrl)) {
             acymailing::display(JText::sprintf('NOT_IN_LIST', $email), 'warning');
         } else {
             $app->enqueueMessage(JText::sprintf('NOT_IN_LIST', $email), 'notice');
         }
         return $this->_closepop($redirectUrl);
     }
     if ($config->get('allow_modif', 'data') == 'none' and empty($my->email) || $my->email != $email) {
         $mailClass = acymailing::get('helper.mailer');
         $mailClass->checkConfirmField = false;
         $mailClass->checkEnabled = false;
         $mailClass->report = false;
         $mailClass->sendOne('modif', $alreadyExists->subid);
         if (empty($redirectUrl)) {
             acymailing::display(JText::_('IDENTIFICATION_SENT'), 'warning');
         } else {
             $app->enqueueMessage(JText::_('IDENTIFICATION_SENT'), 'notice');
         }
         return $this->_closepop($redirectUrl);
     }
     $visibleSubscription = JRequest::getVar('subscription', '', '', 'array');
     $currentSubscription = $userClass->getSubscriptionStatus($alreadyExists->subid);
     $hiddenSubscription = explode(',', JRequest::getVar('hiddenlists', '', '', 'string'));
     $updatelists = array();
     $removeSubscription = array_merge($visibleSubscription, $hiddenSubscription);
     foreach ($removeSubscription as $idList) {
         if (!empty($currentSubscription[$idList]) and $currentSubscription[$idList]->status != '-1') {
             $updatelists[-1][] = $idList;
         }
     }
     if (!empty($updatelists)) {
         $listsubClass = acymailing::get('class.listsub');
         $listsubClass->updateSubscription($alreadyExists->subid, $updatelists);
         if ($config->get('unsubscription_message', 1)) {
             if (empty($redirectUrl)) {
                 acymailing::display(JText::_('UNSUBSCRIPTION_OK'), 'info');
             } else {
                 $app->enqueueMessage(JText::_('UNSUBSCRIPTION_OK'));
             }
         }
     } elseif ($config->get('unsubscription_message', 1)) {
         if (empty($redirectUrl)) {
             acymailing::display(JText::_('UNSUBSCRIPTION_NOT_IN_LIST'), 'info');
         } else {
             $app->enqueueMessage(JText::_('UNSUBSCRIPTION_NOT_IN_LIST'));
         }
     }
     return $this->_closepop($redirectUrl);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:74,代码来源:sub.php

示例13: _ifstatement

 function _ifstatement(&$email, $user)
 {
     if (isset($this->foundtags[$email->mailid])) {
         return;
     }
     $match = '#{if:(.*)}(.*){/if}#Uis';
     $variables = array('subject', 'body', 'altbody');
     $found = false;
     foreach ($variables as $var) {
         if (empty($email->{$var})) {
             continue;
         }
         $found = preg_match_all($match, $email->{$var}, $results[$var]) || $found;
         if (empty($results[$var][0])) {
             unset($results[$var]);
         }
     }
     if (!$found) {
         $this->foundtags[$email->mailid] = false;
         return;
     }
     $app =& JFactory::getApplication();
     $tags = array();
     foreach ($results as $var => $allresults) {
         foreach ($allresults[0] as $i => $oneTag) {
             if (isset($tags[$oneTag])) {
                 continue;
             }
             if (!preg_match('#^([^=!<>~]+)(=|!=|<|>|&gt;|&lt;|~)([^=!<>~]+)$#i', $allresults[1][$i], $operators)) {
                 if ($app->isAdmin()) {
                     acymailing::display('Operation not found : ' . $allresults[1][$i], 'error');
                 }
                 $tags[$oneTag] = $allresults[2][$i];
                 continue;
             }
             $operators[1] = trim($operators[1]);
             if (!isset($user->{$operators[1]})) {
                 if ($app->isAdmin()) {
                     acymailing::display('User variable not set : ' . $operators[1] . ' in ' . $allresults[1][$i], 'error');
                 }
                 $tags[$oneTag] = $allresults[2][$i];
                 continue;
             }
             $tags[$oneTag] = '';
             $prop = strtolower($user->{$operators[1]});
             $val = trim(strtolower($operators[3]));
             if ($operators[2] == '=' and $prop == $val) {
                 $tags[$oneTag] = $allresults[2][$i];
             } elseif ($operators[2] == '!=' and $prop != $val) {
                 $tags[$oneTag] = $allresults[2][$i];
             } elseif ($operators[2] == '>' || $operators[2] == '&gt;' and $prop > $val) {
                 $tags[$oneTag] = $allresults[2][$i];
             } elseif ($operators[2] == '<' || $operators[2] == '&lt;' and $prop < $val) {
                 $tags[$oneTag] = $allresults[2][$i];
             } elseif ($operators[2] == '~' and strpos($prop, $val) !== false) {
                 $tags[$oneTag] = $allresults[2][$i];
             }
         }
     }
     foreach ($results as $var => $allresults) {
         $email->{$var} = str_replace(array_keys($tags), $tags, $email->{$var});
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:63,代码来源:managetext.php

示例14: doupload

 function doupload()
 {
     if (!$this->isAllowed($this->aclCat, 'manage')) {
         return;
     }
     JRequest::checkToken() or jexit('Invalid Token');
     $importFile = JRequest::getVar('uploadedfile', '', 'files');
     if (empty($importFile['name'])) {
         acymailing::display(JText::_('BROWSE_FILE'), 'error');
         return $this->upload();
     }
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.archive');
     jimport('joomla.filesystem.path');
     $config =& acymailing::config();
     $uploadPath = JPath::clean(ACYMAILING_ROOT . 'media' . DS . ACYMAILING_COMPONENT . DS . 'templates');
     if (!is_writable($uploadPath)) {
         @chmod($uploadPath, '0755');
         if (!is_writable($uploadPath)) {
             acymailing::display(JText::sprintf('WRITABLE_FOLDER', $uploadPath), 'warning');
         }
     }
     if (!(bool) ini_get('file_uploads')) {
         acymailing::display('Can not upload the file, please make sure file_uploads is enabled on your php.ini file', 'error');
         return $this->upload();
     }
     if (!extension_loaded('zlib')) {
         JError::raiseWarning('SOME_ERROR_CODE', JText::_('WARNINSTALLZLIB'));
         return $this->upload();
     }
     $filename = strtolower(JFile::makeSafe($importFile['name']));
     $extension = strtolower(substr($filename, strrpos($filename, '.') + 1));
     if (!in_array($extension, array('zip', 'tar.gz'))) {
         acymailing::display(JText::sprintf('ACCEPTED_TYPE', $extension, 'zip,tar.gz'), 'error');
         return $this->upload();
     }
     $joomconfig =& JFactory::getConfig();
     $tmp_dest = JPath::clean($joomconfig->getValue('config.tmp_path') . DS . $filename);
     $tmp_src = $importFile['tmp_name'];
     $uploaded = JFile::upload($tmp_src, $tmp_dest);
     if (!$uploaded) {
         acymailing::display('Error uploading the file from ' . $tmp_src . ' to ' . $tmp_dest, 'error');
         return $this->upload();
     }
     $tmpdir = uniqid() . '_template';
     $extractdir = JPath::clean(dirname($tmp_dest) . DS . $tmpdir);
     $result = JArchive::extract($tmp_dest, $extractdir);
     JFile::delete($tmp_dest);
     if (!$result) {
         acymailing::display('Error extracting the file ' . $tmp_dest . ' to ' . $extractdir, 'error');
         return $this->upload();
     }
     $templateClass = acymailing::get('class.template');
     if ($templateClass->detecttemplates($extractdir)) {
         $messages = $templateClass->templateNames;
         array_unshift($messages, JText::sprintf('TEMPLATES_INSTALL', count($templateClass->templateNames)));
         acymailing::display($messages, 'success');
         if (is_dir($extractdir)) {
             JFolder::delete($extractdir);
         }
         $js = "setTimeout('redirect()',2000); function redirect(){window.top.location.href = 'index.php?option=com_acymailing&ctrl=template'; }";
         $doc =& JFactory::getDocument();
         $doc->addScriptDeclaration($js);
         return;
     }
     acymailing::display('Error installing template', 'error');
     if (is_dir($extractdir)) {
         JFolder::delete($extractdir);
     }
     return $this->upload();
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:72,代码来源:template.php

示例15: installtemplate

 function installtemplate($filepath)
 {
     $fileContent = file_get_contents($filepath);
     $newTemplate = null;
     $newTemplate->name = trim(preg_replace('#[^a-z0-9]#i', ' ', substr(dirname($filepath), strpos($filepath, '_template'))));
     if (preg_match('#< *title[^>]*>(.*)< */ *title *>#Uis', $fileContent, $results)) {
         $newTemplate->name = $results[1];
     }
     $newFolder = preg_replace('#[^a-z0-9]#i', '_', strtolower($newTemplate->name));
     $newTemplateFolder = $newFolder;
     $i = 1;
     while (is_dir(ACYMAILING_TEMPLATE . $newTemplateFolder)) {
         $newTemplateFolder = $newFolder . '_' . $i;
         $i++;
     }
     $newTemplate->namekey = rand(0, 10000) . $newTemplateFolder;
     $moveResult = JFolder::move(dirname($filepath), ACYMAILING_TEMPLATE . $newTemplateFolder);
     if ($moveResult !== true) {
         acymailing::display(array('Error moving folder from ' . dirname($filepath) . ' to ' . ACYMAILING_TEMPLATE . $newTemplateFolder, $moveResult), 'error');
         return false;
     }
     if (!file_exists(ACYMAILING_TEMPLATE . $newTemplateFolder . DS . 'index.html')) {
         $indexFile = '<html><body bgcolor="#FFFFFF"></body></html>';
         JFile::write(ACYMAILING_TEMPLATE . $newTemplateFolder . DS . 'index.html', $indexFile);
     }
     $fileContent = preg_replace('#(src|background)[ ]*=[ ]*\\"(?!(https?://|/))(?:\\.\\./|\\./)?#', '$1="media/com_acymailing/templates/' . $newTemplateFolder . '/', $fileContent);
     if (preg_match('#< *body[^>]*>(.*)< */ *body *>#Uis', $fileContent, $results)) {
         $newTemplate->body = $results[1];
     } else {
         $newTemplate->body = $fileContent;
     }
     if (preg_match('#< *style[^>]*>(.*)< */ *style *>#Uis', $fileContent, $results)) {
         $newTemplate->stylesheet = preg_replace('#(<!--|-->)#s', '', $results[1]);
         if (preg_match('#body *\\{[^\\}]*background-color:([^;]*);#Uis', $newTemplate->stylesheet, $backgroundresults)) {
             $newTemplate->styles['color_bg'] = trim($backgroundresults[1]);
             $newTemplate->stylesheet = preg_replace('#(body *\\{[^\\}]*)background-color:[^;]*;#Uis', '$1', $newTemplate->stylesheet);
         }
         $quickstyle = array('tag_h1' => 'h1', 'tag_h2' => 'h2', 'tag_h3' => 'h3', 'tag_h4' => 'h4', 'tag_h5' => 'h5', 'tag_h6' => 'h6', 'tag_a' => 'a', 'tag_ul' => 'ul', 'tag_li' => 'li', 'acymailing_unsub' => '\\.acymailing_unsub', 'acymailing_online' => '\\.acymailing_online', 'acymailing_title' => '\\.acymailing_title', 'acymailing_content' => '\\.acymailing_content', 'acymailing_readmore' => '\\.acymailing_readmore');
         foreach ($quickstyle as $styledb => $oneStyle) {
             if (preg_match('#' . $oneStyle . ' *{([^}]*)}#Uis', $newTemplate->stylesheet, $quickstyleresults)) {
                 $newTemplate->styles[$styledb] = trim(str_replace(array("\n", "\r", "\t", "\\s"), ' ', $quickstyleresults[1]));
                 $newTemplate->stylesheet = preg_replace('#' . $oneStyle . ' *{[^}]*}#Uis', '', $newTemplate->stylesheet);
             }
         }
     }
     if (!empty($newTemplate->styles['color_bg'])) {
         $pat1 = '#^([^<]*<[^>]*background-color:)([^;">]{1,10})#i';
         $found = false;
         if (preg_match($pat1, $newTemplate->body)) {
             $newTemplate->body = preg_replace($pat1, '$1' . $newTemplate->styles['color_bg'], $newTemplate->body);
             $found = true;
         }
         $pat2 = '#^([^<]*<[^>]*bgcolor=")([^;">]{1,10})#i';
         if (preg_match($pat2, $newTemplate->body)) {
             $newTemplate->body = preg_replace($pat2, '$1' . $newTemplate->styles['color_bg'], $newTemplate->body);
             $found = true;
         }
         if (!$found) {
             $newTemplate->body = '<div style="background-color:' . $newTemplate->styles['color_bg'] . ';" width="100%">' . $newTemplate->body . '</div>';
         }
     }
     $allFiles = JFolder::files(ACYMAILING_TEMPLATE . $newTemplateFolder);
     $thumbnail = '';
     $acypict = acymailing::get('helper.acypict');
     $acypict->maxHeight = 190;
     $acypict->maxWidth = 170;
     foreach ($allFiles as $oneFile) {
         if (preg_match('#(thumbnail|screenshot|muestra)#i', $oneFile)) {
             if ($acypict->available()) {
                 $newPict = $acypict->generateThumbnail(ACYMAILING_TEMPLATE . $newTemplateFolder . DS . $oneFile);
                 if ($newPict) {
                     $oneFile = basename($newPict['file']);
                 }
             }
             $newTemplate->description = '<img src="media/com_acymailing/templates/' . $newTemplateFolder . '/' . $oneFile . '" />';
             break;
         }
     }
     static $order = 0;
     if (empty($order)) {
         $this->database->setQuery('SELECT MAX(ordering) FROM `#__acymailing_template`');
         $order = $this->database->loadResult();
     }
     $order++;
     $newTemplate->ordering = $order;
     $this->save($newTemplate);
     $this->templateNames[] = $newTemplate->name;
     return true;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:89,代码来源:template.php


注:本文中的acymailing::display方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。