本文整理汇总了PHP中jincimport函数的典型用法代码示例。如果您正苦于以下问题:PHP jincimport函数的具体用法?PHP jincimport怎么用?PHP jincimport使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了jincimport函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preview
function preview($key = null, $urlVar = null)
{
$model = $this->getModel();
$table = $model->getTable();
$id = JRequest::getInt('id', 0);
$to_yourself = JRequest::getString('to_yourself', 'off');
$yourself = strtolower($to_yourself) == 'on';
$to_addresses = JRequest::getString('to_addresses', '');
$to_addresses = str_replace(' ', '', $to_addresses);
jincimport('utility.inputchecker');
$addresses = explode(',', $to_addresses);
foreach (array_reverse($addresses, true) as $key => $email) {
if (!InputChecker::checkMail($email)) {
unset($addresses[$key]);
}
}
if (empty($key)) {
$key = $table->getKeyName();
}
if (empty($urlVar)) {
$urlVar = $key;
}
$result = $model->preview($id, $yourself, $addresses);
if ($result === false) {
$this->setError(JText::sprintf('COM_JINC_ERR001', JText::_($model->getError())));
$this->setMessage($this->getError(), 'error');
$this->setRedirect('index.php?option=com_jinc&view=message&layout=preview&tmpl=component&id=' . $id, $msg);
return false;
}
$tostring = count($result) > 0 ? implode(',', $result) : JText::_('COM_JINC_ANYONE');
$msg = JText::sprintf('COM_JINC_INF002', $tostring);
$this->setRedirect('index.php?option=com_jinc&view=message&layout=preview&id=' . $id, $msg);
return true;
}
示例2: getItems
/**
* Method to get an array of data items.
*
* @return mixed An array of data items on success, false on failure.
* @since 1.6
*/
public function getItems()
{
$items = array();
$news_id = JRequest::getInt('news_id', 0);
if ($news_id != 0) {
jincimport('core.newsletterfactory');
$ninstance = NewsletterFactory::getInstance();
if ($newsletter = $ninstance->loadNewsletter($news_id, false)) {
$items = $newsletter->getTagsList();
}
}
$msg_id = JRequest::getInt('msg_id', 0);
if ($msg_id != 0) {
jincimport('core.messagefactory');
$minstance = MessageFactory::getInstance();
if ($message = $minstance->loadMessage($msg_id)) {
$news_id = $message->get('news_id');
jincimport('core.newsletterfactory');
$ninstance = NewsletterFactory::getInstance();
if ($newsletter = $ninstance->loadNewsletter($news_id, false)) {
$items = $newsletter->getTagsList();
if ($message->getType() == MESSAGE_TYPE_MASSIVE) {
unset($items['USER']);
}
unset($items['OPTIN']);
}
}
}
return $items;
}
示例3: display
function display($tpl = null)
{
$layout = $this->getLayout();
if ($layout == 'multisubscription') {
$this->newsletters = array();
if (isset($this->mmsg)) {
jincimport('utility.servicelocator');
$servicelocator = ServiceLocator::getInstance();
$logger = $servicelocator->getLogger();
jincimport('core.newsletterfactory');
$ninstance = NewsletterFactory::getInstance();
foreach ($this->mmsg as $news_id => $text) {
if ($newsletter = $ninstance->loadNewsletter($news_id, true)) {
$this->newsletters[$news_id] = $newsletter;
}
}
}
} else {
$news_id = JRequest::getInt('id', 0);
jincimport('core.newsletterfactory');
$ninstance = NewsletterFactory::getInstance();
if ($newsletter = $ninstance->loadNewsletter($news_id, true)) {
$this->newsletter = $newsletter;
}
}
parent::display($tpl);
}
示例4: update
/**
* Update method to register message sending events.
*
* @access public
* @param $args['news_id'] Newsletter identifier refferring to the event.
* * @param $args['msg_id'] Message identifier refferring to the event.
* @return false if something wrong.
* @since 0.6
*/
function update(&$args)
{
jincimport('utility.servicelocator');
$servicelocator = ServiceLocator::getInstance();
$logger = $servicelocator->getLogger();
if (!isset($args['news_id']) || !isset($args['msg_id'])) {
return false;
}
$news_id = (int) $args['news_id'];
$msg_id = (int) $args['msg_id'];
$dbo =& JFactory::getDBO();
$query = 'UPDATE #__jinc_newsletter SET lastsent = now() ' . 'WHERE id = ' . (int) $news_id;
$dbo->setQuery($query);
$logger->debug('SentMsgEvent: executing query: ' . $query);
if (!$dbo->query()) {
$logger->error('SentMsgEvent: error updating last newsletter dispatch date');
return false;
}
$query = 'UPDATE #__jinc_message SET datasent = now() ' . 'WHERE id = ' . (int) $msg_id;
$dbo->setQuery($query);
$logger->debug('SentMsgEvent: executing query: ' . $query);
if (!$dbo->query()) {
$logger->error('SentMsgEvent: error updating last message dispatch date');
return false;
}
return true;
}
示例5: ImportFromCSV
/**
* The newsletter importer. It imports newsletter subscribers from a CSV file.
*
* @access public
* @param integer $newsletter a newsletter object.
* @param string $csvfile_name the CSV file name.
* @return array containing import results.
* @since 0.6
* @see Newsletter
*/
function ImportFromCSV($newsletter, $csvfile_name)
{
jincimport('utility.jincjoomlahelper');
jincimport('utility.servicelocator');
$servicelocator = ServiceLocator::getInstance();
$logger = $servicelocator->getLogger();
if (!($handle = @fopen($csvfile_name, "r"))) {
$logger->finer('NewsletterImporter: unable to open ' . $csvfile_name);
return false;
}
$result = array();
while (($data = fgetcsv($handle, $this->_LINE_MAX_LENGTH, ",")) !== FALSE) {
$logger->finer('NewsletterImporter: importing ' . implode(', ', $data));
$info = $newsletter->getSubscriptionInfo();
$subscriber_info = array();
$attributes = array();
for ($i = 0; $i < count($info); $i++) {
$prefix = substr($info[$i], 0, 5);
if ($prefix == 'attr_') {
$suffix = substr($info[$i], 5);
$attributes[$suffix] = isset($data[$i]) ? $data[$i] : '';
} else {
$subscriber_info[$info[$i]] = $data[$i];
}
}
$sub_result = array();
$sub_result['data'] = implode(', ', $subscriber_info);
switch ($newsletter->getType()) {
case NEWSLETTER_PUBLIC_NEWS:
$subscriber_info['noptin'] = true;
break;
case NEWSLETTER_PRIVATE_NEWS:
$user_id = $subscriber_info['user_id'];
$user_info = JINCJoomlaHelper::getUserInfo($user_id);
if (empty($user_info)) {
$user_info = JINCJoomlaHelper::getUserInfoByUsername($user_id);
if (empty($user_info)) {
$user_info = JINCJoomlaHelper::getUserInfoByUsermail($user_id);
if (!empty($user_info)) {
$subscriber_info['user_id'] = $user_info['id'];
}
} else {
$subscriber_info['user_id'] = $user_info['id'];
}
}
break;
default:
break;
}
if ($newsletter->subscribe($subscriber_info, $attributes)) {
$sub_result['result'] = 'OK';
} else {
$sub_result['result'] = $newsletter->getError();
}
array_push($result, $sub_result);
}
fclose($handle);
return $result;
}
示例6: setError
/**
* Redefine setError method inherited from Joomla! JObject class
*
* @access public
* @since 0.6
*/
function setError($error)
{
jincimport('utility.servicelocator');
$servicelocator = ServiceLocator::getInstance();
$logger = $servicelocator->getLogger();
$logger->finer(get_class($this) . ': ' . JText::_($error));
parent::setError($error);
}
示例7: getInput
protected function getInput()
{
jincimport('core.newsletterfactory');
$themes = array();
$ninstance = NewsletterFactory::getInstance();
if ($themes = $ninstance->loadThemes()) {
return JHTML::_('select.genericlist', $themes, $this->name, 'class="inputbox"', 'value', 'id', $this->value, $this->id);
}
return false;
}
示例8: getInfo
public function getInfo()
{
if ($item = parent::getItem()) {
jincimport('core.newsletterfactory');
$ninstance = NewsletterFactory::getInstance();
if ($newsletter = $ninstance->loadNewsletter($item->news_id)) {
return $newsletter->getSubscriber($item->id);
}
}
return false;
}
示例9: getData
function getData()
{
jincimport('core.newsletterfactory');
$id = JRequest::getInt('id', 0, 'GET');
$ninstance = NewsletterFactory::getInstance();
if (!($notice = $ninstance->loadNotice($id))) {
$this->setError('COM_JINC_ERR023');
return false;
}
return $notice;
}
示例10: addToolbar
protected function addToolbar()
{
JHTML::stylesheet('administrator/components/com_jinc/assets/css/jinc_admin.css');
JToolBarHelper::title(JText::_('COM_JINC_MENU_SUBSCRIBERS'), 'jinc');
$bar = JToolBar::getInstance('toolbar');
$bar->appendButton('Popup', 'addsubscriber', 'COM_JINC_ADDSUBSCRIBER', 'index.php?option=com_jinc&view=newsletter&tmpl=component&layout=addsubscriber', 875, 550, 0, 0, '');
JToolBarHelper::custom('subscribers.approve', 'approve', 'approve', 'COM_JINC_APPROVE', true);
JToolBarHelper::deleteList(JText::_('COM_JINC_WARNING_DELETE_ITEMS'), 'subscribers.delete');
jincimport('utility.jinchelper');
JINCHelper::helpOnLine(98);
}
示例11: getData
function getData()
{
jincimport('core.messagefactory');
$msg_id = JRequest::getInt('id', 0, 'GET');
$minstance = MessageFactory::getInstance();
if (!($message = $minstance->loadMessage($msg_id))) {
$this->setError('COM_JINC_ERR035');
return false;
}
return $message;
}
示例12: render
/**
* Method to render a statistical chart using built-in image.
*
* @return false if someting wrong
*/
function render()
{
jincimport("graphics.gchart");
jincimport("graphics.gimage");
$chart = new GChart($this->get('legend'), 700, 200);
$chart->addLine($this->get('values'));
$chart->setXMargin(25);
$chart->setYMargin(25);
$chart->setGridColor(192, 192, 192);
$c = new GImage(750, 250);
$c->display($chart);
$c->close();
}
示例13: setTemplate
function setTemplate($id)
{
if (empty($id)) {
return;
}
$app = JFactory::getApplication();
$cssurl = rtrim(JURI::root(), '/') . '/' . 'administrator/index.php?option=com_jinc&task=templatecss.loadcss&format=css&id=' . $id . '&time=' . time();
$filepath = JPATH_COMPONENT_ADMINISTRATOR . DS . 'assets' . DS . 'templates' . DS . $id . '.css';
$filepath = str_replace('/', DS, $filepath);
$name = $this->myEditor->get('_name');
if ($name == 'tinymce') {
$this->editorConfig = array('content_css_custom' => $cssurl, 'content_css' => '0');
} elseif ($name == 'jckeditor' || $name == 'fckeditor') {
$this->editorConfig = array('content_css_custom' => $filepath, 'content_css' => '0', 'editor_css' => '0');
} else {
$fileurl = 'administrator/components/com_jinc/assets/templates/' . $id . '.css';
$this->editorConfig = array('custom_css_url' => $cssurl, 'custom_css_file' => $fileurl, 'custom_css_path' => $filepath);
JRequest::setVar('jinc_cssfile', $fileurl);
if ($name == 'jce') {
$jcepath = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_jce' . DS . 'models' . DS;
if (file_exists($jcepath . 'editor.php')) {
jimport('joomla.filesystem.file');
$content = JFile::read($jcepath . 'editor.php');
if (!strpos($content, 'jinc_cssfile')) {
$jinccode = '
if(JRequest::getCmd(\'option\') == \'com_jinc\'){
$jinc_cssfile = JRequest::getString(\'jinc_cssfile\');
if(!empty($jinc_cssfile)) $settings[\'content_css\'] = $jinc_cssfile;
}
';
$content = preg_replace('#(\\$settings\\[\'content_css\'\\][^=]*= *\\$this->getStyleSheets\\(\\);)#', '$1' . $jinccode, $content);
jincimport('utility.servicelocator');
$servicelocator = ServiceLocator::getInstance();
$logger = $servicelocator->getLogger();
if (strpos($content, 'jinc_cssfile')) {
if (!file_exists($jcepath . 'editor_jbackup.php')) {
if (JFile::copy($jcepath . 'editor.php', $jcepath . 'editor_jbackup.php') !== true) {
$logger->info('JINCEditor - Could not copy the file from ' . $jcepath . 'editor.php to ' . $jcepath . 'editor_jbackup.php', 'error');
}
}
if (JFile::write($jcepath . 'editor.php', $content) !== true) {
$logger->info('Could not write in ' . $jcepath . 'editor.php <br/> Please make sure this folder is writable', 'error');
}
}
}
}
}
}
}
示例14: display
function display($tpl = null)
{
JHTML::stylesheet('administrator/components/com_jinc/assets/css/jinc_admin.css');
JToolBarHelper::title(JText::_('COM_JINC_CPANEL_JINC'), 'jinc');
JToolBarHelper::preferences('com_jinc', '550');
jincimport('utility.jinchelper');
JINCHelper::helpOnLine(87);
$version = JINCHelper::getJINCVersion();
$copyright = JINCHelper::getJINCCopyright();
$license = JINCHelper::getJINCLicense();
$this->assignRef('version', $version);
$this->assignRef('copyright', $copyright);
$this->assignRef('license', $license);
parent::display($tpl);
}
示例15: loadcss
function loadcss()
{
$doc = JFactory::getDocument();
// $doc->setMimeEncoding('text/css');
$tem_id = JRequest::getInt('id', 0);
jincimport('core.messagefactory');
$minstance = MessageFactory::getInstance();
if (!($template = $minstance->loadTemplate($tem_id))) {
return '';
}
if (!($cssfile_content = $template->getCSSFileContent())) {
return '';
}
echo $cssfile_content;
}